Reputation: 4374
I'm using Twilio to connect my "users" with my on-call "staff", but I want to use masked calling as the staff are remote and I need to track how long the calls lasted, so don't want them having each others numbers.
This is all working perfectly using TwiML, but I have the issue that my staff may not answer a call, and the user will be sent to their answering machine. My server will then detect the call was longer than 0 seconds, and will charge the user even though they only got through to the answering machine... So the Answering Machine Detection sounds like what I need: https://www.twilio.com/docs/api/voice/answering-machine-detection
However this doesn't give any examples for use with TwiML. It would seem based off this question that it is not usable? (Using Answering machine detection on Twiml)
So is there any update since the linked answer? Or is it possible for me to do the masked calls without TwiML? Does the response.SetOption
method provide anything useful for this or will I have to live without Answering Machine Detection?
At present my code that generates the TwiML for the TwiML App is like this:
public static string TwiMLDial(string maskedNumber, string to, string callCompleteURL)
{
var response = new Twilio.TwiML.VoiceResponse();
var dial = new Twilio.TwiML.Voice.Dial(action: new Uri(callCompleteURL), callerId: maskedNumber);
dial.Number(to);
response.Gather();
response.Dial(dial);
return response.ToString();
}
Upvotes: 2
Views: 283
Reputation: 73100
Twilio developer evangelist here.
You're right, you can't use the Answering Machine detection from TwiML. As an alternative, what you could do is put the dialling user straight into a queue (using <Enqueue>
) and then dial your staff using the REST API and Answering machine detection. If the staff answer the call, connect them to the dialler by <Dial>
ling the <Queue>
.
Let me know if that helps at all.
Upvotes: 2