0
votes

I have a mostly working chrome extension that uses the Twilio client to allow calling a number from the browser. The twilio client is too unstable to be used reliably, so I'm re-wiring the extension to just perform 'reverse click to dial', but am having trouble getting my head wrapped around the twiml flow.

Assume I have a web service that can produce twiml. Here's the call flow I want to achieve:

  1. Agent launches my chrome extension, and gives it a phone number to dial.
  2. Stored in the extension's settings is the twilio account sid,token, app sid for the twiml app/service, AND the number to connect the dialed number to, typically the agent's cell phone.
  3. My extension makes a request to twilio API, which in turn requests a route in my twiml app.
  4. some magical twiml is produced
  5. agent's cell phone rings
  6. agent answers
  7. he is connected to an outbound dial to the original number he was dialing

What is the simplest twiml that will accomplish this? to boil down the flow:

  1. agent enters number into chrome extension and clicks CALL
  2. agent's phone rings
  3. agent answers and is connected to number entered in step 1.
1

1 Answers

0
votes

Twilio evangelist here.

The way I would do this:

  1. Extension talks to Twilio API to start an outbound phone call to entered number
  2. When entered number answers your app returns Twiml that tells Twilio to <Say> something like "Hold on while we connect you to an agent and then <Dial> the agent:

    <Response>
        <Say>Hold on while we connect you</Say>
        <Dial callerId="+15555555555">
            <Number>[Agent Number]</Number>
        <Dial>
    <Response>
    

If you want to reverse this to dial the agent first, just have your extension tell Twilio to call the Agent number first and then, when the Agent answers, have the TwiML say something like "Hold on while we connect you to the customer" and <Dial> the customer number.

Hope that helps.