从 twilio 文档和教程中,代理不会知道有人在队列中,所以这只有在队列中总是有人并且代理只是坐在那里并整天进行现场呼叫时才有效。
客观的:
当有人打电话时,我想将呼叫连接到代理。如果代理不可用,请将呼叫者添加到队列中。如果第二个人或第三个人来电,请继续将他们添加到队列中。当座席完成他们的第一个电话并挂断时,让下一个排队呼叫并实际拨打座席的电话与座席通话。
我对 twilio 真的很陌生,所以这个 twiml 很糟糕,我已经知道这不起作用,但这是我目前正在尝试的:
<?xml version="1.0" encoding="UTF-8" ?>
<Response>
<Enqueue waitUrl="contactagent.php">myqueue</Enqueue>
</Response>
联系代理.php:
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('../callapp/Services/Twilio.php'); // Loads the library
$sid = "(MYID)";
$token = "(MyToken)";
$client = new Services_Twilio($sid, $token);
$call = $client->account->calls->create($_REQUEST['the caller that's in the queue'], "(the agent's phone number)", "connectagent.xml", array());
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
<Response>
<Say>Your are number ".$_REQUEST['QueuePosition']." in line for a representative.</Say>
<Play>http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3</Play>
</Response>"
?>
连接代理.xml
<?xml version='1.0' encoding='utf-8' ?>
<Response>
<Dial>myqueue</Dial>
</Response>