Incoming Calls

Listen for incoming calls on a connected browser device with the incoming event, and decline them with hangup(). What the current SDK version supports.

2 min read

A connected Edesy browser device emits an incoming event when a call is sent to it, and passes a Call object to your handler. In the current SDK version (0.1.0) you can watch that call's events and decline it with call.hangup(). The SDK is built for outbound calling first, so check the notes below before you plan an inbound flow around it.

Facts#

Item Value
Event device.on("incoming", (call) => { ... })
Object passed A Call, the same type device.call() returns
Decline call.hangup()
Call events available ringing, answered, ended, failed, mute, hold, dtmf
Answer method Not part of the public SDK in version 0.1.0

Listen and decline#

const device = await EdesyVoice.connect("/edesy-token");

device.on("incoming", (call) => {
  console.log("incoming call");
  call.on("ended", () => console.log("incoming call ended"));

  // Decline, for example while the user is busy on another call
  call.hangup();
});

The portal softphone at webrtc.edesy.in does the same: it declines inbound calls because it is an outbound dialer.

How it works#

  1. Register. connect() registers the device under the identity you used for the token.
  2. Receive. A call sent to that registration fires incoming with a Call object.
  3. Decide. Track or decline the call with call.hangup().

Need inbound calls to agents?#

If your team needs to answer calls in the browser with queues, routing and transfers, use the Cloud Contact Center agent desktop. If you need inbound answering in your own app through this SDK, tell us on the contact page.

FAQ#

Can I answer an incoming call with the SDK today?#

Not through the public API in version 0.1.0. The Call object exposes hangup(), toggleMute(), toggleHold() and sendDigit(), but no answer method.

Why would I handle incoming at all?#

To decline calls that arrive at a device used only for outbound calling, so they do not stay unanswered.

Does incoming fire for my own outbound calls?#

No. Outbound calls come from device.call(). incoming fires only for calls sent to the device.

Which identity receives an incoming call?#

The device registered with the token minted for that identity.

Can a browser agent receive queued customer calls?#

Yes, in the Cloud Contact Center agent desktop, which is a separate browser softphone with answer, reject, transfers and dispositions.

Will the drop-in dialer ring for incoming calls?#

No. The drop-in dialer is an outbound keypad only.

Was this page helpful?