Example: Placing an outbound call
This example starts a VoxEngine session, places an outbound PSTN call, and bridges audio to ElevenLabs Agents once the callee answers.
Jump to the Full VoxEngine scenario.
Prerequisites
- Store your ElevenLabs API key in Voximplant
ApplicationStorageunderELEVENLABS_API_KEY. - Store your ElevenLabs Agent ID in Voximplant
ApplicationStorageunderELEVENLABS_AGENT_ID. - Ensure outbound calling is enabled for your Voximplant application and that your caller ID is verified.
Outbound call parameters
The example expects destination and caller ID in customData (read via VoxEngine.customData()):
Custom data example
Launch the routing rule
For quick testing, you can start this outbound scenario from the Voximplant Control Panel:
- Open your Voximplant application and go to the Routing tab.
- Select the routing rule that has this scenario attached.
- Click Run.
- Provide Custom data (max 200 bytes) with
destinationandcallerId:
Custom data example
For production, start the routing rule via Management API startScenarios (pass rule_id, and pass the same JSON string in script_custom_data): https://voximplant.com/docs/references/httpapi/scenarios#startscenarios
Connect call audio
After the callee answers, the example creates an ElevenLabs.AgentsClient and bridges audio:
Connect call audio
Barge-in
Barge-in
Notes
See the VoxEngine API Reference for more details.
Full VoxEngine scenario
voxeengine-elevenlabs-outbound.js