7

My Twilio Client js application allows agents to call each other within the browser. The call is working and after accepting the call both agents can then end the call via Twilio.Device.disconnectAll(). This fires the disconnect callback on both sides allowing updates to the UI.

Cancelling the call from the caller side correctly raises the cancelled event on the dialled side again allowing UI updates.

However I am having trouble updating the UI on the caller side if the dialled agent does not wish to take the call. I have tried the Device.disconnectAll() and the Connection.reject(), ignore() and disconnect() methods but it raises no events/callback on either side and the call continues to ring.

I presume I am missing a step somewhere. Any advice would be much appreciated.

michaelbinks
  • 270
  • 1
  • 14
  • Are you calling `reject()` on the `connection` object passed to the [incoming event handler](https://www.twilio.com/docs/client/device#incoming)? – beerdev Sep 29 '15 at 14:34
  • Yes that is correct. During the `Twilio.Device.incoming` callback the `connection` is persisted to a js variable. Once the user clicks the reject/ignore button, we call `conn.reject()`. – michaelbinks Sep 29 '15 at 15:02
  • that should work, want to post some code? Also, may want to make sure the user is not receiving multiple phone calls (IE the `incoming` event handler should only be hit once) – beerdev Sep 29 '15 at 15:22
  • 2
    I have managed to get it working. When the call is placed we return `` TwiML to Twilio. We now include a callback url in the `` attribute. When the callback fires `DialCallStatus = 'busy'` and we force the caller to hangup with `` TwimL verb, causing the caller to disconnect and their UI to update. I can manually update the dialled UI on the reject click. – michaelbinks Sep 30 '15 at 11:35

0 Answers0