【问题标题】:How can I get the caller from an incoming phone call webhook request?如何从来电 webhook 请求中获取呼叫者?
【发布时间】:2017-12-28 08:43:05
【问题描述】:

我要为 Twilio 中的来电开发一个 webhook:

app.post('/voice', (req, res) => {
  const twiml = new VoiceResponse();
  const caller = ...;
  twiml.say('hello, your number is ' + caller);
  res.type('text/xml');
  res.send(twiml.toString());
});

如何从请求 (req) 中获取来电者电话号码?我不需要名字,只需要号码。

我在文档中找不到调用 webhook 时 POST 正文中发送的内容。

【问题讨论】:

    标签: node.js twilio twilio-api


    【解决方案1】:

    您要查找的caller phone number 位于req 对象中。

    我是req.body.From

    在你的例子中const caller = ...;

    变成const caller = req.body.From;


    文档:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多