I am using Twilio JS SDKs in my Angular application to call my customers. I have a requirement to show the status of the call on the UI(Ringing/Inprogress/completed). For that I have seen some documents to use StatusCallBack web hooks, but how will I be notified in the UI if the web hook gets executed and return the TwiML. Please suggest if any alternatives.
This is my Angular code:
this.device.connect(function (connection) {
connection.on('warning', function (warningName, warningData) {
// alert(warningName);
if (warningName == "low-bytes-received" || warningName == "low-bytes-sent") {
myscope.NetworkIssue();
}
});
connection.on('ringing', function (param1) {
// alert(warningName);
debugger;
});
connection.on('accept', function (param2) {
// alert(warningName);
debugger;
});
});
This is my TWI ML App code:
var response = new VoiceResponse();
var dial = new Dial(callerId: twilioNumber);
if (phoneNumber != null)
{
dial.Number(phoneNumber);
dial.AnswerOnBridge = true;
}
response.Append(dial);
return Content(response.ToString(), "application/xml");