【问题标题】:Pass Function Parameters From Voice IVR从语音 IVR 传递功能参数
【发布时间】:2020-10-08 06:23:49
【问题描述】:

我对 Twilio 非常陌生,但到目前为止,我已经在工作室中构建了安静的小部件网络,我喜欢这个系统的设计。到目前为止,我唯一的问题是能够获取用户输入并将其传递给函数。

在我的 Voice IVR - Twilio Studio 上,我有一个 Gather Input On Call 小部件,它要求呼叫者输入代码。从那里,用户按下的键结果转到运行功能小部件。

我的运行函数属性设置为正确的函数 URL,函数参数设置为

KEY: passedIDVALUE: {{widgets.security.Digits}}

security 是 Gather Input On Call 小部件的正确名称。从那里,我的函数中有以下代码。

exports.handler = function(context, event, callback) {
    
    // get passed IDs
    let passedID1 = context.passedID;
    
    // default to wrong ID entered
        callback(null, "0");

    // approved IDs
    var emps = ["99999"];

    // check if ID matches list
    var emps1 = emps.includes(passedID1);

    // good id found
    if (emps1 === true){
        callback(null, "1");
    }
    
};

在我的一生中,我无法弄清楚为什么没有将输入传递给函数。


据我所知,一切运行良好,只是没有获得关键参数....我将脚本更改为这个

exports.handler = function(context, event, callback) {
    
var passedID1 = context.passedID;

var emps = [41079, 99999];

function CheckID() {
    var IDstatus = emps.includes(passedID1);
  if (IDstatus === true){
    IDstatus = 1;
  }else{
    IDstatus = 0;
  }
    return IDstatus;
}

callback(null, CheckID());
    
};

如果将context.passedID 更改为99999,则流程将完美运行。

【问题讨论】:

    标签: twilio twilio-api twilio-php twilio-twiml twilio-click-to-call


    【解决方案1】:

    您想从event 对象而不是context 对象中获取值。

    var passedID1 = event.passedID;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-21
      • 2018-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多