例如,如果代理A向用户发出呼叫,现在代理A现在转移呼叫代理B,我如何断开代理A与呼叫的连接,让用户和B仍在通话中。
1.当我拨打电话时,我使用这个TwiML。
def unseen_activity(request, slug=None, *args, **kwargs):
form = UnseenActivityForm()
notifications = retrieve_unseen_notifications(request.user.id)
page_num = request.GET.get('page', '1')
page_obj = get_page_obj(page_num, notifications, ITEMS_PER_PAGE)
if page_obj.object_list:
oblist = retrieve_unseen_activity(page_obj.object_list)
else:
oblist = []
context = {'object_list': oblist, 'form':form, 'page':page_obj,'nickname':request.user.username}
return render(request, 'user_unseen_activity.html', context)
def unseen_reply(request, pk=None, *args, **kwargs):
if request.method == 'POST':
form = UnseenActivityForm(request.POST,request=request)
if form.is_valid():
# process cleaned data
else:
notifications = retrieve_unseen_notifications(request.user.id)
page_num = request.GET.get('page', '1')
page_obj = get_page_obj(page_num, notifications, ITEMS_PER_PAGE)
if page_obj.object_list:
oblist = retrieve_unseen_activity(page_obj.object_list)
else:
oblist = []
context = {'object_list': oblist, 'form':form, 'page':page_obj,'nickname':request.user.username}
return render(request, 'user_unseen_activity.html', context)
def unseen_group_reply(group_reply, pk=None, *args, **kwargs):
#similar processing as unseen_reply
2.我正在使用更新方法转移呼叫,并使用此代码拨打其他代理 -
<form action="/light/" method="POST">
<input type="text" name="command" value="{{request.form.command}}">
<input type="submit" value="Submit command">
</form>
并且在tr_url上我使用了TwiML -
<Response>
<Dial callerId="id">
<Number statusCallback="statusCallbackurl" statusCallbackMethod="POST">ag1_num</Number>
</Dial>
<Redirect>music_url</Redirect>
</Response>
并断开调用我调用此方法并传递callsid -
function transfer_call($Sid,&ag2_num){
$childCalls = $this->client->calls->read(array("ParentCallSid" => $Sid));
$childSid = $childCalls[0]->sid;
$rr = array(
"url" => "tr_url".$ag2_num,
"method" => "POST"
);
$call = $this->client->calls($childSid)->update($rr);
return $call->to;
}
我使用呼叫sid断开座席与呼叫的连接,并断开整个呼叫。
答案 0 :(得分:0)
Twilio开发者传道者在这里。
在评论中,您说您在转移后直接使用disconnect_call
方法,并且两者都使用相同的sid。这意味着您转移了从第一个座席挂断的呼叫,但是您也立即挂断了转接的呼叫,因此它永远不会呼叫第二个座席。
您不应该断开第一个座席的连接,将呼叫从他们转移就可以。移除您对disconnect_child
的来电,然后重试。