0
votes

I've been working on a call system with Twilio. Here is how it works:

1.) When someone calls it plays an IVR and they send a response and it redirects them

2.) We then play ringing to them and forward it to a cell phone using DialCallStatus. We use this because we don't want them to hit the voicemail on the cell phone. So, if no one answers the call they hit the twilio voicemail and not the cell phone voicemail. If an operator answers they hear a "press any key to accept the call" they press a key so twilio knows that someone answered the call.

3.) the issue I am having is when I want to display the "missed call" it's not working. I see the call statuses and I tried using the "missed one" but it seems like almost every call is being marked as "completed". Essentially, I want to be able to pinpoint the calls that were not picked up by an actual operator. So, even if they don't leave a voicemail we can call them back.

Sorry for the lengthy question but if you have any idea how to do this it would be much appreciated.

1

1 Answers

0
votes

Specific to the, "press any key to accept the call". Are you using the Number noun url parameter with your Dial verb and using a Gather verb returned with the Number URL to collect this positive input? You will receive a Digits parameter if the dialed party presses any key. The Redirect (see below) is the fall through that hits if no digit is pressed (but the call is answered before the dial timeout). I set the value of Digits equal to timeout if no key was entered.

Look at the Twilio Function code below for an example. In my testing, the Dial action URL does correctly show no-answer if the dialed party answers but does not press a digit before the gather DTMF entry timeout.

Initial Dial Number Code:

exports.handler = function(context, event, callback) {
    let twiml = new Twilio.twiml.VoiceResponse();
    twiml.dial({action: "https://x.x.x.x/dialAction"})
    .number({url: "https://x.x.x.x/gatherWhisp"}, "+15555551212");
    callback(null, twiml);
};

Code than runs when Dialed party answers the call:

exports.handler = function(context, event, callback) {
    let twiml = new Twilio.twiml.VoiceResponse();
    let digits = event.Digits || null;
    if (digits === "timeout") {
        // The dialed party never pressed a digit to accept call
        // The DialCallStatus returned in the Dial action URL should say no-answer
        twiml.hangup();
        callback(null, twiml);
    } else if (digits) {
        twiml.say("You pressed a digit");
        callback(null, twiml);
    } else {
    twiml.gather({numDigits: "1", finishOnKey: ""})
    .say("Please press a digit to accept the call");
    twiml.redirect("https://x.x.x.x/gatherWhisp?Digits=timeout");
    callback(null, twiml);
    }
};