Freeswitch HowTo2

From Osgrid Wiki
Jump to: navigation, search

This tutorial has been originally writen by Carlos Roundel, owner of Cyberlandia, italian grid.This tutorial is under Creative Commons License [BY-SA]

Here is an english translation by Oliver Battini


1. Preparing environment

Let’s prepare the environment. We are here running Ubuntu 8.04.2 Server.

apt-get update

apt-get install -y autoconf automake libtool build-essential subversion libxml2
apt-get install -y libxml2-dev libtiff4 libtiff4-dev php5 php5-cli
apt-get install -y php5-common php5-mcrypt php5-mysql php5-gd php5-pgsql php-pear php-db
apt-get install -y libmysqlclient15-dev curl sox libssl-dev libncurses5-dev bison
apt-get install -y libaudiofile-dev libnewt-dev libcurl4-gnutls-dev
apt-get install -y libnet-ssleay-perl openssl ssl-cert libauthen-pam-perl
apt-get install -y libio-pty-perl libmd5-perl
apt-get install -y libpg-perl libdbd-pg-perl sqlite3
apt-get install -y libsqlite3-dev openssl ssl-cert
apt-get install -y libapache2-mod-php5 libmcrypt-dev

mkdir /home/opensim/freeswitch
cd /home/opensim/freeswitch

2. Freeswitch install

Let’s now download compile and install the current Freeswitch trunk.

svn checkout http://svn.freeswitch.org/svn/freeswitch/trunk freeswitch

cd freeswitch
cd build
cp modules.conf.in modules.conf

vi modules.conf

Look for the line :

  1. codecs/mod_siren

and remove the # character.

Look for the line :

  1. xml_int/mod_xml_curl

and remove the # character.

Save the file ([ESCAPE] then [:wq])

cd ..
AUTOCONF=/usr/bin/autoconf ./bootstrap.sh

Wait some minutes until the operation finishes, then type :

./configure –prefix=/usr/local/freeswitch

Wait again some minutes until it finishes then :

make

Some more minutes of patience (skype, secondlife, facebook…) then,

make install
make mod_siren-install

make mod_xml_curl-install
make sounds-install

make sounds-install

make moh-install
make moh-install

Note that the repetition of both commands are not an error ! Then type :

make samples

3. Freeswitch configuration for OpenSim

Let’s suppose that :

  • our server is connect directly to the internet with a public IP address like : 192.111.222.33
    * there is no firewall limiting any ingoing or outgoing connexion
    * OpenSim runs on the TCP port 9000 on the same server where freeswitch is installed

Now, let’s type :

cd /usr/local/freeswitch/conf/autoload_configs/

vi modules.conf.xml

Look for the line :

<!-- <load module="mod_xml_curl"/> -->

and replace it with :

<load module="mod_xml_curl"/>

[EDIT] : The following lines are already uncommented in recent versions.

Look for the line :

<!--<load module="mod_siren"/>-->

and replace it with :

<load module="mod_siren"/>

Save the file ([ESCAPE] then [:wq])

cd /usr/local/freeswitch/conf/autoload_configs

vi xml_curl.conf.xml

Remove all lines (press [dd] many times if you use vi)

and replace with :

<configuration name="xml_curl.conf" description="cURL XML Gateway">
<bindings>
<binding name="example">
<param name="gateway-url" value="http://192.111.222.33:9000/api/freeswitch-config" bindings="directory"/>
<param name="disable-100-continue" value="true"/>
</binding>
<binding name="local">
<param name="gateway-url" value="http://192.111.222.33:9000/api/freeswitch-config" bindings="dialplan"/>
<param name="disable-100-continue" value="true"/>
</binding>
</bindings>
</configuration>

(replace 192.111.222.33 with the server public IP address where OpenSim runs).

Save the file.

cd /usr/local/freeswitch/conf/

vi vars.xml

Look for the line :

<X-PRE-PROCESS cmd="set" data="global_codec_prefs=G722,PCMU,PCMA,GSM"/>

and replace it with :

<X-PRE-PROCESS cmd="set" data="global_codec_prefs=G722,PCMU,PCMA,GSM,G7221@32000h"/>

4. Starting Freeswtich

screen -S voice

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

Ignore Freeswitch error messages or warnings and detach the screen with :

[CTRL][A][D]


5. OpenSim configuration

Edit the OpenSim.ini configuration file and put these lines :

[FreeSwitchVoice]
 ; In order for this to work you need a functioning freeswitch pbx set
 ; up. Configuration for that will be posted in the wiki soon.
enabled = true
 ;FreeSwitch server is going to contact us and ask us all
 ;sorts of things.
freeswitch_server_user = freeswitch
freeswitch_server_pass = password
freeswitch_api_prefix = /api
 ; this is the IP of your sim
freeswitch_service_server = 192.111.222.33
 ; this should be the same port the region listens on
freeswitch_service_port = 9000
freeswitch_realm = 192.111.222.33
freeswitch_sip_proxy = 192.111.222.33:5060
freeswitch_attempt_stun = false
freeswitch_stun_server = 192.111.222.33
freeswitch_echo_server = 192.111.222.33
freeswitch_echo_port = 50505
freeswitch_well_known_ip = 192.111.222.33

Type the address of your http server here, hostname is allowed. This is provided so you can specify a hostname
 ;This is used by client for account verification. By default, it's the same as the freeswitch service server.
opensim_well_known_http_address = Address_Of_your_SIM_HTTP_Server_Hostname_Allowed

freeswitch_default_timeout = 5000
freeswitch_subscribe_retry = 120
 ; freeswitch_password_reset_url =

Finished !

Start OpenSim normally. At this moment, the voice should be available !

Check that :

  • your parcels are enabled for spatial voice chat
    * your headset and microphone are on

Carlos Roundel followed the official tutorial on http://www.opensimulator.org

Special thanks to Carlos from Cyberlandia for giving us a working tutorial and allowing us to bring voice to New World Grid.