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

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.

CWAConnector.zip