问题描述
我正在尝试使用Twilio python API拨打多个客户端,但这对我不起作用。
Scanario: 当客户使用我们的Twilio支持电话给我们打电话时,我们希望同时拨打多个座席,下一个可用座席(第一个座席)将响应客户的呼叫(此工作正常)。
def handle_voice():
call_sid = form.get("CallSid")
call_log = client.calls(call_sid).fetch()
xml_res = VoiceResponse()
settings = get_settings()
dial = Dial(caller_id=form.get("Caller"))
# dialing multiple client when customer call support team
dial.client("client1")
dial.client("client2")
# converting the normal call to conference call.
dial.conference(call_log.get("sid"),start_conference_on_enter=True,end_conference_on_exit=False,wait_url="{base_url}/{resources}".format(
base_url=settings.base_url,resources="api/wait"))
xml_res.append(dial)
return Response(xml_res.to_xml(),mimetype="application/xml")
但是,当我们尝试从浏览器进行热烈的呼叫转接时,它会响铃到下一个可用的座席,但是当他/她接听电话时,座席将无法与客户交谈,只能收听等待音乐。
会议线路= CallSid
从浏览器添加代理(客户端)
def add_agent(conference_line,agent):
doc = db.get_value("Call Log",conference_line)
#. doc.mobile_no is Twilio mobile number
settings = get_settings()
call = client.calls.create(agent,doc.get("mobile_no"),url="{base_url}/{resources}{params}".format(
base_url = settings.base_url,resources = "<api-path-here>",params="?conference_line=%s"%(conference_line)),method="GET")
现在,当第一个座席从浏览器断开呼叫(或挂断)时,客户也将断开连接。
def conference_line(conference_line):
conference_line_info = db.get_value("Call Log",conference_line)
res = VoiceResponse()
dial = Dial()
dial.conference(conference_line,start_conference_on_enter=True)
res.append(dial)
return Response(res.to_xml(),mimetype="application/xml")
https://github.com/TwilioDevEd/warm-transfer-flask/blob/master/warm_transfer_flask
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)