简体   繁体   English

如何从 twilio twiml 语音中获取 output<gather></gather>

[英]How to get the output from twilio twiml voice <gather>

This is node js script这是节点 js 脚本

const accountSid = 'xxxxxxxxxxxxxxxxxx';
const authToken = 'xxxxxxxxxxxxxxxxxx';
const client = require('twilio')(accountSid, authToken);
client.calls
      .create({
         method: 'GET',
         record: true,
         url: 'https://2f3b18f01640.ngrok.io/voice/callUHC.xml',
         to: '+1xxxxxxxxxxxxx',
         from: '+1xxxxxxxxxxxxx'
       })
      .then(call => console.log(call.sid));

This is TwiML这是 TwiML

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>Calling Established...</Say>
<Pause length="30"/>
<Say>Claim Status</Say>
<Pause length="10"/>
<Gather input="speech"></Gather>
</Response>

Now how can I get the gather input and depends on the input, it will say the respective words.现在我如何获得收集输入并取决于输入,它会说出相应的单词。 Suppose the if the gather input is "Medical" then it will say the Medical Id or if the gather input is "Dental" then it will say the Dental Id number.假设如果收集输入是“医疗”,那么它会说医疗 ID,或者如果收集输入是“牙科”,那么它会说牙科 ID 号。

I ma fresher in Node JS, please help me out.我是 Node JS 的新手,请帮帮我。

You can take a look at this tutorial.你可以看看这个教程。 The <Gather> verb has an action URL which sends the Digits (if using DTMF) or SpeechResult (if using Speech Collection) to that URL for your code to determine the next steps. <Gather>动词有一个动作 URL 将Digits (如果使用 DTMF)或SpeechResult (如果使用语音收集)发送到 URL 以便您的代码确定下一步。

IVR: Phone Tree with Node.js and Express IVR:带有 Node.js 和 Express 的电话树

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM