Calls
SIP with AudioSocket
Connect an Asterisk PBX directly to Spiiksi calls with AudioSocket.
Asterisk 18 and later can stream a call's audio over TCP with AudioSocket(). Spiiksi listens for it, plays the line as one side of a call, and plays the other side's interpretation back into the call. No Twilio needed.
Inbound calls: an entry id#
- In Spiiksi, open API & integrations → Connectors → SIP / PBX. Choose your agents' language and the callers' language, and Connect.
- Copy the entry id (shown once; make a new one if it's lost).
- Add a dialplan context, and route calls to it from an extension, an IVR choice or a queue overflow:
[spiiksi-inbound]
exten => 500,1,Answer()
same => n,Set(SPIIKSI_ENTRY=00000000-0000-0000-0000-000000000000)
same => n,AudioSocket(${SPIIKSI_ENTRY},audio.spiiksi.fi:9092)
same => n,Hangup()Each call to it starts a new Spiiksi call with the caller as the customer. Agents join from Calls.
Callers who speak different languages: let your IVR ask, then start a call with that customer_language through the API and pass the side's line id (below); or route through Twilio, whose menu asks the caller.
A side of a call you started#
Start a call with the API, then ask for a side's own line id:
curl https://api.spiiksi.fi/v1/calls/$CALL_ID/phone-line \
-H "Authorization: Bearer $SPIIKSI_KEY" -H "Content-Type: application/json" \
-d '{"side": "customer"}'{"audiosocket_id": "3f2a…", "host": "audio.spiiksi.fi", "port": 9092}Pass it to AudioSocket(3f2a…,audio.spiiksi.fi:9092), for example from an AGI script that started the call. A new id replaces the side's old one.
The connection#
- TCP to
audio.spiiksi.fi:9092; allow it outbound from the PBX. - Asterisk's AudioSocket protocol: a 16-byte UUID first, then 16-bit 8 kHz mono audio frames, both ways, and a hangup at the end.
- Audio isn't encrypted on this link. Run it over a VPN, or use Twilio's TLS/SRTP SIP if your calls need encryption on the way.
FreeSWITCH and others can use an AudioSocket-compatible module, or reach Spiiksi through Twilio.