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”); 
          SpeechCommon.Navigate(“MainMenu.aspx”);
          break;
      case “1689”: // 800-123-9543
      case “4689”: 
          LogMessage(“CALL DESTINATION”, “Application 2″); 
          SpeechCommon.Navigate(“App2Menu.aspx”);
          break;
      case “1559”: // 800-999-9290
      case “4659”:
          LogMessage(“CALL DESTINATION”, “Application 3″); 
          SpeechCommon.Navigate(“App3Menu.aspx”);
          break;
      case “1111”: // this is for debugging/testing 
           // it points to whaterver needs testing
          //debugger   
          SpeechCommon.Navigate(“App3SubDialog.aspx”);
          break;
      case “2608”:
      case “3061234”:
      case “9043061234”:
          LogMessage(“CALL DESTINATION”, “App Test”); 
          SpeechCommon.Navigate(“AppTest.aspx”);
          break;
      case “2999”:
      case “3062999”:
      case “9043062999”:
          LogMessage(“CALL DESTINATION”, “System Test”); 
          SpeechCommon.Navigate(“SystemTest.aspx”);
          break;
      default:
          LogMessage(“CALL DESTINATION”, “Main pplication (default)”); 
          SpeechCommon.Navigate(“MainMenu.aspx”);
   }
   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.


 



 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>