我正在使用 twiml 创建一个呼叫排队系统,一切正常,就像我可以接听电话和排队呼叫,但我无法从队列中接听电话,我写了这段代码,但它不工作
当有来电时,这是我的 twiml:
我接到第一个电话,其他后续电话排队,但现在第一个电话结束后,我无法选择排队的电话。当我挂断电话时,它会将第一个呼叫者排在队列中。
header("Content-type: text/xml");
$name = $_POST['name'];
$email = $_POST['email'];
$message = '<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>Please wait and one of our agents will be with you shortly.</Say>
<Dial>
<Client>joey</Client>
<Parameter name="name" value="'.$name.'" />
<Parameter name="email" value="'.$email.'" />
</Dial>
<Say>Our agents are still busy please hold.</Say>
<Enqueue waitUrl="waiting.php">Support</Enqueue>
</Response>';
echo $message;
因此,要从队列中接听电话,我发现了这个 Twilio PHP 代码:
use Twilio\TwiML\VoiceResponse;
$support = $_REQUEST['To'];
$response = new VoiceResponse();
$response->say("You will now be connected to the first caller in the queue.");
$dial = $response->dial('');
$dial->queue($support, ['url' => 'about_to_connect.php']);
echo $response;
使用此 JavaSCript 代码
queueButton.click(function() {
Twilio.Device.connect({
To: 'Support'
});
});
在这里,我想按照这个答案Twilio 将代理连接到队列中的呼叫
但是当我单击一个按钮来接听电话时,什么也没有发生,而是我收到了这个 js 错误
twilio.js:7100 Received an error from the gateway: {code: 31002, connection: Connection, message: "Connection Declined", twilioError: Error
code: 31005
description: "Connection error"
explanation: "A connection error occurred during the call"
总而言之,我只需要一个关于如何将代理连接到队列的解决方案,例如查看队列中有多少呼叫并能够从队列中选择它们
凤凰求蛊
相关分类