I am using twilio amd with outbound call. Basically creating a call using callresource to one number. Now i want human detection during the call. Call is picked by human then i need to forward call to my system agent. So for this i am trying to get "AnswerBy" value in "answered" status call back, but "Answerby" is always null. Can you someone let me know how to get the "Answerby" during call in progress and then forward Call. Below is code sample i am using..
Creating Outbound call
string accountSid = WebConfigurationManager.AppSettings["AccountSid"];
string authToken = WebConfigurationManager.AppSettings["AuthToken"];
TwilioClient.Init(accountSid, authToken);
var statusCallbackEvent = new List<string>();
statusCallbackEvent.Add("initiated");
statusCallbackEvent.Add("answered");
var call = CallResource.Create(
url: new Uri("http://demo.twilio.com/docs/voice.xml"),
to: new Twilio.Types.PhoneNumber("+1XXXXXXXXXXXXX"),
from: new Twilio.Types.PhoneNumber(WebConfigurationManager.AppSettings["FromNumber"]),
method: Twilio.Http.HttpMethod.Get,
machineDetection: "Enable",
statusCallbackEvent: statusCallbackEvent,
statusCallback: new Uri("https://68456c0d.ngrok.io/TwilioCallback/CallResponse"),
statusCallbackMethod: Twilio.Http.HttpMethod.Get
);
var response = call.Sid;
Answered status callback
string accountSid = WebConfigurationManager.AppSettings["AccountSid"];
string authToken = WebConfigurationManager.AppSettings["AuthToken"]; ;
TwilioClient.Init(accountSid, authToken);
var response = new VoiceResponse();
var call = CallResource.Fetch(pathSid: obj.CallSid);
if (call.AnsweredBy?.ToLower() == "human")
{
//TO- DO
}
else
{
response.Say("hello world!", voice: "alice");
response.Play(new Uri("http://demo.twilio.com/docs/classic.mp3"));
}