Twilio Studio>功能>语音邮件问题

时间:2018-08-14 15:39:25

标签: twilio

我们当前正在使用Twilio Studio接受来电。然后,这些调用会转到https://github.com/philnash/useful-twilio-functions/tree/master/hunt的修改版本的函数中,该函数尝试使用耳语(Studio本身不支持)到达手机上的代理。这是主要功能:

exports.handler = function(context, event, callback) {
  const numbers = context.AGENT1_NUMBERS.split(',').map(number => number.trim());
  const response = new Twilio.twiml.VoiceResponse();
  if (event.DialCallStatus === 'complete') {
    // Call was answered and completed
    response.hangup();
  } else if (event.finished === 'true') {
    if (context.AGENT1_FINAL_URL) {
      response.redirect(context.AGENT1_FINAL_URL);
    } else {
      response.hangup();
    }
  } else {
    const numberToDial = event.nextNumber ? event.nextNumber : numbers[0];
    const currentNumberIndex = numbers.indexOf(numberToDial);
    let url;
    if (currentNumberIndex + 1 === numbers.length) {
      // No more numbers to call after this.
      url = 'https://redacted.twil.io/agent1?finished=true';
    } else {
      const nextNumber = numbers[currentNumberIndex + 1];
      url = 'https://redacted.twil.io/agent1?nextNumber=' + encodeURIComponent(nextNumber);
    }
    const dial = response.dial({ action: url });
    dial.number({ url: 'https://URL_TO_WHISPER_TWIML' }, numberToDial);
  }
  callback(null, response);
};

这是窃窃私语的TwiML Bin。

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Gather action="URL_TO_FUNCTION" numDigits="1">
   <Say>You are receiving a call, please dial 1 to accept or anything else to reject</Say>
  </Gather>
</Response>

这是连接呼叫的下一个功能。

exports.handler = function(context, event, callback) {
  const response = new Twilio.twiml.VoiceResponse();
  if (event.Digits === '1') {
    response.say('Connecting');
  } else {
    response.hangup();
  }
  callback(null, response);
}

现在,这里的问题是AGENT1_FINAL_URL指向处理语音邮件的TwiML bin。如果呼叫被座席应答并在不按1的情况下断开连接,则此过程会很好地进行。将呼叫者发送到Twilio语音邮件。但是,如果座席只是错过了呼叫或拒绝了呼叫,则呼叫会继续在呼叫者的一端响铃,直到我怀疑它超时为止,此后无论如何呼叫者都已连接并且会听到座席个人语音邮件的截断版本。在他们的手机上。知道为什么会这样吗?

0 个答案:

没有答案