Tuesday, July 30, 2013

PJSIP library package for Ubuntu

I find it pretty annoying to compile PJSIP on all hosts that I use by hand.
It is quite error-prone and the procedure is quite time-consuming.

So, I created the scripts to setup an Ubuntu packet (at the moment only 13.04). It is available as PPA here: https://launchpad.net/~dennis.guse/+archive/sip-tools

On Ubuntu do the following:
sudo add-apt-repository ppa:dennisguse/sip-tools
sudo apt-get update
sudo apt-get install libpjsip-dev python-pjsip

Features:
* Python-bindings
* SSL

Missing Features:
* Video (some dependencies are missing in Ubuntu 13.04 and will come with 13.10).

Friday, July 26, 2013

Reverse proxy with CORS usin Apache2

For the implementation of a Javascript-Client, I needed a CORS enabled reverse-proxy.

Here is one using apache2 (Virtual Host):
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so 
LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so


 ProxyRequests Off

 ProxyPass / http://SERVER
 ProxyPassReverse / http://SERVER

 Header set Access-Control-Allow-Origin "*"
 Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept"

Here is one using apache2 (.htaccess): mod_rewrite and mod_headers must be loaded.
RewriteEngine  On
RewriteBase /
RewriteRule  (.*)  http://SERVER/$1  [P,L]

 Header set Access-Control-Allow-Origin "*"
 Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept"
PS: Be aware of the security implications!