Thursday, 11 February 2016 16:33

SIPml5 Installed on Raspberry Pi 2 Asterisk Server

Written by 
Rate this item
(0 votes)

SIPml5 running on my Asterisk / FreePBX Raspberry Pi 2 server

WebRTC calling directly on my Asterisk Server

I built an Asterisk / FreePBX server on my Raspberry Pi 2 using the RasPBX image.  Today I installed and modified SIPml5 to auto register when ever I log in.

I'm using the RasPBX image on my Raspberry Pi 2.  It is based on the raspbian-jessie image.  I initially attempted to install SIPml5 webphone through the repo, apt-get install sipml5-web-phone, but I was not able to get audio to work.  I didn't do much troubleshooting, as soon as I noticed that it was a much older version than what is available through googlecode.  I removed it, and downloaded SIPml5 from googlecode instead.

I have Asterisk and FreePBX running on my Raspberry Pi 2.  This article describes how I installed SIPml5 locally, so I can login through my web browser, register to my Asterisk server, and make calls.  The details should help out anyone running Asterisk (specifically Asterisk 11).  This does not provide details on setting up Asterisk to communicate properly with SIPml5, you can read on how to do it in my guide: WebRTC / Asterisk Support Guide

 

Download and Install SIPml5 WebPhone

 SSH into your Raspberry Pi using the command line or software like putty.  Your login maybe different, I used root as the default for RasPBX image I am using.

ssh root@raspbx

 

Using svn, download the latest sipml5 version.  This will put it directly into a folder accessible from the web browser.  Depending on your webserver on your specific device, the directory structure maybe different.  I'm using (RasPBX/Raspbian), so my root web directory is /var/www/html/ , but it may be /var/www/ on different webservers.

svn checkout http://sipml5.googlecode.com/svn/trunk/ /var/www/html/sipml5-web-phone

Open your browser and goto your server IP/Hostname /sipml5-web-phone/, in my case it was http://raspbx/sipml5-web-phone/, you should see the SIPml5 front "Try our Demo" page.

sipml5 asterisk raspberry pi 05

 

I don't want the front demo page, I just want to go straight to the phone, so I moved the files around.

mv /var/www/html/sipml5-web-phone/index.html /var/www/html/sipml5-web-phone/index.html.old
cp/var/www/html/sipml5-web-phone/call.htm /var/www/html/sipml5-web-phone/index.html

 

I also wanted to make some changes to the new  index.html file

  • Hardcode registration details, so auto populates the requred login for that specific extension (6001), but has ability to change after page is loaded, and wil revert back to 6001 with another page load.
  • auto register when I load the page to my local Asterisk server under that specific account I hardcoded.
  • disable video calling (I only plan on using this for audio testing purposes)

Here is what the page looks like now

sipml5 asterisk raspberry pi 06

I didn't re-write the entire page, and it's far from proper as I only removed or added code to make it work the way I wanted it to.  I added a few variables towards the top of the file to add my hardcoded registration details,

sipml5 asterisk raspberry pi 07

Good Luck!

 

Troubleshooting

- Websockets and localhost

I spent an hour or two trying to use localhost for my websocket field under the Expert Mode for SIPml5.  The ONLY way I could get it to work, was if I put in the actual IP address of the Asterisk server (ws://192.168.138.60:8088/ws vs ws://localhost:8088/ws)  I changed what networks the Asterisk webserver would listen on (switching between 0.0.0.0 or :: or 127.0.0.1) Using 0.0.0.0 should allow any IPv4, :: should allow and IPv4 and IPv6, and 127.0.0.1 should allow only local.  I also attempted to include an HTTP prefix (asterisk) in case of my Apache server was getting in the way somehow and changing the websocket address accordingly, (ws://locahost:8088/asterisk/ws).  Making my changes in FreePBX, after Apply Config, I was able to verify that the Asterisk server was listening on the networks I was changing it to.

netstat -ln

Here you can see listening on 0.0.0.0 for port 8088

sipml5 asterisk raspberry pi 02

confirm Asterisk webpages

asterisk -rx "http show status"

Here you can see when I added the asterisk HTTP prefix to the server and changed from 0.0.0.0 to listening on :;

sipml5 asterisk raspberry pi 03

and I also checked to make sure the websocket was listening and responding properly, using netcat

printf "GET /asterisk/ws HTTP/1.1\r\n\r\n" | nc localhost 8088

The same expected output from localhost or IP address

sipml5 asterisk raspberry pi 04I plan on running tcpdump and go through to see exactly what's happening, but that'll be for another article...

 

 

References:

Raspberry Pi Model:
Raspberry Pi 2 Model B
Raspberry Pi Image:
Raspbx Beta raspbx-25-01-2016
cat /etc/*-release:
Raspbian GNU/Linux 8 (jessie)
Kernel:
4.1.15-v7+ GNU/Linux
Apache:
Apache/2.4.10 (Raspbian)
Asterisk:
Asterisk 11.21.0
FreePbx:
FreePBX 13.0.51
SIPml5:
Revision 230

 

https://www.doubango.org/sipml5/

 

 

 

Read 4529 times Last modified on Friday, 12 February 2016 18:30
Algis Salys

Creator and owner of algissalys.com.  Linux enthusiast, electronics tinkerer, and likes to spend time in the workshop building and creating new projects.