How to get the caller's audio out of each switch and onto the socket. The protocol itself is on Connect your switch.FreeSWITCH with mod_audio_fork#
mod_audio_fork opens a WebSocket, sends one text frame with the metadata you give it, then streams 16-bit PCM. Pass our start message as the metadata.uuid_audio_fork <uuid> start wss://api.callerapi.com/api/voice/filter/stream?key=YOUR_KEY mono 8k {"type":"start","call_id":"<uuid>","from":"+15559990000","to":"+15551234567","sample_rate":8000,"encoding":"pcm16","params":{"webhook":"https://example.com/hook","language":"en"}}
1.
Run it on the caller's leg, with mono, so only the caller's speech is sent.
2.
Check the argument order against your module version. Older builds take the metadata in a different position.
3.
Use the webhook parameter to act on events. The fork does not expose socket messages to the dialplan.
4.
Stop the fork when the call ends, or let the socket close with the channel. Both end the session.
Asterisk#
Asterisk sends external media by RTP or by AudioSocket. Neither is a WebSocket. Run a small bridge next to Asterisk:1.
Use ARI externalMedia or the AudioSocket dialplan application on the caller's channel.
2.
Receive the RTP or AudioSocket stream in the bridge.
3.
Decode to 16-bit PCM, or pass G.711 mu-law through as mulaw.
4.
Speak the protocol to wss://api.callerapi.com.
The script on Test with a recording is a working client. Replace the WAV reader with your RTP or AudioSocket reader.Kamailio and other SIP proxies#
Kamailio handles signaling only. Fork the media with RTPEngine or your media server into a bridge as described for Asterisk. Send the From or P-Asserted-Identity number and the SIP Call-ID to the bridge so it can fill from and call_id.Any component that can open a WebSocket, send one JSON text frame, and then send binary frames can connect. Most SBC vendors expose this as "media forking" or "SIPREC to WebSocket". Set the encoding to mulaw when the SBC forks G.711 as is.Twilio and Telnyx#
The CallerAPI SIP firewall#
If your domain is already on the CallerAPI SIP firewall, you do not need a socket to reach the honeypot. One setting hands spam calls to a persona. See Hand a call over. Modified at 2026-09-18 16:56:47