【发布时间】:2020-09-08 06:30:59
【问题描述】:
这是代码,我希望 twilio 从一个发布路由的路由中读取,但它不会从那里读取 xlm,我想从用户那里获取数字,并在通话期间根据该输入然后我想要流程根据该输入工作。
.create({
method: 'POST',
url: 'https://stormy-everglades-64562.herokuapp.com/voice',
to: '+923047931504',
from: '+17207344485'
})
.then(call => console.log(call.sid));
app.post('/voice', (request, response) => {
// Create TwiML response
const twiml = new VoiceResponse();
twiml.gather(
{
numDigits: 1,
action: '/gather',
},
gatherNode => {
gatherNode.say('For sales, press 1. For support, press 2.');
}
);
// If the user doesn't enter input, loop
twiml.redirect('/voice');
// Render the response as XML in reply to the webhook request
response.type('text/xml');
response.send(twiml.toString());
});```
【问题讨论】:
标签: javascript twilio twilio-twiml