How to connect AnywhereNow REST Recording API in Dialogue Studio
In this guide we will be connecting to our own Core REST Recording API
This can be useful for managing the recording the be PCI compliant.
Prerequisites
For this scenario the following point must be done first:
-
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. configured with Dialogue Studio, see Create your first flow
-
UCC configured for audio recordings, see: Configure Recording Functionality
Preview
Configure sample flow
-
Login to your Dialogue Studio environment
-
Open or Create a Tab where you want to add the Recording API sample
-
From the menu in the top right, select “Import” and add the following JSON.
CopyJSON[{"id":"797482c9dd9b5b06","type":"tab","label":"Stop Recording","disabled":false,"info":"","env":[]},{"id":"41fcb4c273c2bc57","type":"any-red-indialoguestarted","z":"797482c9dd9b5b06","name":"","config":"","filtertype":"all","x":320,"y":240,"wires":[[],["2158c74a2b2eb7ef"]]},{"id":"10edbda1a8c20fe6","type":"http request","z":"797482c9dd9b5b06","name":"Check recording state","method":"GET","ret":"obj","paytoqs":"ignore","url":"{{{fqdn}}}/attendantservice/api/recording/{{{ucc}}}/{{{session.id}}}","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":700,"y":240,"wires":[["e12d2b1576ada525"]]},{"id":"b3011cc4a3b6deae","type":"comment","z":"797482c9dd9b5b06","name":"TODO: Set [FQDN] and [UCC]","info":"","x":560,"y":200,"wires":[]},{"id":"c6430bf70dbb7e83","type":"function","z":"797482c9dd9b5b06","name":"Prepare recording stop","func":"msg.payload =\n{\n\"Action\":2,\n\"RequesterSipUri\":msg.session.sipUri,\n\"CorrelationId\":msg.session.id,\n\"UCCName\":msg.ucc\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1120,"y":240,"wires":[["0bfb2e90e324d7ed"]]},{"id":"2158c74a2b2eb7ef","type":"change","z":"797482c9dd9b5b06","name":"Set variables","rules":[{"t":"set","p":"ucc","pt":"msg","to":"","tot":"str"},{"t":"set","p":"fqdn","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":240,"wires":[["10edbda1a8c20fe6"]]},{"id":"0bfb2e90e324d7ed","type":"http request","z":"797482c9dd9b5b06","name":"Stop recording","method":"POST","ret":"obj","paytoqs":"ignore","url":"{{{fqdn}}}/attendantservice/api/recording/set","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":1320,"y":240,"wires":[["3cb5180ad504b47c"]]},{"id":"20d63fd959c1dc97","type":"any-red-say","z":"797482c9dd9b5b06","name":"","text":"Recording has been stopped","dataType":"str","saymethod":"Default","voice":"","x":1740,"y":240,"wires":[[]]},{"id":"3cb5180ad504b47c","type":"switch","z":"797482c9dd9b5b06","name":"Check if succesfull","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1510,"y":240,"wires":[["20d63fd959c1dc97"],[]]},{"id":"e12d2b1576ada525","type":"switch","z":"797482c9dd9b5b06","name":"Check if recording","property":"payload.RecordingState","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":910,"y":240,"wires":[["c6430bf70dbb7e83"],[]]}]
-
Open the InDialogue and Select or Configure a server, for more information see: Create your first flow
-
Open the Change node (labeled Set variables) and enter ucc (for example: ucc-sales-123ab) and 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] (for example: http://server.local)
-
To test the flow, initiate a phone call with the UCC, queue a Skill and have an Agent accept the call. The Agent should hear "Recording has been stopped"
-
If you need to customize or extend the logic, you can open the Tab, modify the nodes and responses as needed, and save your changes. For example, only stop recording when a specific caller is calling.
-
Test the flow again to make sure it works.
-
Congratulations, you have now successfully can use the recording api in Dialogue Studio!
Explanation
Trigger on New Active Dialogue
This flow begins with the InDialogue node, which triggers when a new active dialogue starts. It listens for any new dialogue and then proceeds to the next step.
Set Variables
The change node sets the necessary variables for the flow. Specifically, it sets the ucc and fqdn variables, which are required for the subsequent HTTP requests.
Check Recording State
The http request node sends a GET request to check the current recording state. It uses the fqdn, ucc, and session.id variables to construct the URL for the request. The response from this request will determine whether a recording is currently active.
Prepare and Send Stop Request
If the recording is active (checked by the switch node), the flow proceeds to the function node, which prepares the payload for stopping the recording. The payload includes the action to stop the recording, the requester’s 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. URI, the correlation ID, and the UCC name. This payload is then sent via another http request node to stop the recording.
Check Results
The http request node sends the stop recording request and receives a response. The switch node checks the status code of the response to determine if the request was successful. If the status code is 200, it means the recording has been successfully stopped.
Say Message
Finally, if the recording stop request was successful, the Say node plays a message saying “Recording has been stopped” to confirm the action.
This flow ensures that the recording is stopped only if it is currently active and provides feedback on the success of the operation.