Forward a Local Number to a VocRT Voice Application
Connect an inbound DID to your voice application — such as an AI voice assistant — over a secure WebSocket (WSS). Each call opens its own WebSocket session carrying the call’s events and two-way audio.
Part 1: Set Up Forwarding
Point your number at your WebSocket endpoint.
| 1 | Prepare your destinationYour application accepts one WebSocket connection per call. Set up a publicly reachable WSS endpoint with a valid TLS certificate. In your application, assign a destination ID to the assistant or workflow that should answer. wss://voice.example.com/vocrt?destinationId=appointments Replace the host and path with your own. Use |
| 2 | Set forwarding in the portalGo to Inbound → Local Numbers and click the blue Call Forward arrow next to the DID. Under Call Type, select WebSocket, paste the full WSS URL into the destination field, and click Save. The rule applies to incoming calls to this DID. |
| 3 | Alternatively, configure the DID through the APIOpen DID Forward Setting in the PBXme Postman collection. Keep the authentication and other fields from that request, and set the forwarding fields as shown below, substituting your own DID ID and endpoint. {
"action": "forward",
"did_id": "1234",
"call_type": "17",
"call_type_value":
"wss://voice.example.com/vocrt?destinationId=appointments"
}
Full request reference: PBXme API reference (Postman) |
Part 2: Handle the WebSocket Session
Each connection carries the events and audio for one call.
| 4 | Accept the connection and identify the callAccept the WebSocket upgrade. Once the connection opens, PBXme sends the {
"event": "start",
"start": {
"streamSid": "stream-example",
"callSid": "call-example",
"customParameters": {
"destinationId": "appointments",
"callerId": "+12025550124",
"clientType": "external",
"audioFormat": "pcm_8000"
}
}
}Use |
| 5 | Receive speech and send a replyExchange JSON text messages. Decode The caller’s audio arrives on the {"event":"media","media":{"track":"inbound","payload":"<base64-pcm>"}}
{"event":"media","media":{"track":"outbound","payload":"<base64-pcm>"}} |
| 6 | Interrupt playback or end the callTo discard queued reply audio, stop sending the current reply and send {"event":"clear"}When the caller hangs up, PBXme closes the WebSocket without a close reason (close code 1005). Treat any closure as the end of the call and release the session. Closing the socket from your application ends the call. VocRT doesn’t send DTMF (keypad) events, and this version defines no transfer command. |
Part 3: Test an Incoming Call
Verify routing, audio in both directions and session cleanup.
| 7 | Call the DID and listen in both directionsLog the incoming URL path, |
Troubleshooting
No connection reaches the server. Check call type 17, the full wss:// path, the certificate, and the spelling and value of destinationId. Confirm that your proxy forwards WebSocket upgrade requests.
The wrong assistant answers. Compare destinationId in the URL and in the start event with the mapping in your application.
Silence or distorted speech. Check the track direction, the sample rate and the raw PCM format after Base64 decoding. Send audio samples without a WAV header.
For assistance, send the DID, the time and time zone of the test, and the callSid if available.
Contact us at support@pbxme.com or WhatsApp +972 55-966-4944.
