我正在使用 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: Errorcode: 31005description: "Connection error"explanation: "A connection error occurred during the call"總而言之,我只需要一個關于如何將代理連接到隊列的解決方案,例如查看隊列中有多少呼叫并能夠從隊列中選擇它們
twilio 如何使用 PHP 和 JavaScript 從隊列中選擇呼叫
倚天杖
2022-07-08 10:20:35