douqiaolong0528 2014-10-03 14:53
浏览 44
已采纳

Twiml - 自动按(数字)和挂断

I want a simple script that will allow me to:

  • Answer the incoming phone (from Intercom)
  • Automatically press "9"
  • Hangup the call

I have an intercom which calls to my number and I have to answer it then press 9 to door to be opened and hangup. I want to implement this with twilio but can't find any solutions.

Any suggestions?

  • 写回答

1条回答 默认 最新

  • doumi0737 2014-10-03 15:21
    关注

    Twilio evangelist here.

    Just to make sure I understand your question, you want your intercom to call your Twilio number and have Twilio "press 9" and then hang up. Assuming I have that right it should be pretty simple to do.

    You're going to use the <Play> and <Hangup> TwiML verbs and return something like this Twilio in response to our Voice Request:

    <Response>
        <Play digits="9" />
        <Hangup />
    <Response>
    

    if you need to add some time between when the call is answered and the tone is played, you can do something like this:

    <Response>
        <Play digits="wwww9" />
        <Hangup />
    <Response>
    

    Each w character tells Twilio to pause for .5 seconds, so in this sample there is a 2 second delay before the tone is played.

    Hope that helps.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?