Builds the outbound-dial / inbound-answer TwiML that opens a bidirectional Media-Streams websocket
to the agent's media endpoint. <Connect><Stream> (not <Start><Stream>) is the bidirectional form:
Twilio both sends inbound audio AND accepts outbound media frames on the same socket — the full-duplex
leg the agent needs.
Pure + exported so it unit-tests with no network and the MJAPI router can reuse it verbatim.
Parameters
streamUrl: string
The wss://… Media-Streams endpoint Twilio connects the call's audio to.
Returns string
The TwiML document string to return to Twilio (REST twiml param or webhook response body).
Builds the outbound-dial / inbound-answer TwiML that opens a bidirectional Media-Streams websocket to the agent's media endpoint.
<Connect><Stream>(not<Start><Stream>) is the bidirectional form: Twilio both sends inbound audio AND accepts outboundmediaframes on the same socket — the full-duplex leg the agent needs.Pure + exported so it unit-tests with no network and the MJAPI router can reuse it verbatim.