1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Frame serializers — convert [`Frame`]s to/from provider wire formats for
//! WebSocket transports.
//!
//! Ported from pipecat's `pipecat.serializers` subsystem. A serializer sits
//! between [`WebSocketTransport`](crate::transport) and an external telephony
//! provider: outgoing frames become provider messages via [`serialize`], and
//! incoming provider messages become frames via [`deserialize`].
//!
//! [`serialize`]: FrameSerializer::serialize
//! [`deserialize`]: FrameSerializer::deserialize
pub use ;
use async_trait;
use crateFrame;
// ---------------------------------------------------------------------------
// Serialized payloads
// ---------------------------------------------------------------------------
/// A serialized frame ready to send to the provider.
///
/// Mirrors pipecat's `str | bytes` serialize return: JSON-protocol providers
/// (Twilio, Plivo) yield [`Text`](SerializedOutput::Text); raw-binary providers
/// (Vonage) yield [`Binary`](SerializedOutput::Binary).
/// A raw message received from the provider, awaiting deserialization.
// ---------------------------------------------------------------------------
// FrameSerializer trait
// ---------------------------------------------------------------------------
/// Converts frames to/from a provider's wire format.
///
/// Mirrors pipecat's abstract `FrameSerializer` (`base_serializer.py`). Unlike
/// pipecat, [`setup`](FrameSerializer::setup) receives the pipeline sample rates
/// directly rather than a `StartFrame`, since rustvani transports already hold
/// them in [`TransportParams`](crate::transport::TransportParams).