Techie Post: Opensim and Freeswitch problems

I was just replying to a note asking about Opensim and Freeswitch based on the fact I have it working(ish) on Ubuntu on a cloud server. I have been meaning to share where I am up to, though I have not found a complete solution to the problem I am having. However this snippet may help someone, or they may be able to help me 🙂

My Opensim and Freewswitch are running Ubuntu Karmic on a cloud service. Both opensim and freeswitch get built rather than binary distributions. However the ini files and config should be the same (as thats the beauty of this).

Freeswitch works by really just opening a conference call which any avatar will dial into. I am not sure how much digging you have done into the problem but there are a few things to look out for.
I am assuming you have followed the main instructions for config etc http://opensimulator.org/wiki/Freeswitch_Module

I had this all running from 6.8 onwards but recently moved to 0.7 I noticed in bin/config-include that there was now a line in StandaloneCommon.ini for Freeswitch not just the Opensim.ini. I think I had to uncomment that when I moved to 0.7

The main thing is to make sure that Freeswitch is started first and ready , then spark up opensim.

The default for the region in Opensim is to not have voice enabled at a land parcel and region level. In Hippo I enter god mode and set both the estate options and the parcel options to allow voice. Having done that (only needed if reloading the terrain or something major, I usually logoff and log on again with the view and it gets enabled. That one has caught em a few times.

The other thing to consider is some of the viewers, in particular the more recent open source ones are not allowed to package the SLVoice components with them. That one caught be when I asked someone to use Hippo on windows. The Mac hippo is old enough to still have the voice DLL but the newer windows one did not have it! SL Viewer 1 should of course be OK, but I think it is still not advisable to use SL Viewer 2 on opensim. Imprudence discusses a patch http://imprudenceviewer.org/wiki/How_to_Re-enable_Voice_Chat which is how I found out the root of the problem

The server firewall is another thing to check, as is the client firewall. As the ports are potentially different as freeswitch is a completely different application to opensim and the viewer can get blocked.

Should all of the above be ok then its console time for both Opensim and Freeswitch. There are some spurious errors it seems as things try to establish connections. However if you get a couple of clients connected (assuming you get the voice enabled in teh client) you can go into freeswitch and use the sofia commands. sofia status and sofia status profile internal both give a bit of information. I am no expert on the commands but I have been able to see if clients have connected from opensim.

This is where we get to a problem I now have. Freeswitch seems to not be working for everyone who comes to my sim. In my testing I used a mac and a windows machine on my own network at home but both talking to the remote cloud server. That has always worked (though technically it shows as the same IP address twice). I patched in someone else across the country who was using SL viewer 1 and we had a conversation, so I thought it was all working. However a few other people, when we have tried a larger meeting, have experienced problems.

It has been a mix of using a viewer with no SLVoice in it, firewalls but also some strange timing behaviour. It is quite difficult to test but that is why I have been using the sofia commands.

The first person to connect will generally get hold music playing. The second person to connect will enter the call, there is a beep as that happens the hold music ends. However you cannot always hear anyone speaking.
I suspect this is the client firewall operating. i.e. Opensim will talk to freeswitch at a server to server level to patch the person in. the Sofia status tends to show me all the users patched in to the freeswitch console. After that its the SL clients doing the work. When I get no voice response it tends to break the call for everyone. I have not found out how to check that or tell freeswitch to ignore bad calls. Getting the once that break it to logoff so there is only 1 person (i.e. me) in the call sometimes takes a few minutes before the hold music kicks in again. There are some sofia reset commands for the profile that I have dabbled with.

It was only a few weeks ago I hit this snag, the people using my freeswitch are not always in a position to mess with their company firewalls so it has been hard to get a test rig that fails consistently to try and debug it.

I have been meaning to write this down somewhere to help others but wanted to try and fix the problem first, but not many people are using or trying freeswitch.

Having said that if you get the voice connected (probably the god mode parcel audio solution at the start of this) you may find it just works. It could be my server having some bandwidth or memory issues etc. Its a tricky one to spot.

Brushing with java once more

Way back in the dim distant past I spent a lot of time with Java as a language. It was the up and coming write once run anywhere new kid on the block. The trouble was we had to deal with client side applets and the delivery of those to places was getting to be a bit of a mess with lots of plugin’s classpaths and all sorts of clunkiness. On the server we had very rich application server environments like Websphere, Weblogic and ATG Dynamo. They worked well, but were just too big to do anything quickly, so along came PHP (Personal Home Page) which just let people do stuff. Its the foundation of many a blog (WordPress is all PHP as is Boonex Dolphin). PHP talks to nice simple database servers like MySQL. The sort of thing we were doing on Websphere.
However, not we are back to needing richer applications, maintaining state and server side cleverness I seem to be bumping into Java again.
Smartfox server is Java, persisting UDP connections talking to MySql etc that I am talking to with all sorts of clients like Unity3d.
Another project is modelled in Java but talks to Second Life.
Project Wonderland is Java and works really well. I got a great tour of the workings of Wonderland. One of the things you know will happen with Java is the software engineering will be in place (in general). PHP seems to be quicker to hack and you can do good design, but why would you. Java is more for the engineer.
Hence we get things in virtual worlds like Project Wonderland’s toolkit around capabilities. It feels a very Java way to do it, and the notion of containment fits well with a pure OO language.

Project Wonderland Capabilities from Nicole Yankelovich on Vimeo.

Of course when it comes down to it good code is good code.
The impressive thing now is that the cloud servers and server providers like Slicehost running things linux means that it is very easy (its all relative) to get a java package(like wonderland or smartfox) and get it running, or get a mono package (like opensim) and get it running, or just do a LAMP (linux, Apache, Mysql,PHP) application running.
It means, once a little fiddling around is done) that applications can be built not just installations of difficult software. Its not quite utility computing, there still has to be something for us techs to do, but it feels way easier than it used to to get going with applications now.
I have to say how great all the resources on Slicehost are too, for things like the magic apt-get incantations you have to do to easily get the AMP in LAMP going 🙂