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:
Register a handler function for
presence
events withTwilio.Device.presence()
.When a
presence
event is received, add or remove that client from a list in the UI.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 Recipe1
folder under Code
.
How to do it…
We're going to display a list of clients who are connected to the same Twilio app, and then we will make a call to them by performing the following steps:
Download the Twilio Helper Library available at https://github...