domenica 15 gennaio 2012

Handle voip customers with Siproxd on CentOS 5.7



Install Libosip2


cd /usr/local/src
wget http://www.antisip.com/download/exosip2/libosip2-3.5.0.tar.gz
tar xvf libosip2-3.5.0.tar.gz
yum install gcc
cd libosip2-3.5.0
./configure
make
make install
ll /usr/local/lib



Create a new file in /etc/ld.conf.d


echo "/usr/local/lib" > /etc/ld.conf.d/local.conf
ldconfig



Install Siproxd


cd /usr/local/src
wget http://sourceforge.net/projects/siproxd/files/siproxd/0.8.1/siproxd-0.8.1.tar.gz/download
tar xvf siproxd-0.8.1.tar.gz
cd siproxd-0.8.1/
./configure --with-libosip-prefix=/usr/local/lib
make
make install



Do this:


yum remove gcc

Create siproxd user:


useradd -c "Siproxd user" -r -s /bin/nologin siproxd

Basic Siproxd configuration:


vim /etc/siproxd_customer-name.conf


if_inbound = eth0
if_outbound = eth0


sip_listen_port = 5070
daemonize = 0
silence_log = 1
user = siproxd


hosts_allow_reg = 11.22.33.44/16


registration_file = /var/lib/siproxd/siproxd_registrations
autosave_registrations = 300
pid_file = /var/run/siproxd/siproxd.pid


outbound_proxy_host = voip.provider.example.com
outbound_proxy_port = 5060


rtp_proxy_enable = 0
rtp_port_low = 27000
rtp_port_high = 27100
rtp_timeout = 300
rtp_dscp = 46
sip_dscp = 0
rtp_input_dejitter = 0
rtp_output_dejitter = 0
tcp_timeout = 600
tcp_connect_timeout = 500
tcp_keepalive = 20


debug_level = 0x00000000
debug_port = 0

Start siproxd:


/usr/local/sbin/siproxd

Some explanations:
if_inbound/if_outbound - It's the same interface (eth0) because we just have one
hosts_allow_reg - Put here your customer IP (if he has a static one) with the right mask (/16, /24..); you can calculate the mask using a subnet calculator (http://www.subnet-calculator.com)
rtp_proxy_enable = 0 - We just want to proxy the signaling protocol (SIP) not the audio stream (RTP)
outbound_proxy_host - Put here the customer voip provider that you want to connect to

Before setup asterisk, try siproxd configuration using a softphone such as twinkle, ekiga.. It's better a softphone which includes a "Outbound Proxy" field. Twinkle does the trick.

Twinkle example configuration_
User Tab:
User name* = user ID for voip.provider.example.com
Domain* = user ID for voip.provider.example.com
Authentication Name = password for voip.provider.example.com

SIP server Tab:
check on Use Outbound Proxy
Outbound Proxy = your.siproxd.server:5070

If something goes wrong revisit you siproxd configuration running siproxd in debug mode:


/usr/local/sbin/siproxd -c /etc/siproxd_customer-name.conf -d -1 2

NOTE: do different "/etc/siproxd_customer-name.conf" files to give to each siproxd instance you need.


Asterisk trunk configuration
(on the customer PBX)


contact="user ID for voip.provider.example.com"
context=from-trunk
fromuser="user ID for voip.provider.example.com"
outboundproxy="your.siproxd.server:5070"
type=peer
nat=never
host="your.siproxd.server"
port=5070
insecure=very
secret="password for voip.provider.example.com"
username="user ID for voip.provider.example.com"

NOTE: i'm currently still testing this setup. It works pretty fine, but i cant hide some weird behavior with asterisk trunk. For instance, it's easy encounter a voip congestion placing 2 calls one after another. Using siproxd directly with twinkle doesn't. Given this, the trunk works. Any tips will be appreciate

Nessun commento:

Posta un commento