Twilio: Incoming call handling using <Dial> when target is busy or cell is turned off

◇◆丶佛笑我妖孽 提交于 2019-12-10 10:55:06

问题


This question has been asked before (see Twilio - forward call after 2 rings and Twilio call busy status), however they do not answer my scenario.

We have a simple hunting list connected to an phone number provided by Twilio:

<Response>
<Dial timeout="20"><!--cellphone #1--></Dial>
<Dial timeout="20"><!--cellphone #2--></Dial>
<Dial timeout="20"><!--cellphone #3--></Dial>
</Response>

Now, this works in the normal case - if cell #1 doesn't answer it will switch to #2 after 20 seconds.

However, if Cell #1 is turned off (airplane mode, or turned off) then the caller receives a voice message from the local phone carrier with words to the effect of "Sorry this number cannot be reached", then silence, then the second number is called.

So it works, however the user experience is so confusing that we cannot use it.

Same deal with busy/call reject by the called party. In these cases the caller hears a busy tone, and then after the timeout period, Twilio dials the next number in the list.

We tried this via TwiML Bins, and we also tried this using:

<Response>
<Dial action="http://callback" timeout="20"><!--cellphone #1--></Dial>
</Response>

where the callback provided the request to dial cellphone #2, however the callback was called only after the timeout, not at the point the first called party became unavailable.

Other service provides we've used appear to solve this by hiding sound played in the cases of busy/no-answer/phone turned off behind a ringing tone (i.e. they don't simply pipe the called party channel to the caller, but play their own ring tone).

Is there any chance through Twilio we can improve what the calling party hears in the case of busy/unavailable?

Update

I tried both Conference and Queue. With Queue I finally found most of a solution whereby using a script I could initiate a call:

#!/usr/bin/python
import support_numbers
from twilio.rest import TwilioRestClient                                                                                                

account_sid = "AAA" # Your Account SID from www.twilio.com/console                                       
auth_token  = "YYY"  # Your secret from www.twilio.com/console                                             

numbers = support_numbers.numbers()                                                                                                     

client = TwilioRestClient(account_sid, auth_token)                                                                                      
call = client.calls.create(
        to=numbers[0],
        from_="XXXX",                                                                                                          
        method="GET",                                                                                                                   
        status_callback="http://example.com/cgi-bin/twilio/try-second.py",                                                       
        status_callback_method="GET",                                                                                                   
        status_events=["completed"],
        url="http://example.com/cgi-bin/twilio/join-support-queue.py")


print "Content-type: text/xml\n";
print """<?xml version="1.0" encoding="UTF-8"?>
<Response>  
        <Say>Please Wait</Say>
        <Play>http://com.twilio.music.classical.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3</Play>            <Redirect/>
</Response>
"""

This would have the person who is contacted join the support queue. If they do not answer the phone, or reject the call, then "try-second.py" is called. This would then try the next person in line.

A separate file "support_numbers.py" stores the list of phone numbers.

I'm not particularly happy with this solution. It is much more complex than I'd like.


回答1:


On possible solution is to put the inbound call in a conference, and when you get a successful outbound call, patch them into the conference.




回答2:


<Response>
    <Say>Please wait while we're trying to connect you to the next available representative.</Say>
    <Dial timeout="20"><!--cellphone #1--></Dial>

    <Say>Please wait while we're trying to connect you to the next available representative.</Say>
    <Dial timeout="20"><!--cellphone #2--></Dial>

    <Say>Please wait while we're trying to connect you to the next available representative.</Say>
    <Dial timeout="20"><!--cellphone #3--></Dial>
</Response>


来源:https://stackoverflow.com/questions/38135564/twilio-incoming-call-handling-using-dial-when-target-is-busy-or-cell-is-turne

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!