首页 > 解决方案 > 如何在 twilio 中添加分机号码单击以使用节点 js 进行呼叫

问题描述

根据此处的文档此处的 github 源代码,我已经克隆了该应用程序,它运行良好。

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

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

请有人帮忙。

标签: node.jstwiliotwilio-click-to-calltwilio-programmable-voice

解决方案


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

一旦用户拿起,他们将在此功能中通过 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();
  }

在此功能中,您将能够按照此处所述发送数字。


推荐阅读