TwiML 脚本会跳过记录动词并且不会记录消息

发布于 2025-01-12 23:50:30 字数 1363 浏览 0 评论 0原文

我一遍又一遍地解决这个看似简单的 TwiML (Twilio) 问题,但无法弄清楚发生了什么。

我的目标:将呼入呼叫放入队列,同时向客服人员拨打呼出呼叫,看看他们是否可以接听呼叫。如果客服人员可以接听呼叫,则两个呼叫将被桥接。如果客服人员无法接听电话,那么呼叫者会听到大约一分钟的等待音乐,然后是一条消息,要求他们留下语音邮件。呼叫者留下语音邮件后,呼叫应该挂断。

发生了什么:在接受入站呼叫后,呼叫者会听到一条简短的消息,然后进入队列(这有效)。向客服人员拨打出站电话(这有效),如果他们可以接听电话,他们就会接听(这有效)。如果客服人员无法接听电话,则呼叫者会听到大约一分钟的等待音乐,然后是一条消息,要求他们留下语音邮件(这有效)。然后,呼叫者没有机会留下语音邮件,而是突然挂断。 Record 动词似乎被跳过,就好像它不存在一样,流程直接进入挂断。

以下是接听来电和入队 waitUrl 的代码:

incoming-call.php

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Say voice="Polly.Joanna-Neural">Please wait while I find someone to speak with you.</Say>
  <Enqueue waitUrl="wait-url.php">support</Enqueue>
</Response>

wait-url.php

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Play loop="1">../../audio-files/hold-music/smile.mp3</Play>
  <Say voice="Polly.Joanna-Neural">I'm sorry, but I couldn't reach anyone to take your call. Please leave a message, and someone will return your call as soon as possible. Have a great day!</Say>
  <Record timeout="10" />
  <Hangup/>
</Response>

我尝试过使用和不使用记录状态回调来重新配置记录动词url,有或没有超时,甚至什么也没有。在每种情况下,通话都会结束,而不会录制消息。

预先感谢您对如何解决此问题的任何想法或建议。

I've gone through this seemingly simple TwiML (Twilio) issue over and over but can't figure out what's going on.

My Objective: Place an inbound call in Queue while an outbound call is made to an agent to see if they can take the call. If the agent can take the call, then the two calls are bridged. If an agent can't take the call, then the caller hears hold music for about a minute, which is followed by a message asking them to leave a voicemail. After the caller leaves a voicemail, the call should hang up.

What Happens: Upon accepting an inbound call, the caller hears a brief message and is then Enqueued (this works). An outbound call is made to an agent (this works), and if they can take the call, they do (this works). If the agent can't take the call, then the caller hears hold music for about a minute and then a message asking them to leave a voicemail (this works). Then, instead of giving the caller an opportunity to leave a voicemail, the call abruptly hangs up. The Record verb is seemingly skipped over as though it's not there, and the flow goes directly to Hangup.

Here's the code for taking the incoming call and the Enqueue waitUrl:

incoming-call.php

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Say voice="Polly.Joanna-Neural">Please wait while I find someone to speak with you.</Say>
  <Enqueue waitUrl="wait-url.php">support</Enqueue>
</Response>

wait-url.php

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Play loop="1">../../audio-files/hold-music/smile.mp3</Play>
  <Say voice="Polly.Joanna-Neural">I'm sorry, but I couldn't reach anyone to take your call. Please leave a message, and someone will return your call as soon as possible. Have a great day!</Say>
  <Record timeout="10" />
  <Hangup/>
</Response>

I've tried reconfiguring the Record verb with and without a recordingStatusCallback url, with and without a timeout, and even with nothing at all. In every instance the call just ends without recording a message.

Thank you in advance for any thoughts or suggestions on how to solve this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

伤痕我心 2025-01-19 23:50:30

正如您在评论中所述,问题在于您的呼叫仍保留在队列中,并且您正在处理的 TwiML 只能是 waitUrl 友好的 TwiML。

您需要的是让呼叫离开队列,然后它可以继续使用所有可用的 TwiML。您可以使用 TwiML 元素。当呼叫离开队列时,它将继续执行 元素之后的下一个 TwiML。我假设,根据您当前的实现,您的 mp3 文件的长度大约是您希望呼叫者留在队列中的长度。

因此,在您的情况下,您可以将 TwiML 更新为以下内容:

incoming-call.php - 将呼叫排入队列,但也会在呼叫者离开队列后处理录制语音邮件。

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Say voice="Polly.Joanna-Neural">Please wait while I find someone to speak with you.</Say>
  <Enqueue waitUrl="wait-url.php">support</Enqueue>

  <Say voice="Polly.Joanna-Neural">I'm sorry, but I couldn't reach anyone to take your call. Please leave a message, and someone will return your call as soon as possible. Have a great day!</Say>
  <Record timeout="10" />
  <Hangup />
</Response>

wait-url.php - 播放 mp3,然后离开队列。

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Play loop="1">../../audio-files/hold-music/smile.mp3</Play>
  <Leave />
</Response>

The issue, as you have described in your comment, is that your call remains in the queue and the TwiML you are dealing with can only be waitUrl friendly TwiML.

What you need is for the call to leave the queue, then it can continue with all available TwiML. You can have a call leave the queue with the <Leave> TwiML element. When a call leaves the queue it continues with the next TwiML after the <Enqueue> element. I assume, based on your current implementation, that your mp3 file is about the length you want the caller to stay in the queue.

So in your case you can update your TwiML to the following:

incoming-call.php - enqueues the call, but also handles recording voicemail once the caller leaves the queue.

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Say voice="Polly.Joanna-Neural">Please wait while I find someone to speak with you.</Say>
  <Enqueue waitUrl="wait-url.php">support</Enqueue>

  <Say voice="Polly.Joanna-Neural">I'm sorry, but I couldn't reach anyone to take your call. Please leave a message, and someone will return your call as soon as possible. Have a great day!</Say>
  <Record timeout="10" />
  <Hangup />
</Response>

wait-url.php - plays the mp3, then leaves the queue.

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Play loop="1">../../audio-files/hold-music/smile.mp3</Play>
  <Leave />
</Response>
怀里藏娇 2025-01-19 23:50:30

尝试修改入队调用 CallSid 以指向新的 TwiML 源(其中包括 Record 动词)。如果客服人员无法接听电话,您将触发此操作。

Try modifying the Enqueued calls CallSid to point to a new TwiML source (which includes the Record verb). You will trigger this if the agent can’t take the call.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文