在Twilio队列中录制语音邮件

Pet*_*rey 2 twilio

我正在使用Twilio编写呼叫中心应用程序,但遇到了问题。当我们找到座席接听电话时,这些电话就被接收并放入队列中。他们在听音乐时,会读取他们在队列中的位置,我正在尝试使用“收集”动词让他们按1,然后留言。

一切正常,除了它不会录制。我尝试过在队列外进行录制,而且一切都很好,所以看来问题出在队列中。因此,我不确定如何处理?

因此,如果我只是在初始连接上发送此消息:

<Response><Say>Please record your message after the tone.</Say><Record action="http://ngrok.com/handleVoicemailRecording"></Record></Response>
Run Code Online (Sandbox Code Playgroud)

然后工作正常,并调用该方法。但是,如果我按照自己的意愿执行“正确的”路由,则不会进行记录,并且队列立即为该队列重新调用“ waitUrl”操作:

初始通话:

[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>
Run Code Online (Sandbox Code Playgroud)

队列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>
Run Code Online (Sandbox Code Playgroud)

记录命令,其中的说说起作用,而记录不起作用

[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>
Run Code Online (Sandbox Code Playgroud)

然后3秒钟后(说了话),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>
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?这是设计使然吗?我能以一种有用的方式解决它吗?

phi*_*ash 6

Twilio开发人员布道者在这里。

此行为是设计使然。该<Enqueue>文档为您提供了可在waitUrlTwiML中使用的动词。但是,这并不意味着您不走运,我们仍然可以创建此功能。

您可以使用让用户离开队列的方式<Gather>来代替去。通话不会挂断,而是会尝试从原始通话后继续进行。添加您的<Say/><Record/><Leave><Enqueue><Say/><Record/>在原始TwiML中 TwiML,当用户决定离开队列并记录消息时,它将播放。

因此,您最初的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>
Run Code Online (Sandbox Code Playgroud)

您的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>
Run Code Online (Sandbox Code Playgroud)

而Gather动作就变成:

<Response>
  <Leave/>
</Response>
Run Code Online (Sandbox Code Playgroud)

让我知道是否有帮助。