在Twilio队列中录制语音邮件

时间:2016-01-19 17:45:25

标签: twilio

我正在使用Twilio编写一个呼叫中心应用程序,我遇到了一个问题。收到呼叫并将其放入队列,同时我们找到一个代理来接听电话。当他们正在听保持音乐时,他们会在队列中读取他们的位置,我正在尝试使用Gather动词让他们按1然后留言。

这一切都很好,除了它不会记录。我已经尝试在队列之外进行录制了,一切都很好,所以看起来它是队列中的问题。因此,我不确定如何处理它?<​​/ p>

所以,如果我只是在初始连接上发送它:

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

然后它工作正常,并调用该方法。但是,如果我按照我所看到的那样执行“正确”路由,则记录不会发生,并且队列会立即重新调用队列的“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>

队列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>

录制命令,其中的Say是有效的,而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>

然后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>

有什么想法吗?这是设计的吗?我能以有用的方式解决这个问题吗?

2 个答案:

答案 0 :(得分:5)

Twilio开发者传道者在这里。

此行为是设计使然。 <Enqueue>文档为您提供了verbs that can be used within the waitUrl TwiML。但是,这并不意味着你运气不好,我们仍然可以创建这个功能。

您可以使用<Gather>让用户离开队列,而不是从<Say/><Record/>转到<Leave>。呼叫不会挂断,而是会尝试从原始<Enqueue>之后继续。在原始的TwiML中添加<Say/><Record/>,当用户决定离开队列并记录消息时,它将播放。

所以,你最初的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>

您的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>

而Gather的行动就变成了:

<Response>
  <Leave/>
</Response>

让我知道这是否有帮助。

答案 1 :(得分:0)

我找到了一个解决方案,并不意味着任何退出队列的人都会转到语音邮件,并且使用REST API来更改相关的呼叫,将其从队列中删除并转发到另一个记录你的信息的TWiML文件。