Twilio呼叫断开连接

时间:2018-05-14 07:03:36

标签: node.js lambda twilio

我创建了两个Lambda函数。

Lambda函数优先:

module.exports.submit = (event, context, callback) => {

 const twiml = new VoiceResponse();

  /** using Twiml Gather record the message and generate callback */
   const gather = twiml.gather({
    input:'speech',
    finishOnKey:'',
    action:'url of second lambda function' 

  });
  twiml.say('We did not recived any inputs, Thanks for calling')

  callback(null, response.success(twiml.toString()));

};

Lambda函数第二

module.exports.submit = (event, context, callback) => {

  const twiml = new textReponse();
  console.log(querystring.parse(event.body));

  twiml.say(`Hello,kshitiz how may i help you`);

  callback(null, response.success(twiml.toString()));

};

我面临的问题是呼叫断开。因此,当用户呼叫我的Twilio号码时,我可以使用twiml -<gather>-<speech>并调用第二个Lambda函数,第二个Lambda函数可以接收“speechresult”。当Lambda第二次返回结果时,我能够在移动设备中收听,但在此之后呼叫很快就会断开。我希望我的呼叫继续,并且仅在用户断开连接时断开连接。 我尝试了不同的解决方案,但无法使其正常工作,似乎我错过了一些东西。

1 个答案:

答案 0 :(得分:0)

好的,对Twiml有了更多了解。我已经解决了这个问题。解决方案是使用Twilio redirect features

希望它有助于其他

相关问题