E.g.->If agent A makes a call to a user and now agent A transfers the call the agent B now how can i disconnect agent A from the call and let user and B still on the call.
1.When I make the call I use this TwiML.
<Response>
<Dial callerId="id">
<Number statusCallback="statusCallbackurl" statusCallbackMethod="POST">ag1_num</Number>
</Dial>
<Redirect>music_url</Redirect>
</Response>
2.I am transferring the call by using update method and dialing the other agent by using this code-
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;
}
and on the tr_url I used TwiML-
<Response>
<Dial>ag2_num</Dial>
<Redirect>disconnectedcallurl-usingemptyqueue(todisconnectthefirstagent)</Redirect>
</Response>
and to disconnect the call I called this method and pass the callsid-
function disconnect_call($callsid){
$rr = array("status" => "completed");
$call = $this->client->calls($callsid)->update($rr);
echo $call->direction;
}
I use the call sid to disconnect the agent from the call and it disconnect the whole call.