Freeswitch Module

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Errors & Solutions: altered example error from custom port 8021 to standard SIP port 5060 so as not to confuse readers)
m
 
(132 intermediate revisions by 12 users not shown)
Line 1: Line 1:
{{Template:Quicklinks}}
+
{{Quicklinks|Freeswitch_Module}} <br />  
<br />
+
  
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)
+
{{thirdparty}}
  
== FreeSwitch Install ==
+
The FreeSWITCH module enables voice in OpenSimulator with no changes required to the Linden Labs Second Life viewer. For OpenSimulator 0.7.0.2 and earlier, the viewer must be between versions 1.22 and 1.23.5. For OpenSimulator 0.7.1 and later 2.x viewers will also work.
  
Follow the instructions [http://wiki.freeswitch.org/wiki/Installation_Guide here] on how to compile from source. We need to enable two specific modules.
+
A little history on the development of the FreeSWITCH module is given here:
'''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 to make active the entries for xml_curl and the siren14 codec
+
* http://zaki.asia/2009/04/28/freeswitch-module-in-opensim.html
  
    codecs/mod_siren
+
How To Install FreeSwitch PBX on Ubuntu 20.04 and 18.04
 +
* https://computingforgeeks.com/how-to-install-freeswitch-pbx-on-ubuntu/
 +
 
 +
== FreeSwitch Install ==
 +
 
 +
Follow the [https://developer.signalwire.com/freeswitch/FreeSWITCH-Explained/Installation/#Compiling_and_Installation compilation instructions in the FreeSWITCH wiki]. '''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)'''. For OpenSim's purposes, we need to enable two specific modules.
 +
 
 +
Make sure to [https://developer.signalwire.com/freeswitch/FreeSWITCH-Explained/Installation/#Compile_and_Install_Sounds install the hold music] if you are not going to disable it in the "configure conference.conf.xml" section below.
 +
 
 +
When you get to "'''Edit modules.conf'''" section of the Freeswitch build instructions, edit the modules.conf file and uncomment to make active the entries for xml_curl and the siren14 codec
 +
 
 +
  codecs/mod_siren
 
     and
 
     and
    xml_int/mod_xml_curl
+
  xml_int/mod_xml_curl
  
 +
''Note: Freeswitch Git master as of 18th April 2011 already has codecs/mod_siren configured''
  
* You can also use this [http://madhawa.com/?p=10 guide] for setting it up in a quick way -- [[User:Fly-man-|Fly-man-]]
+
<u>January 2019 update</u> : The Freeswitch wiki is now at https://freeswitch.org/confluence/. As stated, « The sprint that copied remaining pages from the old mediawiki to Confluence has given us all the documentation fit to print, however they are not organized well. Search is your friend. »
  
==FreeSwitch Config==
+
The installation page may be found at https://freeswitch.org/confluence/display/FREESWITCH/Installation.
  
Install and compile Freeswitch, making sure you enable the xml_curl module and also the siren14 codec.
+
Configuration page : https://freeswitch.org/confluence/display/FREESWITCH/Configuring+FreeSWITCH
 +
 
 +
Note that Debian, Ubuntu and CentOS/RHEL have packages as explained respectively
 +
[https://freeswitch.org/confluence/display/FREESWITCH/Debian+9+Stretch here],
 +
[https://freeswitch.org/confluence/display/FREESWITCH/Ubuntu+16.04+Xenial here],
 +
and [https://freeswitch.org/confluence/display/FREESWITCH/CentOS+7+and+RHEL+7 here].
 +
 
 +
== FreeSwitch Config ==
  
 
=== enable mod_xml_curl ===
 
=== 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.
+
Once you've compiled and installed Freeswitch, you will need to activate mod_siren and mod_xml_curl in /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml, since it's disabled by default on a fresh install.  
  
uncomment the lines...
+
uncomment the lines...  
     <load module="mod_xml_curl"/>
+
 
 +
     &lt;load module="mod_xml_curl"/&gt;
  
 
and  
 
and  
 
    <load module="mod_siren"/>
 
  
=== configure mod_xml_curl ===
+
    &lt;load module="mod_siren"/&gt;
  
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 you wish to be supported).
+
''Note: Freeswitch Git master as of 18th April 2011 already has mod_siren configured''
  
example xml_curl.conf.xml  found in /usr/local/freeswitch/conf/autoload_configs
+
=== configure mod_xml_curl ===
  
 +
mod_xml_curl is a freeswitch module which enables dynamic configuration of freeswitch from a web server. In this case, it is the opensim region server.
  
  <configuration name="xml_curl.conf" description="cURL XML Gateway">
+
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 you wish to be supported).  
  <bindings>
+
        <binding name="example">
+
                <param name="gateway-url" value="http://youropensimregionip: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://youropensimregionip:9000/api/freeswitch-config" bindings="dialplan"/>
+
                <param name="gateway-credentials" value="freeswitch:password"/>
+
                <param name="disable-100-continue" value="true"/>
+
        </binding>
+
  </bindings>
+
  </configuration>
+
  
 +
You can set this up by editing /usr/local/freeswitch/conf/autoload_configs/xml_curl.conf.xml.
  
The /usr/local/freeswitch/conf/vars.xml requires modification to enable the siren14 codec
+
==== OpenSimulator 0.7.1 and later ====
 +
You can replace the existing config with the following settings, or just add the directory and dialplan bindings. The IP address is used by the Freeswitch server to reach the OpenSimulator freeswitch service to fetch its configuration details. If you're running everything on a single server and your system has only one IP address, this can simply be localhost. If you're running freeswitch on another server or you have multiple IP addresses then this explicitly needs to be your standalone's address.
  
search within vars.xml for the global_codec_prefs and change the line to read
+
You will also need to change the port number if you're using a different standalone HTTP port from the default (9000).
  
    <X-PRE-PROCESS cmd="set" data="global_codec_prefs=G7221@32000h,G722,PCMU,PCMA,GSM"/>
+
On grid grid mode you will need to replace '''localhost''' with the ip of the ROBUST instance running the FreeSwitch grid service, and replace the port with the service port (usually 8004).
  
or
+
This configuration tells freeswitch where to obtain the "dialplan" and "directory" configuration from opensim (as mentioned by the bindings attributes). More details on mod_xml_curl module can be found [http://wiki.freeswitch.org/wiki/Mod_xml_curl here].
  
     <X-PRE-PROCESS cmd="set" data="global_codec_prefs=G7221@32000h,G7221@16000h,G722,PCMU,PCMA,GSM"/>
+
&lt;configuration name="xml_curl.conf" description="cURL XML Gateway"&gt;
 +
&lt;bindings&gt;
 +
    &lt;binding name="directory"&gt;
 +
            &lt;param name="gateway-url" value="http://localhost:9000/fsapi/freeswitch-config" bindings="directory"/&gt;
 +
            &lt;param name="gateway-credentials" value="freeswitch:password"/&gt;
 +
            &lt;param name="disable-100-continue" value="true"/&gt;
 +
    &lt;/binding&gt;
 +
    &lt;binding name="dialplan"&gt;
 +
            &lt;param name="gateway-url" value="http://localhost:9000/fsapi/freeswitch-config" bindings="dialplan"/&gt;
 +
            &lt;param name="gateway-credentials" value="freeswitch:password"/&gt;
 +
            &lt;param name="disable-100-continue" value="true"/&gt;
 +
    &lt;/binding&gt;
 +
&lt;/bindings&gt;
 +
&lt;/configuration&gt;
 +
 
 +
==== OpenSimulator 0.7.0.2 and earlier ====
 +
 
 +
For OpenSimulator 0.7.0.2 and earlier the setup is identical except that the gateway-url paths start with /api rather than /fsapi.
 +
 
 +
&lt;configuration name="xml_curl.conf" description="cURL XML Gateway"&gt;
 +
&lt;bindings&gt;
 +
    &lt;binding name="directory"&gt;
 +
            &lt;param name="gateway-url" value="http://localhost:9000/api/freeswitch-config" bindings="directory"/&gt;
 +
            &lt;param name="gateway-credentials" value="freeswitch:password"/&gt;
 +
            &lt;param name="disable-100-continue" value="true"/&gt;
 +
    &lt;/binding&gt;
 +
    &lt;binding name="dialplan"&gt;
 +
            &lt;param name="gateway-url" value="http://localhost:9000/api/freeswitch-config" bindings="dialplan"/&gt;
 +
            &lt;param name="gateway-credentials" value="freeswitch:password"/&gt;
 +
            &lt;param name="disable-100-continue" value="true"/&gt;
 +
    &lt;/binding&gt;
 +
&lt;/bindings&gt;
 +
&lt;/configuration&gt;
 +
 
 +
=== configure vars.xml ===
 +
 
 +
''Note: Freeswitch Git master as of 18th April 2011 already has this configured''
 +
 
 +
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
 +
 
 +
    &lt;X-PRE-PROCESS cmd="set" data="global_codec_prefs=G7221@32000h,G722,PCMU,PCMA,GSM"/&gt;
 +
 
 +
or
 +
 
 +
     &lt;X-PRE-PROCESS cmd="set" data="global_codec_prefs=G7221@32000h,G7221@16000h,G722,PCMU,PCMA,GSM"/&gt;
  
 
G7221@32000h is the siren14 codec
 
G7221@32000h is the siren14 codec
Line 70: Line 122:
 
=== configure conference.conf.xml ===
 
=== 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:
+
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 sound file lines, as shown in the example below.
 +
 
 +
<pre>
 +
  <!-- Profiles are collections of settings you can reference by name. -->
 +
  <profiles>
 +
    <!--If no profile is specified it will default to "default"-->
 +
    <profile name="default">
 +
    ...
 +
      <!-- If TTS is enabled all audio-file params beginning with -->
 +
      <!-- 'say:' will be considered text to say with TTS -->
 +
      <!-- Override the default path here, after which you use relative paths in the other sound params -->
 +
      <!-- Note: The default path is the conference's first caller's sound_prefix -->
 +
      <!--<param name="sound-prefix" value="$${sounds_dir}/en/us/callie"/>-->
 +
      <!-- File to play to acknowledge succees -->
 +
      <!--<param name="ack-sound" value="beep.wav"/>-->
 +
      <!-- File to play to acknowledge failure -->
 +
      <!--<param name="nack-sound" value="beeperr.wav"/>-->
 +
      <!-- File to play to acknowledge muted -->
 +
      <!-- <param name="muted-sound" value="conference/conf-muted.wav"/> -->
 +
      <!-- File to play to acknowledge unmuted -->
 +
      <!-- <param name="unmuted-sound" value="conference/conf-unmuted.wav"/> -->
 +
      <!-- File to play if you are alone in the conference -->
 +
      <!-- <param name="alone-sound" value="conference/conf-alone.wav"/> -->
 +
      <!-- File to play endlessly (nobody will ever be able to talk) -->
 +
      <!--<param name="perpetual-sound" value="perpetual.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"/> -->
 +
      <!-- File to play when the conference is locked -->
 +
      <!-- <param name="locked-sound" value="conference/conf-locked.wav"/> -->
 +
      <!-- File to play when the conference is locked during the call-->
 +
      <!-- <param name="is-locked-sound" value="conference/conf-is-locked.wav"/> -->
 +
      <!-- File to play when the conference is unlocked during the call-->
 +
      <!-- <param name="is-unlocked-sound" value="conference/conf-is-unlocked.wav"/> -->
 +
      <!-- File to play to prompt for a pin -->
 +
      <!-- <param name="pin-sound" value="conference/conf-pin.wav"/> -->
 +
      <!-- File to play to when the pin is invalid -->
 +
      <!-- <param name="bad-pin-sound" value="conference/conf-bad-pin.wav"/> -->
 +
      ...
 +
    </profile>
 +
  ...
 +
  </profiles>
 +
</pre>
 +
 
 +
== OpenSimulator config ==
 +
 
 +
=== Config for OpenSimulator 0.7.1 onwards ===
 +
 
 +
==== Standalone ====
 +
 
 +
The configuration is explained in OpenSim.ini.example. Here's one example
 +
 
 +
[FreeSwitchVoice]
 +
    Enabled = true
 +
    LocalServiceModule = OpenSim.Services.FreeswitchService.dll:FreeswitchService
 +
   
 +
[FreeswitchService]
 +
    ServerAddress = 192.168.1.2
 +
 
 +
In this case, the FreeSWITCH server is running on 192.168.1.2 and only viewers on the local LAN need to access it. If people needed to access the standalone (and hence the voice service) externally, then this IP would have to be one that could be reached from the outside (e.g. 80.175.122.1). No other files need to be configured.
 +
 
 +
==== Grid Mode ====
 +
In grid mode, [FreeSwitchVoice] in OpenSim.ini and [FreeswitchService] in Robust.ini or Robust.HG.ini need to be configured. Configurations details are shown in both OpenSim.ini.example, Robust.ini.example and Robust.HG.ini.example. Here is an example configuration for OpenSim.ini.
 +
 
 +
[FreeSwitchVoice]
 +
    Enabled = true
 +
    LocalServiceModule = OpenSim.Services.Connectors.dll:RemoteFreeswitchConnector
 +
    FreeswitchServiceURL = http://192.168.1.3:8004/fsapi
 +
 
 +
Add for Robust.ini/Robust.HG.ini
 +
 
 +
[FreeswitchService]
 +
    LocalServiceModule = OpenSim.Services.FreeswitchService.dll:FreeswitchService
 +
    ServerAddress = http://192.168.1.4
 +
 
 +
In this case, the grid service is running on 192.168.1.3 and the FreeSWITCH server is running on 192.168.1.4.
 +
 
 +
For more details on FreeSWITCH config for this version you may want to refer to
 +
 
 +
* http://opensimulator.org/mantis/view.php?id=5267
 +
* http://opensimulator.org/mantis/view.php?id=5274
 +
 
 +
=== OpenSimulator 0.7.0.2 and earlier ===
 +
 
 +
==== Standalone ====
 +
 
 +
Add the following to your OpenSim.ini
 +
 
 +
[FreeSwitchVoice]
 +
Enabled = true
 +
LocalServiceModule = "OpenSim.Services.FreeswitchService.dll:FreeswitchService"
 
   
 
   
      [...]
+
[FreeswitchService]
      &lt;!-- File to play if you are alone in the conference --&gt;
+
ServerAddress = youropensimregionip
      &lt;!-- &lt;param name="alone-sound" value="conference/conf-alone.wav"/&gt; --&gt;
+
Realm = "youropensimregionip"
      [...]
+
      &lt;!-- File to play when you're alone (music on hold)--&gt;
+
      &lt;!-- &lt;param name="moh-sound" value="$${hold_music}"/&gt; --&gt;
+
      &lt;!-- File to play when you join the conference --&gt;
+
      &lt;!-- &lt;param name="enter-sound" value="tone_stream://%(200,0,500,600,700)"/&gt; [^] --&gt;
+
      &lt;!-- File to play when you leave the conference --&gt;
+
      &lt;!-- &lt;param name="exit-sound" value="tone_stream://%(500,0,300,200,100,50,25)"/&gt; [^] --&gt;
+
      &lt;!-- File to play when you ae ejected from the conference --&gt;
+
      &lt;!-- &lt;param name="kicked-sound" value="conference/conf-kicked.wav"/&gt; --&gt;
+
      [...]
+
  
==OpenSim Config==
+
==== Grid Mode ====
 +
Add the following to your OpenSim.ini
  
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
 +
LocalServiceModule = OpenSim.Services.Connectors.dll:RemoteFreeswitchConnector
 +
FreeswitchServiceURL = http://ip.of.your.robust.server.for.freeswitch.connector:8004/fsapi
  
    [FreeSwitchVoice]
+
Add the following to your Robust.ini or Robust.HG.ini
    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
+
    ; IP address of an opensim region with voice enabled
+
    freeswitch_service_server = youropensimregionip
+
    ;the port your Opensim 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
+
    ; freeswitch_password_reset_url =
+
  
    ; opensim_well_known_http_address = youropensimregionip
+
[FreeswitchService]
    ; CHECK THIS...  should be Address_Of_your_SIM_HTTP_Server_Hostname_Allowed
+
LocalServiceModule = OpenSim.Services.FreeswitchService.dll:FreeswitchService
 +
ServerAddress = ip.of.your.robust.server.for.freeswitch.connector
 +
  Realm = "ip.of.your.robust.server.for.freeswitch.connector"
  
Note that if you are running in Opensim grid mode, a single Freeswitch service on yourfreeswitchserverip can support multiple regions on one or more Opensim.exe running on one or more hosts. And the Freeswitch server need not be on the same host as the Opensim.exe used to anchor the connection.
+
If your Freeswitch complains about an unknown domain, you have probably mixed ips and host names. You should always use dotted quad IP addresses, as there are string compares done on them in Freeswitch code and a name and it's corresponding address are not considered to be the same!
  
 
== Firewall Config ==
 
== Firewall Config ==
  
Make sure that the ports used by Freeswitch are acessible though your firewall(s). In the example above these are ports 5060 and 50505... though other ports may be used for call initiation (port 1720 for H.323 Call Signaling) and dynamically assigned ports for specific call traffic. The usual H.323 and SIP traffic dynamic port handling on modern firewalls usually enables this.
+
Basically ports 1720 and 5060, and maybe 5050 must be open for listening.
 +
 
 +
Make sure that the ports used by Freeswitch are accessible though your firewall(s). In the example above the main port used is 5060 though other ports may be used for call initiation (port 1720 for H.323 Call Signalling) and dynamically assigned ports for specific call traffic. The usual H.323 and SIP traffic dynamic port handling on modern firewalls usually enables this.
 +
 
 +
Is port 50505 actually used, or is it just something that must be
 +
reported by OpenSimulator when the Freeswitch service makes contact?
 +
 
 +
<br /> More details on the Freeswitch ports used and firewall configuration details are at http://wiki.freeswitch.org/wiki/Firewall
 +
 
 +
If you have problems with NAT/Routers look at using STUN (Simple Traversal of UDP through NATs). More information at http://wiki.freeswitch.org/wiki/NAT_Traversal
 +
 
 +
== Starting everything up ==
 +
 
 +
1. Freeswitch fetches OpenSimulator related configuration from the OpenSimulator freeswitch voice module and service that we set up earlier. Therefore, you need to start OpenSimulator first. On startup you should see the lines
 +
 
 +
21:45:33 - [FreeSwitchVoice]: using FreeSwitch server <your ip address>
 +
21:45:33 - [FreeSwitchVoice]: plugin enabled
 +
 
 +
2. Start freeswitch. This will complain about
 +
 
 +
<pre>
 +
[ERR] mod_xml_curl.c:302 Error Parsing Result! [http://localhost:9000/fsapi/freeswitch-config] data: [hostname=fruitfly&section=directory&tag_name=&key_name=&key_value=&Event-Name=REQUEST_PARAMS&Core-UUID=8cdac78a-e880-11e0-a320-3324fcf85684&FreeSWITCH-Hostname=fruitfly&FreeSWITCH-Switchname=fruitfly&FreeSWITCH-IPv4=192.168.1.2&FreeSWITCH-IPv6=%3A%3A1&Event-Date-Local=2011-09-26%2021%3A46%3A03&Event-Date-GMT=Mon,%2026%20Sep%202011%2020%3A46%3A03%20GMT&Event-Date-Timestamp=1317069963782065&Event-Calling-File=sofia.c&Event-Calling-Function=config_sofia&Event-Calling-Line-Number=3965&purpose=gateways&profile=external]
 +
</pre>
 +
 
 +
and
 +
 
 +
[ERR] mod_xml_curl.c:305 Received HTTP error 404 trying to fetch http://localhost:9000/fsapi/freeswitch-config data: [hostname=fruitfly&section=directory&tag_name=domain&key_name=name&key_value=192.168.1.2&Event-Name=GENERAL&Core-UUID=8cdac78a-e880-11e0-a320-3324fcf85684&FreeSWITCH-Hostname=fruitfly&FreeSWITCH-Switchname=fruitfly&FreeSWITCH-IPv4=192.168.1.2&FreeSWITCH-IPv6=%3A%3A1&Event-Date-Local=2011-09-26%2021%3A46%3A05&Event-Date-GMT=Mon,%2026%20Sep%202011%2020%3A46%3A05%20GMT&Event-Date-Timestamp=1317069965442975&Event-Calling-File=switch_core.c&Event-Calling-Function=switch_load_network_lists&Event-Calling-Line-Number=1173&domain=192.168.1.2&purpose=network-list]
 +
 
 +
You can ignore these errors for now - they should be fixed in the future but will not prevent Freeswitch from working.
 +
 
 +
On the OpenSimulator region (on standalone) or grid console (on grid) you should see the lines
 +
 
 +
[FreeSwitchVoice]: Received request for config section directory, event calling function 'config_sofia'
 +
[FreeSwitchVoice]: Received request for config section directory, event calling function 'config_sofia'
 +
[FreeSwitchVoice]: Received request for config section directory, event calling function 'switch_load_network_lists'
 +
 
 +
3. Now, make sure your parcel in the region has voice enabled in the parcel dialog. You may need to change this and then restart OpenSimulator if it wasn't previously set.
 +
 
 +
4. Login your client. Make sure you have voice enabled and it's working (probably by testing on another grid first).
 +
 
 +
5. If everything has gone according to plan, you should see something like the line
 +
 
 +
[FreeSwitchVoice]: OnRegisterCaps() called with agentID 0fe223e7-370a-46da-b935-b0831ddf6d08 caps OpenSim.Framework.Capabilities.Caps in scene test2
 +
 
 +
amongst others on the OpenSimulator region console. And on the freeswitch console you should see something like
 +
 
 +
<pre>
 +
2011-09-26 22:10:09.866918 [WARNING] sofia_reg.c:1241 SIP auth challenge (REGISTER) on sofia profile 'internal' for [xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2] from ip 192.168.1.2
 +
2011-09-26 22:10:10.046904 [ERR] mod_xml_curl.c:305 Received HTTP error 404 trying to fetch http://localhost:9000/fsapi/freeswitch-config
 +
data: [hostname=fruitfly&section=directory&tag_name=domain&key_name=name&key_value=192.168.1.2&Event-Name=GENERAL&Core-UUID=da41cd40-e883-11e0-b7d8-07a2aa0d33c8&FreeSWITCH-Hostname=fruitfly&FreeSWITCH-Switchname=fruitfly&FreeSWITCH-IPv4=192.168.1.2&FreeSWITCH-IPv6=%3A%3A1&Event-Date-Local=2011-09-26%2022%3A10%3A10&Event-Date-GMT=Mon,%2026%20Sep%202011%2021%3A10%3A10%20GMT&Event-Date-Timestamp=1317071410046904&Event-Calling-File=mod_voicemail.c&Event-Calling-Function=resolve_id&Event-Calling-Line-Number=1284&action=message-count&key=id&user=xD-Ij5zcKRtq5NbCDHd9tCA%3D%3D&domain=192.168.1.2]
 +
2011-09-26 22:10:10.466949 [WARNING] sofia_reg.c:1241 SIP auth challenge (INVITE) on sofia profile 'internal' for [conf-xZGQ1Yjc3ZjgtYmY4OC00NWFjLWFhY2UtMzViZDc2NDI2Yzgx@192.168.1.2] from ip 192.168.1.2
 +
2011-09-26 22:10:10.646923 [NOTICE] switch_channel.c:816 New Channel sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 [eb426488-e883-11e0-b7e2-07a2aa0d33c8]
 +
2011-09-26 22:10:10.646923 [INFO] mod_dialplan_xml.c:331 Processing Justin Clark-Casey <xD-Ij5zcKRtq5NbCDHd9tCA==>->conf-xZGQ1Yjc3ZjgtYmY4OC00NWFjLWFhY2UtMzViZDc2NDI2Yzgx in context default
 +
2011-09-26 22:10:10.646923 [NOTICE] mod_dptools.c:930 Channel [sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2] has been answered
 +
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6561 using channel sound prefix: /usr/local/freeswitch/sounds/en/us/callie
 +
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '0' to 'mute'
 +
2011-09-26 22:10:10.646923 [INFO] switch_ivr_async.c:163 Digit parser mod_conference: Setting realm to conf
 +
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '*' to 'deaf mute'
 +
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '9' to 'energy up'
 +
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '8' to 'energy equ'
 +
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '7' to 'energy dn'
 +
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '3' to 'vol talk up'
 +
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '2' to 'vol talk zero'
 +
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '1' to 'vol talk dn'
 +
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '6' to 'vol listen up'
 +
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '5' to 'vol listen zero'
 +
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '4' to 'vol listen dn'
 +
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '#' to 'hangup'
 +
</pre>
 +
 
 +
With any luck, the voice buttons on your client will now be active and working.
 +
 
 +
== Issues and Solutions ==
 +
 
 +
Make sure that you have enabled voice in the "About Land"-&gt;"Voice" dialogue in the region, you will need to be a region admin to do this.
 +
 
 +
Check the plot also has voice enabled. You must be a plot owner or have suitable permisison to do this. Recent Linden Labs Second Life viewers do not offer this option, so use Hippo or another client which does.
 +
 
 +
{| cellspacing="1" cellpadding="1" border="1" align="left" style="width: 1010px; height: 66px;"
 +
|-
 +
! scope="col" | Issue <br />
 +
! scope="col" | Resolution<br />
 +
|-
 +
| --[ERR] mod_xml_curl.c:230 xml_url_fetch() Received HTTP error 0 trying to fetch:<br />
 +
| To solve this error, get the last GIT of FreeSwitch, follow this instructions (for Ubuntu)&nbsp; [http://wiki.freeswitch.org/wiki/Ubuntu_Quick_Start#Updating_direct_from_Git here]<br />
 +
|-
 +
| --mod_event_socket.c -&gt; Socket Error Could not listen on 127.0.0.1:5060:<br />
 +
| This means something is using the port 5060, usually freeswitch is already running, on Ubuntu, try the following command: netstat -npl &#124; grep 85060 If freeswitch is running, close is with: sudo freeswitch -stop OR sudo invoke-rc.d freeswitch stop <br />
 +
|-
 +
| --[ERR] [WARNING] sofia_reg.c:1540 sofia_reg_parse_auth()Can't find user [x8cOXAiIzTVC6xqf-nquLkw==@"some ip or domain here"] etc ...
 +
| a solutions to this error is, mod your vars.xml replacing the domain lines <X-PRE-PROCESS cmd="set" data="domain=whatever is in the realm setting of your freeswitch config"/>  <X-PRE-PROCESS cmd="set" data="domain_name=whatever is in the realm setting of your freeswitch config"/> -  Now this will most likely break your freeswitch for anything other than your opensim. But should get you closer<br />
 +
|-
 +
| --[WARNING] mod_local_stream.c:393 Unknown source moh, trying 'default'
 +
[ERR] mod_local_stream.c:402 Unknown source default
 +
| If you see these log messages continuously on the Freeswitch console, then you have either not disabled the conference sounds or you have not installed them (see earlier).
 +
|}
 +
 
 +
<br />
 +
<br clear=all>
 +
 
 +
Use some of the debugging features in FreeSWITCH:
 +
 
 +
* conference list <--- to see if you have any conferences setup (note you have to be inworld when you try this)
 +
* xml_curl debug_on <--- this command will dump the transactions between OpenSimulator and FreeSWITCH into a file (on linux it is in /tmp)
 +
* xml_curl debug_off <-- turn it off after you login/logout a few times
 +
 
 +
== Notes from Openvue Grid setup for FreeSwitch ==
 +
 
 +
Using Windows Vista 32 bit OS. Works with FreeSwitch 1.0.4 and later (for a specific tested example, FreeSWITCH Version 1.0.head (git-e0c37c1 2010-11-05 18-20-09 -0500)).
 +
 
 +
Additional notes that might help:
 +
 
 +
1. We established a simple OpenSim.exe on the SAME host as the FreeSwitch.exe service and put a single simple island on that (we called it "Talk") as some folks observed that FreeSwitch had problems with connecting if it was CONFIGURED to link to another server, but we don't believe this is necessary.
 +
 
 +
2. FreeSwitch provides service to all OpenSim.exe instances on any servers you wish even though its only configured for one.
  
More details on the Freeswitch ports used and firewall configuration details are at http://wiki.freeswitch.org/wiki/Firewall
+
3. There is one FreeSwitch channel per region, change regions and you change channel. So all users to talk must be on the same region. All plots on one region share the same single region channel.
  
If you have problems with NAT/Routers look at using STUN (Simple Traversal of UDP through NATs). More vinformation at http://wiki.freeswitch.org/wiki/NAT_Traversal
+
4. You appear as one user in the SL Viewers, ALL other users appear as a single "user" with a coded name for the other users on the channel - something like conf-x9999999999999999999.
  
== Errors & Solutions ==
+
5. You must have voice enabled at the region, AND the plot level. This is a pain, as the default setting in OpenSimulator is that PLOTS have voice turned off. The standard viewers 1.23 and 2.x do not allow you to turn this back on, so you must use a third party viewer to turn on PLOT voice. I have asked before that we change the default setting when a plot is created to have this on by default (or on if the region voice is on - which it is by default).
  
''' NOTE: Do not post FreeSwitch errors on Mantis, since 'melanie' will close the thread and treat you like a moron. '''
+
6. We are not sure if you MUST start FreeSwitch.exe before the regions that you want voice to work on. But we do so for safety. It works fine over OpenSim.exe restarts without FreeSwitch being started again.
  
--'''[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) [http://wiki.freeswitch.org/wiki/Ubuntu_Quick_Start#Updating_direct_from_Git here].
+
7. If you wish to use FreeSwitch beyond your local network, remember to configure for EXTERNALLY accessible IP addresses. Use IP numbers for FreeSwitch... and if there are 192.168.x.x style local net addresses in there you will not get FreeSwitch to work with external users. It can work through a range of firewalls with suitable mechanisms such as port forwarding or DMZs, so long as you definitely map to the externally visible IP address. Ensure you have the appropriate ports open in your Firewall(s). See separate section in Wiki on ports required.
--'''mod_event_socket.c -> Socket Error Could not listen on 127.0.0.1:5060''': This means something is using the port 5060, usually freeswitch is already running, on Ubuntu, try the following command: netstat -npl | grep 8021
+
  
 +
8. There are some red errors on startup of FreeSwitch - at least in our setup - which appears to be related to a missing config file that FreeSwitch tries to retrieve from OpenSimulator (opensim-region-server-url:port/api/freeswitch-config) that is not in the OpenSimulator setup... We have (safely?) ignored those without problems...
  
If freeswitch is running, close is with: sudo freeswitch -stop OR sudo invoke-rc.d freeswitch stop
+
2010-11-13 14:42:55.252361 [ERR] mod_xml_curl.c:252 Received HTTP error 0 trying
 +
to fetch http://129.215.219.143:9000/api/freeswitch-config
 +
data: [hostname=shuna&section=directory&tag_name=domain&key_name=name&key_value=
 +
129.215.219.143&Event-Name=GENERAL&Core-UUID=cb64ea40-aa92-494b-be13-65d9c468efe
 +
c&FreeSWITCH-Hostname=shuna&FreeSWITCH-IPv4=129.215.219.143&FreeSWITCH-IPv6=2002
 +
%3A81d7%3Adb8f%3A%3A81d7%3Adb8f&Event-Date-Local=2010-11-13%2014%3A42%3A54&Event
 +
-Date-GMT=Sat,%2013%20Nov%202010%2014%3A42%3A54%20GMT&Event-Date-Timestamp=12896
 +
59374247361&Event-Calling-File=switch_core.c&Event-Calling-Function=switch_load_
 +
network_lists&Event-Calling-Line-Number=984&domain=129.215.219.143&purpose=network-list]
  
MAKE SURE the OpenSim region you point Freeswitch at IS NOT running when you start FreeSwitch.
+
9. 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 relevant lines. See examples above on this Wiki page.
  
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. Recent Linden Labs Second Life viewers do not offer this option, so use Hiippo or another client which does.
+
[[Category:Voice]]

Latest revision as of 22:29, 6 August 2024



The FreeSWITCH module enables voice in OpenSimulator with no changes required to the Linden Labs Second Life viewer. For OpenSimulator 0.7.0.2 and earlier, the viewer must be between versions 1.22 and 1.23.5. For OpenSimulator 0.7.1 and later 2.x viewers will also work.

A little history on the development of the FreeSWITCH module is given here:

How To Install FreeSwitch PBX on Ubuntu 20.04 and 18.04

Contents

[edit] FreeSwitch Install

Follow the compilation instructions in the FreeSWITCH wiki. 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). For OpenSim's purposes, we need to enable two specific modules.

Make sure to install the hold music if you are not going to disable it in the "configure conference.conf.xml" section below.

When you get to "Edit modules.conf" section of the Freeswitch build instructions, edit the modules.conf file and uncomment to make active the entries for xml_curl and the siren14 codec

 codecs/mod_siren
   and
 xml_int/mod_xml_curl

Note: Freeswitch Git master as of 18th April 2011 already has codecs/mod_siren configured

January 2019 update : The Freeswitch wiki is now at https://freeswitch.org/confluence/. As stated, « The sprint that copied remaining pages from the old mediawiki to Confluence has given us all the documentation fit to print, however they are not organized well. Search is your friend. »

The installation page may be found at https://freeswitch.org/confluence/display/FREESWITCH/Installation.

Configuration page : https://freeswitch.org/confluence/display/FREESWITCH/Configuring+FreeSWITCH

Note that Debian, Ubuntu and CentOS/RHEL have packages as explained respectively here, here, and here.

[edit] FreeSwitch Config

[edit] enable mod_xml_curl

Once you've compiled and installed Freeswitch, you will need to activate mod_siren and mod_xml_curl in /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml, since it's disabled by default on a fresh install.

uncomment the lines...

   <load module="mod_xml_curl"/>

and

   <load module="mod_siren"/>

Note: Freeswitch Git master as of 18th April 2011 already has mod_siren configured

[edit] configure mod_xml_curl

mod_xml_curl is a freeswitch module which enables dynamic configuration of freeswitch from a web server. In this case, it is the opensim region server.

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 you wish to be supported).

You can set this up by editing /usr/local/freeswitch/conf/autoload_configs/xml_curl.conf.xml.

[edit] OpenSimulator 0.7.1 and later

You can replace the existing config with the following settings, or just add the directory and dialplan bindings. The IP address is used by the Freeswitch server to reach the OpenSimulator freeswitch service to fetch its configuration details. If you're running everything on a single server and your system has only one IP address, this can simply be localhost. If you're running freeswitch on another server or you have multiple IP addresses then this explicitly needs to be your standalone's address.

You will also need to change the port number if you're using a different standalone HTTP port from the default (9000).

On grid grid mode you will need to replace localhost with the ip of the ROBUST instance running the FreeSwitch grid service, and replace the port with the service port (usually 8004).

This configuration tells freeswitch where to obtain the "dialplan" and "directory" configuration from opensim (as mentioned by the bindings attributes). More details on mod_xml_curl module can be found here.

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

[edit] OpenSimulator 0.7.0.2 and earlier

For OpenSimulator 0.7.0.2 and earlier the setup is identical except that the gateway-url paths start with /api rather than /fsapi.

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

[edit] configure vars.xml

Note: Freeswitch Git master as of 18th April 2011 already has this configured

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

[edit] 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 sound file lines, as shown in the example below.

  <!-- Profiles are collections of settings you can reference by name. -->
  <profiles>
    <!--If no profile is specified it will default to "default"-->
    <profile name="default">
    ...
      <!-- If TTS is enabled all audio-file params beginning with -->
      <!-- 'say:' will be considered text to say with TTS -->
      <!-- Override the default path here, after which you use relative paths in the other sound params -->
      <!-- Note: The default path is the conference's first caller's sound_prefix -->
      <!--<param name="sound-prefix" value="$${sounds_dir}/en/us/callie"/>-->
      <!-- File to play to acknowledge succees -->
      <!--<param name="ack-sound" value="beep.wav"/>-->
      <!-- File to play to acknowledge failure -->
      <!--<param name="nack-sound" value="beeperr.wav"/>-->
      <!-- File to play to acknowledge muted -->
      <!-- <param name="muted-sound" value="conference/conf-muted.wav"/> -->
      <!-- File to play to acknowledge unmuted -->
      <!-- <param name="unmuted-sound" value="conference/conf-unmuted.wav"/> -->
      <!-- File to play if you are alone in the conference -->
      <!-- <param name="alone-sound" value="conference/conf-alone.wav"/> -->
      <!-- File to play endlessly (nobody will ever be able to talk) -->
      <!--<param name="perpetual-sound" value="perpetual.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"/> -->
      <!-- File to play when the conference is locked -->
      <!-- <param name="locked-sound" value="conference/conf-locked.wav"/> -->
      <!-- File to play when the conference is locked during the call-->
      <!-- <param name="is-locked-sound" value="conference/conf-is-locked.wav"/> -->
      <!-- File to play when the conference is unlocked during the call-->
      <!-- <param name="is-unlocked-sound" value="conference/conf-is-unlocked.wav"/> -->
      <!-- File to play to prompt for a pin -->
      <!-- <param name="pin-sound" value="conference/conf-pin.wav"/> -->
      <!-- File to play to when the pin is invalid -->
      <!-- <param name="bad-pin-sound" value="conference/conf-bad-pin.wav"/> -->
      ...
    </profile>
  ...
  </profiles>

[edit] OpenSimulator config

[edit] Config for OpenSimulator 0.7.1 onwards

[edit] Standalone

The configuration is explained in OpenSim.ini.example. Here's one example

[FreeSwitchVoice]
   Enabled = true
   LocalServiceModule = OpenSim.Services.FreeswitchService.dll:FreeswitchService
   
[FreeswitchService]
   ServerAddress = 192.168.1.2

In this case, the FreeSWITCH server is running on 192.168.1.2 and only viewers on the local LAN need to access it. If people needed to access the standalone (and hence the voice service) externally, then this IP would have to be one that could be reached from the outside (e.g. 80.175.122.1). No other files need to be configured.

[edit] Grid Mode

In grid mode, [FreeSwitchVoice] in OpenSim.ini and [FreeswitchService] in Robust.ini or Robust.HG.ini need to be configured. Configurations details are shown in both OpenSim.ini.example, Robust.ini.example and Robust.HG.ini.example. Here is an example configuration for OpenSim.ini.

[FreeSwitchVoice]
   Enabled = true
   LocalServiceModule = OpenSim.Services.Connectors.dll:RemoteFreeswitchConnector
   FreeswitchServiceURL = http://192.168.1.3:8004/fsapi

Add for Robust.ini/Robust.HG.ini

[FreeswitchService]
   LocalServiceModule = OpenSim.Services.FreeswitchService.dll:FreeswitchService
   ServerAddress = http://192.168.1.4

In this case, the grid service is running on 192.168.1.3 and the FreeSWITCH server is running on 192.168.1.4.

For more details on FreeSWITCH config for this version you may want to refer to

[edit] OpenSimulator 0.7.0.2 and earlier

[edit] Standalone

Add the following to your OpenSim.ini

[FreeSwitchVoice]
Enabled = true
LocalServiceModule = "OpenSim.Services.FreeswitchService.dll:FreeswitchService"

[FreeswitchService]
ServerAddress = youropensimregionip
Realm = "youropensimregionip"

[edit] Grid Mode

Add the following to your OpenSim.ini

[FreeSwitchVoice]
Enabled = true
LocalServiceModule = OpenSim.Services.Connectors.dll:RemoteFreeswitchConnector
FreeswitchServiceURL = http://ip.of.your.robust.server.for.freeswitch.connector:8004/fsapi

Add the following to your Robust.ini or Robust.HG.ini

[FreeswitchService]
LocalServiceModule = OpenSim.Services.FreeswitchService.dll:FreeswitchService
ServerAddress = ip.of.your.robust.server.for.freeswitch.connector
Realm = "ip.of.your.robust.server.for.freeswitch.connector"

If your Freeswitch complains about an unknown domain, you have probably mixed ips and host names. You should always use dotted quad IP addresses, as there are string compares done on them in Freeswitch code and a name and it's corresponding address are not considered to be the same!

[edit] Firewall Config

Basically ports 1720 and 5060, and maybe 5050 must be open for listening.

Make sure that the ports used by Freeswitch are accessible though your firewall(s). In the example above the main port used is 5060 though other ports may be used for call initiation (port 1720 for H.323 Call Signalling) and dynamically assigned ports for specific call traffic. The usual H.323 and SIP traffic dynamic port handling on modern firewalls usually enables this.

Is port 50505 actually used, or is it just something that must be
reported by OpenSimulator when the Freeswitch service makes contact?


More details on the Freeswitch ports used and firewall configuration details are at http://wiki.freeswitch.org/wiki/Firewall

If you have problems with NAT/Routers look at using STUN (Simple Traversal of UDP through NATs). More information at http://wiki.freeswitch.org/wiki/NAT_Traversal

[edit] Starting everything up

1. Freeswitch fetches OpenSimulator related configuration from the OpenSimulator freeswitch voice module and service that we set up earlier. Therefore, you need to start OpenSimulator first. On startup you should see the lines

21:45:33 - [FreeSwitchVoice]: using FreeSwitch server <your ip address>
21:45:33 - [FreeSwitchVoice]: plugin enabled

2. Start freeswitch. This will complain about

 [ERR] mod_xml_curl.c:302 Error Parsing Result! [http://localhost:9000/fsapi/freeswitch-config] data: [hostname=fruitfly&section=directory&tag_name=&key_name=&key_value=&Event-Name=REQUEST_PARAMS&Core-UUID=8cdac78a-e880-11e0-a320-3324fcf85684&FreeSWITCH-Hostname=fruitfly&FreeSWITCH-Switchname=fruitfly&FreeSWITCH-IPv4=192.168.1.2&FreeSWITCH-IPv6=%3A%3A1&Event-Date-Local=2011-09-26%2021%3A46%3A03&Event-Date-GMT=Mon,%2026%20Sep%202011%2020%3A46%3A03%20GMT&Event-Date-Timestamp=1317069963782065&Event-Calling-File=sofia.c&Event-Calling-Function=config_sofia&Event-Calling-Line-Number=3965&purpose=gateways&profile=external]

and

[ERR] mod_xml_curl.c:305 Received HTTP error 404 trying to fetch http://localhost:9000/fsapi/freeswitch-config data: [hostname=fruitfly&section=directory&tag_name=domain&key_name=name&key_value=192.168.1.2&Event-Name=GENERAL&Core-UUID=8cdac78a-e880-11e0-a320-3324fcf85684&FreeSWITCH-Hostname=fruitfly&FreeSWITCH-Switchname=fruitfly&FreeSWITCH-IPv4=192.168.1.2&FreeSWITCH-IPv6=%3A%3A1&Event-Date-Local=2011-09-26%2021%3A46%3A05&Event-Date-GMT=Mon,%2026%20Sep%202011%2020%3A46%3A05%20GMT&Event-Date-Timestamp=1317069965442975&Event-Calling-File=switch_core.c&Event-Calling-Function=switch_load_network_lists&Event-Calling-Line-Number=1173&domain=192.168.1.2&purpose=network-list]

You can ignore these errors for now - they should be fixed in the future but will not prevent Freeswitch from working.

On the OpenSimulator region (on standalone) or grid console (on grid) you should see the lines

[FreeSwitchVoice]: Received request for config section directory, event calling function 'config_sofia'
[FreeSwitchVoice]: Received request for config section directory, event calling function 'config_sofia'
[FreeSwitchVoice]: Received request for config section directory, event calling function 'switch_load_network_lists'

3. Now, make sure your parcel in the region has voice enabled in the parcel dialog. You may need to change this and then restart OpenSimulator if it wasn't previously set.

4. Login your client. Make sure you have voice enabled and it's working (probably by testing on another grid first).

5. If everything has gone according to plan, you should see something like the line

[FreeSwitchVoice]: OnRegisterCaps() called with agentID 0fe223e7-370a-46da-b935-b0831ddf6d08 caps OpenSim.Framework.Capabilities.Caps in scene test2

amongst others on the OpenSimulator region console. And on the freeswitch console you should see something like

2011-09-26 22:10:09.866918 [WARNING] sofia_reg.c:1241 SIP auth challenge (REGISTER) on sofia profile 'internal' for [xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2] from ip 192.168.1.2
2011-09-26 22:10:10.046904 [ERR] mod_xml_curl.c:305 Received HTTP error 404 trying to fetch http://localhost:9000/fsapi/freeswitch-config
data: [hostname=fruitfly&section=directory&tag_name=domain&key_name=name&key_value=192.168.1.2&Event-Name=GENERAL&Core-UUID=da41cd40-e883-11e0-b7d8-07a2aa0d33c8&FreeSWITCH-Hostname=fruitfly&FreeSWITCH-Switchname=fruitfly&FreeSWITCH-IPv4=192.168.1.2&FreeSWITCH-IPv6=%3A%3A1&Event-Date-Local=2011-09-26%2022%3A10%3A10&Event-Date-GMT=Mon,%2026%20Sep%202011%2021%3A10%3A10%20GMT&Event-Date-Timestamp=1317071410046904&Event-Calling-File=mod_voicemail.c&Event-Calling-Function=resolve_id&Event-Calling-Line-Number=1284&action=message-count&key=id&user=xD-Ij5zcKRtq5NbCDHd9tCA%3D%3D&domain=192.168.1.2]
2011-09-26 22:10:10.466949 [WARNING] sofia_reg.c:1241 SIP auth challenge (INVITE) on sofia profile 'internal' for [conf-xZGQ1Yjc3ZjgtYmY4OC00NWFjLWFhY2UtMzViZDc2NDI2Yzgx@192.168.1.2] from ip 192.168.1.2
2011-09-26 22:10:10.646923 [NOTICE] switch_channel.c:816 New Channel sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 [eb426488-e883-11e0-b7e2-07a2aa0d33c8]
2011-09-26 22:10:10.646923 [INFO] mod_dialplan_xml.c:331 Processing Justin Clark-Casey <xD-Ij5zcKRtq5NbCDHd9tCA==>->conf-xZGQ1Yjc3ZjgtYmY4OC00NWFjLWFhY2UtMzViZDc2NDI2Yzgx in context default
2011-09-26 22:10:10.646923 [NOTICE] mod_dptools.c:930 Channel [sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2] has been answered
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6561 using channel sound prefix: /usr/local/freeswitch/sounds/en/us/callie
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '0' to 'mute'
2011-09-26 22:10:10.646923 [INFO] switch_ivr_async.c:163 Digit parser mod_conference: Setting realm to conf
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '*' to 'deaf mute'
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '9' to 'energy up'
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '8' to 'energy equ'
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '7' to 'energy dn'
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '3' to 'vol talk up'
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '2' to 'vol talk zero'
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '1' to 'vol talk dn'
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '6' to 'vol listen up'
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '5' to 'vol listen zero'
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '4' to 'vol listen dn'
2011-09-26 22:10:10.646923 [INFO] mod_conference.c:6924 sofia/internal/xD-Ij5zcKRtq5NbCDHd9tCA==@192.168.1.2 binding '#' to 'hangup'

With any luck, the voice buttons on your client will now be active and working.

[edit] Issues and Solutions

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.

Check the plot also has voice enabled. You must be a plot owner or have suitable permisison to do this. Recent Linden Labs Second Life viewers do not offer this option, so use Hippo or another client which does.

Issue
Resolution
--[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:5060:
This means something is using the port 5060, usually freeswitch is already running, on Ubuntu, try the following command: netstat -npl | grep 85060 If freeswitch is running, close is with: sudo freeswitch -stop OR sudo invoke-rc.d freeswitch stop
--[ERR] [WARNING] sofia_reg.c:1540 sofia_reg_parse_auth()Can't find user [x8cOXAiIzTVC6xqf-nquLkw==@"some ip or domain here"] etc ... a solutions to this error is, mod your vars.xml replacing the domain lines <X-PRE-PROCESS cmd="set" data="domain=whatever is in the realm setting of your freeswitch config"/> <X-PRE-PROCESS cmd="set" data="domain_name=whatever is in the realm setting of your freeswitch config"/> - Now this will most likely break your freeswitch for anything other than your opensim. But should get you closer
--[WARNING] mod_local_stream.c:393 Unknown source moh, trying 'default'

[ERR] mod_local_stream.c:402 Unknown source default

If you see these log messages continuously on the Freeswitch console, then you have either not disabled the conference sounds or you have not installed them (see earlier).



Use some of the debugging features in FreeSWITCH:

  • conference list <--- to see if you have any conferences setup (note you have to be inworld when you try this)
  • xml_curl debug_on <--- this command will dump the transactions between OpenSimulator and FreeSWITCH into a file (on linux it is in /tmp)
  • xml_curl debug_off <-- turn it off after you login/logout a few times

[edit] Notes from Openvue Grid setup for FreeSwitch

Using Windows Vista 32 bit OS. Works with FreeSwitch 1.0.4 and later (for a specific tested example, FreeSWITCH Version 1.0.head (git-e0c37c1 2010-11-05 18-20-09 -0500)).

Additional notes that might help:

1. We established a simple OpenSim.exe on the SAME host as the FreeSwitch.exe service and put a single simple island on that (we called it "Talk") as some folks observed that FreeSwitch had problems with connecting if it was CONFIGURED to link to another server, but we don't believe this is necessary.

2. FreeSwitch provides service to all OpenSim.exe instances on any servers you wish even though its only configured for one.

3. There is one FreeSwitch channel per region, change regions and you change channel. So all users to talk must be on the same region. All plots on one region share the same single region channel.

4. You appear as one user in the SL Viewers, ALL other users appear as a single "user" with a coded name for the other users on the channel - something like conf-x9999999999999999999.

5. You must have voice enabled at the region, AND the plot level. This is a pain, as the default setting in OpenSimulator is that PLOTS have voice turned off. The standard viewers 1.23 and 2.x do not allow you to turn this back on, so you must use a third party viewer to turn on PLOT voice. I have asked before that we change the default setting when a plot is created to have this on by default (or on if the region voice is on - which it is by default).

6. We are not sure if you MUST start FreeSwitch.exe before the regions that you want voice to work on. But we do so for safety. It works fine over OpenSim.exe restarts without FreeSwitch being started again.

7. If you wish to use FreeSwitch beyond your local network, remember to configure for EXTERNALLY accessible IP addresses. Use IP numbers for FreeSwitch... and if there are 192.168.x.x style local net addresses in there you will not get FreeSwitch to work with external users. It can work through a range of firewalls with suitable mechanisms such as port forwarding or DMZs, so long as you definitely map to the externally visible IP address. Ensure you have the appropriate ports open in your Firewall(s). See separate section in Wiki on ports required.

8. There are some red errors on startup of FreeSwitch - at least in our setup - which appears to be related to a missing config file that FreeSwitch tries to retrieve from OpenSimulator (opensim-region-server-url:port/api/freeswitch-config) that is not in the OpenSimulator setup... We have (safely?) ignored those without problems...

2010-11-13 14:42:55.252361 [ERR] mod_xml_curl.c:252 Received HTTP error 0 trying
to fetch http://129.215.219.143:9000/api/freeswitch-config
data: [hostname=shuna&section=directory&tag_name=domain&key_name=name&key_value=
129.215.219.143&Event-Name=GENERAL&Core-UUID=cb64ea40-aa92-494b-be13-65d9c468efe
c&FreeSWITCH-Hostname=shuna&FreeSWITCH-IPv4=129.215.219.143&FreeSWITCH-IPv6=2002
%3A81d7%3Adb8f%3A%3A81d7%3Adb8f&Event-Date-Local=2010-11-13%2014%3A42%3A54&Event
-Date-GMT=Sat,%2013%20Nov%202010%2014%3A42%3A54%20GMT&Event-Date-Timestamp=12896
59374247361&Event-Calling-File=switch_core.c&Event-Calling-Function=switch_load_
network_lists&Event-Calling-Line-Number=984&domain=129.215.219.143&purpose=network-list]

9. 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 relevant lines. See examples above on this Wiki page.

Personal tools
General
About This Wiki