October 2009


Arts & Entertainment and Created by Nate and General28 Oct 2009 01:28 am

I’ve decided to go ahead and make all of my completed (and one mostly-complete) tracks available here under a CC-BY-SA License. There are 13 tracks so far, all trance-influenced electronica, some with female vocals by Naomi. Any and all feedback is appreciated, but mostly — enjoy!

On a related note, I’m making decent headway on a new track which I’ll hopefully release before the end of the year if I manage to get enough breathing room around my upcoming web-based game project which is now running a private alpha. I’ll convert that project to public alpha shortly, so keep an eye out for a post announcing this!

General and Programming22 Oct 2009 04:44 pm

I’ve had occasion to play around with FreeSwitch lately and was looking at implementing a directory of extensions on the main menu, and so I set up Brian Snipes’ example Lua directory from the FreeSwitch wiki. I didn’t like the fact that the extension list was hardcoded, so I replaced the names{} table with the following bit of code. It’s ugly, but it’s my first 2-3 hours of messing with Lua. Anyway, it basically makes a system call to “grep” to pull the extensions out of your FS directory XML files using the effective_caller_id_* values which you may or may not have in each listing in the directory. Maybe this will help someone avoid having to reinvent the wheel completely.

Note: this presumes that each entry in the directory lives in its own users_[firstinitial][lastname].xml file. For example, I have users_nsimpson.xml containing the following two lines:

<variable name="effective_caller_id_name" value="Nate Simpson"/>
<variable name="effective_caller_id_number" value="1000"/>

You can hack the following code to match the particulars of your own installation. Also, I think string.gfind() has become string.gmatch() in Lua 5.1, so you may need to tweak that as well.


-- NS: build the names table from grep
directory_path = "/usr/local/freeswitch/conf/directory/default/"

namesearch = io.popen("grep effective_caller_id_ "..directory_path.."user_*.xml")
namelist = namesearch:read("*a")
namesearch:close()

names = {}

for thisuser, thisname in string.gfind(namelist, "user_(%a+)\.xml:%s+ xsp,xfp,thisextension= string.find(namelist, "user_"..thisuser.."\.xml:%s+ reversename = string.gsub(thisname, "(%a+)%s(%a+)", "%2_%1")

names[reversename] = thisextension
end