I cannot find a way to send a no-answer outbound call to go straight to mailbox.
I tried to use AMD to handle the flow of call but it did not work for me. If a call is declined, I get a voicemail on an answering machine. If I let the phone ring and let the call go unanswered, I do not get a voicemail on my device.
Twilio.TwilioClient.Init(username, password);
CallResource call = CallResource.Create(+1xxxxxxxxx, +1xxxxxxxxx,
twiml: <Response> <Say> Enjoy! </Say> </Response>", //detail of voice
timeout: 60,
statusCallback: new Uri(https://test.com/api/Callback),
statusCallbackMethod: Twilio.Http.HttpMethod.Post,
statusCallbackEvent: ["initiated", "ringing", "answered", "completed"],
machineDetection: "DetectMessageEnd"
);
When you specify the
twimlparameter, the TwiML instructions will be executed immediately, while the AMD process is still trying to detect whether a human is answering or an answering machine. You should specify theurlparameter pointing to a webhook handler that reads theAnsweredByparameter and if it ismachine_end_beep, respond with the TwiML you'd like.Here's an example. The code below creates the call using the
urlparameter which Twilio will call once AMD determines who is answering the call.The webhook handler looks like this:
AnsweredBycan also be other values than the two cases above, as shown in the AMD docs. The ASP.NET Core app is using the Twilio helper library for ASP.NET Core to handle the webhook.