Am I Done?

In the Cloud

Creating a WCF ACD Server Part II - Presence using the UC AJAX SDK

Creating a WCF ACD Server Part II - Presence using the UC AJAX SDK

  • Comments 4

Download Sample Code

Ok let me say this for clarification. This isn't a "real" ACD. It isn't "real" because we aren't actually transferring the callers off the IVR. Part of the benefit of an ACD is that moves callers off your IVR to somewhere else so that your IVR has open ports for other callers. So if you are thinking of making a solution similar to what I'm showing you here, make sure you have enough ports on your IVR for as many users as you will have on hold.

Being Speech Server (2007) doesn't charge per port but per server, the number of ports is only limited by the hardware you have it on. You can estimate your needs using the Speech Server (2007) Capacity Planning Guide.

API Discovery
Ok back to the ACD. We want this "ACD" to check presence to determine who to transfer the call to, but which API should we use to actually check the presence of another user? OCS API, UCMA, UCC API, Communicator Automation API or the UC AJAX API.

OCS API  - This we can rule out immediately, as it's API is designed for 1.) Admin activities via WMI - 2.) Add on Applications – IE: IM Filtering

UCMA – This API is designed for server type applications, it doesn't have presence capabilities. So UCMA is out as well..

The Communicator Automation API -  I'm ruling out as it needs Communicator to be installed locally and like the name implies, it "Automates" Communicator.

UCC API – This API does have presence abilities, along with Audio/Video. Anything Communicator can do we can do using this API.

UC AJAX API -  It does have presence abilities, but no Audio/Video. Essentially allows us to send XML request over HTTP in a format CWA is expecting to perform simple actions. Anything CWA can do, we can do using this API.

The choice here is yours to make, but I'm going to go with the UC AJAX API as I just really need to query presence. If I was building something a little more difficult that needed to be a little more efficient, I'd go with UCC API. Another decision point is that I do not Audio or Video features.  

The UC AJAX API is very simple, in fact you don't need to reference a "UC Assembly”, you use the Core .NET Assemblies to send format XML request in a format that CWA is expecting and send it over HTTP\HTTPS to CWA. Instead of writing code to actually do the formatting, I cannibalize code from the UC AJAX SDK sample and wrap it up in a nice Assembly project named CWAConnector. Notice that I didn’t rip out everything because I only need to query presence, but leave it in because I might need other abilities later.

Ok, now application can log in to OCS via CWA and check presence of a set of users.

UserAgent cwaAgent;
Contact[] otherUsers;
bool isSignedIn;

cwaAgent = new UserAgent();

isSignedIn = cwaAgent.SignIn("user", "password", "domain", "cwa.domain.com", "user@domain.com");

Contact contact1 = new Contact();
contact1.Uri =
"sip:user1@domain.com";
otherUsers[0] = contact1;

Contact contact2 = new Contact();
contact2.Uri =
"sip:user2@domain.com";
otherUsers[1] = contact2;

if (_isSignedIn)
{

cwaAgent.QueryUserPresence(otherUsers);

}

You can check the users presence via the Availbility property of Contacts in the collection. IE: otherUsers[0].Availability.

In Part III, the final part, we will make some changes the WCF code we had in Part I and add Presence Lookup based on Part II.

Attachment: CWAConnector.zip
Leave a Comment
  • Please add 6 and 2 and type the answer here:
  • Post
  • This code is fine but supposed I am running a console program, it doesnt work. The problem is with the QueryPresenceMethod. It appears it does not wait for the response from CWA and the code call is returned to the caller hence the avaliability is always reflected as 0. What options do we need to change this piece of code to make it work in a console application context? Will appreciate any advice.

  • Sorry for the late response. What is missing here is that we need to handle the OnUserPresenceChanged in the UserAgent class.

    I'll have some updated code up later.

  • Thanks for this post, it has been helpful. I'm having the same issue as kenshing though. What exactly do we have to do to be able to send back the response in a synchronous fashion? I'm new to .NET and EventArgs, so I'm not sure where is the correct place to handle the response.

    Assuming your code above, what needs to be done so that otherUsers[0].Availability doesn't return a 0? Is it even possible?

    Thanks again!

  • nvm, I found how to register a handler in the managed API sample that comes with the CWA Ajax SDK.

Page 1 of 1 (4 items)