[英]Twilio recording and voicemail function
大家好,我正在为我的 twilio 号码实施新的呼叫转发 ivr 系统,但我的 function 号码出现问题,我希望你们能以某种方式提供帮助。
所以我试图记录我收到的所有电话,除此之外还有一个语音邮件选项。 这就是我要去的地方。
On twiml i crate an action to go to reddirect to voicemail after time out, Than i use recordingStatusCallback to record the call tha dont go to voicemail and both work perfectly but when i receive the record from the function that i execute on recordingStatusCallback the email doesnt显示 callFrom 和 Callto(返回未定义),我进行了研究并发现 thar recordingStatusCallback 参数结果没有 callFrom 和 callTo 参数。 我想知道是否有一种方法可以在我接到电话时临时存储该结果,所以我有我的 email 或从其他函数获取结果。 请参阅下面的部分代码。 这是 twiml dial 和 number 参数。
const dial = twiml.dial({
timeout: 20,
method: 'GET',
action: 'voicemail',
record: 'record-from-answer',
recordingStatusCallback: 'recording',
callerId: context.TWILIO_PHONE_NUMBER,
});
dial.number({url: 'whisper',}, context.MY_PHONE_NUMBER);
这是发送记录对话的 copu 的函数。
//Initialize SendGrid Mail Client
const sgMail = require('@sendgrid/mail');
// Define Handler function required for all Twilio Functions
exports.handler = function(context, event, callback) {
// Build SG mail request
sgMail.setApiKey(context.SENDGRID_API_SECRET);
// Define message params
const msg = {
to: context.TO_EMAIL_ADDRESS,
from: context.FROM_EMAIL_ADDRESS,
subject: 'New Call Received',
html: `Hi ${context.LEADGEN_NAME},<br>
<p><strong>This is a friendly notification that you received the follwing call:</strong></p>
<p><strong>Call From (Client): </strong></p>${event.Caller}<br>
<p><strong>Call to: </strong></p>${event.To}<br>
<p>You are receiving this email because you are subscribed to email alerts for ${context.LEADGEN_NAME} tracking numbers.</p>
<p>Thanks, </p>
<p><strong>Recorded link </strong></p>${event.RecordingUrl}<br>
<p><strong>Fuel Marketing Solutions </strong></p>`,
};
// Send message
sgMail.send(msg)
.then(response => {
console.log("Neat.")
callback();
})
.catch(err => {
console.log("Not neat.")
callback(err);
});
您可以通过在 recordingStatusCallback url 中添加参数来解决此问题。
let actionUrl = `https://${DOMAIN_NAME}/${URL_PATH}?callTo=${callTo}&callFrom=${callFrom}`;
const dial = twiml.dial({
timeout: 20,
method: 'GET',
action: 'voicemail',
record: 'record-from-answer',
recordingStatusCallback: actionUrl,
callerId: context.TWILIO_PHONE_NUMBER,
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.