I have encountered a small problem using Twilio with C#. Basically, I'm having trouble controlling the call after the .Dial method is called.
Considering I have the following piece of code:
TwilioResponse _twiml = new TwilioResponse();
_twiml.Dial(RedirectPhoneNumner, new { action = Url.Action("BusyCallAction"), timeout = 5 });`
The following is being rendered in my application:
<Response>
<Dial action="/Home/BusyCallAction" timeout="5">*RedirectPhoneNumber*</Dial>
</Response>
For testing purposes, I've added a timeout of 5 seconds. After the timeout has passed, the call ends, instead of redirecting the user to the following controller:
[HttpPost]
public ActionResult BusyCallAction(string dialCallStatus)
{
if (dialCallStatus == "busy")
{
_twiml.Say(dialCallStatus);
//more code here
}
return TwiML(_twiml);
}
Note: The method has the HttpPost data annotation because the default method attribute in the dial method is set to POST.
I need to know whether the call was answered, or if it was busy.