Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

JavaScript API Reference

emannion edited this page Oct 18, 2011 · 20 revisions

JavaScript API Reference

Initialization and Configuration

  • window.navigator.service.call

For example - "let ikran = window.navigator.service.call". If the variable "ikran" is then null, Firefox was unable to load the add-on.

P2P SIP Mode

  • startP2PMode(dn, callback)

Starts listening for incoming call by binding on port 5060 (changeable by setProperty of LocalVoipPort). Prepares system for placeP2PCall(). "dn" is an identifier for the call, like "1001", and will be used by the other peer in the call to placeP2PCall().

  • placeP2PCall(dn, ip, ctx, callback)

Initiates a call to a peer listening with startP2PMode(). "dn" is the identifier used by peer, and "ip" is address of peer.

Using SIP Proxy Server

  • registerUser(devicename, dn, password, proxyip, callback)
  • placeCall(dn, ctx, callback)

Answering

  • answerCall(ctx, callback)

DTMF

You must be on an active call to send DTMF digits. Can send one or many digits using sendDigits.

  • sendDigits(digits)

Property API's

You can get or set properties using setProperty and getProperty. The properties "localvoipport" and "remotevoipport" are used for configuring the client in peer to peer mode. The property transport can be set to tcp or udp. Asterisk and Kamailio prefer setting the transport to udp but CUCM prefers tcp.

  • setProperty(propertyLiteral)

e.g. Me.setProperty({"localvoipport": 5061, "remotevoipport": 5061});

  • getProperty(property)

e.g. var version = Me.getProperty("version");

Hold\Resume

You must be on an active call before you can place a call on hold.

  • holdCall()

  • resumeCall()

Shutdown

  • hangupCall()
  • unregisterUser()