如果无人接听,将 twilio 呼叫转移到语音信箱 [英] Diverting twilio call to voicemail if unanswered

查看:54
本文介绍了如果无人接听,将 twilio 呼叫转移到语音信箱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我正在尝试解决的问题,我很想就我的 twilio 设置提供一些建议.

I'd love some advice on my twilio setup for a problem I'm trying to solve.

概述:

我们系统中的每个用户都有一个 twilio 电话号码,他们可以将其分发给任何人以与他们联系.

Each user in our system is provisioned a twilio phone number that they can hand out to anyone to contact them.

如果 personA 通过提供的 twilio 电话号码联系我们系统中的用户 (userB),如果他们可用,我们希望将他们与 userB 联系起来.如果 userB 不可用,我们希望将 personA 定向到语音邮件.换句话说,我们希望确保我们能够控制语音邮件体验和语音邮件本身,以便我们可以将其存储在我们的系统中,而不是将语音邮件留在用户 B 的设备上.

If personA contacts a user in our system (userB) via the provisioned twilio phone number, we'd like to connect them with userB if they are available. If userB is not available, we'd like to direct personA to voicemail. In other words, we want to make sure that we have control of the voicemail experience and the voicemail itself so that we can store it in our system, rather than having the voicemail be left on userB's device.

当前解决方案:

  • PersonA 的来电被添加到队列中.同时,系统拨出userB.
  • 要求用户 B 按 1 接听电话.UserB 显式输入的原因是为了检测 UserB 是否可以接听电话.(例如,如果给用户 B 的呼叫转到他们的个人语音信箱,则不会出现明确的数字输入,告诉我们他们无法接听.)
  • 如果用户 B 在指定的时间内没有输入 1,则人员 A 将被定向到语音邮件.
  • 如果 UserB 按 1,则修改对 UserB 的调用(通过 twilio rest api)以拨打 PersonA 所在的队列以连接 UserB 和 PersonA.

当前解决方案的问题:

在此解决方案中,何时将人员 A 的呼叫转移到语音邮件的控制是由呼叫用户 B 的结果控制的,这似乎是次优的.例如,我们可能根本无法调用 UserB.在这种情况下,personA 将无限期地留在队列中.

In this solution, the control of when to divert personA's call to voicemail is controlled by the outcome of the call to UserB, which seems suboptimal. For instance, we may not be able to call UserB at all. In this case, personA would stay in the queue indefinitely.

在这种情况下,我希望发生的是轮询 personA 所在的队列以检查队列中的时间,如果队列中的时间大于阈值,则将呼叫转移到语音邮件.但是,似乎无法准确知道呼叫在队列中无人值守的时间,因为:

What I'd like to happen in this case is to poll the queue personA is in to check the time in queue, and divert the call to voicemail if time in queue is greater than a threshold. However, it does not seem like it is possible to accurately know how long a call is unattended in a queue because:

  • 队列中的呼叫状态为 in-progress,即使呼叫者正在听等待音乐.这与 PersonA 的呼叫已被应答的状态相同.

  • The status of a call in a queue is in-progress even if the caller is listening to wait music. This is the same status as if PersonA's call had been answered.

如果用户 B 拨入队列,则呼叫仅在桥接方断开连接时出列,而人员 A 的呼叫的呼叫状态没有变化,表明他们已连接到用户 B.

If UserB dials into the queue, the call is only dequeued when the bridged parties disconnect, with no change in the call status of PersonA's call to indicate that they have been connected to UserB.

问题

  • 我对为什么不能轮询呼叫队列以将呼叫转移到语音信箱的理解是否正确?
  • 我是否应该将 PersonA 呼叫到会议中,如果 UserB 有空,将他/她连接到 PersonA 所在的会议?
  • 如果我使用会议设置,那么检测 PersonA 在会议中等待了多长时间以便在 UserB 从未加入会议的情况下将 PersonA 的呼叫转移到语音邮件的最简单方法是什么?

推荐答案

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

Twilio developer evangelist here.

我认为您可能将队列中的事情变得过于复杂.您实际上可以在原始呼叫中提供消息和收集信息,而无需自己拨出并最终连接两个呼叫.

I think you may have overcomplicated things a bit here with the queue. You can actually provide the message and gather within the original call without having to dial out yourself and eventually connect the two calls.

方法如下:

您的来电 TwiML 应如下所示:

Your incoming call TwiML should look like this:

<Response>
  <Dial action="/call_complete" timeout="30">
    <Number url="/whisper">
      ONWARD DIAL NUMBER
    </Number>
  </Dial>
</Response>

名词一个 URL 将在两个调用连接之前播放该 URL 的 TwiML 内容.您可以在此处使用 <Gather> 来确保用户接听了电话,而不是他们自己的语音邮件系统:

Giving the <Number> noun a URL will play the TwiML contents of that URL before the two calls are connected. You can use <Gather> in here to make sure the user has answered the call and not their own voicemail system:

/whisper

<Response>
  <Gather numDigits="1" timeout="10" action="/gather_result">
    <Say voice="alice">You are receiving a call, press any key to accept</Say>
  </Gather>
  <Hangup/>
</Response>

/gather_result 需要确定是否按下了某个键.如果它被按下,那么我们将继续调用,我们可以使用空响应来完成,因为这会将控制权交还给原始的 .如果没有按下数字,我们就挂断这一端,这会导致原始 完成并指向它的 action 属性.(我不确定您使用的是哪种语言,但这里有一些 Rubyish 伪代码)

The /gather_result needs to work out whether a key was pressed or not. If it was pressed then we head through to the call, which we can do with an empty response as this gives control back to the original <Dial>. If no number was pressed we hangup this end, which causes the original <Dial> to complete and direct onto its action attribute. (I'm not sure what language you're working with but here is some Rubyish pseudo code)

/gather_result

<Response>
  if params["Digits"] and params["Digits"].empty?
    <Hangup/>
  end
</Response>

/call_complete 将在 操作结束后被调用.如果此时呼叫的状态为已完成"或已接听",则用户已接听电话并正确回应了耳语,我们可以挂断电话.如果还有其他问题,我们会将呼叫重定向到我们的语音邮件记录器.

/call_complete will then get called once the <Dial> action is over. If the status of the call at this point is "completed" or "answered" then the user has picked up the call and responded correctly to the whisper and we can hang up. If it's anything else, we redirect our call onto our voicemail recorder.

/call_complete

<Response>
  if params["DialCallStatus"] == "completed" or params["DialCallStatus"] == "answered"
    <Hangup/>
  else
    <Say voice="alice">The call could not be answered this time, please leave a message</Say>
    <Record action="/record_complete" />
  end
</Response>

最后你的 /record_complete 动作可以对录音 URL 做任何你想做的事情并挂断电话.

Then finally your /record_complete action can do whatever you want with the recording URL and hang up the call.

/record_complete

<Response>
  <Hangup/>
</Response>

这一切都可以通过 Twimlets 实现,如在这篇博文中.如果这有帮助,请告诉我.

This can all be achieved with Twimlets, as described in this blog post. Let me know if this helps at all.

这篇关于如果无人接听,将 twilio 呼叫转移到语音信箱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆