One of the new features of sipsorcery is the ability to create multiple dialplans. This means it’s now a lot easier to do a bit of testing if you’re struggling with a bit of Ruby script.

As an example say you have an issue with a regular expression match (a topical subject on the forums at the moment) you could create a new dialplan and put some minimal regular expression matching code in it.

sys.Log("webcallback dialplan starting...callback number=#{req.URI.User}")
case req.URI.User
   when /\*1234$/ then sys.Log("#{req.URI.User} matched /\*1234$/")
   else sys.Log("No match")

In this case I have used my webcallback dialplan so that I can do a test by invoking the callback URL
instead of having to call into my dialplan.

To invoke the above dialplan I used the following URL, you will need to put in your own sipsorcery username for it to work for you.*1234

I got the dialplan trace emailed to me and unsuprisingly the log messages were:

DialPlan=> Dialplan trace commenced at 16 Jul 2009 18:36:08:180.
DialPlan=> webcallback dialplan starting…callback number=*1234
DialPlan=> *1234 matched /*1234$/