Index

Getting started

Loading and initializing the plugin

Accessing the enumeration values from the plugin

To access the enumeration values that need to be passed as arguments and/or returned by the plugin methods and properties you need to include the linphone.js file that is delivered in the SDK package in your project.

Loading the plugin

TODO

Initializing the plugin

To initialize the plugin, call the init method of the core object:

core.init();

For more information, see the documentation of the init() method of LinphoneCore.

Registering the callback handlers

To be able to handle events coming from the plugin, some callback handlers need to be registered. Here is an example with a function displaying the call state changes in the javascript console:

function onCallStateChanged(event, call, state, message) {
	console.log(message);
}
addEvent(core, "callStateChanged", onCallStateChanged);

Starting iterate timer

core.iterateEnabled = true;

Where to go from here?

All the operations are then performed by calling methods of the core plugin object. The core object has methods to create new objects such as LinphoneAddress, LinphoneAuthInfo, LinphoneFriend...

How to register to a SIP server?

function registration(username, password, server) {
	var core = getCore();
	var proxy = core.newProxyConfig();
	var authinfo = core.newAuthInfo(username, null, password, null, null);
	core.addAuthInfo(authinfo);
	proxy.identity = 'sip:' + username + '@' + server;
	proxy.serverAddr = 'sip:' + server;
	proxy.expires = 3600;
	proxy.registerEnabled = true;
	core.addProxyConfig(proxy);
	core.defaultProxy = proxy;
}

For more information about the registration process, look at the documentation of the LinphoneProxyConfig and LinphoneAuthInfo objects.

How to initiate an outgoing call?

Here is a simple javascript function to initiate an outgoing call:

function call(addressStr) {
	var core = getCore();
	var address = core.newAddress(addressStr);
	if (address !== null) {
		core.inviteAddress(address);
	}
}

For more information about calls, look at the documentation of the LinphoneAddress and LinphoneCall objects.

How to initiate an outgoing call with custom SIP headers?

Here is an example showing the use of the custom SIP headers when initiating an outgoing call.

function callWithCustomHeaders(addressStr) {
	var core = getCore();
	var params = core.createDefaultCallParameters();
	if (params !== null) {
		params.addCustomHeader("Weather", "bad");
		params.addCustomHeader("Working", "yes");
		var headerValue = params.getCustomHeader("Weather"); // headerValue = "bad"
	}
	var address = core.newAddress(addressStr);
	if (address !== null) {
		core.inviteAddressWithParams(address, params);
	}
}

For more information about custom SIP headers, look at LinphoneCallParams.addCustomHeader and LinphoneCallParams.getCustomHeader.

How to handle presence?

Your own presence and the presence of your friends are handled by the LinphonePresenceModel object. Some helper properties and methods are there to handle the basic cases of presence, that is to say having a single activity.

For example to set your own presence to "on-the-phone":

function onThePhone() {
	var core = getCore();
	var presenceModel = core.presenceModel;
	presenceModel.setActivity(linphone.PresenceActivityType.OnThePhone, null);
	core.presenceModel = presenceModel;
}

The same can be done with more control by creating the whole presence model manually. Here is the same example but doing everything manually:

function onThePhone() {
	var core = getCore();
	var model = core.newPresenceModel();
	var service = core.newPresenceService(null, linphone.PresenceBasicStatus.Closed, null);
	model.addService(service);
	var person = core.newPresencePerson(null);
	var activity = core.newPresenceActivity(linphone.PresenceActivityType.OnThePhone, null);
	person.addActivity(activity);
	model.addPerson(person);
	core.presenceModel = model;
}

This is basically the same for the presence of your friends except that you cannot modify it. So you can access the presence information of a friend with some helper properties and methods:

function printFriendPresence(lf) {
	var model = lf.presenceModel;
	if (model !== null) {
		console.log("Basic status: " + model.basicStatus);
		console.log("Activity: " + model.activity);
	} else {
		console.log("Friend " + lf.name + " is offline.");
	}
}

But you can also explore the whole presence model manually. To see all the methods and properties to do this, look at the documentation of the LinphonePresenceActivity, LinphonePresenceModel, LinphonePresenceNote, LinphonePresencePerson and LinphonePresenceService objects.

Compilation

Prerequisites

Common

  • python (2.7)
  • python-M2Crypto (for python 2.7): Used for signing
  • cmake (2.8.2 or greater)
  • java (used for packaging)
  • openssl
  • awk (on Windows get it from http://gnuwin32.sourceforge.net/packages/gawk.htm and add it to your PATH environment variable)
  • patch (on Windows get it from http://gnuwin32.sourceforge.net/packages/patch.htm and add it to your PATH environment variable)
  • Make sure you have cloned the linphone-web-plugin repository recursively. If this is not the case, get the submodules:

    git submodules update --recursive --init

Windows platform

  • Visual studio C++ 2010
  • Windows Driver Kit Version 7.1.0 (http://www.microsoft.com/en-us/download/details.aspx?id=11800)
  • WiX to generate the MSI installer (http://wixtoolset.org/). Use the version 3.7, newer versions do not work as of now.
  • MinGW32 (http://mingw.org/) You need to install mingw-developer-toolkit, mingw32-base, mingw32-gcc-g++ and msys-base in the "Basic Setup". Make sure to follow the post-installation instruction from http://mingw.org/wiki/Getting_Started#toc2.
  • nasm (http://www.nasm.us/)

Linux platform

  • X11 dev
  • chrpath

Mac OS X platform

  • Xcode
  • Mac ports (for python and modules)

Firebreath

FireBreath aims to be a cross-platform plugin architecture. You have to download the last stable version using git:

git clone git://git.linphone.org/firebreath.git -b firebreath-1.7 --recursive

Place linphone-web-plugin project in the ./projects/ directory at the firebreath root (create it if doesn't exist). Follow the Firebreath documentation following the used system for compiling linphone-web.

Compile

Follow firebreath document in order to compile linphone-web plugin. The generated files can be found in ./build/bin directory inside Firebreath project root.

Windows

You have to add python, openssl and WiX in the PATH environment variable. Make sure you are building with Visual Studio 2010, using the prep2010.cmd script. If you want to compile in Debug mode, use the command line:

prep2010.cmd projects\linphone-web-plugin build "-DWITH_DYNAMIC_MSVC_RUNTIME=1" "-DCMAKE_BUILD_TYPE=Debug"

and then use the Debug configuration in Visual Studio. If you want to compile in Release mode, use the command line:

prep2010.cmd projects\linphone-web-plugin build "-DWITH_DYNAMIC_MSVC_RUNTIME=1"

and then use the Release configuration in Visual Studio.

Mac OS X

Don't use XCode directly it doesn't use corrects environment and target architectures. For configuring the firebreath, use the following command:

./prepmac.sh -DCMAKE_OSX_DEPLOYMENT_TARGET="10.6" -DCMAKE_OSX_ARCHITECTURES="i386"

This is permit the plugin to run on older version of Mac OS X than the one you use and force only one architecture. After enter in ./build/ directory of Firebreath and run the following command:

xcodebuild -arch i386

Sign

In order to sign each produced container you have to copy in ./sign/ directory at the linphone-web project root (create it if doesn't exist) the following files:

  • linphoneweb.pfx: The file containing private/public keys and the certificate (only for active-x part)
  • linphoneweb.pem: The file containing private/public keys and the certificate
  • passphrase.txt: The password used for open the two previous files (can be added just before compile and remove after)

License

Linphone Web - Web plugin of Linphone an audio/video SIP phone
Copyright (C) 2012-2013 Belledonne Communications

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

Full terms of GPLv2 is available in COPYING file.

Any web application or web site making use of the Linphone-web plugin is considered by copyright owners as "work based on the Program" according the GPL terminology. As a result, such web app or web site shall be licensed under the GPLv2 or later.

Proprietary licensing is available from http://www.belledonne-communications.com .