AculabCloudCaller javascript interface



Creates an AculabCloudCaller object. A page can have more than one AculabCloudCaller at a time.

AculabCloudCaller object functions

boolean isSupported()

Returns true if the browser supports the necessary functionality and false if not.

void makeCall(cloudid, servicename, callerid)

cloudid is the identifier of the Aculab Cloud that is hosting the incoming service (e.g. 1-2-0).
servicename is the name of the Aculab Cloud incoming service that the call will be connected to.
callerid is the value that will be placed in the call_from field in the call details of the application's main channel.
Callerid must be a valid SIP URI 'user' element, see RFC 3261 - Section 25 for details.

This initiates the call to the specified Aculab Cloud incoming service. Call progress is reported by the callbacks, so these should be set before calling this function.

This throws a string exception if:

void sendDtmf(dtmf_str)

dtmf_str is a string containing the DTMF digits to be sent. These are 0,1,2,3,4,5,6,7,8,9,*,#,A,B,C and D.

This throws a string exception if there is an invalid digit in the string. There is no return value.

void disconnect()

Disconnects any existing call. This can be called at any time.

void attachMediaStreamToElement(element, stream)

Attaches the media stream stream to the <audio> element. It does not force the element into the playing state.
This is a helper function to deal with the different ways browsers currently handle attaching media streams to <audio> elements. You may use your own code to perform this action. However, if you have used this function then detachMediaStreamFromElement() must be called when the call disconnects to ensure all resources can be released.

void detachMediaStreamFromElement(element)

Detaches any current media stream from the <audio> element. This should be called when the call disconnects to ensure the resources are released.

AculabCloudCaller data properties


Must be null or an array of RTCIceServer objects. If used, this must be set before calling makeCall().


Must be a numeric value between 0 and 3 inclusive. 0 disables logging.

AculabCloudCaller callback properties

Each of these callback properties must be either null or a function. The function will be passed a single object parameter. Additional information may be included as properties of that object. All such properties are detailed below.


The call has disconnected.

The parameter object will have the following properties:
causeOne of the following strings:
no microphone is available to the AculabCloudCaller, usually because the user refused access or there is no microphone.
the incoming service called hangup() with the busy cause or the service could not be started (due to limited UAS capacity, for example)
the specified incoming service name does not exist
the incoming service attempted to redirect the call
the call was rejected either by the incoming service or an intermediary
the call did not connect
the call was unsuccessful for some other reason
an internal error occurred.
the call has disconnected in the normal way after having connected


The incoming service has signalled that the call is ringing.


Called when remote media is available to be rendered to the user.

The parameter object will have the following properties:
streamA MediaStream object suitable for passing to the attachMediaStreamToElement() function above.


Called once the local microphone input has been obtained and the connection to the Aculab Cloud has been established. The browser will now start to prepare the sockets needed to transport the call media. Once this has been done, the request to start the incoming service will be sent.


Called when the incoming service has answered the call.


Called when an internal error has occurred.

The parameter object will have the following properties:
errorA string describing the error that has occurred.