This is node js script
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
<?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.
I m a fresher in Node JS, please help me out.
You can take a look at this tutorial. The
<Gather>
verb has an action URL which sends theDigits
(if using DTMF) orSpeechResult
(if using Speech Collection) to that URL for your code to determine the next steps.IVR: Phone Tree with Node.js and Express