The World According to Marc
-
UCMA 3 How-To: Inbound Call Throttling
Speech Server included a setting in the Administrator Console for inbound call throttling, simply set it and forget it. Here we'll discus how we can accomplish graceful inbound call throttling with UCMA 3.0. The basis for what we're discussing here is covered in the prior article "Decline A Call". We'll extend this code such that it checks for the number of calls currently connected to the application and gracefully declines calls with a busy signal we've reached capacity. One thing to understand about UCMA applications is that there are two objects in play here. The first is the Conversation object, the second is the Call object. Each Conversation instance can have one or more Calls associated with it. This is because (unlike Speech Server) UCMA supports conferencing. A conference is a single Conversation involving multiple Calls. For most IVR style applications however you'll have only a single Call per Conversation. For this reason (and because frankly its easier to understand) our sample here will be counting the number of "Conversations" rather than the number of "Calls". The ApplicationEndpoint class has a method called GetConverstations() which returns a generic collection of Conversation objects. When you create a new UCMA Workflow the default name for our ApplicationEnpoint is _endpoint. By executing _endpoint.GetConverstaions().Count we get an integer representing the number of Conversations active on this endpoint. Because we're making some assumptions with our application (a. there is a 1:1 ration or Conversations to Calls and b. we've got a single endpoint) we can test this value against our maximum threshold. For example, lets assume we have a maximum load of 50 calls:
if (_endpoint.GetConversations().Count > 50){
}
One note here, the call we are going decline here is included in GetConverstations().Count. We're not counting how many callers are within the Workflow, we counting the number of connections hitting the endpoint. This means there is a potential race condition here, if 50 people tried to call us at the exact same moment in time it would decline them all even though none of them had made it into the Workflow. Given how fast we reach this point it is unlikely, but it is something to keep in mind you are expecting that kind "instant load". In other words, American Idol needs a more nuanced method here. Now that we've got our count, we can simply Decline the call and return the status 486 (BUSY HERE) trigger a busy signal to the caller:
if (_endpoint.GetConversations().Count > 50) { call.Decline(new CallDeclineOptions(486)); return; }
-
Testing UCMA Applications
One of the first things you notice when you start developing UCMA is the lack of an integrated SIP Phone for testing your applications. Speech Server made it trivial to test out your application, simply press F5 and everything was ready to go. UCMA lacks the integrated environment so you'll need a software phone of some kind to try out your app. I have been using one called PhonerLite for years. It is freely downloadable from http://www.phonerlite.de/index_en.htm and works like a charm. The key reasons I like it is that it supports UDP/TCP/TLS is extremely simply to use and has a build-in debugger that shows you the SIP messaging (something that is extremely useful when your application simply doesn't answer your call). I would recommend going with the beta version (currently 1.85) at http://www.phoner.de/PhonerLiteBeta.zip. Unzip it someplace and run the PhonerLite executable.
Select "manual configuration"
Give yourself a user name (I always use "1234")
Take the defaults for the next two screens
Select the "Configuration" tab and then the "Network" sub-tab
Change your Port to something unused and your connection type to TCP
Enter the SIP address for your app in the "Destination name" field and click the green phone icon and you're off.
-
UCMA 3 How-To: Decline A Call
In Speech Server we had an activity for declining a call. Typically this was used when you wanted to pull your application "off-line" for some reason. UCMA 3.0 doesn't have this activity, but the Core API still has support for it. Rather than declining the call within the Workflow, we'll be declining the call prior to the Workflow starting. I'll show how to do this using the out-of-the-box code you get when creating a new CommunicationWorkflow. If you look inside Program.cs you'll find the StartWorkflow() method. When we reach this point in the application we already have a "call" object which makes it trivial to Decline the call. The default code looks like this:
1: private static void StartWorkflow(Call call, SipRequestData requestData)
2: {
3: Debug.Assert(call != null, "call != null");
4: Debug.Assert(call is AudioVideoCall || call is InstantMessagingCall,
5: "Only AudioVideoCall and InstantMessagingCall are subscribed to above.");
6:
7: WorkflowInstance workflowInstance = _workflowRuntime.CreateWorkflow(typeof(Workflow1));
We'll insert our code starting at line 6, we'll also add some intelligence so that it allows me to call from my developer line while rejecting everyone else.
1: private static void StartWorkflow(Call call, SipRequestData requestData)
2: {
3: Debug.Assert(call != null, "call != null");
4: Debug.Assert(call is AudioVideoCall || call is InstantMessagingCall,
5: "Only AudioVideoCall and InstantMessagingCall are subscribed to above.");
6:
7: if (!call.RemoteEndpoint.Participant.UserAtHost.StartsWith("1234@"))
8: {
9: call.Decline(new CallDeclineOptions(503));
10: return;
11: }
12:
13: WorkflowInstance workflowInstance = _workflowRuntime.CreateWorkflow(typeof(Workflow1));
14: ...
A couple of tips:
- Take a look at the call object. It has a lot of interesting properties that let you make intelligent decisions about the call before your workflow has started.
- Make sure you use a SIP code (CallDeclineOptions) that your gateways understand and make sense. You don't want to toss a BUSY HERE if it isn't in fact BUSY.
-
Workflow Differences in UCMA 3.0
The following is a list of activities from Speech Server 2007 and UCMA 3.0. UCMA brings with it a number of new activities (due mostly to UCMA handling both Speech and Instant Messaging) but it also drops a number of activities we've become used to having in Speech Server.
Speech Server 2007 UCMA 3.0 AnswerCall AcceptCall BlindTransfer BlindTransfer Command SpeechCommand ConsecutiveNoInputsSpeechEvent ConsecutiveNoInputsSpeechEvent ConsecutiveNoRecognitionsSpeechEvent ConsecutiveNoRecognitionsSpeechEvent ConsecutiveSilencesSpeechEvent ConsecutiveSilencesSpeechEvent DeclineCall -
DetectAnsweringMachine -
DisconnectCall DisconnectCall FormFillingDialog -
GetAndConfirm -
GoTo GoTo HelpCommand SpeechHelpCommand InvokeWorkflow -
MakeCall OutboundCall Menu -
NavigableList -
QuestionAnswer SpeechQuestionAnswer RecordAudio -
RecordMessage -
RepeatCommand SpeechRepeatCommand SaltInterpreter -
SetTaskStatus -
SpeechSequence CommunicationsSquence Statement SpeechStatement Validator -
VoiceXmlInterpreter -
-
CallDisconnectedEvent -
CallOnHoldEvent -
CallOnHoldTimeoutEvent -
CallRetrievedEvent -
GetPresence -
InstantMessagingStatement -
InstantMessagingQuestioNAnswer -
InstantMessagingCommand -
InstantMessagingCommand -
InstantMessagingHelpCommand -
ConsecutiveNoInputsInstantMessageEvent -
ConsecutiveSilencesInstantMessagingEvent -
ConsecutiveNoRecognitionsInstantMessagingEvent In the coming weeks I'll be covering some workarounds to the missing activities.
-
Bing Blahs
I really like Bing. In the last few years they have really improved things but then today they lost me again. As a Developer I search a lot. Ok, a lot more than a lot… Today I was asked to enter a captcha to continue using the service (with a captcha that is impressible to read by the way). I found out this happens a lot more than I knew about. Ironically I gave up trying to read the captcha from Bing and searched for what was going on using Google…
-
Lync 2010 Released
Lync 2010 has hit RTM - http://blogs.technet.com/b/uc/archive/2010/10/27/microsoft-lync-released-to-manufacturing.aspx
-
Ray Ozzie and Steve Ballmer
So Ray Ozzie announced few days ago that he is leaving Microsoft and then followed up with a typical Ozzie blog post this weekend…. Yeah… Please make sure to clean out the office, we wouldn’t want you to leave any of your “vision” behind.
Sorry, I’m just not a Ray Ozzie fan. He made his name on Lotus Notes, which I admit has generated a lot of jobs. Given, it is mainly jobs for consultants helping companies get off of the platform but I guess beggars can’t be choosers. Groove was a hype machine that only succeeded in getting us to install it multiple times in hope that over the years they somehow made it hurt less. At least it had a rock solid uninstall function. That was was an improvement over Notes I guess.
This leaves us with Steve Ballmer, whom I happen to enjoy a lot. Not for his strategic moves or his understanding of technology but for his shear force of will. Seeing him on fire churns up images of The Jock grabbing The Geek by the privates and explaining the nuances of proper etiquette, with a squeeze. I would pay good money to see Mr. Ballmer beat the snot out of that narcissistic elitist prick heading Apple.
Ok, sarcasm and sniping aside I actually am a fan of Ballmer. He isn’t afraid to clean house when things are not working. That isn’t as easy as it sounds, often times executives hold on to their “people” simply because they can’t admit failure. Also, Steve is the perfect weight to balance the overly optimistic techie who thinks if they simply “build it and they will come”. The only problem is that I think he’s the wrong face for the company. They need a visionary technology guy to stand out front and leave Steve in the background kicking butt and getting things done.
If Microsoft is serious about changing things up they need someone who is willing to change fast, bring in concepts from the outside when they work and frankly look smarter than anyone else in the room. So come on Microsoft, start grooming Scott Guthrie. If you don’t know what you have in Scott Gu then you’re blind and your fate is predictable.
UPDATE: Someone sent me this link from CNN that talks a bit about their vision problems. Personally I think they’re a little off the mark with XBOX, to say it was beat by the Wii is kind of unfair given that they came out at two different times and targeted two different markets. But generally I think they make some good points.
-
OCS: New Version, New Name
The press releases went up a few minutes ago so I can finally share this.
The overly long winded name Microsoft Office Communications Server is no more. The entire product line (including Office Communicator) has been rebranded as “Lync”.
The new product line will include:
- Lync 2010 (replaces Communicator)
- Lync Server 2010 (replaces Office Communications Server)
- Lync Online (replaces Communications Online)
- Lync Web App (replaces Web Communicator)
You can read the full press release here: http://www.microsoft.com/Presspass/press/2010/sep10/LyncPR.mspx
UPDATE: The UC Team has released some more details on their blog http://blogs.technet.com/b/uc/archive/2010/09/13/introducing-microsoft-lync-the-next-ocs.aspx
-
New MSDN Format
I really like the new layout for MSDN, but I especially enjoy the nod to Steve Ballmer’s infamous “Developers, Developers, Developers” speech in the header.
-
2010 MVP Award
Today I received word that I had been awarded an MVP for Microsoft Communications Server again. I’m very excited about Unified Communications and the upcoming Microsoft Communications Server “14”. I’ll be doing a lot of work and posting regarding UCMA 3.0 over the next few months. If you’re thinking about UC development its time to start boning up on UCMA, it is where all the Microsoft UC goodness is heading.