Media Pass
Using the Media Pass feature, you can delegate audio processing to external systems, with RustPBX handling the protocol part.
Configure in the option: CallOption parameter's mediaPass: MediaPassOption in the Invite/Accept command:
Parameters
url
WebSocket service address.
inputSampleRate
Audio sample rate received from the WebSocket connection (also the RTP/WebRTC track sample rate).
Recommended settings:
- SIP calls: 16000hz
- WebRTC calls:
- G722: 16000hz
- Opus: 48000hz
- Others: 8000hz
outputSampleRate
Audio sample rate sent from the WebSocket connection (also the sample rate that external services will receive) If different from inputSampleRate, resampling will be required.
packetSize
Packet size (default: 2560 bytes).
Flow
When a call-in or call-out session is established, a Media Pass Track will be created. Like other Tracks, the start and end of the Media Pass Track will trigger Track Start and Track End events respectively.
Media Pass Track will use the configured address plus parameters to request the external websocket service. Example:
ws://127.0.0.1:8080/?sample_rate=16000&packet_size=1024
sample_rateis the configuredoutputSampleRatepacket_sizeis the configuredpacketSize
After the connection is successful, Media Pass Track will start bidirectional audio forwarding, as shown: