Guides

Disclaimer

This version of FreeSWITCH is considered end of life, and we will no longer work to support it. You should consider upgrading to FreeSWITCH 1.6 or later.

Configure FreeSWITCH

SIP.js has been tested with FreeSWITCH 1.5.14 without any modification to the source code of SIP.js or FreeSWITCH.

System Setup

FreeSWITCH and SIP.js were tested using the following setup:

Required Packages

Install the following dependencies:

Using YUM, all dependencies can be installed with:

yum install git autoconf automake libtool gcc-c++ libuuid-devel zlib-devel libjpeg-devel ncurses-devel openssl-devel

Install FreeSWITCH

FreeSWITCH recommends using the latest version of FreeSWITCH from the FreeSWITCH git repo. This example uses FreeSWITCH tag v1.5.14.

Configure FreeSWITCH

The default configuration files for FreeSWITCH are located in /usr/local/freeswitch/conf.

Start by editing the internal SIP profile sip_profiles/internal.xml. Uncomment the line <param name="ws-binding" value=":5066"/> to allow web sockets to talk to FreeSWITCH. No other configuration changes are necessary to make FreeSWITCH work with WebRTC.

<!--internal.xml-->
<!-- Uncomment the following: -->
<param name="ws-binding"  value=":5066"/>

If you’d like to enable video as well as audio, adjust FreeSWITCH’s codec preferences to include VP8.

<!--vars.xml-->
...
<X-PRE-PROCESS cmd="set" data="global_codec_prefs=PCMU,PCMA,VP8">
<X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=PCMU,PCMA,VP8">
...

Start FreeSWITCH: /usr/local/freeswitch/bin/freeswitch.

Configure SIP.js

SIP.js works with FreeSWITCH without any special configuration parameters. The following UA is configured to connect to a default FreeSWITCH configuration. Replace 127.0.0.1 with the IP address of your FreeSWITCH server.

var config = {
  // Replace this IP address with your FreeSWITCH IP address
  uri: '1000@127.0.0.1',

  // Replace this IP address with your FreeSWITCH IP address
  // and replace the port with your FreeSWITCH port
  ws_servers: 'ws://127.0.0.1:5066',

  // FreeSWITCH Default Username
  authorizationUser: '1000',

  // FreeSWITCH Default Password
  password: '1234'
};

var ua = new SIP.UA(config);

Troubleshooting

It is known that SIP.js and FreeSWITCH might not interop well if you have the following option enabled on FreeSWITCH:

<variable name="sip-force-contact" value="NDLB-connectile-dysfunction"/>

Firefox 34+ requires SIP.js 0.6.4 or later to interop with FreeSWITCH or Asterisk.

FreeSWITCH has a confluence article on WebRTC support.