Twilio javascript client callback when answering a call

I am using the Twilio JavaScript client. I can make calls, capture callback events, connect and disconnect. How do I implement a callback when a call is answered? I need to show the call timer after answering the call.

+3


source to share


1 answer


Twilio js client has a Device property which has the following methods that you can use.



Twilio.Device.incoming(softPhoneIncoming);
Twilio.Device.connect(softPhoneConnect);

function softPhoneIncoming(conn) {
        console.log(conn.parameters.From); // who is calling
        conn.accept(); //This will accept the incoming phone call
    }

function softPhoneConnect(conn)
    {
        // Called for all new connections, you could start the timer here
    }

      

+1


source







All Articles