Presence Provider
Introduction
The Presence Provider is a module of the UCC A Unified Contact Center, or UCC, is a queue of interactions (voice, email, IM, etc.) that are handled by Agents. Each UCC has its own settings, IVR menus and Agents. Agents can belong to one or several UCCs and can have multiple skills (competencies). A UCC can be visualized as a contact center “micro service”. Customers can utilize one UCC (e.g. a global helpdesk), a few UCC’s (e.g. for each department or regional office) or hundreds of UCC’s (e.g. for each bed at a hospital). They are interconnected and can all be managed from one central location. Core application which has the following characteristics:
- Maintains Subscriptions to Agent Presence for all UCC's running in the same service.
- If UCMA Microsoft Unified Communications Managed API (UCMA) is used primarily to build middle-tier applications that work with the Skype for Business Server. Presence Source is enabled only one subscription is done per Agent if an Agent is registered in multiple UCC's within the same service.
- Automatically resubscribe in case a subscription becomes terminated by Skype for Business
- In case the PresenceView and associated LocalEndpoint are terminated by Skype for Business, the Presence Provider will automatically try to recover from this.
- Supports both an application endpoint and optionally a user endpoint (used only for hybrid Skype for Business Online Agents) at the same time. If a subscription cannot be registered by the first, another attempt will be executed with the other endpoint.
- Supports Presence updates from third-party sources (for example snapper)
The main drive to develop purpose of the Presence Provider this feature is to lower the amount of SIP The Session Initiation Protocol, or SIP, is a protocol for multimedia communication (audio, video and data communication). SIP is also used for Voice over IP (VoIP). SIP has interactions with other Internet protocols such as HTTP and SMTP. traffic for presence subscriptions. ThereforeFor this, the module gathers the Presence usage of agents for all UCC's inside a single application. For each unique agent, the Presence Provider will register only once. It will monitor the presence subscription and will restore the subscription if needed, which That will happen in case the presence subscription is terminated or the endpoint used for the presence view is terminated.
Prerequisites
-
AnywhereNow Installation account is needed, Learn More
Installation
New installations or updates of the primary AnywhereNow Core wil create the required applications and endpoints automatically if this does not exist yet. However manual creation of Presence Provider applications and endpoints may be required (to adhere to company naming conventions or when adding Enterprise+ services for example).
For creation of the required Trusted Application and Trusted Application Endpoints regular Skype for Business Powershell commands can be used.
-
Define a unique name and an available port number for the Trusted Application.
-
Open Powershell as Administrator
-
Run command like (replacing bold letters with the defined unique names):
CopyPowerShellNew-CsTrustedApplication -ApplicationId ucc_presenceprovider01 -TrustedApplicationPoolFqdn Trustpool.example.com -Port 6120
-
When requested by Skype for Business run the command:
-
When enable topology has finished, create the Trusted Application Endpoint
-
Run the command like (replacing bold letters with the defined unique names):
CopyPowerShellNew-CsTrustedApplicationEndpoint -ApplicationId ucc_presenceprovider01 -TrustedApplicationPoolFqdn Trustpool.example.com -SipAddress sip: ucc_presenceprovider01@sipdomain.com
-
Apply any necessary policies to the sip endpoint according to your internal Skype for Business guidelines
-
Create a server firewall inbound rule for the port number selected for the Trusted Application (to allow the FrontEndPool servers to communicate with the Presence Provider Trusted Application).
Tip
You could use the EXTRA UCC script for the above but remember to manually remove the 3 system endpoints that are automatically created with that script.
For creating the optional User Endpoint (in Hybrid with Skype for Business Online topologies) use the established procedures for adding useraccounts and sipaddresses available in your company.
Configuration
The presence provider needs a separate Application Id, an Application Endpoint (mandatory) and a User Endpoint (optional). The following additional settings must be configured in the configuration file.
The default path of this file is:
C:\ProgramData\Anywhere365\Core\Service\UnifiedContactCenterService\Config.xml
<?xml version="1.0" encoding="utf-8"?>
<config version="1.5">
<License>license.key</License>
<PresenceProvider maxPresenceSubscriptionsPerSecond="15" failedPresenceSubscriptionsResubscribeDelay="15" maxFailedPresenceSubscriptionsPerUri="3">
<UcmaPresenceSource enabled="true" ApplicationId="urn:application:ucc_presenceprovider01" >
<UserEndpoint UserUri="sip:demo_user@sipdomain.com" PoolFqdn="" />
<ApplicationEndpoint OwnerUri="sip:ucc_presenceprovider01@sipdomain.com" />
</UcmaPresenceSource>
<PstnPresenceSource enabled="true" />
<AttendantServiceSource enabled="false">
<Match pattern="domain.com" />
<Match pattern="domain2.com" />
</AttendantServiceSource>
<MsGraphPresenceSource enabled="true">
<Accounts>
<Account Id="my-presence-account1" TenantId="4119dd4d-e455-4535-9d45-b3535f584cad" />
</Accounts>
</MsGraphPresenceSource>
</PresenceProvider>
The PresenceProvider Element in the config.xml file contains 4 attributes:
-
FailedPresenceSubscriptionsResubscribeDelay = If a subscription has been failed this delay is applied before a next attempt is issued. Optional parameter. If not defined, the default is taken (900 seconds) [unit is seconds].
-
MaxFailedPresenceSubscriptionsResubscribeDelay (since 6.4.5) = Retries are now implemented using exponential back-off. MaxFailedPresenceSubscriptionsResubscribeDelay indicates the maximum delay in the exponential sequence. For example: if FailedPresenceSubscriptionResubscribeDelay is 10 seconds, then the retry values will be [10, 20, 40, 80, 160, ..., MaxFailedPresenceSubscriptionsResubscribeDelay]. If not defined, the default is taken (8 hours, which is 28800 seconds) [unit is seconds]
-
MaxPresenceSubscriptionsPerSecond = Throttle for the maximum number of subscriptions per second. Optional parameter. If not defined, the default is taken (15 seconds) [unit is seconds].
-
MaxFailedPresenceSubscriptionsPerUri = If this limit is exceeded, the Presence Provider quits with retrying. The subscription process is stopped for the particular Uri. If set to zero, this parameter is ignored. Default value if not specified (3).
The PresenceProvider Element can contain 4 different sources.
-
AttendantServiceSource =If enabled, then Agents that match the sipdomain patterns defined in the configuration will use the AttendantService to manage their presence. This is for example used when Snapper needs to be used to detect local agent presence and changes.
-
Microsoft Graph Presence Source = If enabled, the AnywhereNow application can use the Teams user presence. Be aware that the presence source has the highest priority over other present sources, but only when the 'Teams UPN In Windows Active Directory, a User Principal Name (UPN) is the name of a system user in an email address 'like' format. A UPN (for example: john.doe@domain.com) consists of the user name (logon name), separator (the @ symbol), and domain name (UPN suffix).' SharePoint field is populated. Find out more about the API limit and required Graph API permissions at Microsoft Graph documentation.
-
PstnPresenceSource = If enabled, then Agents that use an E.164 The E.164 phone number format is an international (ITU) standard for dialing telephone numbers on the Public Switched Telephony Network (PSTN). Loosely formulated, only "+" and upto 15 digits (0-9) are allowed For example: +4433221100 (For number notation/display and storage see the E.123 standard) lineuri as sipaddress (PSTN agents) will use this source. This source is managed internally by the UCC. (PSTN presence states can only be marked as available or busy)
-
UcmaPresenceSource = If enabled, the source used if a not more specific source matches. This source reflects the Skype Presence which is obtained via UCMA. The source can be configured with a single Application Endpoint or a Single User Endpoint or both an Application and a User Endpoint. Both endpoints must be registered on premises. The Single User endpoint must exist, but not be used in a Skype client by a user. The UserEndpoint will only be used to subscribe to an agent’s presence which is homed on Skype for Business Online.
Examples of behavior
Which PresenceSource is used for agent address sip example@workstreampeople.com?
-
If the AttendantServiceSource is enabled and <Match pattern="workstreampeople.nl" /> and <Match pattern="workstreampeople.com" /> is configured,
-
'sip:example@workstreampeople.com' does not match the pattern 'workstreampeople.nl'
-
'sip:example@workstreampeople.com' matches the pattern 'workstreampeople.com'
-
Result = The AttendantServiceSource is used
Which PresenceSource is used for (PSTN) Agent tel:+31612345678?
-
If the AttendantServiceSource is enabled and <Match pattern="workstreampeople.nl" /> and <Match pattern="workstreampeople.com" /> is configured,
-
'tel:+31612345678' does not match the pattern 'workstreampeople.nl'
-
'tel:+31612345678 ' does not match the pattern 'workstreampeople.com'
-
-
If the PstnPresenceSource is enabled
-
'tel:+31612345678' matches an E/164 lineuri
-
Result = The PstnPresenceSource is used
Which presence source is used for agent address sip:example@anywhere.now?
-
The AttendantServiceSource is enabled and <Match pattern="workstreampeople.nl" /> and <Match pattern="workstreampeople.com" /> is configured,
-
'sip:example@anywhere.now' does not match the pattern 'workstreampeople.nl'
-
'sip:example@anywhere.now ' does not match the pattern 'workstreampeople.com'
-
-
The PstnPresenceSource is enabled
-
'sip:example@domain.net' does not match an E.164 lineuri
-
-
The UcmaPresenceSource is enabled
Result = The UcmaPresenceSource is used
You always need to enable the PstnPresenceSource if you are using PSTN Agents. It means that your PSTN Agents will not be called by a UCC if they are already in call with this UCC Service.
You need to enable the AttendantServiceSource for Agents that use other clients not detectable by UCMA in which they can set their presence, such as the Snapper. (also requires proper configuration of Snapper, i.e. Update AgentPresence in UCC).
You always need to enable the UcmaPresenceSource for those Agent subscriptions that are not covered by the other Presence Sources.
You only need to configure a UserEndpoint in the UcmaPresenceSource if you are using a Hybrid environment and want to subscribe to presence on a user in the same sipdomain but is homed on Skype for Business Online. This does not apply when the agent had Skype for Business Public Federation When using AnywhereNow in combination with Federation you can add agents working with a Skype for Business or Teams account to your UCC. with the AnywhereNow topology.
Attributes
UcmaPresenceSource has 2 attributes (enabled:true/false, ApplicationId)
-
Enabled Indicates that this source is enabled
-
ApplicationId (mandatory). This is an additional application id.
The source must contain 1 ApplicationEndpoint element and 0/1 UserEndpoint elements
ApplicationEndpoint has 1 attribute
-
OwnerUri = The sipuri of the endpoint
UserEndpoint has 2 attributes
-
UserUri = The sipuri of the user
-
PoolFqdn (optional) = the pool fqdn FDQN stands for Fully Qualified Domain Name and specifies the exact location in the tree hierarchy of the Domain Name System (DNS). An example for [hostname].[domain].[top level domain] is [www].[microsoft].[com] of the user, if autodiscovery fails (possible formats: <fqdn> / <fqdn:port>)
PstnPresenceSource has 1 attribute
-
Enabled = Indicates that this source is enabled
AttendantServiceSource has 1 attribute
-
Enabled = Indicates that this source is enabled
The source must contain 1 or more Match elements
Match has 1 attribute
-
pattern= The regex pattern to match the Agents uri
UCC service needs to be restarted for the changes to take effect. Every new subscription request that matches one of the AttendantServiceSource patterns will only be using the AttendantService presence source.
There is no limitation in the amount of Match elements added to the AttendantServiceSource element.
Logging
In this section some of the most interesting logging entries.
Description | Log |
---|---|
Configuration line, which shows all parameters. In this case one application endpoint and no user endpoint. |
2018-05-08 14:05:26,467 [1] UccStarter INFO - PresenceProviderConfiguration:: MaxFailedPresenceSubscriptionsPerUri: 3, FailedPresenceSubscriptionsResubscribeDelay: 60MaxPresenceSubscriptionsPerSecond 15, ApplicationId: urn:application:ucc_app14_1, ApplicationEndpoints:[sip:ucc_app01@anywhere.now] UserEndpoints:[] |
Request from within Ucc for subscribing an agent. |
2018-05-08 14:05:48,159 [5] ucc_app01 INFO - PresenceProviderClient::Subscribe sipUrisip:user1@domain.com |
Presence change (Ucc level, reported on behave of the UCC) |
2018-05-08 14:07:11,174 [6] ucc_app01 DEBUG - ucc_app01 Presence change: 'sip:user1@domain.com' Away : 15500 : : Computer : SameEnterprise Formal:False, Active:True. WspModalityCapabilities: (audio: True, video: True, text: True) |
Presence change event received by UCC. Reports both the new and the previous presence state. |
2018-05-08 14:05:49,222 [31] ucc_app01 INFO - PresenceProviderClient::event PresenceChangedEventArgs: PreviousPresence: [], NewPresence: [PresenceNotificationEventArgs:: SipUri: sip:user1@domain.com WspModalityCapabilities: (audio: True, video: True, text: True), WspDeviceType: Computer, WspSourceNetwork: SameEnterprise, WspPresenceAvailability: Away, WspPresenceAvailabilityValue: 15500, ActivityToken: ] |