Welcome to GotSpeech.NET Sign in | Help

Marshall Harrison - "the gotspeech guy"

Site news, Speech Server insight and assorted ramblings
Hosting Multiple Applications

The question came up recently in one of our forums regarding testing new applications on a live server. This got me to thinking about hosting of multiple applications on one server.

Unfortunately with MSS 2004 you can technically only host one application. This is because TAS can only point to one web address for an inbound application and it only looks at one message queue for outbound applications. Fortunately there is a practical way around this restriction for both inbound and outbound and it involves code (which is what we all like to do). I'm going to show you away around this for an inbound call and briefly touch on how to handle the problem with outbound calls and thin I'll finish with a quick peek at how MSS 2007 handles this.

As I stated for inbound calls, TAS can only point to one web page. Since we can’t change TAS then we have to consider how we can make that web page handle multiple applications. This is easily done if you think of the web page as an application router. Every call into your system will be sent to that page and then it will "route" the call to the proper application.

How does it do that? There are a couple of ways; for example you could ask the user which app they were calling for but that isn't very elegant. A much better approach is to design your applications so that they answer to different phone numbers. Your router page would then look at the called DNIS and determine which application to run. Technically you only have one application but if you design the router correctly it can send the caller to any number of virtual applications.

This is really a very simple thing to do in your code. I do it in the JavaScript but it can be done in the code-behind. The web page that TAS points to contains nothing but an AnswerCall control with the OnClientConnected set to a JavaScript function called DetectCallDestination which looks like this -

 function DetectCallDestination(obj, callid, networkCallingDevice, networkCalledDevice)

  switch (networkCalledDevice)
      case "4511": //Main Menu
      case "8600": //Limited PROD
          LogMessage("CALL DESTINATION", "Main Application"); 
      case "1689": // 800-123-9543
      case "4689": 
          LogMessage("CALL DESTINATION", "Application 2"); 
      case "1559": // 800-999-9290
      case "4659":
          LogMessage("CALL DESTINATION", "Application 3"); 
      case "1111": // this is for debugging/testing 
           // it points to whaterver needs testing
      case "2608":
      case "3061234":
      case "9043061234":
          LogMessage("CALL DESTINATION", "App Test"); 
      case "2999":
      case "3062999":
      case "9043062999":
          LogMessage("CALL DESTINATION", "System Test"); 
          LogMessage("CALL DESTINATION", "Main pplication (default)"); 
   return true;

As you can see you can add any number of applications to the router by adding another case statement checking for the correct DNIS. My applications reside behind our PBX so I check for the 4 digit extension code as well as the 7 & 10 digit numbers is some cases as I sometimes can't control how the DNIS comes in.

I have a default case that sends the caller to the primary application incase a new number gets pointed to my apps by accident. I also have some special cases I handle. For example, the case "1111" is something that I use when debugging an application. Often times I don't want to navigate down through several menus (that have already been tested) to get to the area I need to test so I use "1111" in TASIM to get me as close to the code I'm testing as possible.

For outbound calls you will need to do something similar except that you will have to pass the application to run as a parameter on the command line. Not hard to do at all so I'll leave that as a homework assignment for you to play with. If you get stuck on this then email and I’ll help out.

MSS 2007 has a better approach to this when doing SIP. In the MMC You can set the URL and the Message Queue at the application level along with which SIP addresses it answers to. This makes a much neater and a more practical approach.

As with most things in life there is more that one way to do this. If you have addressed this problem differently I would love to hear how you solved the problem.



Posted: Friday, October 13, 2006 9:22 AM by marshallharrison


brandontyler said:

Speech Application Deployment Service will do all this for you as well.  It is a redistributable installer in the SDK.  It allows you to configure what apps go with what DNIS numbers like you can in MSS 2007. You can read about it here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/SASDK_UserManual/html/um_deploy_adding_configuring_web_server.asp
# October 13, 2006 10:55 AM

marshallharrison said:

I've never used SADS as I've always preferred to just copy the Directories to the server.

Do you know how it works under the covers? TAS still only has on start page and queue.
# October 13, 2006 12:16 PM

brandontyler said:

You point TAS at the SADS start page and then it routes by DNIS.  It also takes care of the caching by using the manifest.xml.  It is pretty cool you should check it out.
# October 17, 2006 9:38 PM

brandontyler said:

It says Deployment but it really should say routing service. It really just routes to the correct application according to DNIS (or port).  I copy my directories to the server as well.  Or I make a .msi.
# October 17, 2006 9:39 PM
Anonymous comments are disabled