lync-2013ucma

Ucma4 Delayed Response when using PresenceServices BeginPresenceQuery


On Test Machine , When sending a request to FRONT END, i have great response (two seconds). On production, request takes 30 sec or more , organization have more than 5000 users. If have another away to get SIPs Status using UCMA? UCWA cannot using. any idea ?

Code :

public Dictionary<string, string> GetAgentsAvailability(List<string> usersUris)
{
    lock (lockObj)
    {
        AgentsAvailability = new Dictionary<string, string>();
        try
        {
            if (usersUris != null && usersUris.Count > 0)
            {
                IAsyncResult agentAvailabilityCheck = ApplicationEndPoint.PresenceServices.BeginPresenceQuery(usersUris, new string[] { "state" },null, null);
                WaitHandle[] w = new WaitHandle[] { agentAvailabilityCheck.AsyncWaitHandle };
                WaitHandle.WaitAll(w, 3000);
           }
            else
            {
                WriteEntry.ELog("Platform - GetAgentsAvailability - No Agent SIPs to check.", EventLogEntryType.Information);
            }
        }
        catch (Exception ex)
        {
            WriteEntry.ELog(ex.ToString(), EventLogEntryType.Error);
            throw;
        }
        return AgentsAvailability;
    }
}

Solution

  • For such a large number of users I'd recommend using Presence Subscription to inform you of current presence and presence changes rather than trying to check the presence of all the users at once.

    See the following Microsoft article on working with Presence and Groups for more details https://msdn.microsoft.com/en-us/library/office/hh456406(v=office.14).aspx

    There's quite a lot on the above link but the functionality you are after is centred on RemotePresenceView class.