twilio-client.js
twilio-client.js copied to clipboard
Receiving a status call back for when call is answered
Is your feature request related to a problem? Please describe.
I have been trying to add a call record feature to my application using JS. In doing so I received an error:
You attempted a real-time operation on a Call that was not in-progress. Calls that have completed cannot be recorded or redirected.
I understand this is because I am initiating call record before the call is being answered. I have been trying to initiate call record when an out going call is answered , but I don't seen to find any callback for when a call gets answered.
Describe the solution you'd like
I have been using Twilio.Connection
for this application. Provision to use the status in event reference of a connection when the call has been answered would be helpful.
.on('answered', handler())
Describe alternatives you've considered I tried updating the call status via back end, but this did't help me with my problem.
const call = await client.calls(req.body.CallSid).update({
statusCallback:
"https://test.com/api/twilio/webhook/status",
statusCallbackEvent: ["initiated","ringing","answered"],
statusCallbackMethod: "POST",
});
Hi @Shreets, have you tried using our answerOnBridge setting in your TwiML app? This setting separates ringing from answered and I believe should give you the specificity you're looking for. If you're using 1.x, you will also need to set enableRingingState: true
in your Device settings to utilize answerOnBridge.