JavaScript API

You can control Ozeki Phone System with its JavaScript API. You can integrate the potentials of Ozeki Phone System into your website. You can make chat consoles, conference rooms, webphones for example. The things you can do are limitless, like your imagination.

On this page you can find a general summary about the classes, methods and events of the Javascript API. By clicking on each link you can get further information about the given object.

1: JavaScript API classes

The pillars of your script are the classes. We made some classes for you to use them easily in collaboration with the phone system. You can learn about our classes by clicking on them.

ClassDescription
OzWebClient

The OzWebClient class contains methods for connecting the webclient to Ozeki Phone System and disconnecting it from it. The WebClient class is the main communication interface between Ozeki Phone System and Javascript.

Call

The Call class represents a call object in the system. The class contains methods for a wide range of call, messaging and video stream functionalities. It also contains events to help messaging and monitor callstates.

OzCamera

The Camera class represents a camera. The class contains methods for setting up your camera and checking out camera features.

Extension The Extension class represents an extension (or outside line) in the system. The Extension class provides basic information about the extension configured in Ozeki Phone System.

Helper The helper class contains methods which lets you query out information from the OzWebclient instance.

Session

The Session class represents a session of an ongoing call in the system. The Session class provides session modification functions such as hold(), unhold(), etc. which can only be used if the connected webclient has the required privileges.

User

The User class represents a user configured in Ozeki Phone System XE. The user class contains the user's name, phone number , email address and other user related information.

Classes can contain constructor(s), methods, properties and events. The constructor makes an object of the class, the methods are functions used on the object, properties are attributes of the object. You can also register on events, so if an event occurs it calls a function.

2: JavaScript API methods

Below you can see a detailed reference book of the methods we have made for the JavaScript API.

MethodDescription
OzWebClient class methods:
OzWebClient.connect(serverAddress, token, properties)

Connects the webclient to Ozeki Phone System.

OzWebClient.createCall(dialedNumber, callType)

Returns a new Call object with the specified target phone number.

OzWebClient.checkWebphoneState(serverAddress, webphoneId, callback)

It is used to check if the webphone is available.

OzWebClient.disconnect()

Disconnects the webclient from Ozeki Phone System.

OzWebClient.getCallHistory(filters)

Initiates a call history query request to Ozeki Phone System. *

OzWebClient.setupCall(caller, callee)

Creates a call between two extensions configured in Ozeki Phone System.

Call class methods:
accept()

Accepts a call coming to the webclient.

attachCamera(cam)

Attaches the video stream of a camera to the call.

forward(target)

Forwards the call while not picked up.

getCallState()

Returns the callstate of the current call.

getOtherParty()

Returns the phone number of the other party.

hangUp()

Hangs up the call.

hold()

Holds the call.

reject()

Rejects a call coming to the webclient.

sendMessage(message)

Sends a message to the other party.

setRemoteDisplay(displayId)

Displays the video stream coming from the other party.

start()

Starts the call.

transfer(target)

Transfers the call after its picked up.

unHold()

Unholds the call.

OzCamera class methods:

getFps()

Returns the frames per second value of the video stream.

getHeight()

Returns the height of the video stream in pixels.

getId()

Returns the ID of the camera display.

getName()

Returns the name of the camera the object represents.

getWidth()

Returns the width of the video stream in pixels.

OzCamera.getNames()

Returns the names of available cameras.

OzCamera.getCameraByIndex(index)

Returns a new Camera object or null if the given index is not present in the array.

OzCamera.getCameraByName(cameraName)

Returns a new Camera object or null if the given cameraName does not exists.

setDisplay(displayId)

Sets which display should show the video stream.

setMode(width,height,fps)

Sets the width, height and fps of the video stream.

setQuality(bandwidth, quality)

Sets the transmission bandwidth and quality of the video stream.

Helper class methods:
getActiveCallsOfExtension(extensionId)

Retrieves the active calls of the specified extension.

getActiveCallsOfUser(userId)

Retrieves the active calls of the specified user.

getActiveSessionById(sessionId)

Retrieves the session by the specified session ID, or null if the session does not exists.

getActiveSessionsBySessionState(sessionState)

Retrieves the sessions by the specified session state.

getCallHistoryOfExtension(extensionId, properties)

Initiates a getCallHistory request with the specified extension ID.

getExtensionById(id)

Retrieves the extension with the specified ID, or null if the extension does not exists.

getExtensions()

Retrieves the extensions configured in Ozeki Phone System.

getExtensionsByType(extensionType)

Retrieves the extensions whose type equals to the specified type.

getOutsideLineById(id)

Retrieves the outside line with the specified ID, or null if the outside line does not exists.

getOutsideLines()

Retrieves the outside lines configured in Ozeki Phone System.

getOutsideLinesByType(outsideLineType)

Retrieves the outside lines whose type equals to the specified type.

getUserByExtension(extensionId)

Retrieves the user instance by the specified extension ID, e.g returns the user whose device list contains the specified extension. *

getUserById(userId)

Retrieves the user instance by the specified user ID, or null if the user does not exists.

Session class methods:
blindTransfer(transferor, phoneNumber)

Uses blind transfer to transfer the call to another party. *

close()

Closes the session, terminating the call. *

closeWithHangup()

Closes the session by calling HANGUP. *

forward(phoneNumber)

Forwards the session to another party. *

hangup()

Calls HANGUP on the session, terminating the call.*

hold()

Holds both call parties. *

sendDtmf(key, phoneNumber)

Sends a DTMF signal to one of the call parties. *

startListen()

Starts a listening session e.g. lets you listen to the ongoing call. *

stopListen()

Stops the current listening session. *

unhold()

Unholds both call parties. *

* Can only be used if the connected webclient has the required privilege.

3: JavaScript API events

Below you can see a detailed reference book of events we made for the JavaScript API.

EventDescription
OzWebClient class events:
OzWebClient.onCallHistoryInfoReceivedThis event occurs when the result of the query initiated from the getCallHistory function has been received.
OzWebClient.onClientStateChangedThis event occurs when the state of the webclient changes.
OzWebClient.onConnectionStateChangedThis event occurs when the state of the connection changes.
OzWebClient.onErrorOccuredThis event occurs if an error message has been received from Ozeki Phone System.
OzWebClient.onExtensionInfoReceivedThis event occurs when the webclient receives information about an extension.
OzWebClient.onExtensionRemovedThis event occurs when the webclient receives information about an extension which has been removed.
OzWebClient.onIncomingCallThis event occurs when the webclient receives an incoming call.
OzWebClient.onSessionCreatedThis event occurs if a new Session has been created e.g. a new session has started in Ozeki Phone System.
OzWebClient.onSessionClosedThis event occurs when an active session has been closed.
OzWebClient.onUserInfoReceivedThis event occurs when the webclient receives information about a user.
OzWebClient.onUserRemovedThis event occurs when the webclient receives information about a user being removed from Ozeki Phone Sytem XE.
OzWebClient.onWebphoneStateReceivedThis event occurs when the state of the webphone is received.
Call class events:
onCallStateChangedThis event occurs when the state of the call changes. Callstates: "RINGING", "NOT_FOUND", "REJECTED", "HOLD", "IN_CALL", "COMPLETED", "BUSY" and "ANSWERED".
onMessageReceivedThis event occurs when a message is received.
Extension class events:
onExtensionStatusChangedThis event occurs when the status of the extension has changed.
Session class events:
onSessionStateChangedThis event occurs when the state of an active session has changed.

If you have any questions or need assistance, please contact us at  info@ozekiphone.com