2
votes

We are building a custom phone system (PBX) on twilio.

When a caller calls in, a few recordings are played and then we have a dial verb. Within the dial verb can be one or more <number> nouns, which allow us to create 1 or more calls depending on the need (ring group).

When one of the numbers answers, and is connected I need to be able to put in a GATHER verb so that the person answering the phone, can easily transfer the caller to another predetermined extension. Ideally, they would just be able to tap in 100# and the caller would be disconnected and the transferred to extension 100.

How do I accomplish this?

I have the following so far, but it seems I cannot nest Gather inside of anything else, so I am at a loss as to how to accomplish what I need.

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Play>http://example.com/thankyouforcalling.mp3</Play>
    <Play>http://example.com/anothermessage.mp3</Play>
    <Play>http://example.com/connecttosales.mp3</Play>
    <Dial action="inboundcomplete" record="true" timeout="90">
       <Number>555-555-1211</Number>
       <Number>555-555-1210</Number>
    </Dial>
</Response>

Any help on this would be great!

1

1 Answers

1
votes

Twilio developer evangelist here.

The best thing to do here is actually dial your callers into a conference. You can then use the hangUpOnStar attribute of the <Dial> verb to allow a user to drop out of the call and make changes to it with a <Gather> verb in another bit of TwiML.

This can be quite a confusing process, but we have two blog posts on the matter depending on your preference of language. Either check out this post on warm phone call transfers with Python, Flask and Twilio or this post on how to warm transfer a call with Java and Twilio.

Let me know if this helps.