Freeswitch Module

From OpenSimulator

Revision as of 03:05, 27 July 2010 by Aiaustin (Talk | contribs)

Jump to: navigation, search


The FreeSwitch module enables voice in opensim with no changes required to the SL or Hippo clients (must be over 1.22 for SL and 0.5 for Hippo)

FreeSwitch Install

Follow the instructions here on how to compile from source. We need to enable two specific modules. please ensure you compile from the freeswitch trunk for now until we can post a minimum version number (there are known issues with older versions)

When you get to the part in the instructions where it says "Edit modules.conf so that it will build the modules you desire." edit the modules.conf file and uncomment out the entries for xml_curl and the siren14 codec

   codecs/mod_siren
   and
   xml_int/mod_xml_curl


  • You can also use this guide for setting it up in a quick way -- Fly-man-

FreeSwitch Config

Install and compile Freeswitch, making sure you enable the xml_curl module and also the siren14 codec.

enable mod_xml_curl

Next, do not forget to activate mod_xml_curl in /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml. mod_xml_curl is disabled by default on fresh install.

uncomment the lines...

   <load module="mod_xml_curl"/>

and

   <load module="mod_siren"/>

configure mod_xml_curl

the xml_curl module configuration should point to an opensim region that has the freeswitch voice module enabled (voice also needs to be enabled in the estate setting for all regions)

example xml_curl.conf.xml found in /usr/local/freeswitch/conf/autoload_configs


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


The /usr/local/freeswitch/conf/vars.xml requires modification to enable the siren14 codec

search within vars.xml for the global_codec_prefs and change the line to read

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

or

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

G7221@32000h is the siren14 codec

configure conference.conf.xml

By default, FreeSwitch plays hold music when there is only one avatar in the conference and beeps for everyone when avatars arrive and leave. To disable, edit /usr/local/freeswitch/conf/autoload_configs/conference.conf.xml. Locate the "default" profile and comment out the following lines as shown below:

      [...]
      <!-- File to play if you are alone in the conference -->
      <!-- <param name="alone-sound" value="conference/conf-alone.wav"/> -->
      [...]
      <!-- File to play when you're alone (music on hold)-->
      <!-- <param name="moh-sound" value="$${hold_music}"/> -->
      <!-- File to play when you join the conference -->
      <!-- <param name="enter-sound" value="tone_stream://%(200,0,500,600,700)"/> [^] -->
      <!-- File to play when you leave the conference -->
      <!-- <param name="exit-sound" value="tone_stream://%(500,0,300,200,100,50,25)"/> [^] -->
      <!-- File to play when you ae ejected from the conference -->
      <!-- <param name="kicked-sound" value="conference/conf-kicked.wav"/> -->
      [...]

OpenSim Config

Add the following section to OpenSim.ini. You will also need to enable voice in the regions estate settings. Make sure the freeswitch server is started BEFORE bringing the region up.

   [FreeSwitchVoice]
   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
   ;The IP address of an opensim voice region
   freeswitch_service_server = youropensimregionip
   ;the port your region is running on
   freeswitch_service_port = 9000 
   ;your freeswitch IP address
   freeswitch_realm = yourfreeswitchserverip
   freeswitch_sip_proxy = yourfreeswitchserverip:5060
   freeswitch_attempt_stun = false
   freeswitch_stun_server = yourfreeswitchserverip
   freeswitch_echo_server = yourfreeswitchserverip
   freeswitch_echo_port = 50505
   freeswitch_well_known_ip = yourfreeswitchserverip
   freeswitch_default_timeout = 5000
   freeswitch_subscribe_retry = 120

Note that if you are running in Opensim grid mode, a single Freeswitch service on yourfreeswitchserverip can support multiple regions even on several Opensim.exe on the same and different hosts.

Errors & Solutions

NOTE: Do not post FreeSwitch errors on Mantis, since 'melanie' will close the thread and treat you like a moron.

--[ERR] mod_xml_curl.c:230 xml_url_fetch() Received HTTP error 0 trying to fetch: To solve this error, get the last GIT of FreeSwitch, follow this instructions (for Ubuntu) here. --mod_event_socket.c -> Socket Error Could not listen on 127.0.0.1:8021: This means something is using the port 8021, usually freeswitch is already running, on Ubuntu, try the following command: netstat -npl | grep 8021

If freeswitch is running, close is with: sudo freeswitch -stop OR sudo invoke-rc.d freeswitch stop


MAKE SURE the OpenSim region you point Freeswitch at IS NOT running when you start FreeSwitch.

ALSO make sure that you have enabled voice in the "About Land"->"Voice" dialogue in the region, you will need to be a region admin to do this.

Personal tools
General
About This Wiki