Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

Call Control Concepts


Twilio recommends that all calls between customer and agent (both inbound to agent and outbound from agent) be connected via a Twilio <Conference> hub. Note that the name Conference can be misleading - think of Conference as the network media resource which allows your calls to be transferred, or do things like monitor, whisper, barge.

All Twilio contact center voice features are designed with Conference at the middle of the call topology. Adopting Conference gives you access to the features described below and ensures your call topology is built to support additional Twilio voice features.

This page covers the following areas:

  • Call setup using a Conference bridge
  • Putting caller on hold
  • Cold Transfer (to a known person or to an unknown person in a specific queue)
  • Warm Transfer (to a known person or to an unknown person in a specific queue)
  • Supervisor Monitor mid-call
  • Supervisor Whisper Mid-call
  • Supervisor Barge-in mid-call
  • Pre-call automated details whisper to agent

Note that while there are multiple ways to build these sorts of call flows, the recommendations here focus on using TaskRouter as part of each use case, in order to make sure that TaskRouter has full visibility of agent utilization, to ensure reporting/dashboard accuracy.


Call setup using a Conference bridge

call-setup-using-a-conference-bridge page anchor

TaskRouter can take care of all the orchestration of connecting caller and agent via a conference bridge. This function does the following on your behalf:

  • Connect agent into conference. The conference will be named by the TaskSID.
  • Listen to callback that the agent has answered the call
  • Move the caller from the queue and into the conference (note that this flow is optimized to ensure the media is routed locally for global deployments using Twilio Global Low Latency (GLL)).

To invoke this function, issue a conference instruction to the reservation request, either through the TaskRouter JS SDK or as a response to the assignment callback. For more details, see the TaskRouter conference instruction.

Here's an example of a Task that has been through Conference Instruction:

1
{
2
"from_country": "GB",
3
"conference": {
4
"room_name":"WTa525c5b78f33f3c0ebba5f4572dd63bc",
5
"sid":"CF9ae83ef32b28ccc25105f3273828952c",
6
"participants":{
7
"worker":"CA2bce114074e05093defe99446e54eaf2",
8
"customer":"CA78598dbba985e38fb6d08e003a00563f"
9
}
10
},
11
"called": "+447903546100",
12
"to_country": "GB",
13
"to_city": "",
14
"to_state": "",
15
"caller_country": "GB",
16
"call_status": "in-progress",
17
"call_sid": "CA78598dbba985e38fb6d08e003a00563f",
18
"account_sid": "ACa157c7575370d480a640dd92889341cc",
19
"from_zip": "",
20
"from": "+447903543800",
21
"direction": "inbound",
22
"called_zip": "",
23
"caller_state": "",
24
"to_zip": "",
25
"called_country": "GB",
26
"from_city": "",
27
"called_city": "",
28
"caller_zip": "",
29
"api_version": "2010-04-01",
30
"called_state": "",
31
"from_state": "",
32
"caller": "+447903543800",
33
"caller_city": "",
34
"to": "+447903546100"
35
}

To put a call on hold, send a POST request to the Conference Participant resource. This requires that you have already set the call up via a conference bridge, as described above.

Put a call on holdLink to code sample: Put a call on hold
1
curl -X POST "https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/Conferences/CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json" \
2
--data-urlencode "Hold=true" \
3
--data-urlencode "HoldUrl=https://www.myapp.com/hold" \
4
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN

If you are using TaskRouter's conference instruction, all the SIDs you need will be within the Task Attributes.

  • Conference SID will be the conference.sid from the Task Attributes, which your application will have access to client side
  • Participant SID will be conference.participants.customer from the Task Attributes

The HoldUrl should provide the instructions for what hold music/announcement you want to play while the caller is on hold.


A basic cold call transfer would involve:

  • Put the caller on hold (as above)
  • Add a participant to the conference (the target of the transfer)
  • Remove the first agent CallSID from the conference
  • In the cold call transfer scenario, it is not important for the addition of the new participant to be completed before the first agent call SID is removed. The conference and caller leg will stay up even if no one else is on the conference.

However, if you are investing in accurate reporting of your contact center deployment, you will probably want to use TaskRouter to deliver this transfer, in order to ensure accuracy of agent statistics.


If doing a warm transfer using TaskRouter, the flow changes as follows


Supervisor Monitor mid-call

supervisor-monitor-mid-call page anchor

You will need to connect your supervisor leg and once they answer respond with TwiML as follows:

1
<Response>
2
<Dial>
3
<Conference muted="true">TaskSID</Conference>
4
</Dial>
5
</Response>

If you are using TaskRouter's conference instruction, the name of the conference you need to join will be the Task SID.


Upgrading Monitor to Barge mid-call

upgrading-monitor-to-barge-mid-call page anchor

For a supervisor to barge into a call they are monitoring, update the supervisor's call leg to turn off muting. For more details, see the Conference Participant resource.