Example: Answering an incoming call
Connect an inbound call to Qwen Cloud
For the complete documentation index, see llms.txt.
Overview
This example answers an inbound call and connects it to Qwen Cloud with a short prompt, an English voice, and barge-in.
⬇️ Jump to the Full VoxEngine scenario.
Prerequisites
- Set up an inbound entrypoint for the caller:
- Create a routing rule that points the destination to this scenario.
- Store your Qwen Cloud API key in Voximplant Secrets under
QWEN_API_KEY.
Architecture
Usage highlights
- Create a
VoiceAgentAPIClientwithQwenCloud.createVoiceAgentAPIClient. - The example pins
modeltoqwen-audio-3.1-realtime-plus. - On
SessionCreated, sendsessionUpdatewithvoice,instructions, languages, andturn_detection. - On
SessionUpdated, bridge audio withVoxEngine.sendMediaBetween(call, client)and ask Qwen to greet the caller. - On
InputAudioBufferSpeechStarted, callclearMediaBufferso the caller can interrupt playback.
Media bridge
QwenCloud.VoiceAgentAPIClient is not in VoxMediaUnitMap yet. sendMediaBetween matches the other realtime connectors. See Overview for the typings gap.
Turn detection and barge-in
Configure before you run
- Set
QWEN_API_KEYin Voximplant Secrets. - Change
voiceif you want another Qwen system voice or a cloned voice id.beth_v3.1is an English 3.1 voice. The provider default islonganqian_v3.1. - Adjust
SYSTEM_PROMPTfor your brand voice and guardrails.
Try it
Suggested test prompts:
- “Hello”
- “What can you help me with?”
- “Goodbye.”
Notes
See the VoxEngine API Reference for more details.
Full VoxEngine scenario
voxeengine-qwen-answer-incoming-call.js