Twilio TwiML:客户端挂断后不要录音 [英] Twilio TwiML: Don't record after client hangs up

查看:25
本文介绍了Twilio TwiML:客户端挂断后不要录音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的 twiml:

I have my twiml as such:

<Response>
    <Dial timeout="12">
    <Client>Robbie</Client>
    </Dial>
    <Say>
    The person you are trying to reach is currently unavailable. Please leave a message at the beep.
    </Say>
    <Record action="/voicemail/fdasjhklewu/" maxLength="90" method="GET" timeout="7"/>
    </Response>

这里 twilio 尝试联系客户端以连接和传入呼叫,然后如果没有响应,则转到语音邮件.

Here twilio tries to reach the client to connect and incoming call and then if there's no response, it goes to voicemail.

但是,如果我接听然后挂断,它仍然会转到语音信箱.如何挂断而不转到语音信箱?

However, if I answer and then hangup, it still goes to voicemail. How can I hangup and not goto voicemail?

推荐答案

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

Twilio developer evangelist here.

你实际上可以实现你想要的,但方式略有不同.

You can actually achieve what you want, but in a slightly different way.

如果你像这样向 传递一个动作:

If you pass an action to your <Dial> like this:

<Response>
  <Dial action='/after_dial'>
    <Client>Robbie</Client>
  </Dial>
</Response>

然后一旦调用完成,您将需要一些东西来处理对该操作的回调.下面是一个使用 Sinatra 编写的 Ruby 示例(尽管您可以使用任何您想要的语言来完成此操作):

Then once the call completes, you'll need something to deal with a callback to that action. Here is an example in Ruby with Sinatra (though you can do this with whatever language you want):

post '/after_dial' do
  content_type 'text/xml'
  if ['busy', 'no-answer', 'failed', 'canceled'].include?(params['DialCallStatus'])
    "<Say>
       The person you are trying to reach is currently unavailable. Please leave a message at the beep.
     </Say>
     <Record action="/voicemail/fdasjhklewu/" maxLength="90" method="GET" timeout="7"/>"
  else
    "<Hangup/>"
  end
end

DialCallStatus 参数告诉您呼叫发生了什么,因此如果由于任何原因忙、未接、取消或失败,您可以转到语音信箱,否则呼叫已完成,您可以挂断.

The DialCallStatus parameter tells you what happened to the call, so if it was busy, missed, canceled or failed for any reason you can go to voicemail, otherwise the call was completed and you can just hangup.

告诉我这是否有帮助.

这篇关于Twilio TwiML:客户端挂断后不要录音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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