O'Reilly logo

Twilio Cookbook Second Edition by Roger Stringer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Displaying availability

Great, now you're able to make calls from one browser to another. Your application is starting to look pretty sweet. There's only one thing still missing though. How will you figure out who is available to receive an incoming call? Furthermore, how will you keep this list updated as clients connect and disconnect?

Getting Started

We can show a list of people who are available to be called in a few easy steps as follows:

  1. Register a handler function for presence events with Twilio.Device.presence().
  2. When a presence event is received, add or remove that client from a list in the UI.
  3. When the client name is clicked in the list, invoke the previously written call() function.

The complete code for this recipe can be found in the

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required