简体   繁体   中英

Twilio - Divert Call & Display Original Number Dialed Prior to the Diversion

I researched Twilio and Stack but can't find an answer. I just need to know if this is possible before I spend big dollars on additional phone lines.

I have several businesses with different phone numbers but want to answer all calls from the one phone line which uses caller ID to display the original number dialed, prior to being diverted, so we can answer the call in the correct business name.

For example, a personal dials X (Business A) which is diverted to Y (Business B). When the call comes in to Y, the caller ID displays X (the name of the original business name dialed, in this case Business A). Then we can answer the call "Good morning, Business A). This would be replicated for 5 different businesses all coming in to the one line.

This will save us from installing several phone lines. I believe this must be possible but would greatly appreciate confirmation of this. I am prepared to pay a developer to make it happen.

Thank you in advance.

Boyd.

Yes this is possible with Twilio.

Basically, you'll want to point your Business X Twilio phone line to an XML file that looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Dial callerId="BUSINESS_X_NUMBER">BUSINESS_Y_NUMBER</Dial>
</Response>

Put that code in a file on a server somewhere and point your Twilio number "Voice URL" to that file's URL.

Then replicate this for each of your other businesses, replacing the BUSINESS_X_NUMBER with whatever that business' phone number is, and point the Twilio numbers for those businesses at the URLs that you place those files in.

Now whenever someone dials any of your numbers, Phone Y will ring and the callerId will show the number that the customer originally dialed.

To get fancier with it, you can write a server-side script to dynamically replace the BUSINESS_X_NUMBER part with a value that is read from the URL.

You can have all your business numbers point to a single file with a GET parameter on the file's URL, like this for Business X:

http://www.your-site-whatever.com/twilio_handler.php?dialed_number=BUSINESS_X_NUMBER

This would be Business Z's "Voice URL":

http://www.your-site-whatever.com/twilio_handler.php?dialed_number=BUSINESS_Z_NUMBER

And your twilio_handler.php file would look like this:

<?xml version="1.0" encoding="UTF-8"?>
    <Response>
        <Dial callerId="<?php echo $_GET['dialed_number']; ?>">BUSINESS_Y_NUMBER</Dial>
    </Response>

edit: Note that according to Twilio's rules , all your Business X,Z, etc numbers have to be Twilio numbers (or at least numbers that you've registered with Twilio). The line that they all point to does not, though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM