0

To set this up, here is the use case:

  • IVR system calls someone and reads a long-ish twiml prompt at them (about 251 characters)
  • at the end of the prompt gather user input
  • if a non-human answers the phone, I'm using asyncAMD callback to get the result of AMD and then leave a voice message

I am currently placing an outbound call using this code:

var call = CallResource.Create(
    machineDetection: "DetectMessageEnd",   
    asyncAmd: "true",
    asyncAmdStatusCallback: new Uri("[URI to callback]"),
    asyncAmdStatusCallbackMethod: HttpMethod.Post,      
    twiml: new Twilio.Types.Twiml("<Response><Say>[MyMessage]</Say></Response>"),       
    from: new Twilio.Types.PhoneNumber(configuration["fromPhoneNumber"]),
    to: new Twilio.Types.PhoneNumber(configuration["toPhoneNumber"])
);

where "MyMessage" is about 251 characters long.

The answering machine bit works wonderfully, and I'm able to leave a voice message in case a non-human answers (see my question and subsequent answer for How to leave a voicemail using Twilio AMD? for details).

However, I cannot for the life of me figure out how to prolong the asyncAMD callback long enough for the initial prompt to be finished in the case a human answers.

I've tried adding all of these optional API tuning parameters, and I still can't get it to work:

machineDetectionTimeout: 59,
machineDetectionSpeechThreshold: 6000,
machineDetectionSpeechEndThreshold: 5000,
machineDetectionSilenceTimeout: 10000,

What are my options here? Bail on asyncAMD and use blocking AMD? I need to be able to leave a voice message in case of a non-human answering, but I need to push the results of the asyncAMD invoking it's callback long enough for the initial response to be read in a human answers.

Michael McCarthy
  • 1,502
  • 3
  • 18
  • 45
  • If the async AMD calls back and says it's a human then you can keep playing the message by not doing anything to the call. It will just continue through the TwiML you sent it in the first place. Is there something else you are doing here? – philnash Nov 11 '21 at 03:14
  • I'm going to take this approach. In the recipient answers and says "hello" (which is likely they'll say it), answeredBy will return "human", but if they don't and just listen to the initial prompt, I get "unknown" back. At this point, I'm going to treat an answeredBy "unknown" as a person answering and listening to the initial Twiml prompt. – Michael McCarthy Nov 12 '21 at 14:57

1 Answers1

0

I'm going to take this approach. In the recipient answers and says "hello" (which is likely they'll say it), answeredBy will return "human", but if they don't and just listen to the initial prompt, I get "unknown" back. At this point, I'm going to treat an answeredBy "unknown" as a person answering and listening to the initial Twiml prompt.

Michael McCarthy
  • 1,502
  • 3
  • 18
  • 45