如何使用 Twilio 函数将呼叫转接至带分机号的 phone 号码?
How to use a Twilio function to transfer a call to a phone number with an extension?
我正在尝试使用 Twilio 函数将呼叫转接至带分机号的 phone 号码。
从 Twilio 流调用 Twilio 函数。
现在,呼叫转移到 phone 号码。但是,永远不会调用扩展。
我在 "sendDigits" 中添加了一些 "w" 个暂停字符...但它并没有改变任何东西。
Here is my Twilio flow
Here is my Twilio function widget with the parameter
这里是twilio函数的代码
exports.handler = function(context, event, callback) {
// set-up the variables that this Function will use to forward a phone call using TwiML
// REQUIRED - you must set this
let phoneNumber = event.PhoneNumber || "NUMBER TO FORWARD TO";
// OPTIONAL
let callerId = event.CallerId || null;
// OPTIONAL
let timeout = event.Timeout || null;
// OPTIONAL
let allowedCallers = event.allowedCallers || [];
// generate the TwiML to tell Twilio how to forward this call
let twiml = new Twilio.twiml.VoiceResponse();
let allowedThrough = true;
if (allowedCallers.length > 0) {
if (allowedCallers.indexOf(event.From) === -1) {
allowedThrough = false;
}
}
let sendDigits = event.sendDigits;
let dialParams = {};
dialParams.sendDigits = sendDigits
if (callerId) {
dialParams.callerId = callerId;
}
if (timeout) {
dialParams.timeout = timeout;
}
if (allowedThrough) {
twiml.dial(dialParams, phoneNumber);
}
else {
twiml.say('Sorry, you are calling from a restricted number. Good bye.');
}
// return the TwiML
callback(null, twiml);
};
有什么想法吗?
Dial 动词没有 sendDigits 属性,但 REST API 有。
你可以使用带有拨号动词https://www.twilio.com/docs/voice/twiml/number, and its associated URL parameter to reference a TwiML Bin with a Play, https://www.twilio.com/docs/voice/twiml/play的Number名词及其数字属性,在被叫方应答phone之后,但在双方通话之前播放DTMF彼此。
我正在尝试使用 Twilio 函数将呼叫转接至带分机号的 phone 号码。
从 Twilio 流调用 Twilio 函数。
现在,呼叫转移到 phone 号码。但是,永远不会调用扩展。
我在 "sendDigits" 中添加了一些 "w" 个暂停字符...但它并没有改变任何东西。
Here is my Twilio flow
Here is my Twilio function widget with the parameter
这里是twilio函数的代码
exports.handler = function(context, event, callback) {
// set-up the variables that this Function will use to forward a phone call using TwiML
// REQUIRED - you must set this
let phoneNumber = event.PhoneNumber || "NUMBER TO FORWARD TO";
// OPTIONAL
let callerId = event.CallerId || null;
// OPTIONAL
let timeout = event.Timeout || null;
// OPTIONAL
let allowedCallers = event.allowedCallers || [];
// generate the TwiML to tell Twilio how to forward this call
let twiml = new Twilio.twiml.VoiceResponse();
let allowedThrough = true;
if (allowedCallers.length > 0) {
if (allowedCallers.indexOf(event.From) === -1) {
allowedThrough = false;
}
}
let sendDigits = event.sendDigits;
let dialParams = {};
dialParams.sendDigits = sendDigits
if (callerId) {
dialParams.callerId = callerId;
}
if (timeout) {
dialParams.timeout = timeout;
}
if (allowedThrough) {
twiml.dial(dialParams, phoneNumber);
}
else {
twiml.say('Sorry, you are calling from a restricted number. Good bye.');
}
// return the TwiML
callback(null, twiml);
};
有什么想法吗?
Dial 动词没有 sendDigits 属性,但 REST API 有。
你可以使用带有拨号动词https://www.twilio.com/docs/voice/twiml/number, and its associated URL parameter to reference a TwiML Bin with a Play, https://www.twilio.com/docs/voice/twiml/play的Number名词及其数字属性,在被叫方应答phone之后,但在双方通话之前播放DTMF彼此。