简体   繁体   English

在 Twilio 队列中录制语音邮件

[英]Recording a voicemail while in a Twilio Queue

I'm writing a call centre app using Twilio, and I've run into a problem.我正在使用 Twilio 编写呼叫中心应用程序,但遇到了问题。 The calls are received and put into a queue, while we find an agent to answer the call.接听电话并将其放入队列中,同时我们会找到代理人接听电话。 Whilst they're listening to the hold music, they are read their position in the queue, and I'm trying to use a Gather verb to allow them to press 1 and then leave a message.当他们正在听等待音乐时,他们会读取他们在队列中的位置,我正在尝试使用 Gather 动词让他们按 1,然后留言。

It all works well, except that it won't record.一切正常,除了它不会记录。 I've tried recording outside of the queue and it's all fine, so it seems to be the fact that it's in the queue that is the problem.我试过在队列外录制,一切正常,所以问题似乎出在队列中。 I'm not sure, thus, how to deal with it?因此,我不确定如何处理它?

So, if I just send this on initial connection:所以,如果我只是在初始连接时发送这个:

<Response><Say>Please record your message after the tone.</Say><Record action="http://ngrok.com/handleVoicemailRecording"></Record></Response>

then it works fine, and calls the method.然后它工作正常,并调用该方法。 If however, I do the "proper" route as I see it, then the recording doesn't happen, and the queue immediately re-calls the "waitUrl" action for the queue:但是,如果我按照我所看到的那样执行“正确”路由,则不会进行记录,并且队列会立即重新调用队列的“waitUrl”操作:

Initial call:初始调用:

[2016-01-19 17:38:45.637] <Response><Say voice="alice" language="en-AU">Thanks for calling, please note all calls may be recorded for security and training purposes. We'll answer your call very shortly.</Say><Enqueue waitUrl="http://ngrok.com/holdMusic">1COVERAUS</Enqueue></Response>

Queue waitUrl response:队列 waitUrl 响应:

[2016-01-19 17:38:56.202] <Response><Gather numDigits="1" action="http://ngrok.com/leaveVoicemail"><Say>Thanks for waiting, you're 1 in the queue. Press 1 at any time to leave a message.</Say><Play>https://s3-ap-southeast-2.amazonaws.com/somemusic.mp3</Play></Gather></Response>

Record command, the Say of which works, and the Record doesn't Record 命令,Say of which 有效,而 Record 无效

[2016-01-19 17:39:10.861] <Response><Say voice="alice" language="en-AU">Please record your message after the tone.</Say><Record action="http://ngrok.com/handleVoicemailRecording"></Record></Response>

And then 3 seconds later (at the end of the Say), Twilio requests the waitUrl again, having not beeped.然后 3 秒后(在 Say 结束时),Twilio 再次请求 waitUrl,没有发出哔哔声。

[2016-01-19 17:39:13.757] <Response><Gather numDigits="1" action="http://ngrok.com/leaveVoicemail"><Say voice="alice" language="en-AU">Thanks for waiting, you're 1 in the queue.</Say><Say voice="alice" language="en-AU">Press 1 at any time to leave a message.</Say><Play>https://s3-ap-southeast-2.amazonaws.com/somemusic.mp3</Play></Gather></Response>

Any ideas?有任何想法吗? Is this by design?这是设计使然吗? Can I get around it in a useful way?我能以有用的方式绕过它吗?

Twilio developer evangelist here. Twilio 开发者传播者在这里。

This behaviour is by design.此行为是设计使然。 The <Enqueue> documentation provides you the verbs that can be used within the waitUrl TwiML . <Enqueue>文档为您提供了可以在waitUrl TwiML 中使用的动词 However, this does not mean that you are out of luck, we can still create this feature.但是,这并不意味着您不走运,我们仍然可以创建此功能。

Instead of going from <Gather> to <Say/><Record/> you can use <Leave> to have the user leave the queue.您可以使用<Leave>让用户离开队列,而不是从<Gather><Say/><Record/> The call won't hang up, rather it will try to carry on from after the original <Enqueue> .呼叫不会挂断,而是会尝试从原始<Enqueue>之后继续。 Add your <Say/><Record/> in that original TwiML and it will play when the user decides to leave the queue and record a message.在原来的 TwiML 中添加您的<Say/><Record/> ,它会在用户决定离开队列并录制消息时播放。

So, you initial TwiML will now be:因此,您的初始 TwiML 现在将是:

<Response>
  <Say voice="alice" language="en-AU">
    Thanks for calling, please note all calls may be recorded for security and training purposes. We'll answer your call very shortly.
  </Say>
  <Enqueue waitUrl="http://ngrok.com/holdMusic">1COVERAUS</Enqueue>
  <Say voice="alice" language="en-AU">
    Please record your message after the tone.
  </Say>
  <Record action="http://ngrok.com/handleVoicemailRecording"></Record>
</Response>

Your waitUrl TwiML stays the same:您的 waitUrl TwiML 保持不变:

<Response>
  <Gather numDigits="1" action="http://ngrok.com/leaveVoicemail">
    <Say>
      Thanks for waiting, you're 1 in the queue. Press 1 at any time to leave a message.</Say>
    <Play>https://s3-ap-southeast-2.amazonaws.com/somemusic.mp3</Play>
  </Gather>
</Response>

And the Gather action simply becomes: Gather 动作简单地变成了:

<Response>
  <Leave/>
</Response>

Let me know if that helps at all.让我知道这是否有帮助。

I found a solution to this which doesn't mean anyone dropping out of the queue goes to voicemail, and it's to use the REST API to change the relevant call, dropping it from the queue and forwarding to another TWiML document which records your message.我找到了一个解决方案,这并不意味着任何退出队列的人都会转到语音邮件,而是使用 REST API 更改相关呼叫,将其从队列中删除并转发到另一个记录您的消息的 TWiML 文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM