如何使用node.js在twilio点击调用中添加扩展号



根据此处的文档&github的源代码在这里,我已经克隆了应用程序,它工作得很好。

假设我的销售人员有一些扩展,那么我如何在这个脚本中进行扩展。通常,使用senddigit,我可以在twilio中传递扩展,但我不知道如何用这个salesNumber实现它。

twilioClient.createCall(salesNumber, phoneNumber, headersHost)
.then((result) => {
response.send({message: result});
})
.catch((error) => {
response.status(500).send(error);
});

请有人帮忙。

我认为您在这里看到了错误的代码片段。上面的代码没有直接调用Twilio客户端。相反,它从这个文件中调用helper函数来启动调用。

一旦用户拿起,他们将通过TwiML连接到该功能中的销售人员:

voiceResponse: (salesNumber, Voice = VoiceResponse) => {
let twimlResponse = new Voice();
twimlResponse.say('Thanks for contacting our sales department. Our ' +
'next available representative will take your call. ',
{ voice: 'alice' });
twimlResponse.dial(salesNumber);
return twimlResponse.toString();
}

在这个功能中,您将能够按照这里提到的发送数字。

最新更新