【发布时间】:2021-01-19 18:26:01
【问题描述】:
大家好,我正在为我的 twilio 号码实施一个新的呼叫转发 ivr 系统,但我的一个功能出现问题,我希望你们能以某种方式提供帮助。
所以我试图记录我收到的所有电话,除此之外还有一个语音邮件选项。这是我的进展情况。
在 twiml 上,我创建了一个操作以在超时后转到重定向到语音邮件,比我使用recordingStatusCallback 来记录不转到语音邮件的呼叫并且两者都可以正常工作,但是当我收到来自我在recordingStatusCallback 上执行的函数的记录时电子邮件没有显示 callFrom 和 Callto(返回未定义),我进行了研究并发现 thar recordingStatusCallback 参数结果没有 callFrom 和 callTo 参数。我想知道是否有一种方法可以在我接到电话时临时存储该结果,以便我在电子邮件中保存或从其他功能获取结果。请参阅下面的部分代码。 这是 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);
});
【问题讨论】:
标签: javascript node.js twilio twilio-api twilio-twiml