CommandFusion iViewer v5
Scripting Documentation

Table of contents

SIP API

iViewer 5 and later on iOS supports SIP audio and video calls. Interaction with iViewer's SIP systems typically occurs by sending commands over to the system, and by listening to feedback it sends. In some cases getting events can be convenient, like when coming back from background.

Events

CF.SIPCallEvent

This event is fired when a SIP call changes state. You currently can get notified when a call rings, is connected and is disconnected. The primary purpose of the event is to notify the Javascript code after a user pressed the Answer button in a call notification alert that was displayed while the application was in background.

Example:

CF.userMain = function() {
    // Start watching SIP call events
	CF.watch(CF.SIPCallEvent, CF.SIPCallRingingIncoming, onSIPCallEvent);
	CF.watch(CF.SIPCallEvent, CF.SIPCallRingingOutgoing, onSIPCallEvent);
	CF.watch(CF.SIPCallEvent, CF.SIPCallConnected, onSIPCallEvent);
	CF.watch(CF.SIPCallEvent, CF.SIPCallDisconnected, onSIPCallEvent);
};

function onSIPCallEvent(event, system, callID, oppositeNumber) {
	CF.log("SIP call event="+event+" system="+system+", callID="+callID+", number="+oppositeNumber);
}

Functions

CF.setSystemProperties(systemName, changes)

The CF.setSystemProperties function allows you to set properties for remote systems. Systems of SIP type expose a number of specific properties you can use to control the behavior of your connection to a SIP gateway. Please refer to the CF.setSystemProperties for base syntax and examples.

General SIP properties
Audio-Video encoders SIP properties
Background incoming calls management

The backgroundIncomingCall object describes how the software should handle incoming SIP calls while the application is not frontmost. Options are to show an alert, automatically decline the call or do nothing (let the call follow up to voicemail if configured at the SIP gateway).

All fields are optional with default values and are as follows:

Notes on background incoming calls

When the application is in background and has been configured to display an alert on incoming call, the answer button will ask the system to open the application and put it frontmost. Then your Javascript will receive a CF.SIPCallEvent with a CF.SIPCallRingingIncoming subevent. From then on, you can take the decision to answer the call by sending the appropriate command to the SIP system.

Use the flipToPage and raiseJoin properties to automatically switch to a specific page / display a subpage upon user pressing the Answer button on an incoming SIP call alert.