Saturday, February 14, 2015

Freeswitch installation on CentOs, Amazon, Google Compute Engine

First check the dependencies on Freeswitch wiki if not go with this!

$ yum install git gcc-c++ autoconf automake libtool wget python ncurses-devel
zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel 
pcre-devel speex-devel ldns-devel libedit-devel

Allow the default 
RTP 10000-20000 UDP port
SIP port 5060-5061, 5080-5081
websocket ws and wss port maybe 5066 or 8081, 7334
in IPtables and Firewalls


Choose a location to install

$ cd /usr/src/

Install git command and take the latest source from git hub

$ git clone https://freeswitch.org/stash/scm/fs/freeswitch.git

$ cd /usr/src/freeswitch

# The -j argument spawns multiple threads to speed the build process$ ./bootstrap.sh -j

# if you want to add or remove modules from the build, edit modules.conf
vi modules.conf
# add a module by removing '#' comment character at the beginning of the line
# remove a module by inserting the '#' comment character at the beginning of the line containing the name of the module to be skipped
 
$ ./configure -C

make && make install



Install Sounds
CD-Quality Sounds
$ make cd-sounds-install
$ make cd-moh-install

Set Owner and Permissions
# create user 'freeswitch'
# add it to group 'daemon'
# change owner and group of the freeswitch installation
$cd /usr/local
$useradd --system --home-dir /usr/local/freeswitch -G daemon freeswitch
$passwd -l freeswitch

$chown -R freeswitch:daemon /usr/local/freeswitch/
$chmod -R 770 /usr/local/freeswitch/
$chmod -R 750 /usr/local/freeswitch/bin/*

$mkdir /var/run/freeswitch
$chown -R freeswitch:daemon  /var/run/freeswitch


Start FreeSWITCH

$cd /usr/local/freeswitch/bin
$./freeswitch

or

EXPORT the path to
vim ~/.bash_profile

PATH=$PATH:$HOME/bin:/usr/local/bin:/usr/local/freeswitch/bin

Now start it by
$freeswitch -ncwait 
Connect back again to console using
$fs_cli

Configuration Edits
$ cd /usr/local/freeswitch/conf/sip_profiles

remove vp6 files and dir if you don't use it

Just leave external  external.xml  internal.xml  files alone

Internal xml is the sip user reg place
go to fs_cli
cli>reload mod_sofia   ---> to show internal profile in sofia status

$ vim internal.xml
change below tags

<param name="context" value="default"/>  to route all the SIP invites to user agent directory in directory

<param name="apply-nat-acl" value="rfc1918"/>

<param name="aggressive-nat-detection" value="true"/>
<param name="apply-inbound-acl" value="domains"/>
<param name="presence-hosts" value="your-external-ip"/>
<param name="multiple-registrations" value="true"/>
<param name="inbound-zrtp-passthru" value="true"/>
<param name="NDLB-broken-auth-hash" value="true"/>
<param name="NDLB-broken-auth-hash" value="true"/>
<param name="NDLB-received-in-nat-reg-contact" value="true"/>
<param name="auth-calls" value="true"/>
<param name="ext-rtp-ip" value="$${external_rtp_ip}"/>
<param name="ext-sip-ip" value="$${external_sip_ip}"/>
        
<param name="force-register-domain" value="your-external-ip"/>
<!--force the domain in subscriptions to this value -->
<param name="force-subscription-domain" value="your-external-ip"/>
<!--all inbound reg will stored in the db using this domain -->
<param name="force-register-db-domain" value="your-external-ip"/>

<!-- uncomment for sip over websocket and webrtc support --
<param name="ws-binding"  value=":8081"/>


Now change external sip and rtp ips in var..xml
$ cd /usr/local/freeswitch/conf/vars.xml 
 <X-PRE-PROCESS cmd="set" data="default_password=yourwish"/>
 <X-PRE-PROCESS cmd="set" data="bind_server_ip=your-external-ip"/>
 <X-PRE-PROCESS cmd="set" data="external_rtp_ip=your-external-ip"/>
 <X-PRE-PROCESS cmd="set" data="external_sip_ip=your-external-ip"/>
         

then comment all the default values in
data="default_provider

Change the PRT ports range if needed in 
$ vim /usr/local/freeswitch/conf/autoload_configs/switch.conf.xml

<!-- RTP port range -->
    <param name="rtp-start-port" value="10000"/>
    <param name="rtp-end-port" value="20000"/>


Change the domains in acl.xml in autolaod dir if needed!

Finally relaodxml and restart the server to take effect

use Freeswitch Rosetta Stone guide if you're familiar with asterisk cli commands

use eval command to check the variable values in fs_cli
   cli> eval $${domain}

user sofia commad to see all profile related queires
  cli> sofia show profile internal   ---> to see the full profile status
  cli> sofia show profile internal reload --->to reload the profile
  cli> sofia show profile internal reg  ---> to see the sip registered
  cli> shutdown     ---> to shutdown the server
  cli>reloadxml     ---> to check and save the edited xml files
  cli>load or unload or reload mod_ sofia    ---> to fix SIP reg errors
 




2 comments:

  1. Really good information to show through this blog. I really appreciate you for all the valuable information that you are providing us through your blog. Google cloud computing online training Bangalore

    ReplyDelete
  2. Nice work, your blog is concept-oriented, kindly share more
    AWS Online Training

    ReplyDelete

CSS tricks

Mixed paint in background: background: linear-gradient(to right, #b6e358, #38b143) Grid view: display: grid; grid-template-columns: a...