Page tree
Skip to end of metadata
Go to start of metadata
This page describes how you can retrieve information in real time about the phone calls placed on the VoipNow infrastructure, without having to pool UnifiedAPI services.


The API Notifications is a REST service restricted to VoipNow apps installed on the user level. The service is not accessible to apps deployed on other account levels.

Once the connection to the service is established, the HTTP connection is upgraded to the WebSocket protocol.

Connect to service

In order to get notifications in real time, you must send a GET request to the following endpoint:

GET /hubgetsb/ws/<Query-Parameters> HTTP/1.1

The request headers must contain WebSocket and upgrade information:

Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: <generated>
Sec-WebSocket-Protocol: notification
Sec-WebSocket-Version: 13

For more information about Sec-WebSocket-Key, please refer to RFC 6455.


The <Query-Parameters> must contain the following:


SHA1 (AppId + AccessToken), where AppId and AccessToken are also used for OAuth authentication.

instanceIdStringYesA random string that identifies the connection context. If you want to open multiple WebSockets for the same app, use different instanceId.



Returns a standard response as shown below:

HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: 654c50002ca653b033e941a031e0336d
Sec-WebSocket-Protocol: notification

and upgrades the connection to WebSocket. Let the fun begin (smile)


HTTP CodeNotes
401 Not AuthorizedAuthentication could not be performed.

WebSocket messages

Message format

All messages received on the WebSocket have the following JSON format:

timestampNumberThe time when the message was sent on WebSocket, with microtimestamp precision.
classStringThe class is always an (functionality reserved for the future).
contentAPINotificationThe actual payload of the message.

The APINotification has the following format:


The ID of the app that generated the message.


There are two types of customers:

  • user - message is targeted to a user only
  • org - message is targeted to all users in an organization (broadcast)

The ID of the destination:

  • <UserID> - valid for toType=user only
  • <OrgID> - valid for toType=org only

The date when the message was generated, timestamp.

contextStringA context for the APINotification.
eventStringThe event in the context space.
nonceStringAn arbitrary string generated by the producer of the notification.
payloadJSON ObjectA JSON object that fully describes the API notification.

Phone call notifications

Notifications related to phone call events can be easily recognized because the APINotification that carries them has:

  • context=sys.phonecall
  • event=update

The Phone Call payload has the following format.

phoneCallIdObject-IdThe ID of the phoneCall.
phoneCallViewIdObject-IdThe ID of the vnode that was changed.
extensionJSON Object

The extension is always relative to the phoneCallView. The following properties are available:

  • extensionId
  • number
  • extendedNumber
  • DID (if incoming call, the DID called)

The status of the call leg:

  • created - the call leg is created
  • destroyed - the call leg is destroyed
  • updated - the call leg was updated (all other cases)

The status of the call recording:

  • on - the call is recorded
  • off - the call is no longer recorded
  • voicemail - the voicemail is running on this call leg
  • fax - the fax is running on this call leg
  • on - the call leg is placed on hold
  • off - the call leg is placed off hold
  • on - the call leg is in parking
  • off - the call leg is out of parking

The flow of the call relative to extension can be:

  • incoming
  • outgoing

This is set up only for incoming calls.

dialedStringThis is the phone number that was dialed and it applies only to outgoing calls.

The call disposition can be any of the following:

  • BUSY
answeredDateWhen the call was answered.
startedDateWhen the call was started in the system.
nonceStringA unique call identifier that can be set up by the API customers. 

Software development advice


The payload of the notification is not identical to the PhoneCall resource, but it carries enough information to allow a client to understand what happens with the call. In most common scenarios, the client does not have to interrogate UnifiedAPI in order to get the PhoneCall resource.

For example, you can easily integrate VoipNow with an app that requires to be informed whenever a user is called from a specific number in order to show an incoming call panel in real time. 


The WebSocket client must be implemented using (version 1.0). While is a node project, there are compatible client implementations for other programming languages as well.

It is very important to properly handle WebSocket connect/disconnect/reconnect, otherwise notifications may be missed because API Notifications are not queued; they are sent as soon as they occured. If the client is not listening on the WebSocket, the notification is missed.


Note that API Notifications are not stateful. There is no guarantee that all properties in the payload are available.

We guarantee that there is enough information to identify the call and all properties that have been modified are present.

#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
  • No labels

Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.