Features / Calls / Events



Two ways of subscription are available to you:

  • RX Observables
  • Window Listeners

RX Observables


RxJS is a library for reactive programming using Observables, to make it easier to compose asynchronous or callback-based code. This project is a rewrite of Reactive-Extensions/RxJS with better performance, better modularity, better debuggable call stacks, while staying mostly backwards compatible, with some breaking changes that reduce the API surface.

You can subscribe to callEvents$ observable of type CallEvent.

  window.ZIWO.calls.callEvents$.subscribe(
    event => ...
  );

This way you can use all RX operators.

  window.ZIWO.calls.callEvents$.pipe(
    filter(event => event.type === 'active'),
    tap(() => console.log('Got an active event'))
  ).subscribe(
    event => {
      ...
    }
  )


Window Listeners


All window events for calls have the ziwo-call- prefix. Then you can listen to all events or a specific one like active. The event will be of type CustomEvent of CallEvent.

  // All events
  window.addEventListener('ziwo-call-all', (e) => console.log('Triggered by any call event', e.detail));

  // Active events
  window.addEventListener('ziwo-call-active', (e) => console.log('Triggered by an active call event', e.detail));

List of events

Name Scope Description
ready
ringing Inbound Incoming call ringing
requesting Outbound Requesting an outgoing call
trying Outbound Trying to reach the outgoing call did
early Outbound Connection established with outgoing call did
attach Inbound / Outbound [Call recovering] Event sent by the server after authentication to let us know we have a call to recover
answering Inbound / Outbound Answering the call
active Inbound / Outbound Call is active - participants are connected
recovering Inbound / Outbound [Call recovering] Call is recovering
hangup Inbound / Outbound Call has been hangup
destroy Outbound Call has been destroyed - Favor using hangup when possible
consent-in Outbound Call sent to consent workflow
consent-back Outbound Call back from consent workflow
mute Inbound / Outbound Call muted
unmute Inbound / Outbound Call unmuted
held Inbound / Outbound Call held
unheld Inbound / Outbound Call unheld


For more technical details you can read the Calls Manager documentation.



results matching ""

    No results matching ""