User Tools

Site Tools


realtime

Realtime

The realtime interface is based on socket.io, so that any compatible platform may listen in.

This document will focus on the javascript implementation into a webpage.

Other types of apps should take similar steps and connect to the endpoint: https://api.telecomx.dk

Setting up

Include https://api.telecomx.dk/socket.io/socket.io.js - e.g.:

<script src="https://api.telecomx.dk/socket.io/socket.io.js"></script>

Connecting

Connecting requires a token from a validated logon - see Login for documentation.

socket = io.connect(host);
socket.on('connect', function() {
  socket.emit('authenticate', { token: my_login_token, client: 'Application name', instanceId: 'unique-id-of-client', ip: '1.2.3.4' });
});
socket.on('authenticated', function () {
  socket.emit('subscribe', { type: 'event_type' });
});

client, instanceId and ip are not required, but recommended and helps when debugging issues.

You can subscribe to the following channels:

  // Admin users only
  socket.emit('subscribe', { type: 'ADMIN'); // Admin firehose
  socket.emit('subscribe', { type: 'ADMIN', types: [ 'CONFIG','CALL','REGISTER','PBX','REALTIME'] }); // Admin firehose for specific types
  socket.emit('subscribe', { type: 'ADMIN:CONFIG' }); // All configuration events
  socket.emit('subscribe', { type: 'ADMIN:CALL' }); // All call events for outbound/inbound calls
  socket.emit('subscribe', { type: 'ADMIN:REGISTER' }); // All register/unregister events for SIP trunks and SIP phones
  socket.emit('subscribe', { type: 'ADMIN:PBX' }); // All PBX events
  socket.emit('subscribe', { type: 'ADMIN:REALTIME' }); // All Realtime connect/disconnect events
 
  // Users with at least PERSONAL permission
  socket.emit('subscribe', { type: 'PBX', customer: '12345789012457890ABCD' }); // PBX events on customer
  socket.emit('subscribe', { type: 'PBX', customer: '12345789012457890ABCD', events: ['CALL_START','CALL_END'] }); // PBX events on customer, but only specific events
  socket.emit('subscribe', { type: 'CONFIG', customer: '12345789012457890ABCD' }); // Configurations events on customer
  socket.emit('subscribe', { type: 'CONFIG', customer: '12345789012457890ABCD', events: ['EMPLOYEE_CREATED','EMPLOYEE_UPDATED','EMPLOYEE_DELETED'] }); // Configurations events on customer, but only specific events
  socket.emit('subscribe', { type: 'CONFIG-NOT-IPTV', customer: '12345789012457890ABCD' }); // Configurations events on customer, excluding IPTV
 
  // Users with at least VIEWER permission
  socket.emit('subscribe', { type: 'REGISTER', customer: '12345789012457890ABCD' }); // SIP trunk and SIP phone register events on customer
  socket.emit('subscribe', { type: 'CALL', customer: '12345789012457890ABCD' }); // Call events for outbound/inbound calls on customer

You may also listen to the following event to handle when you are connected or disconnected:

socket.on('subscribed', function(data) { write('We are now subscribed to ' + data.type); });
socket.on('unsubscribed', function() { write('We are now unsubscribed'); });
socket.on('disconnect', function(data) { write('Disconnected!'); });

If the connection the the server is lost, Socket.IO will automatically reconnect when possible. Because we listen to connect and authenticated, we will automatically be authenticated and resume listening to the relevant events as soon as we are re-connected.

Receiving events

To be notified when an event is received, you listen for the type of event:

socket.on('CONFIG', function(event) { write('We got a config event'); });

The events event object contains 5 properties:

Name Type Description
event String A sub-event type that further describes the type of event.
customer Id Id of the customer the event relates to (if it applies to a customer).
employee Id Id of the employee who caused the event (only applies to CONFIG events).
id Id Id of the object created/updated/deleted (only applies to CONFIG events).
data Object An object with additional data.

Type: CONFIG

Event Field Description
Basics
EMPLOYEE_AUTHENTICATED When an employee is authenticated
name Name of the employee who logged on.
accessLevel Access level of the employee - see more here.
CUSTOMER_CREATED A customer has been created
CUSTOMER_UPDATED A customer has been updated
CUSTOMER_DELETED A customer has been deleted
CUSTOMER_BLOCKED A customer has been blocked
CUSTOMER_UNBLOCKED A customer has been unblocked
EMPLOYEE_CREATED An employee has been created
EMPLOYEE_UPDATED An employee has been updated
EMPLOYEE_DELETED An employee has been deleted
EMPLOYEE_DISABLED An employee has been disabled
EMPLOYEE_ENABLED An employee has been re-enabled
SIP and MVNO accounts
SIP_ACCOUNT_CREATED A SIP account has been created
SIP_ACCOUNT_UPDATED A SIP account has been updated
SIP_ACCOUNT_DELETED A SIP account has been deleted
SIP_ACCOUNT_DISABLED A SIP account has been disabled
SIP_ACCOUNT_ENABLED A SIP account has been enabled
MVNO_ACCOUNT_CREATED An MVNO account has been created
MVNO_ACCOUNT_UPDATED An MVNO account has been updated
MVNO_ACCOUNT_DELETED An MVNO account has been deleted
MVNO_ACCOUNT_DISABLED An MVNO account has been disabled
MVNO_ACCOUNT_ENABLED An MVNO account has been enabled
MVNO_ACCOUNT_PROVISIONED An MVNO account has been provisioned
MVNO_ACCOUNT_RESTORED An MVNO account has been restored from pre-terminate state
Porting and numbers
PORTING_CREATED A porting has been created
PORTING_UPDATED A porting has been updated
PORTING_ORDERED A porting has been ordered
PORTING_CONTACT A porting had a 'donor contacted' event
PORTING_CONFIRMED A porting has been confirmed
PORTING_CANCELLED A porting has been cancelled
PORTING_REJECTED A porting has been rejected
NUMBER_CREATED A number has been created. If number is part of a series, data is an array of all the numbers.
NUMBER_UPDATED A number has been updated. If number is part of a series, data is an array of all the numbers.
NUMBER_DELETED A number has been deleted. If number is part of a series, data is an array of all the numbers.
Products and call rating
PRODUCT_CREATED A product has been created
PRODUCT_UPDATED A product has been updated
PRODUCT_DELETED A product has been deleted
DESTINATION_CREATED A destination has been created
DESTINATION_UPDATED A destination has been updated
DESTINATION_DELETED A destination has been deleted
SPECIAL_DESTINATION_CREATED A special destination has been created
SPECIAL_DESTINATION_UPDATED A special destination has been updated
SPECIAL_DESTINATION_DELETED A special destinatio has been deleted
ROAMING_VOICE_CREATED A romaing voice destination has been created
ROAMING_VOICE_UPDATED A romaing voice destination has been updated
ROAMING_VOICE_DELETED A romaing voice destination has been deleted
ROAMING_DATA_CREATED A roaming data destination has been created
ROAMING_DATA_UPDATED A roaming data destination has been updated
ROAMING_DATA_DELETED A roaming data destination has been deleted
ROAMING_TEXT_CREATED A roaming text destination has been created
ROAMING_TEXT_UPDATED A roaming text destination has been updated
ROAMING_TEXT_DELETED A roaming text destination has been deleted
SBC
SBC_PEER_CREATED An SBC peer has been created
SBC_PEER_UPDATED An SBC peer has been updated
SBC_PEER_DELETED An SBC peer has been deleted
SBC_PEER_HOST_DOWN A host on an SBC peer has been marked as down data contains property host with the IP of the peer host.
SBC_PEER_HOST_UP A host on an SBC peer has been marked as up data contains property host with the IP of the peer host.
SBC_SERVER_CREATED An SBC server has been created
SBC_SERVER_UPDATED An SBC server has been updated
SBC_SERVER_DELETED An SBC server has been deleted
SBC_HOST_CREATED A trusted host has been created
SBC_HOST_UPDATED A trusted host has been updated
SBC_HOST_DELETED A trusted host has been deleted
SBC_RULE_CREATED An LCR rule has been created
SBC_RULE_UPDATED An LCR rule has been updated
SBC_RULE_DELETED An LCR rule has been deleted
DK_SERVICE_OPERATOR_CREATED A Danish service operator has been created
DK_SERVICE_OPERATOR_UPDATED A Danish service operator has been updated
DK_SERVICE_OPERATOR_DELETED A Danish service operator has been deleted
DK_NUMBER_UPDATED A number in the danish number plan had its operator updated
FRAUD_IP_BLACKLIST_CREATED An IP address has been added to the blacklist
FRAUD_IP_BLACKLIST_DELETED An IP address has been removed from the blacklist
FRAUD_IP_WHITELIST_CREATED An IP address has been added to the whitelist
FRAUD_IP_WHITELIST_DELETED An IP address has been removed from the whitelist
FRAUD_NUMBER_BLACKLIST_CREATED A phone number or prefix has been added to the number blacklist
FRAUD_NUMBER_BLACKLIST_DELETED A phone number or prefix has been removed from the number blacklist
Invoicing
CURRENT_INVOICE_CREATED A current invoice item has been created
CURRENT_INVOICE_UPDATED A current invoice item has been updated
CURRENT_INVOICE_DELETED A current invoice item has been deleted
INVOICE_CREATED An invoice has been created
Call enhancer
TCE_CREATED A Call Enhancer has been created
TCE_UPDATED A Call Enhancer has been updated
TCE_DELETED A Call Enhancer has been deleted
Presence proxy
PRESENCE_PROXY_CREATED A presence proxy server has been created
PRESENCE_PROXY_UPDATED A presence proxy server has been updated
PRESENCE_PROXY_DELETED A presence proxy server has been deleted
IPTV
IPTV_BASECHANNELS_CREATED A base channel has been created
IPTV_BASECHANNELS_UPDATED A base channel has been updated
IPTV_BASECHANNELS_DELETED A base channel has been deleted
IPTV_CHANNELS_CREATED An IPTV channel has been created
IPTV_CHANNELS_UPDATED An IPTV channel has been updated
IPTV_CHANNELS_DELETED An IPTV channel has been deleted
IPTV_PACKAGES_CREATED An IPTV TV channel package has been created
IPTV_PACKAGES_UPDATED An IPTV TV channel package has been updated
IPTV_PACKAGES_DELETED An IPTV TV channel package has been deleted
IPTV_SETTINGS_CREATED Common IPTV settings for a reseller / businnes has been created
IPTV_SETTINGS_UPDATED Common IPTV settings for a reseller / business has been updated
IPTV_SETTINGS_DELETED Common IPTV settings for a reseller / business has been deleted
IPTV_DRMACCOUNT_CREATED A DRM account for viewing IPTV on mobile devices has been created
IPTV_DRMACCOUNT_UPDATED A DRM account for viewing IPTV on mobile devices has been updated
IPTV_DRMACCOUNT_DELETED A DRM account for viewing IPTV on mobile devices has been deleted
IPTV_DEVICE_CREATED A device (stb/app/web) for viewing IPTV has been created
IPTV_DEVICE_UPDATED A device (stb/app/web) for viewing IPTV has been updated
infoOnly True when only informational data has been updated
IPTV_DEVICE_DELETED A device (stb/app/web) for viewing IPTV has been deleted
IPTV_DEVICE_LOGIN Device (app/web) logged in
type INITIAL_LOGIN - first time login where device is auto-created
RE_LOGIN - returning device which was logged out
IPTV_DEVICE_LOGOUT Device logged out
IPTV_DEVICE_UNREGISTERED Device unregistered from the DRM account
IPTV_DEVICE_CHANNEL_PLAYING Device started showing a TV channel
channel Id of channel
IPTV_DEVICE_CHANNEL_STOPPED Device stopped showing a TV channel
channel Id of channel
IPTV_DEVICE_ARCHIVE_PLAYING Device started playback of video from archive
epgId Id of show that is being played
IPTV_DEVICE_ARCHIVE_STOPPED Device stopped playback of video from archive
epgId Id of show that is not being played anymore
IPTV_DEVICE_RECORDING_PLAYING Device started playback of recording
epgId Id of show that is being played
IPTV_DEVICE_RECORDING_STOPPED Device stopped playback of recording
epgId Id of show that is not being played anymore
IPTV_DEVICE_RECORDING_SCHEDULED Device scheduled a show for recording
epgId Id of show to record
IPTV_DEVICE_RECORDING_DELETED Device deleted a recording - scheduled or recorded
epgId Id of show to delete
mode ALL - all the customers recordings are deleted
SINGLE - a specific recording is deleted
IPTV_DEVICE_RECORDING_FAVORITE Device marked a show as a favorite for long time storage
recording Id of recording
favorite True if marked as favorite
IPTV_DEVICE_RENAMED Device renamed a device
device Id of renamed device
IPTV_DEVICE_REQUESTS_SERVED STB received one or more command requests
IPTV_DEVICE_SPEEDTEST_COMPLETED STB completed a speed test
IPTV_DEVICE_TUNNEL_CONNECTING STB is establishing the VPN tunnel
IPTV_DEVICE_UI_LOADING STB is loading the user interface
IPTV_DEVICE_DVB_UPDATING STB is updating DVB settings
IPTV_SUBSCRIPTIONS_CREATED Subscription settings for an IPTV customer has been created
IPTV_SUBSCRIPTIONS_UPDATED Subscription settings for an IPTV customer has been updated
IPTV_SUBSCRIPTIONS_DELETED Subscription settings for an IPTV customer has been deleted
IPTV_RADIO_CHANNELS_CREATED A radio channel has been created
IPTV_RADIO_CHANNELS_UPDATED A radio channel has been updated
IPTV_RADIO_CHANNELS_DELETED A radio channel has been deleted
IPTV_TABLET_PROFILE_CREATED A tablet profile has been created
IPTV_TABLET_PROFILE_UPDATED A tablet profile has been updated
IPTV_TABLET_PROFILE_DELETED A tablet profile has been deleted
Internet
INTERNET_REQUEST_CREATED An Internet request has been created
INTERNET_REQUEST_OFFERED An Internet request has been updated
INTERNET_REQUEST_DELETED An Internet request has been deleted
INTERNET_ACCOUNT_CREATED An Internet account has been created
INTERNET_ACCOUNT_UPDATED An Internet account has been updated
INTERNET_ACCOUNT_CANCELLED An Internet account has been cancelled
Hosted PBX
PBX_AUDIO_CREATED An audio item has been created.
PBX_AUDIO_UPDATED An audio item has been updated.
connected True when callee has answered the call from the PBX server and is introduced to the recording procedure.
recording True when recording of the audio has begun on the PBX server.
PBX_AUDIO_DELETED An audio item has been deleted.
replacedBy Id of PBX audio that shall be used instead of this. Used when recording audio via phone.
PBX_GROUP_CREATED A PBX dialplan group has been created
PBX_GROUP_UPDATED A PBX dialplan group has been updated
PBX_GROUP_DELETED A PBX dialplan group has been deleted
PBX_EXTENSION_CREATED A PBX dialplan extension has been created
employeeId Id of the employee the extension belongs to, if any
PBX_EXTENSION_UPDATED A PBX dialplan extension has been updated
employeeId Id of the employee the extension belongs to, if any
PBX_EXTENSION_DND_UPDATED A PBX dialplan extension has updated DND state for one of its phones
phoneId Id of the phone that changed
type Type of phone: MVNO or SIP or EXTERNAL.
dnd True if DND is enabled, false otherwise.
PBX_EXTENSION_DELETED A PBX dialplan extension has been deleted
employeeId Id of the employee the extension belongs to, if any
PBX_CONFERENCE_CREATED A PBX dialplan conference has been created
PBX_CONFERENCE_UPDATED A PBX dialplan conference has been updated
fromPbx True if sent by hosted pbx to indicate a change.
PBX_CONFERENCE_DELETED A PBX dialplan conference has been deleted
PBX_TRUNK_CREATED A PBX dialplan trunk has been created
PBX_TRUNK_UPDATED A PBX dialplan trunk has been updated
PBX_TRUNK_DELETED A PBX dialplan trunk has been deleted
PBX_DIAL_CREATED A PBX dialplan dial has been created
PBX_DIAL_UPDATED A PBX dialplan dial has been updated
PBX_DIAL_DELETED A PBX dialplan dial has been deleted
PBX_QUEUE_CREATED A PBX dialplan queue has been created
PBX_QUEUE_UPDATED A PBX dialplan queue has been updated
PBX_QUEUE_DELETED A PBX dialplan queue has been deleted
PBX_TIME_ROUTER_CREATED A PBX dialplan time router has been created
PBX_TIME_ROUTER_UPDATED A PBX dialplan time router has been updated
PBX_TIME_ROUTER_DELETED A PBX dialplan time router has been deleted
PBX_PLAYBACK_CREATED A PBX dialplan playback has been created
PBX_PLAYBACK_UPDATED A PBX dialplan playback has been updated
PBX_PLAYBACK_DELETED A PBX dialplan playback has been deleted
PBX_URL_ROUTER_CREATED A PBX dialplan URL router has been created
PBX_URL_ROUTER_UPDATED A PBX dialplan URL router has been updated
PBX_URL_ROUTER_DELETED A PBX dialplan URL router has been deleted
PBX_SET_VALUE_CREATED A PBX dialplan set value has been created
PBX_SET_VALUE_UPDATED A PBX dialplan set value has been updated
PBX_SET_VALUE_DELETED A PBX dialplan set value has been deleted
PBX_VALUE_ROUTER_CREATED A PBX dialplan value router has been created
PBX_VALUE_ROUTER_UPDATED A PBX dialplan value router has been updated
PBX_VALUE_ROUTER_DELETED A PBX dialplan value router has been deleted
PBX_MENU_ROUTER_CREATED A PBX dialplan menu router has been created
PBX_MENU_ROUTER_UPDATED A PBX dialplan menu router has been updated
PBX_MENU_ROUTER_DELETED A PBX dialplan menu router has been deleted
PBX_PHONEBOOK_CREATED A PBX phonebook entry has been created
multiple True if multiple entries was created
ids If multiple, then this array holds the ids of the created entries.
personal Id of employee if contact is personal.
PBX_PHONEBOOK_UPDATED A PBX phonebook entry has been updated
personal Id of employee if contact is personal.
picture Id of picture - indicated that the update was due to picture change.
pictureDeleted True when update was due to picture deleted.
PBX_PHONEBOOK_DELETED A PBX phonebook entry has been deleted
PBX_PHONEBOOK_DELETE_ALL All PBX phonebook entries for a user or customer has been deleted
deleted What was deleted: SHARED contacts or PERSONAL contacts
for Who was it deleted for. If PERSONAL, then is of employee, else id of customer
PBX_CALENDAR_CREATED A PBX calendar event has been created
employee Id of employee the event belongs to.
PBX_CALENDAR_UPDATED A PBX calendar event has been updated
employee Id of employee the event belongs to.
PBX_CALENDAR_DELETED A PBX calendar event has been deleted
employee Id of employee the event belongs to.
PBX_CALENDAR_DELETE_ALL All PBX calendar events for a user mer has been deleted
employee Id of employee the event belongs to.
MUSIC_ON_HOLD_CREATED A PBX Music on hold class has been created
MUSIC_ON_HOLD_UPDATED A PBX Music on hold class has been updated
MUSIC_ON_HOLD_DELETED A PBX Music on hold class has been deleted
SIP_PHONE_MODEL_CREATED A PBX SIP phone model has been created
SIP_PHONE_MODEL_UPDATED A PBX SIP phone model has been updated
SIP_PHONE_MODEL_DELETED A PBX SIP phone model has been deleted
SIP_PHONE_CREATED A PBX SIP phone has been created
SIP_PHONE_UPDATED A PBX SIP phone has been updated
SIP_PHONE_DELETED A PBX SIP phone has been deleted
SIP_PHONE_CONFIG A PBX SIP phone has received its configuration
PBX_APP_DASHBOARD_CREATED A PBX APP Dashboard has been created
PBX_APP_DASHBOARD_UPDATED A PBX APP Dashboard has been updated
PBX_APP_DASHBOARD_DELETED A PBX APP Dashboard has been deleted
DNS_CREATED A DNS item has been created
DNS_UPDATED A DNS item has been updated
DNS_DELETED A DNS item has been deleted
Job
JOB_CREATED When a job is created
JOB_SUCCEEDED When a job successfully completed
JOB_FAILED When a job fails with an error
Helpcenter
HELPCENTER_CREATED When a helpcenter is created
HELPCENTER_UPDATED When a helpcenter successfully updated
HELPCENTER_DELETED When a helpcenter is deleted
HELPCENTER_CASE_CREATED When a helpcenter case is created
HELPCENTER_CASE_UPDATED When a helpcenter case successfully updated
HELPCENTER_CASE_DELETED When a helpcenter case is deleted
Network device
NETWORK_DEVICE_CREATED A network device has been created
NETWORK_DEVICE_UPDATED A network device has been updated
NETWORK_DEVICE_PROVISIONED A network device has been provisioned
NETWORK_DEVICE_DELETED A network device has been deleted
Network device model
NETWORK_DEVICE_MODEL_CREATED A network device model has been created
NETWORK_DEVICE_MODEL_UPDATED A network device model has been updated
NETWORK_DEVICE_MODEL_DELETED A network device model has been deleted
ROUTER_CREATED A router was created
ROUTER_UPDATED A router was updated
ROUTER_DELETED A router was deleted
ROUTER_EVENT A router event occurred
type progress or done.
percent If type is progress, this is how many percent has ben completed.
tasks If type is progress, this is the number of tasks to complete.
completed If type is progress, this is the number of completed tasks.
success If type is completed, this is true on success, and false on failure.
error If type is completed and success is false, this is the error message.

Type: CALL

Event Field Description
START When a call is initiated.
callid The unique Call-ID for the call.
direction The direction - I for inbound, O for outbound.
from The callers phone number.
to The called phone number.
voiceaccount Id of the SIP/MVNO account that is making/receiving the call.
ANSWER When a call is answered.
callid The unique Call-ID for the call.
direction The direction - I for inbound, O for outbound.
from The callers phone number.
to The called phone number.
sourceCustomerId Id of the customer making the call (if outbound).
destinationCustomerId Id of the customer receiving the call (if inbound/between 2 customers).
PREEND When a call is about to end.
callid The unique Call-ID for the call.
direction The direction - I for inbound, O for outbound.
from The callers phone number.
to The called phone number.
sourceCustomerId Id of the customer making the call (if outbound).
destinationCustomerId Id of the customer receiving the call (if inbound/between 2 customers).
reason Reason the call ended: CANCEL, BYE, BLOCKED, BLACKLISTED, FRAUD or a SIP 4xx/5xx/6xx response code.
endedBy A for caller, B for callee, S for system.
END When a call has ended.
callid The unique Call-ID for the call.
direction The direction - I for inbound, O for outbound.
from The callers phone number.
to The called phone number.
sourceCustomerId Id of the customer making the call (if outbound).
destinationCustomerId Id of the customer receiving the call (if inbound/between 2 customers).
reason Reason the call ended: CANCEL, BYE, BLOCKED, BLACKLISTED, FRAUD or a SIP 4xx/5xx/6xx response code.
endedBy A for caller, B for callee, S for system.
MAXCHANNELS When a customer tries to use more voice channels than permitted (ADMIN only).
callid The unique Call-ID for the call.
from The callers phone number.
to The called phone number.
limit The max number of concurrent calls allowed on the customer.
sourceCustomerId Id of the customer making the call (if outbound).
PEER_ERROR When a peer fails (ADMIN only).
callid The unique Call-ID for the call.
peerip IP address of the peer.
from The callers phone number.
to The called phone number.
sourceCustomerId Id of the customer making the call (if outbound).
FRAUD When a call is terminated due to suspicion of fraud.
callid The unique Call-ID for the call.
peerip IP address of the peer.
from The callers phone number.
to The called phone number.
sourceCustomerId Id of the customer making the call (if outbound).

Type: REGISTER

This both reports register events and authentication errors for both register and invite requests.

Event Field Description
REGISTER When a SIP trunk client or PBX SIP phone registers / renews its registration.
customer Id of customer, if known and source is pbx.
data.ip IP address the client is registering from.
data.port Port the client is registering from.
data.expires Number of seconds until the registration expires.
data.username The username on the SIP trunk.
data.sipAccount Id of the SIP trunk.
data.sipphone ID of SIP phone, if known and source is pbx.
data.source trunk, gw or pbx.
data.pbxServer IP address of PBX server.
data.trunkServer IP address of trunk server.
UNREGISTER When a SIP trunk client or PBX SIP phone un-registers.
customer Id of customer, if known and source is pbx.
data.ip IP address the client is unregistering from.
data.port Port the client is unregistering from.
data.username The username on the SIP trunk.
data.sipAccount Id of the SIP trunk.
data.sipphone ID of SIP phone, if known and source is pbx.
data.source trunk, gw or pbx.
data.pbxServer IP address of PBX server.
data.trunkServer IP address of trunk server.
ERROR When an error occurs during registration by a SIP trunk client or PBX SIP phone.
customer Id of customer, if known and source is pbx.
data.error The error that occurred:
not_found - account not found
username_not_found - supplied username was not found
invalid_password - password is invalid
auth_error - authentication failed due to stale nonce
invalid_ip - client is not at the approved IP address
invalid_country - client tried to register from a non-approved country.
interval_too_brief - client requested register interval below 600 seconds.
data.ip IP address the client is trying to register from.
data.username The username on the SIP trunk, if known.
data.sipAccount Id of the SIP trunk, if known and source is trunk or gw.
data.sipphone ID of SIP phone, if known and source is pbx.
data.country Country that the client tried to register from, but is not on the approved list.
data.source trunk, gw or pbx.
data.pbxServer IP address of PBX server.
data.trunkServer IP address of trunk server.

Type: TRUNK

This reports the creation of call session on the SIP trunk servers. It is used internally to keep track of ongoing calls.

Event Field Description
SESSION_CREATE When a call session is created.
data.type Type of call event callin or callout or related.
data.callid Call-ID for the call.
data.destination Destination URI (only for type callout).
data.sbc IP address of the SBC server the call is coming from (only for type callin).
data.voiceaccount Id of the voice account this call belongs to.
data.trunk IP address of the trunk handling the call.
data.from Callers phone number in E.164 format.
data.to Callees phone number in E.164 format.
data.clientIP IP address of the caller.
data.clientPort Port for the caller.
data.fromtag From Tag.
data.key Related key, (only for type related).
SESSION_DELETE When a call session is deleted.
data.type Type of call event callin or callout or related.
data.key Related key, (only for type related).
data.callid Call/ID for the call (only for types callin and callout).
data.delay Optional number of seconds to delay the deletion.

Type: REDIS

Event Field Description
MASTER_SWITCH Redis database switched master (ADMIN only).
from IP address of previous master.
to IP address of new master.
SERVER_DOWN A Redis database is down (ADMIN only).
serverType Type of server that is down: master, slave or sentinel.
host IP address of the server.
SERVER_UP A Redis database is up again (ADMIN only).
serverType Type of server that has come up: master, slave or sentinel.
host IP address of the server.

Type: PBX

Events related to hosted PBX.

Event (type) Field Description
CALL_START When a call starts.
CALL_RING When a call is ringing.
CALL_ANSWER When a call is answered.
CALL_END When a call has ended.
CALL_UPDATE When a call is updated due to a caller id update.
CALL_HOLD When a call is updated due to a caller id update.
CALL_UNHOLD When a call is updated due to a caller id update.
event Type of event: CALL_START, CALL_RING, CALL_ANSWER, CALL_END, CALL_UPDATE, CALL_HOLD, CALL_UNHOLD.
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.
sessionId Id of the session - for binding caller and callee events.
customer Id of customer.
caller Caller phone number.
callerName Caller name.
callerPrivacy True if caller has secret number.
callee Callee phone number.
calleeName Callee name.
channel Id of channel.
callId Call-ID of the inbound call leg towards the PBX.
direction Direction of call: I (inbound from external) or O (outbound from local).
leg Call leg: I (in from caller to PBX) or O (out from PBX to callee).
originator Type of call originator: SIPPHONE, MOBILE, EXTERNAL or SYSTEM.
device Id of SIP phone or MVNO account making the call. Null if call is from an external source.
extension Id of extension this call leg belongs to.
extensionState Current state of the extension: IDLE, RINGING, BUSY.
queueId Id of queue, if call was originated by a queue.
queueName Name of queue, if call was originated by a queue.
hideOtherParty True if the other party if this call shall not be shown because the extension owner wish to hide it.
EMPLOYEE_PRESENCE_CHANGED Presence has changed for an employee.
customer Id of customer
_id Id of employee
data Updated presence data: state, location, message, expire
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.

Conference

Sub-event (type) Field Description
CONFERENCE_ENTERED A participant has entered a conference room.
customer Id of customer
_id Id of conference
conferenceName Name of conference
number Participants phone number
name Participants name - if known
employee Participants employee id - if known
muted True if participant is muted
room Room number
callId Call ID
channelId Channel Id
entered Date/time when caller entered the conference
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.
CONFERENCE_LEFT A participant has left a conference room.
customer Id of customer
_id Id of conference
conferenceName Name of conference
number Participants phone number
name Participants name - if known
employee Participants employee id - if known
muted True if participant is muted
room Room number
callId Call ID
channelId Channel Id
entered Date/time when caller entered the conference
duration Number of seconds the participant was in the room.
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.
CONFERENCE_CHANGED A participants info has changed. Used to detect mute/unmute.
customer Id of customer
_id Id of conference
conferenceName Name of conference
number Participants phone number
name Participants name - if known
employee Participants employee id - if known
muted True if participant is muted
room Room number
callId Call ID
channelId Channel Id
entered Date/time when caller entered the conference
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.

Variables

Sub-event (type) Field Description
CALL_VARIABLE A call variable is set/updated/deleted.
name Name of the variable.
value New value of the variable.
deleted True if variable was deleted.
customer Id of the customer.
callId Id of the call the variable is on.
channel Channel Id
extension Id of extension that set/deleted the call variable, if available.
employee Id of employee that set/deleted the call variable, if available.
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.
VARIABLE A persistent PBX variable is set/updated/deleted.
name Name of the variable. Prefixed with SHARED: if shared, prefixed with <employee-id>: if personal.
value New value of the variable.
variableType Type of variable: SYSTEM, SHARED or PERSONAL.
deleted True if variable was deleted.
customer Id of the customer.
callId Id of the call the variable is on.
channel Channel Id
extension Id of extension that set/deleted the variable, if available.
employee Id of employee that set/deleted the variable, if available.
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.
SWITCH A persistent PBX switch is set/updated/deleted.
name Name of the switch. Prefixed with SHARED: if shared, prefixed with <employee-id>: if personal.
value New value of the switch, true or false.
switchType Type of switch: SYSTEM, SHARED or PERSONAL.
deleted True if switch was deleted.
customer Id of the customer.
callId Id of the call the variable is on.
channel Channel Id
extension Id of extension that set/deleted the switch, if available.
employee Id of employee that set/deleted the switch, if available.
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.

Call recording

Sub-event (type) Field Description
RECORDING_START A call recording has started.
customer Id of the customer.
employee Id of the employee making the recording, if not common.
_id Id of recording, while recording it.
channel Id of channel making the recording.
caller Caller phone number.
callee Callee phone number.
source Type of entity making the recording: EMPLOYEE or COMMON.
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.
RECORDING_END A call recording has ended.
customer Id of the customer.
employee Id of the employee making the recording, if not common.
_id Id of recording, while recording it.
channel Id of channel making the recording.
caller Caller phone number.
callee Callee phone number.
recordingId Id of the recording in the database.
duration Length of recording in seconds.
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.
RECORDING_UPDATE A recorded call has been updated (follow up).
_id Id of the recording in the database. Null if updated an ongoing call.
customer Id of the customer.
employee Id of the employee, if not common.
channels Array of id's of channels that has been updated, if updating an ongoing call.
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.
RECORDING_DELETED A recorded call has been deleted.
_id Id of the recording in the database.
customer Id of the customer.
employee Id of the employee, if not common.
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.

Queue

Sub-event (type) Field Description
QUEUE_ENTERED A caller has entered a queue.
customer Id of the customer.
queue Id of the queue.
_id Id of call in the queue.
state State of call: QUEUED, CALLBACK, VIP.
number Callers phone number.
name Callers name.
position Position in the queue.
entered Date/time when caller entered the queue.
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.
sessionId Session id - for tracking the call.
QUEUE_LEFT A caller in a queue left the queue.
customer Id of the customer.
queue Id of the queue.
_id Id of call in the queue.
state State of call: ANSWERED (by member), CANCELLED (hangup before answered), TIMED_OUT (timeout transfer engaged), NO_MEMBERS (no members transfer engaged), ALL_BUSY (all members busy transfer engaged).
number Callers phone number.
name Callers name.
position Position in the queue.
entered Date/time when caller entered the queue.
answered Date/time when caller was answered by a member.
answeredByExtension Extension id of the member who answered the call
answeredByNumber Phone number of the member who answered the call
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.
sessionId Session id - for tracking the call.
QUEUE_MEMBER_JOIN A member has joined the queue.
customer Id of the customer.
employee Id of employee who did it, if available.
_id Id of queue.
data Data about the member who joined: _id, extension, number, priority, calls, lastCallEnded, permanent. See definition here, in members section
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.
QUEUE_MEMBER_UPDATE A member has changed priority and/or permanent.
customer Id of the customer.
employee Id of employee who did it, if available.
_id Id of queue.
data Data about the member who was updated: _id, extension, number, priority, calls, seconds, lastCallEnded, permanent. See definition here, in members section
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.
QUEUE_MEMBER_LEFT A member has left the queue.
customer Id of the customer.
employee Id of employee who did it, if available.
_id Id of queue.
data Data about the member who left: _id, extension, number, priority, calls, lastCallEnded, permanent. See definition here, in members section
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.
QUEUE_UPDATED Queue settings has been updated.
type QUEUE_UPDATED
customer Id of customer
_id Id of queue
employee Id of employee who did it - if available.
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.
QUEUE_DELETED Queue has been deleted.
type QUEUE_UPDATED
customer Id of customer
_id Id of queue
employee Id of employee who did it - if available.
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.
QUEUE_MASTER Broadcast periodically
customer Id of the customer.
_id Id of queue.
callerId Caller Id
eventId Event Id
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.

Voicemail

Sub-event (type) Field Description
VOICEMAIL_NEW A new voicemail message has been recorded.
type VOICEMAIL_NEW
customer Id of customer
_id Id of employee the voicemail belongs to
voicemailId Id of voicemail message
callerNumber Phone number of caller
callerName Name of caller, if available
length Length of message in seconds
newMessages Number of new messages
oldMessages Number of old messages
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.
VOICEMAIL_OLD A voicemail message has been played back and is now an old message.
type VOICEMAIL_OLD
customer Id of customer
_id Id of employee the voicemail belongs to
voicemailId Id of voicemail message
newMessages Number of new messages
oldMessages Number of old messages
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.
VOICEMAIL_DELETED A voicemail message has been deleted.
type VOICEMAIL_DELETED
customer Id of customer
_id Id of employee the voicemail belongs to
voicemailId Id of voicemail message, null if all voicemails were deleted.
newMessages Number of new messages
oldMessages Number of old messages
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.

Audio prompt recording

Sub-event (type) Field Description
AUDIO_RECORD An audio prompt recording event occurred.
state New state for recording: CALLING, MENU, LISTEN, PRERECORDING, RECORDING, COMPLETED, CANCELLED.
_id Reference id for the recording. For recognising which recording session, this belongs to.
extension Called extension.
customer Customer id.
audio Id of newly recorded audio item. Only if type is COMPLETED.
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.

Misc

Sub-event (type) Field Description
SIP_PHONE_HOST A SIP phone is locked/unlocked from a specific PBX server.
customer The customer the SIP phone belongs to.
_id Id of the SIP phone.
count Number of locks that exists, one for each call. 0 if no more locks exists.
pbxServer hostname of PBX server publishing the event.
eventId Unique id of the event.
PERSONAL_QUEUE_CLEANUP A caller waiting in a personal queue has been forcefully removed.
customer The customer the SIP phone belongs to.
_id The id of the extension the caller is waiting for.
channel Id of the killed channel.
calls Number of calls in the personal queue.
PERSONAL_QUEUE_JOIN A caller has joined a personal queue.
customer The customer the SIP phone belongs to.
_id The id of the extension the caller is waiting for.
channel Id of the channel.
caller Phone number of the caller.
callerName Name of the caller, if available.
callerPrivacy True if caller has secret number.
calls Number of calls in the personal queue.
PERSONAL_QUEUE_LEAVE A caller waiting in a personal queue has left the queue.
customer The customer the SIP phone belongs to.
_id The id of the extension the caller is waiting for.
channel Id of the channel.
caller Phone number of the caller.
callerName Name of the caller, if available.
callerPrivacy True if caller has secret number.
calls Number of calls in the personal queue.

Request /Reply

Between 2 realtime client requests and replies can be sent using this feature.

Both ends must listen to REQUEST and REPLY messages, using socketio.on('REQUEST', handler) handling.

Request

A request is sent using socket.io emit into the room request with the following message payload:

property Type Description
to Object Recipient data
to.employee Id Id of employee to send the request to.
to.instanceId String [optional] Id of the client instance to send the request to. Omit to send to all the employees clients.
request String Type of request, see options below.
data Any Additional data to send with the request, if any, otherwise omit.
data.token String Telecom X token for employee to impersonate (request type CommunicatorImpersonate only).
data.network String Id of ZeroTier network to join or leave (request type CommunicatorZeroTierJoin/CommunicatorZeroTierLeave only).
replyTo Object [optional] Reply to data. Omit if you do not want a reply.
replyTo.employee Id Id of employee to send the reply to.
replyTo.instanceId String Id of client instance to send the request to. Omit to send the reply to all the employees clients.

Types of requests that are currently known:

Request Supported by Description
CommunicatorLoggerGetHistory Communicator Desktop Request a client to return the internal event history.
CommunicatorLoggerClearHistory Communicator Desktop Request client to clear the internal event history.
CommunicatorLoggerStartStream Communicator Desktop Request client to start streaming log events to the replyTo recipient.
CommunicatorLoggerStopStream Communicator Desktop Request client to stop streaming log events to the replyTo recipient.
CommunicatorReload Communicator Desktop Request client to restart the application.
CommunicatorTerminate Communicator Desktop Request client to quit.
CommunicatorDevtoolsShow Communicator Desktop Request client to show the developer tools window for debugging.
CommunicatorDevtoolsHide Communicator Desktop Request client to hide the developer tools window.
CommunicatorImpersonate Communicator Desktop Request client to start impersonating another employee, so that the user may configure the employees dashboard.
CommunicatorGetStatus Communicator Desktop Request client to return current status on all subsytems in the app.
CommunicatorZeroTierStatus Communicator Desktop Request client to return current status on the local ZeroTier client.
CommunicatorZeroTierJoin Communicator Desktop Request client to join a network.
CommunicatorZeroTierLeave Communicator Desktop Request client to leave a network.

Communicator requests only works if the sender has access to the recipient (e.g. same customer, reseller or admin). CommunicatorZeroTier requests are only accepted if sender and receiver is the same employee.

Example

{
  to: {
    employee: '12345678901234567890ABCD',
    instanceId: 'cvh38ruvhbe3ugvbhehgviwhvhcienbvj'
  },
  request: 'CommunicatorGetStatus',
  replyTo: {
    employee: '12345678901234567890AAAA',
    instanceId: 'dbewiuvhegf84hrtfu849yi4hb3wui9gjfndf'
  }
}

Please use the socketio.emit('request', playload, response ⇒ {}) api to send the request, as the response object will hold the following:

Property Type Description
success Boolean True if request has successfully delivered to the server.
requestId String Id of request. Used to match against any replies to the request.

Reply

A reply is sent using socket.io emit into the room reply with the following message playload:

property Type Description
to Object Recipient data
to.employee Id Id of employee to send the reply to, as stated in request.replyTo.
to.instanceId String Id of the client instance to send the request to, as stated in request.replyTo.
request String Type of request, as stated in request.
requestId String Id of request, as stated in request.
data Any Additional data to send with the reply, if any, otherwise omit.
from Object [optional] Reply to data. Omit if you do not want a reply.
from.employee Id Id of employee who sent the reply.
from.instanceId String Id of client instance who sent the reply.

Please consider that some requests may yield multiple replies, e.g. when requesting a stream or when sending a request to all of the clients an employee has.

realtime.txt · Last modified: 2025/11/08 04:41 by Per Møller

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki