Adding Programmable Voice participants to Video Rooms
Overview
The Programmable Video Rooms API enables developers to add real-time voice and video into web, mobile, and desktop applications. With the Programmable Voice integration, developers can now connect PSTN (Public Switched Telephone Network) and SIP audio calls into their Programmable Video Rooms.
Working with Twilio Video Rooms in TwiML
Programmable Video Rooms are represented in TwiML through the Room noun and Connect verb.
To connect a Programmable Voice call to a Video Room, use the UniqueName
(see the Room REST API documentation for further information):
<?xml version="1.0" encoding="UTF‐8"?> <Response> <Connect> <Room>DailyStandup</Room> </Connect> </Response>
The name of the Room is up to you and is namespaced to your account.
Connecting Incoming calls to a Video Room
The Programmable Voice documentation shows how to handle incoming voice calls. When a call comes in, Twilio will webhook into your webserver to request TwiML. To connect the incoming call to a Programmable Video Room, your webserver should be respond back with a TwiML response containing a
Making Outgoing calls and connecting them to a Video Room
The Programmable Voice documentation shows how to make outgoing calls. Twilio will webhook into your webserver when the called party answers the call to request TwiML. To connect the call to a Programmable Video Room, your webserver should be respond back with a TwiML response containing a
Setting the Voice participant’s Identity
Programmable Video Rooms expect every Participant to have a unique Participant identity. Every Programmable Voice participant that joins a Programmable Video Room is considered to be a new participant. You can set a unique identity on the voice caller participant using 'participantIdentity'. If participantIdentity is not provided, then Twilio will generate a random string and set it as the Participant identity.
<?xml version="1.0" encoding="UTF-8"?> <Response> <Connect> <Room participantIdentity='alice'>DailyStandup</Room> </Connect> </Response>
Note: Programmable Video requires each Participant to have a unique identity. If duplicate Participants join a Programmable Video Room, then Twilio will disconnect the original duplicate participant and throw an error.
Known Issues
- The
<Connect>
verb is designed to connect individual PSTN phone calls into a Video Room. This functionality should not be used to bridge a Programmable Voice Conference with a Video Room. This is an unsupported use case and it can fail in unexpected ways.
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.