Please excuse our look. We're just getting started here.

Want to learn more about Twilio Forums? Check out our FAQ page here.

How to answer incoming phone calls with Javascript SDK and Node.js

Hello fellow coders,

I have managed to create an outgoing phone system just fine with the Javascript SDK and Node.js on the backend. However, I'm failing to see how I would be able to have an incoming phone call come in and respond to that call in the browser.

I have found the following definition of the incoming event from the device here: https://www.twilio.com/docs/voice/sdks/javascript/twiliodevice#incoming-event and implemented into my application on the client (javascript SDK) side.

I currently have an HTTP Post webhook that is setup and it is in fact triggered when you make an outbound call as well as make an inbound call to the same number (outlined below). I'm just seeming to be missing how you manage to make the connection back to the browser.


I appreciate any advice or guidance that may be provided.

Best Answer

Answers

  • Hey @bdelvalle, thank you so much for the answer! I feel it led me in the right direction. However, when you create an inbound call now it rings once and then hangs up. The Twilio console, server logs, or browser console display any errors.

    I can see the call was processed from Twilio Dashboard call logs and the call was sent to the client with the same identity identifier I provided when generating the token.

    Below, you will find a screenshot of my front end code.


  • I'm ashamed. device.register();. That's all I was missing. Just that. Sigh, so much time wasted. Thank you @bdelvalle for the help.

If this is an emergency, please contact Twilio Support. This is not an official Support channel. https://support.twilio.com/
Have an urgent question?
Please contact Twilio Support. This is not an official Support channel.
Contact Support