Module bridge

Module bridge 

Source
Expand description

Vendor-neutral call-bridge components.

Every contact-center connector — Twilio Media Streams, a raw SIP/RTP leg, a platform’s gRPC virtual-agent slot — reduces to the same duties: move audio frames both ways through voice::pump, land caller keypresses and call identity in session state where flow guards read them, and keep the caller’s ear busy while slow work runs. This module holds those duties as small, connector-agnostic components, so a new connector composes them instead of re-inventing them.

Nothing here owns a socket. Connectors own transport; these components own semantics.

Structs§

DtmfDeduper
Deduplicates RFC 4733 end-of-event packets.
FillerConfig
Configuration for spawn_latency_filler.

Constants§

KEY_CALLER
State key holding the caller identity the transport presented (SIP From, a platform’s ANI field, …).
KEY_CALL_SID
State key holding the transport’s call identifier once known.
KEY_DTMF
State key holding the most recent DTMF digit pressed by the caller.
KEY_DTMF_HISTORY
State key holding every DTMF digit pressed so far, concatenated in order.
KEY_STREAM_SID
State key holding the transport’s media-stream identifier once known.

Functions§

record_dtmf
Record one DTMF keypress into session state under the shared keys.
spawn_latency_filler
Keep the caller’s ear busy while the model is slow: when the caller stops speaking (LiveEvent::VadEnd) and no model audio arrives within config.delay, inject the configured clip into the connector’s playback channel. Model audio or an interruption disarms the timer; a Playback::Flush from a barge-in clears any queued filler exactly like any other queued audio.