Twilio initiate outbound call that connects agent phone before dialing target number

Viewed 8825

I want to create a help desk web page in which an agent can click a link to initiate an outbound call to a target number. I understand how to use the Web Client to make that happen, but for an agent who doesn't have bandwidth to support VoIP, I'd like Twilio to call the agent's phone number then dial the target number.

The experience would be much like using Google Voice with Google Chat/Hangout client -- Google Voice calls your number/client, then initiates a call to the target.

Also, if both agent and target phone numbers are domestic landlines, would this scenario incur 2X the per minute landline fees?

I'm not looking for code necessarily, but rather an answer based on Twilio APIs and Twiml concepts.

3 Answers

Thank you for the great answer, @user3229526, it worked like a charm.

In order to unhardcode the number to call, just append the number you wish to call as a URL parameter in the Twilio Requst URL

array("url" => "http://example.com/call_them.php?number=1234567890")

And edit call_them.php to accept that parameter

<Response>
    <Dial>
        <?php echo '+1'. $_GET['number']; ?> // +1 for country code
    </Dial> 
</Response>
Related