Tuesday, August 7, 2012

FreeSWITCH, making calls via web-browser [using mod_rtmp]

Finally back to blog after a longtime. Continuing from the FreeSWITCH stuff. I learned about the RTMP module which enables us to connect to the FreeSWITCH server via web browser and make calls just like any other Soft-phone.

This is wonderful, I don't need to install any soft-phone or anything, just open up my FS server RTMP phone page - login using my SIP credentials and once authenticated make calls !! simple.

In order to get it working I went back to the source directory of Freeswitch and just compiled thertmp module. Learn more about the FreeSWITCH RTMP Module from this link.

root@FS_HA1#cd /usr/src/freeswitch
root@FS_HA1#make mod_rtmp && make mod_rtmp install

once compiled and installed successfully, enable the rtmp module to be loaded automatically by freeswitch.

root@FS_HA1#cd /usr/local/freeswitch/conf/autoload_configs/

root@FS_HA1#vim modules.conf.xml

Uncomment by removing the "<!--" and "-->"

<load module="mod_rtmp"/>

Save and exit from the file after uncommenting.

Goto FreeSwitch console.


Since my freeswitch was already started so to load RTMP module either I need to restart my Freeswitch server or I can just load the module from the console just like this.

freeswitch@internal> load mod_rtmp

It will print lots of output lines on console. Once loaded successfully edit the module settings to your choice.

root@FS_HA1#cd /usr/local/freeswitch/conf/autoload_configs/

root@FS_HA1#vim rtmp.conf.xml

I didn't need to change anything so I just simply reviewed the rtmp.conf.xml file and exited.

Now, time to copy the web-phone from the source directory to the web root.

root@FS_HA1#cd /usr/src/freeswitch/clients/

root@FS_HA1#cp -rf flex/ /var/www/html/

Now we need to edit the html file and change one small thing there.

root@FS_HA1#vim /var/www/html/flex/freeswitch.html

We need to change the rtmp url to that of our server's public IP.
var flashvars = {
      rtmp_url: 'rtmp://'

Save and exit, now open your browser and type down this URL.

You;ll see a sample dialer. Login using your SIP credentials and if asked for allowing the browser to use your webcam/microphone/speaker accept it.

After successful login you should be able to make calls given the context your user is assigned to is configured likewise.


  1. Thanks. This is very cool!
    Can I call from SIP to "web-phone" on page?

    1. Well Yeah. But I will suggest you to look into WebRTC for this purpose now.

    2. WebRTC isn't ready yet. Its partially supported in Chrome/FF...why do you think hangouts still uses a plugin?