Saturday, August 29, 2009

Connecting to OpenSim with SL Viewer on Mac

I am just running a sim in standalone mode but I want to share it out to other computers on my home network. Whether you are or not it's the same. The only diff is where it says 'ipofyoursim' you'll put whatever fixed IP your sim has.
  1. Download Second Life to your Mac, version 1.23, not viewer 2.
  2. Make edit as plain text rather than rtf. This is because when you run the commands in the plain text file the shell will encounter formatting codes if it's rtf format.
  3. Paste this in a new file: /Applications/Second\\ Life -loginuri http://ipofyoursim:9000/ -loginpage http://ipofyoursim:9000/?method=login. Save file as '' on desktop.
  4. Open terminal, navigate to desktop (cd desktop).
  5. Change permissions to executable (chmod 777
  6. Run executable (./ Preceding ./ is required because for a file to be run as an executable the shell needs the file's system path. If the terminal session is in the same folder as the file, ./ is shorthand for the system path to terminal's location.
  7. Login to your sim!
  8. For a more user-friendly method, create an applescript with the script do shell script "/Users/username/desktop/" and put that on the desktop. No need to bother with Terminal after the chmod.

Thursday, August 27, 2009

FreeSWITCH log, successful connection

Logfile contents of a successful OpenSim chat connection using FreeSWITCH, including text coloring.
2009-08-27 14:13:40.525224 [DEBUG] switch_core_state_machine.c:397 (sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ Running State Change CS_NEW
2009-08-27 14:13:40.525224 [DEBUG] switch_core_state_machine.c:403 (sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ State NEW
2009-08-27 14:13:40.525224 [DEBUG] sofia_glue.c:3079 Audio Codec Compare [SIREN14-3D:111:32000:0]/[G7221:115:32000:20]
2009-08-27 14:13:40.525224 [DEBUG] sofia_glue.c:3079 Audio Codec Compare [SIREN14-3D:111:32000:0]/[G722:9:8000:20]
2009-08-27 14:13:40.525224 [DEBUG] sofia_glue.c:3079 Audio Codec Compare [SIREN14-3D:111:32000:0]/[PCMU:0:8000:20]
2009-08-27 14:13:40.525224 [DEBUG] sofia_glue.c:3079 Audio Codec Compare [SIREN14-3D:111:32000:0]/[PCMA:8:8000:20]
2009-08-27 14:13:40.525224 [DEBUG] sofia_glue.c:3079 Audio Codec Compare [SIREN14-3D:111:32000:0]/[GSM:3:8000:20]
2009-08-27 14:13:40.525224 [DEBUG] sofia_glue.c:3079 Audio Codec Compare [PCMU:0:8000:0]/[G7221:115:32000:20]
2009-08-27 14:13:40.525224 [DEBUG] sofia_glue.c:3079 Audio Codec Compare [PCMU:0:8000:0]/[G722:9:8000:20]
2009-08-27 14:13:40.525224 [DEBUG] sofia_glue.c:3079 Audio Codec Compare [PCMU:0:8000:0]/[PCMU:0:8000:20]
2009-08-27 14:13:40.540848 [DEBUG] sofia_glue.c:2037 Set Codec sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ PCMU/8000 20 ms 160 samples
2009-08-27 14:13:40.540848 [DEBUG] sofia_glue.c:3039 Set 2833 dtmf payload to 101
2009-08-27 14:13:40.540848 [DEBUG] sofia.c:3376 (sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ State Change CS_NEW -> CS_INIT
2009-08-27 14:13:40.540848 [DEBUG] switch_core_session.c:933 Send signal sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ [BREAK]
2009-08-27 14:13:40.540848 [DEBUG] switch_core_state_machine.c:397 (sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ Running State Change CS_INIT
2009-08-27 14:13:40.540848 [DEBUG] switch_core_state_machine.c:480 (sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ State INIT
2009-08-27 14:13:40.540848 [DEBUG] mod_sofia.c:83 sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ SOFIA INIT
2009-08-27 14:13:40.540848 [DEBUG] mod_sofia.c:111 (sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ State Change CS_INIT -> CS_ROUTING
2009-08-27 14:13:40.540848 [DEBUG] switch_core_session.c:933 Send signal sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ [BREAK]
2009-08-27 14:13:40.540848 [DEBUG] switch_core_state_machine.c:480 (sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ State INIT going to sleep
2009-08-27 14:13:40.540848 [DEBUG] switch_core_state_machine.c:397 (sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ Running State Change CS_ROUTING
2009-08-27 14:13:40.540848 [DEBUG] switch_core_state_machine.c:483 (sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ State ROUTING
2009-08-27 14:13:40.540848 [DEBUG] mod_sofia.c:130 sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ SOFIA ROUTING
2009-08-27 14:13:40.540848 [DEBUG] switch_core_state_machine.c:78 sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ Standard ROUTING
2009-08-27 14:13:40.540848 [INFO] mod_dialplan_xml.c:252 Processing Sophie Nauman->confctl-xNDFhZTQ4MjEtMDFmMi00NDNkLTkzMWEtOWRhMjA3YmQ1ZTFk in context default
Dialplan: sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ parsing [default->sip_uri] continue=false
Dialplan: sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ Regex (FAIL) [sip_uri] destination_number(confctl-xNDFhZTQ4MjEtMDFmMi00NDNkLTkzMWEtOWRhMjA3YmQ1ZTFk) =~ /^sip:(.*)$/ break=on-false
Dialplan: sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ parsing [default->opensim_conferences] continue=false
Dialplan: sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ Regex (PASS) [opensim_conferences] destination_number(confctl-xNDFhZTQ4MjEtMDFmMi00NDNkLTkzMWEtOWRhMjA3YmQ1ZTFk) =~ /^confctl-(.*)$/ break=on-false
Dialplan: sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ Action answer()
Dialplan: sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ Action conference(xNDFhZTQ4MjEtMDFmMi00NDNkLTkzMWEtOWRhMjA3YmQ1ZTFk-${domain_name}@default)
2009-08-27 14:13:41.556460 [DEBUG] switch_core_state_machine.c:114 (sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ State Change CS_ROUTING -> CS_EXECUTE
2009-08-27 14:13:41.556460 [DEBUG] switch_core_session.c:933 Send signal sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ [BREAK]
2009-08-27 14:13:41.556460 [DEBUG] switch_core_state_machine.c:483 (sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ State ROUTING going to sleep
2009-08-27 14:13:41.556460 [DEBUG] switch_core_state_machine.c:397 (sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ Running State Change CS_EXECUTE
2009-08-27 14:13:41.556460 [DEBUG] switch_core_state_machine.c:490 (sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ State EXECUTE
2009-08-27 14:13:41.556460 [DEBUG] mod_sofia.c:173 sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ SOFIA EXECUTE
2009-08-27 14:13:41.556460 [DEBUG] switch_core_state_machine.c:151 sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ Standard EXECUTE
EXECUTE sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ answer()
2009-08-27 14:13:41.556460 [DEBUG] mod_dptools.c:649 sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@ receive message [ANSWER]
2009-08-27 14:13:41.556460 [DEBUG] sofia_glue.c:2271 AUDIO RTP [sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@] port 17858 -> port 22860 codec: 0 ms: 20
2009-08-27 14:13:41.556460 [DEBUG] switch_rtp.c:1138 Starting timer [soft] 160 bytes per 20ms
2009-08-27 14:13:41.556460 [DEBUG] mod_sofia.c:549 Local SDP sofia/internal/xWOiLAj9AQHGGCji61A8MMw==@
o=FreeSWITCH 1251378963 1251378964 IN IP4
c=IN IP4
t=0 0
m=audio 17858 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -

Thursday, August 06, 2009

Voice chat in OpenSim

Good news--it works. Bad news--it's hard to do.
(UPDATE 10/16: Not hard any more. The binary install of OpenSim is easy with the Diva Distribution. The FreeSWITCH part is kind of hard, still.)
This post explains my specific environment (standalone on a LAN).
This is my setup: XPSP2, compiled version 0.6.5 of OpenSim, Freeswitch, and SL Viewer version 1.23. Here are the steps to making it happen:
  1. First install MySQL like in this tutorial.
  2. The binary version of OpenSim doesn't include the Freeswitch voice module, so you'll have to compile an experimental version from source. (update: well, now I've upgraded to the 0.6.6 binary on a separate installation and it does include the FreeSwitch module, but I can't get it to run with MySQL storage, only SQLite. Something to work on...)
  3. A couple weeks ago I used an SVN client, or subversion client, called TortoiseSVN to download the subversion 0.6.5 from They've since moved to a system called 'Git' for downloading subversions and the versions are no longer there. I haven't tried Git but the directions for installing it are here and downloading the right version here (scroll down). Just try to get 0.6.5 as I found when upgrading to 0.6.6 it wouldn't run with MySQL. Some configurations were changed I couldn't figure out. Download it to C:\Program Files\OpenSim (you have to create this first).
  4. Once you have the files and folders, you have to compile the program. Go here and scroll down to the green Visual C# 2008 compiler and download and install it. It will also contain the .NET 2.0 framework, which is required for OpenSim to run.
  5. Now it's time to compile. Navigate to your OpenSim directory and run "runprebuild.bat" by double clicking on it.
  6. Open Visual C# through the start menu. Click File > Open Project. Browse to your OpenSim directory and choose a file called "OpenSim.sln". On the right side in a moment you should see a file tree under Solution Explorer. At the top menu, click Build > Build Solution. At the bottom of the Visual C# window you'll see the status change as it builds each project. It will tell you when it's done.
  7. Before you configure OpenSim, you need to download and configure Freeswitch. You can download a precompiled binary here, and, yes, you have to install the Microsoft Visual C++ 2008 Redistributable Package like it says before you run the Freeswitch program.
  8. To configure Freeswitch to work with OpenSim, you have to change some config settings in a few xml files, explained here. This video also demos the steps, though the end, configuring the region, has conflicting info. He's using SLViewer v1.22 but it shouldn't work until 1.23.
  9. Now you're ready to configure settings for OpenSim in the OpenSim.ini file. Follow these instructions from numbers 5-11 to set OpenSim to store data in your MySQL database and other stuff. This version will have the Freeswitch module section that was absent in the binary version. Configure those settings as shown at the bottom of the Freeswitch config instructions.
  10. Now you can start up Freeswitch. Double click freeswitch.exe. Ignore the red error messages (really!). Start up OpenSim exe. Now go to exactly 3:00 here where they are starting OpenSim.exe and follow their steps, which continue on in part 2, EXCEPT where you put in the region IP (at 5:00) you'll want to put in the computer's fixed IP (Your sysadmin will have to assign the computer a fixed IP if you can't). You can stop when they get to downloading Hippo Viewer.
  11. Now you need the SLViewer version 1.23. This is key, because earlier versions don't work with Freeswitch. Install it and configure it as in step 14 here.
  12. Once you're logged in to your sim, you have to enable voice chat for the estate. Click Edit > Preferences and under Voice Chat make sure it's enabled. Then click World > Region/Estate, click the estate tab and make sure "Allow Voice Chat" is checked. The above video I mentioned is confusing because he is using SLViewer v1.22, which allows him to make the final config adjustment of right clicking on the terrain, clicking About Land, clicking the media tab, and choosing either "use the estate spatial channel" or "private channel". This option isn't available in v1.23, but I couldn't get voice to work in 1.22. Even now I'm wondering if I was able to get it to work in 1.23 because I had first selected the "use estate spatial channel" in a 1.22 viewer, then switched to 1.23. I don't know...It's also possible I didn't know to click the lock on the talk button and that's why it didn't work in 1.22, though I could swear the talk button was greyed out, unclickable.
  13. Anyway, once these things are set, you need someone else to log on or you could talk to yourself over two computers. If you are using headsets, make sure they are plugged in before starting the viewer. To talk, look for the talk button on the lower right. Click the lock next to it to toggle talking on or just click and hold the talk button while you're talking.

Monday, August 03, 2009

Installing OpenSim to use over a LAN

OpenSim is an open source version of Second Life. You install, run, and configure it, set up a viewer, and it's your very own virtual world. SL has tons of object (prims) that are given away or sold and OpenSim is a blank slate. But it's yours and you have full control over who can access it and what they can do there. That makes it an excellent resource for teaching.

There are lots of tutorials on getting your own OpenSim up and running out there but 90% are just for standalone sandbox on your own machine and the rest are for grid mode in which you link your region with others out there on other people's machines. I'm writing this tutorial because I want to run my own sim but have my students connect to it through a client viewer on laptops connecting over our school's wireless network. The basic plan is installing the opensim service on a computer, installing MySQL so objects have permanence and don't have to be reactivated when the sim restarts or users log off, and giving that computer a static IP so client apps always know where to find it. With this setup you can run the sim on one computer and connect to it from any other computer on your school network, but it's not publicly available outside your school unless you open that IP up through the firewall (which I may consider later on). Here's how I did it (UPDATE 10/16: I've just upgraded to the newest version of OpenSim using Diva's Distribution, which makes all of the following pretty much obsolete. I'm just keeping the old steps below so I can look back some day and appreciate how far it's all come. It's now SO much easier. Here is the tutorial for the Diva approach.)
  1. Desktop running Windows XP SP3, assigned a static IP by the DNS server, no monitor, I just log in remotely. (Ask your system administrator to assign the IP if you, like me, can't.)
  2. MySQL 5.1 installed (good instructions here, a little old. The Toad (MySQL GUI) part is for an earlier version of Toad, but the idea is to create a root account and create a new database called 'opensim'. If you prefer you can use the mysql command line (tutorials here and here instead for mysql command line tools. No need to create any tables. OpenSim will do that on first run. Stop the first tutorial and continue to the next step when he gets to configuring the opensim.ini file because it's for an older version of OpenSim.
  3. Okay, now go download an opensim binary (look for the Windows binary on the right, soon to be version 0.6.6). The version I've installed is 'standalone' 0.6.3. The two flavors of OpenSim are standalone and grid mode and I spent two days thinking that since I wanted to share out my region with other computers on our LAN I needed grid mode (which is much more complicated to install). After much frustration (couldn't connect) it dawned on me that grid mode is for connecting regions over the internet. Standalone is what you want if you're just looking for an insulated virtual world not connected to the other regions out there.
  4. Run the installer but don't start OpenSim yet. First you need to edit some settings in the OpenSim.ini file you'll find among the many files in the Program Files\OpenSim folder. OpenSim.exe looks to this file for all of its configuration info so you set these here by adding and removing semi-colons so it will ignore and follow what you want it to.
  5. So open OpenSim.ini in a text editor.
  6. Under STORAGE add a semi-colon in front of storage_plugin = "OpenSim.Data.SQLite.dll"
    (and the next line "storage_connection_string" if it doesn't have one).
  7. You want it to use your MySQL database to store primitives and user attributes so they stay from one session to another. I believe the default, SQLite, isn't good with that. So remove the semi-colon from storage_plugin="OpenSim.Data.MySQL.dll" and the next line.
  8. One the connection string line you'll need to add your database details, storage_connection_string="Data Source=localhost;Database=opensim;User ID=root;Password=yourpassword;";
  9. Under the PHYSICS section you might want to uncomment the physics = OpenDynamicsEngine line. This physics algorithm prevents objects from going through each other whereas the default doesn't.
  10. The PERMISSIONS section allows you to set permissions (obviously) but I haven't played with that yet. I will definitely revisit those settings soon. Once OpenSim is running, you can shut it down, change settings, and restart it if you want to adjust things.
  11. In the STANDALONE section there are more SQLite settings and you need to change them to the same MySQL settings as in the STORAGE section.
  12. There are more interesting settings further down that I haven't investigated yet, like SUN for daytime and nighttime automation and VOICE for voice chat. I'll update when I get these figured out. You'll see below I'm not using the Hippo Opensim viewer but if you do you'll want to fill in the GRIDINFO section which gives the appropriate details to Hippo when you set it to your sim.
  13. Now go to exactly 3:00 here where they are starting OpenSim.exe and follow their steps, which continue on in part 2, EXCEPT where you put in the region IP (at 5:00) you'll want to put in the computer's fixed IP. You can stop when they get to downloading Hippo Viewer.
  14. I tried Hippo and it's great except that if students are connecting on Windows machines with network accounts Hippo has no way I could figure out of saving the sim IP as the default for all users on the machine. Instead, I downloaded the Second Life viewer, installed it on the student laptops, right clicked on the desktop icon (which will need to be moved to the All Users desktop and given full permissions to 'everyone') and added the following flag in the 'target' field: -loginuri That reroutes the viewer to your sim rather than actual Second Life on the web. If you don't want the occasionally racy SL screenshots showing up either you can add -loginpage
  15. Now with your sim running, open the SL viewer from the icon and login with the master avatar account you created. I hope it works!
  16. Finally, you might be wondering about voice chat. There's supposedly a module, explained here, that enables that through the SL viewer. We'll see. I've spent some time on this but I'll address it in a separate post because it turns out to be quite involved.

Teaching With OpenSim

The drama teacher in my school asked me to look into setting up a virtual world like Second Life that he could use for his students to produce and perform a virtual play, with an eye towards eventually collaborating with another school. It's an amazing idea. I looked into a few existing options--Second Life and There. But neither fit our needs. SL is bandwidth heavy and segregates teens from adults unless you purchase a private island for a grand and while There is more affordable you can't share the prims you've purchased (I don't think you can actually make things yourself), which rules out easy collaboration. I have more thoughts on the ideologies of SL and There here.

So I settled on OpenSim for an adventure. Now that it's set up it is the perfect platform. Permissions can be managed, prims can be shared with other users, and in many other ways you have full control over your region.

A couple of other ideas that have occurred to me are virtual soccer (just for fun), and sculpture exhibits. I would like to have a department meeting in there, too. If anyone has more ideas let me know.