Skip to content

Commit

Permalink
Add XMPP notification (#2)
Browse files Browse the repository at this point in the history
* Add XMPP notification processing
  • Loading branch information
pokornyIt authored Jan 23, 2023
1 parent 84a2ca7 commit 6df914d
Show file tree
Hide file tree
Showing 30 changed files with 1,337 additions and 958 deletions.
52 changes: 48 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,56 @@ API allows actions per one agent or group of agents.
- set agent not-ready state
- logout agent

## Limitation
The current version does not use XMPP communication with the Finesse server.
## Connection
Program used connection to Finesse API and XMPP for notification.
Utilizes ports:

- 8445 - HTTPS Finesse API
- 7443 - WSS Finesse XMPP over HTTP notification (for secure)
- 5222 - XMPP notification (non-secure - notice below)

***Notice:**
Cisco Finesse, Release 12.5(1) onward, the 5222 port (non-secure connection) is disabled
by default. Set the `utils finesse set_property webservices enableInsecureOpenfirePort` to true
to enable this port. For more information, see Service Properties section in
[Cisco Finesse Administration Guide](https://www.cisco.com/c/en/us/support/customer-collaboration/finesse/products-maintenance-guides-list.html).*

### Certificate
Program need to add the Finesse Notification certificate to their respective trust stores.

**Windows systems**:
If you can use secure XMPP you must add valid server certificate to **Trusted Root Certification Authorities**.
- right-click on the DER file and select **Install certificate**
- select **Current User**
- select **Please all certificates in following store**
- click on **Browse...**
- select **Trusted Root Certification Authorities**
- finish

**Ubuntu**:
If you can use secure XMPP you must add valid server certificate to **Trusted Root Certification Authorities**.

```shell
sudo apt install ca-certificates
sudo cp finesse.pem /usr/local/share/ca-certificates/finesse.crt
sudo update-ca-certificates
```

#### How to download the certificate:

1. Sign in to the Cisco Unified Operating System Administration through the URL (https://FQDN:8443/cmplatform, where FQDN is the fully qualified domain name of the primary Finesse server and 8443 is the port number).
2. Click Security > Certificate Management.
3. Click Find to get the list of all the certificates.
4. In the Certificate List screen, choose Certificate from the Find Certificate List where drop-down menu, enter tomcat in the begins with option and click Find.
5. Click the FQDN link which appears in the Common Name column parallel to the listed tomcat certificate.
6. In the pop-up that appears, click the option Download .PEM or .DER File to save the file on your desktop.


System support security XMPP over HTTP (WSS).
The current version does not support XMPP secure communication with the Finesse server.
Program tested on version Finesse 12.5.

## How use

For any operation is necessary to create a server structure with an address and port.
It is necessary to register the agents with which the operations will take place on the server.

Expand Down Expand Up @@ -47,4 +91,4 @@ state := server.LoginAgent("Name2")
states, err = server.ReadyAgentsParallelWithStatus(true)
```

Program use standard logger library "github.com/sirupsen/logrus".
Program use logger library "github.com/sirupsen/logrus".
28 changes: 28 additions & 0 deletions XMPP/error-invalid-line.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!-- error invalid device -->
<message from="pubsub.c01-finesse-b.devlab.zoomint.com" to="6021@c01-finesse-b.devlab.zoomint.com" id="4WNIBzEW">
<event xmlns="http://jabber.org/protocol/pubsub#event">
<items node="/finesse/api/User/6021">
<item id="a6ca891f-8b34-443f-8c7d-dac020d41838387">
<notification xmlns="urn:xmpp:push:0">
&lt;Update&gt;
&lt;data&gt;
&lt;apiErrors&gt;
&lt;apiError&gt;
&lt;peripheralErrorCode&gt;10125&lt;/peripheralErrorCode&gt;
&lt;errorType&gt;Invalid Device&lt;/errorType&gt;
&lt;errorMessage&gt;CF_INVALID_LOGON_DEVICE_SPECIFIED&lt;/errorMessage&gt;
&lt;peripheralErrorText&gt;A device target with the network target ID specified cannot be found. This could indicate either an internal error or a configuration error&lt;/peripheralErrorText&gt;
&lt;peripheralErrorMsg&gt;PERERR_TELDRIVE_NODEVICETARGETFORNETTARGETID&lt;/peripheralErrorMsg&gt;
&lt;errorData&gt;260&lt;/errorData&gt;
&lt;/apiError&gt;
&lt;/apiErrors&gt;
&lt;/data&gt;
&lt;requestId&gt;&lt;/requestId&gt;
&lt;source&gt;/finesse/api/User/6021&lt;/source&gt;
&lt;event&gt;put&lt;/event&gt;
&lt;/Update&gt;
</notification>
</item>
</items>
</event>
</message>
25 changes: 25 additions & 0 deletions XMPP/error-invalid-state.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!-- error set ready not logged in agent -->
<message from="pubsub.c01-finesse-b.devlab.zoomint.com" to="6021@c01-finesse-b.devlab.zoomint.com" id="YOCGofpO">
<event xmlns="http://jabber.org/protocol/pubsub#event">
<items node="/finesse/api/User/6021">
<item id="a6ca891f-8b34-443f-8c7d-dac020d41838370">
<notification xmlns="urn:xmpp:push:0">
&lt;Update&gt;
&lt;data&gt;
&lt;apiErrors&gt;
&lt;apiError&gt;
&lt;errorType&gt;Invalid State&lt;/errorType&gt;
&lt;errorMessage&gt;CF_INVALID_OBJECT_STATE&lt;/errorMessage&gt;
&lt;errorData&gt;22&lt;/errorData&gt;
&lt;/apiError&gt;
&lt;/apiErrors&gt;
&lt;/data&gt;
&lt;requestId&gt;&lt;/requestId&gt;
&lt;source&gt;/finesse/api/User/6021&lt;/source&gt;
&lt;event&gt;put&lt;/event&gt;
&lt;/Update&gt;
</notification>
</item>
</items>
</event>
</message>
50 changes: 50 additions & 0 deletions XMPP/login.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!-- success login -->
<message from="pubsub.c01-finesse-b.devlab.zoomint.com" to="6021@c01-finesse-b.devlab.zoomint.com" id="QM0FAiNp">
<event xmlns="http://jabber.org/protocol/pubsub#event">
<items node="/finesse/api/User/6021">
<item id="a6ca891f-8b34-443f-8c7d-dac020d41838330">
<notification xmlns="urn:xmpp:push:0">
&lt;Update&gt;
&lt;data&gt;
&lt;user&gt;
&lt;dialogs&gt;/finesse/api/User/6021/Dialogs&lt;/dialogs&gt;
&lt;extension&gt;2830&lt;/extension&gt;
&lt;firstName&gt;LPU&lt;/firstName&gt;
&lt;lastName&gt;Test 21&lt;/lastName&gt;
&lt;loginId&gt;6021&lt;/loginId&gt;
&lt;loginName&gt;lpu_test_21&lt;/loginName&gt;
&lt;mediaType&gt;1&lt;/mediaType&gt;
&lt;pendingState&gt;&lt;/pendingState&gt;
&lt;reasonCodeId&gt;-1&lt;/reasonCodeId&gt;
&lt;roles&gt;
&lt;role&gt;Agent&lt;/role&gt;
&lt;role&gt;Supervisor&lt;/role&gt;
&lt;/roles&gt;
&lt;settings&gt;
&lt;wrapUpOnIncoming&gt;OPTIONAL&lt;/wrapUpOnIncoming&gt;
&lt;wrapUpOnOutgoing&gt;OPTIONAL&lt;/wrapUpOnOutgoing&gt;
&lt;/settings&gt;
&lt;state&gt;NOT_READY&lt;/state&gt;
&lt;stateChangeTime&gt;2023-01-13T11:07:11.466Z&lt;/stateChangeTime&gt;
&lt;teamId&gt;5005&lt;/teamId&gt;
&lt;teamName&gt;LPU_test&lt;/teamName&gt;
&lt;teams&gt;
&lt;Team&gt;
&lt;id&gt;5005&lt;/id&gt;
&lt;name&gt;LPU_test&lt;/name&gt;
&lt;uri&gt;/finesse/api/Team/5005&lt;/uri&gt;
&lt;/Team&gt;
&lt;/teams&gt;
&lt;uri&gt;/finesse/api/User/6021&lt;/uri&gt;
&lt;wrapUpTimer&gt;7200&lt;/wrapUpTimer&gt;
&lt;/user&gt;
&lt;/data&gt;
&lt;event&gt;PUT&lt;/event&gt;
&lt;requestId&gt;&lt;/requestId&gt;
&lt;source&gt;/finesse/api/User/6021&lt;/source&gt;
&lt;/Update&gt;
</notification>
</item>
</items>
</event>
</message>
50 changes: 50 additions & 0 deletions XMPP/logout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!-- Success logout message -->
<message from="pubsub.c01-finesse-b.devlab.zoomint.com" to="6021@c01-finesse-b.devlab.zoomint.com" id="1pCI755F">
<event xmlns="http://jabber.org/protocol/pubsub#event">
<items node="/finesse/api/User/6021">
<item id="a6ca891f-8b34-443f-8c7d-dac020d41838326">
<notification xmlns="urn:xmpp:push:0">
&lt;Update&gt;
&lt;data&gt;
&lt;user&gt;
&lt;dialogs&gt;/finesse/api/User/6021/Dialogs&lt;/dialogs&gt;
&lt;extension&gt;&lt;/extension&gt;
&lt;firstName&gt;LPU&lt;/firstName&gt;
&lt;lastName&gt;Test 21&lt;/lastName&gt;
&lt;loginId&gt;6021&lt;/loginId&gt;
&lt;loginName&gt;lpu_test_21&lt;/loginName&gt;
&lt;mediaType&gt;1&lt;/mediaType&gt;
&lt;pendingState&gt;&lt;/pendingState&gt;
&lt;reasonCodeId&gt;-1&lt;/reasonCodeId&gt;
&lt;roles&gt;
&lt;role&gt;Agent&lt;/role&gt;
&lt;role&gt;Supervisor&lt;/role&gt;
&lt;/roles&gt;
&lt;settings&gt;
&lt;wrapUpOnIncoming&gt;OPTIONAL&lt;/wrapUpOnIncoming&gt;
&lt;wrapUpOnOutgoing&gt;OPTIONAL&lt;/wrapUpOnOutgoing&gt;
&lt;/settings&gt;
&lt;state&gt;LOGOUT&lt;/state&gt;
&lt;stateChangeTime&gt;2023-01-13T10:46:22.083Z&lt;/stateChangeTime&gt;
&lt;teamId&gt;5005&lt;/teamId&gt;
&lt;teamName&gt;LPU_test&lt;/teamName&gt;
&lt;teams&gt;
&lt;Team&gt;
&lt;id&gt;5005&lt;/id&gt;
&lt;name&gt;LPU_test&lt;/name&gt;
&lt;uri&gt;/finesse/api/Team/5005&lt;/uri&gt;
&lt;/Team&gt;
&lt;/teams&gt;
&lt;uri&gt;/finesse/api/User/6021&lt;/uri&gt;
&lt;wrapUpTimer&gt;7200&lt;/wrapUpTimer&gt;
&lt;/user&gt;
&lt;/data&gt;
&lt;event&gt;PUT&lt;/event&gt;
&lt;requestId&gt;&lt;/requestId&gt;
&lt;source&gt;/finesse/api/User/6021&lt;/source&gt;
&lt;/Update&gt;
</notification>
</item>
</items>
</event>
</message>
50 changes: 50 additions & 0 deletions XMPP/not-ready.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!-- success not-ready -->
<message from="pubsub.c01-finesse-b.devlab.zoomint.com" to="6021@c01-finesse-b.devlab.zoomint.com" id="Ev58lXZj">
<event xmlns="http://jabber.org/protocol/pubsub#event">
<items node="/finesse/api/User/6021">
<item id="a6ca891f-8b34-443f-8c7d-dac020d41838350">
<notification xmlns="urn:xmpp:push:0">
&lt;Update&gt;
&lt;data&gt;
&lt;user&gt;
&lt;dialogs&gt;/finesse/api/User/6021/Dialogs&lt;/dialogs&gt;
&lt;extension&gt;2830&lt;/extension&gt;
&lt;firstName&gt;LPU&lt;/firstName&gt;
&lt;lastName&gt;Test 21&lt;/lastName&gt;
&lt;loginId&gt;6021&lt;/loginId&gt;
&lt;loginName&gt;lpu_test_21&lt;/loginName&gt;
&lt;mediaType&gt;1&lt;/mediaType&gt;
&lt;pendingState&gt;&lt;/pendingState&gt;
&lt;reasonCodeId&gt;-1&lt;/reasonCodeId&gt;
&lt;roles&gt;
&lt;role&gt;Agent&lt;/role&gt;
&lt;role&gt;Supervisor&lt;/role&gt;
&lt;/roles&gt;
&lt;settings&gt;
&lt;wrapUpOnIncoming&gt;OPTIONAL&lt;/wrapUpOnIncoming&gt;
&lt;wrapUpOnOutgoing&gt;OPTIONAL&lt;/wrapUpOnOutgoing&gt;
&lt;/settings&gt;
&lt;state&gt;NOT_READY&lt;/state&gt;
&lt;stateChangeTime&gt;2023-01-13T11:21:47.026Z&lt;/stateChangeTime&gt;
&lt;teamId&gt;5005&lt;/teamId&gt;
&lt;teamName&gt;LPU_test&lt;/teamName&gt;
&lt;teams&gt;
&lt;Team&gt;
&lt;id&gt;5005&lt;/id&gt;
&lt;name&gt;LPU_test&lt;/name&gt;
&lt;uri&gt;/finesse/api/Team/5005&lt;/uri&gt;
&lt;/Team&gt;
&lt;/teams&gt;
&lt;uri&gt;/finesse/api/User/6021&lt;/uri&gt;
&lt;wrapUpTimer&gt;7200&lt;/wrapUpTimer&gt;
&lt;/user&gt;
&lt;/data&gt;
&lt;event&gt;PUT&lt;/event&gt;
&lt;requestId&gt;&lt;/requestId&gt;
&lt;source&gt;/finesse/api/User/6021&lt;/source&gt;
&lt;/Update&gt;
</notification>
</item>
</items>
</event>
</message>
49 changes: 49 additions & 0 deletions XMPP/ready.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!-- success ready -->
<message from="pubsub.c01-finesse-b.devlab.zoomint.com" to="6021@c01-finesse-b.devlab.zoomint.com" id="r5B2BdUA">
<event xmlns="http://jabber.org/protocol/pubsub#event">
<items node="/finesse/api/User/6021">
<item id="a6ca891f-8b34-443f-8c7d-dac020d41838339">
<notification xmlns="urn:xmpp:push:0">
&lt;Update&gt;
&lt;data&gt;
&lt;user&gt;
&lt;dialogs&gt;/finesse/api/User/6021/Dialogs&lt;/dialogs&gt;
&lt;extension&gt;2830&lt;/extension&gt;
&lt;firstName&gt;LPU&lt;/firstName&gt;
&lt;lastName&gt;Test 21&lt;/lastName&gt;
&lt;loginId&gt;6021&lt;/loginId&gt;
&lt;loginName&gt;lpu_test_21&lt;/loginName&gt;
&lt;mediaType&gt;1&lt;/mediaType&gt;
&lt;pendingState&gt;&lt;/pendingState&gt;
&lt;roles&gt;
&lt;role&gt;Agent&lt;/role&gt;
&lt;role&gt;Supervisor&lt;/role&gt;
&lt;/roles&gt;
&lt;settings&gt;
&lt;wrapUpOnIncoming&gt;OPTIONAL&lt;/wrapUpOnIncoming&gt;
&lt;wrapUpOnOutgoing&gt;OPTIONAL&lt;/wrapUpOnOutgoing&gt;
&lt;/settings&gt;
&lt;state&gt;READY&lt;/state&gt;
&lt;stateChangeTime&gt;2023-01-13T11:14:47.981Z&lt;/stateChangeTime&gt;
&lt;teamId&gt;5005&lt;/teamId&gt;
&lt;teamName&gt;LPU_test&lt;/teamName&gt;
&lt;teams&gt;
&lt;Team&gt;
&lt;id&gt;5005&lt;/id&gt;
&lt;name&gt;LPU_test&lt;/name&gt;
&lt;uri&gt;/finesse/api/Team/5005&lt;/uri&gt;
&lt;/Team&gt;
&lt;/teams&gt;
&lt;uri&gt;/finesse/api/User/6021&lt;/uri&gt;
&lt;wrapUpTimer&gt;7200&lt;/wrapUpTimer&gt;
&lt;/user&gt;
&lt;/data&gt;
&lt;event&gt;PUT&lt;/event&gt;
&lt;requestId&gt;&lt;/requestId&gt;
&lt;source&gt;/finesse/api/User/6021&lt;/source&gt;
&lt;/Update&gt;
</notification>
</item>
</items>
</event>
</message>
Loading

0 comments on commit 6df914d

Please sign in to comment.