javascript - When making a call from the browser, how can I tell programmatically when the call has been answered? -
i'm writing web client flask, , integrating twilio allow me create phone calls browser. , good, it's working, have status info want update when phone call answered.
the connection.status() method doesn't seem help, since "open" seems mean phone call attempting go through, , status stays open until "closed" when phone call ends.
is there way (either through browser or registering callback python code on server) status update when phone call transitions "ringing" "live" ?
for outbound calls
the twilio.js library states:
twilio.device main entry point creating outbound connections, accepting incoming connections, , setting connection event handlers. within device documentation, goes on state .status() method:
returns status of device. the key here in code snippet:
twilio.device.incoming(function(conn) { console.log(conn.parameters.from); conn.status // => "pending" conn.accept(); conn.status // => "connecting" }); now key here remember device.incoming used when outbound phone call has been made browser specified here:
the device.incoming handler function called when incoming event fired. triggered whenever incoming connection outbound rest phone call or twiml <dial> device made. with above code snippet, able check
conn.status to "connecting" when connection transitioning open status , "open" 1 time phone call picked outgoing call. result able set flag , log 1 time outbound phone call picked up. twiml used:
<response> <dial callerid="+1888xxxxxxx"> {{insert phone number here}} </dial> </response> here documentation device specifications , general twilio.js library:
http://www.twilio.com/docs/client/device
and
http://www.twilio.com/docs/client/twilio-js
please allow me know if have other questions!
thank time,
javascript python twilio
No comments:
Post a Comment