Twilio 能否用于接听 phone 电话并按键?
Can Twilio be used to answer a phone call and press a key?
我想知道我是否通常可以从 Twilio 获得一个 phone 号码,然后让另一个应用程序拨打该号码并让 twilio 接听并按 # 键或其他键序列。如果可能的话,我会很高兴被指点为要查看的任何基本文档。
此处为 Twilio 开发人员布道师。
好消息,你绝对可以做到!您可以购买 Twilio 号码。然后,您为该号码设置一个 URL,这样当 Twilio 收到对该号码的呼叫时,它会向该号码发出 HTTP 请求以了解要执行的操作。
URL 需要用 TwiML (which is XML) to tell Twilio what to do with the call. To perform what you want to achieve, you need the <Play>
verb 来回应。
为了接听电话,按 # 键然后挂断您需要 return 这个 TwiML:
<Response>
<Play digits="#"/>
<Hangup/>
</Response>
如果按键前需要等待,可以使用"w"延迟0.5s。因此,要延迟 2 秒然后按 #,您需要:
<Response>
<Play digits="wwww#"/>
<Hangup/>
</Response>
我想知道我是否通常可以从 Twilio 获得一个 phone 号码,然后让另一个应用程序拨打该号码并让 twilio 接听并按 # 键或其他键序列。如果可能的话,我会很高兴被指点为要查看的任何基本文档。
此处为 Twilio 开发人员布道师。
好消息,你绝对可以做到!您可以购买 Twilio 号码。然后,您为该号码设置一个 URL,这样当 Twilio 收到对该号码的呼叫时,它会向该号码发出 HTTP 请求以了解要执行的操作。
URL 需要用 TwiML (which is XML) to tell Twilio what to do with the call. To perform what you want to achieve, you need the <Play>
verb 来回应。
为了接听电话,按 # 键然后挂断您需要 return 这个 TwiML:
<Response>
<Play digits="#"/>
<Hangup/>
</Response>
如果按键前需要等待,可以使用"w"延迟0.5s。因此,要延迟 2 秒然后按 #,您需要:
<Response>
<Play digits="wwww#"/>
<Hangup/>
</Response>