首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从twilio Gather获取数字

从twilio Gather获取数字
EN

Stack Overflow用户
提问于 2016-02-05 11:43:13
回答 1查看 691关注 0票数 0

我正在试着把号码输入到电话里。我认为在引脚函数中使用res.Digits是可行的,但我得到了一个未定义的错误

代码语言:javascript
复制
exports.Say = function(req, res)
{
    var resp = new twilio.TwimlResponse();

    resp.gather(
    {
        action:'http://pap-papdemo.rhcloud.com/api/Phone/Pin',
        finishOnKey:'#',
        method:"POST"
    }, function()
    {
        this.say('Please enter your Phone and Pin number followed by the hash key');
    });

    //Render the TwiML document using "toString"
    res.writeHead(200,
    {
          'Content-Type':'text/xml'
    });

    res.end(resp.toString());

};




     exports.Pin = function(req, res)
        {
            var resp = new twilio.TwimlResponse();
            console.log("***** PIN *****");


            console.log("Pin: Response " +  res.body.Digits);

            //Render the TwiML document using "toString"
            res.writeHead(200,
            {
                  'Content-Type':'text/xml'
            });

            res.end(resp.toString());

        };

是否知道我需要做什么,因为我需要在数据库中存储个人识别码

EN

回答 1

Stack Overflow用户

发布于 2016-03-02 05:04:07

来自Twilio的Megan。我看到你回答了你自己的问题,但我想我应该更新一下,作为其他登陆这里的人的答案。

除了标准的TwiML语音请求参数之外,它还可以请求“Twilio will pass Digits as a parameter”URL。

因此,var pin = JSON.stringify(req.body.Digits);在这种情况下工作。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35215925

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档