有人可以告訴我:如何接聽呼叫者,從排隊到撥號(轉發)。在一個應用程式中,通過自動化這個???
我有類似的東西,它不會作業:
<Say>hello</Say>
<Enqueue waitUrl="https://brass-dragonfly-1957.twil.io/assets/poczekalnia.xml">support</Enqueue>
<Dial url="/ivr/agent/screencall">
000000000
<Queue>support</Queue>
</Dial>
<Redirect>/ivr/welcome/</Redirect>
</Response>
在 python 中看起來像這樣:
twiml_response.say('hello')
twiml_response.enqueue('support', wait_url='https://brass-dragonfly-1957.twil.io/assets/poczekalnia.xml')
twiml_response.dial(' 000000000', url=reverse('ivr:agents_screencall')).queue('support')
uj5u.com熱心網友回復:
看起來您正試圖在一個 TwiML 回應中為您的呼叫者和代理執行操作,但這是行不通的。
當您<Enqueue>
是呼叫者時,不會執行任何后續 TwiML,直到您使用<Leave>
.
看起來您想撥打座席,讓他們篩選呼叫,然后將他們連接到佇列中的呼叫者。為此,您首先要使用 REST API 創建對代理的呼叫。通過該呼叫,您將提供一個 URL,當該代理連接時將請求該 URL。在對該 URL 的回應中,您應該向他們說出訊息,然后<Dial>
是<Queue>
. 像這樣的東西:
import os
from twilio.rest import Client
account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_AUTH_TOKEN']
client = Client(account_sid, auth_token)
def call(request):
twiml_response = VoiceResponse()
twiml_response.say('hello')
twiml_response.enqueue('support', wait_url='https://brass-dragonfly-1957.twil.io/assets/poczekalnia.xml')
call = client.calls.create(
url = '/agent'.
to = agent_phone_number,
from = your_twilio_number
)
return HttpResponse(twiml_response, content_type='text/xml')
然后,作為對端點的 webhook 的回應/agent
,您應該回傳您的回應以進行篩選,可能如下所示:
def agent(request):
twiml_response = VoiceResponse()
gather = Gather(action='/agent_queue', method='POST', numDigits=1)
gather.say('You are receiving an incoming call, press 1 to accept')
twiml_response.append(gather)
return HttpResponse(twiml_response, content_type='text/xml')
最后,/agent_queue
您確定篩選呼叫的結果,如果代理接受,則將它們連接到佇列。
def agent_queue(request):
twiml_response = VoiceResponse()
digits = request.POST.get("Digits", "")
if digits == "1":
dial = Dial()
dial.queue('support')
twiml_response.append(dial)
else:
twiml_response.hangup()
return HttpResponse(twiml_response, content_type='text/xml')
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/508603.html