Version: Smart Feature Phone 3.0

Telephony service

Instanciating the service#

Load the following scripts:

<script src=""></script>
<script src=""></script>
<script src=""></script>

You can then get an instance of the service with code similar to:

const session = new lib_session.Session();
const sessionstate = {};
let _telephonyManager = null;
sessionstate.onsessionconnected = function () {
console.log(`Telephony onsessionconnected`);
lib_telephony.Telephony.get(session).then((TelephonyService) => {
console.log(`Got Telephony : #TelephonyService.service_id}`);
_telephonyManager = TelephonyService;
}).catch((e) => {
console.log(`Error calling Telephony service${JSON.stringify(e)}`);
_telephonyManager = null;
sessionstate.onsessiondisconnected = function () {
console.log(`Telephony onsessiondisconnected Daemon Crashed`);
// On desktop version, set ENV WS_RUNTIME_TOKEN=secrettoken'websocket', 'localhost', 'secrettoken', sessionstate, true);

Then the developer can use _telephonyManager as Telephony service instance.

This service implements the TelephonyManager interface.

CallState enumeration#


TelephonyManager Interface#



callState is of type CallState

To get value, use code similar to:

_telephonyManager.callState().then(value => { ... });

To set value, use code similar to:

_telephonyManager.callState = value;



The CALLSTATE_CHANGE event emits a CallState

To manage this event, use code similar to:

function handleEvent(value) {
_telephonyManager.addEventListener(_telephonyManager.CALLSTATE_CHANGE_EVENT, handleEvent);
_telephonyManager.removeEventListener(_telephonyManager.CALLSTATE_CHANGE_EVENT, handleEvent);

Sample code#

New APIs sample code