Agent Utils-SmartAssist or Contact Center Library
TheagentUtils library lets you to dynamically modify call transfer properties through the app builder before transferring the call to a human agent. It provides a wide range of options, including:
- Dynamic SIP Configuration: Modify the SIP properties before transferring the call.
- Transfer Types: Change the type of transfer (for example, Skill-based, SIP-based).
- User Information: Update user-specific information before routing the call to the agent.
agentUtils, you can adjust SmartAssist properties directly from the app, which is ideal when you need to fine-tune call transfers by modifying parameters like SIP URIs or transfer methods before sending the call to the Outer Source or Agent Desktop.
Agent Transfer Node in Platform (Used with agentUtils)
To apply changes made with agentUtils, you need to use the Agent Transfer node in AI for Service. The Agent Transfer node routes the call back to SmartAssist from the app, and based on the type of transfer selected in SmartAssist (for example, External, SIP Transfer, SmartAssist Agent Desktop), the call is appropriately routed.
You can make this process dynamic by using agentUtils to modify transfer properties (such as SIP URI or transport type) before executing the Agent Transfer node.
Major Advantage:
Unlike voiceUtils, the agentUtils + Agent Transfer Node flow supports header encoding/decoding and user-to-user (UUI) data transfer, enabling secure and efficient data transfer during the process. This is one of the key reasons to prefer this method for complex call transfers that require encoded headers or UUI support.
Example Use Case:
If you need to dynamically change the SIP transport type or update the SIP URI based on the user’s session, agentUtils lets you to modify these properties via a script node in the app builder. The Agent Transfer node handles the actual routing to the SmartAssist platform.
Voice Utils (SmartAssist Library)
ThevoiceUtils library is specifically for the SmartAssist Voice Gateway. Used for transferring calls to external sources, such as SIP endpoints or phone numbers, without involving the Agent Desktop. This library supports functionalities. Learn more.
- Hangup
- Agent Transfer (via Invite and Refer)
- Abort Prompt
- Play and Pause Audio, etc
voiceUtils, the call is directly routed to an external source (such as a SIP endpoint or a phone number), bypassing the SmartAssist platform. There is no interaction with the Use SmartAssist Agent Desktop for scenarios that require completing the call transfer externally.
-
Transfer with Headers: You can use
voiceUtils.invite()andvoiceUtils.refer()to transfer the call with custom headers. However, it’s important to note that this doesn’t support header encoding/decoding or user-to-user (UUI) data transfer. Example Use Case: If you are transferring the call to an external SIP provider or a phone number directly,voiceUtilsis the ideal choice. This method bypasses SmartAssist and works best for simple SIP or phone number transfers.
When to Use What
agentUtils+Agent Transfer Node:
voiceUtils: Use this method when you need to transfer the call directly to an external source like a SIP endpoint or phone number, bypassing the SmartAssist platform. It’s best for simple transfers without the need for header encoding or UUI support.
VoiceUtils Helper Methods
Use these functions in the Channel Override template within JavaScript sections. You can execute all functions in the Message Node. General Syntax -print(utility function)
Hangup
Use Cases:- If you need to forcibly hang up the call from the app during the flow or call.
-
Use this function with Run Automation to dynamically send headers in a BYE message, similar to a SIP BYE.
Syntax:
print(voiceUtils.hangup(message,headers,queueCommand))The message, headers, and queueCommand are optional parameters. Header syntax:
To skip the message and only send the headers, provide an empty string as the first argument.
SIP Refer
This function transfers the call to an external contact number (telephone number or SIP URI). After the transfer (Refer), the app’s call leg will disconnect. Use Case: Transfer the call to a third party using the utility in the message node with Run Automation from SmartAssist. message - Optional (Send Empty Message), referTo - Required, headers - Optional, referredBy - Optional Syntax:print(voiceUtils.refer(message,ReferTo,headers,queueCommand,referredBy))
* Parameters order must be maintained. * Parameters after
referTo are optional but must be passed in the correct sequence. * If skipping headers but specifying queueCommand or referredBy, pass null or {} as placeholders accordingly.SIP Invite
The SIP Invite initiates a conference call. The app’s leg remains active after the call connects to the third party, and once the call with the third party ends, the app’s call resumes. The callerId and target fields are mandatory and contains either a SIP URI or a phone number. To pass these values, provide an empty string for the message, followed by the callerId and target. Syntax:print(voiceUtils.invite(message, callerId, target,headers,queueCommand))
Example:
AbortPrompt
The abortPrompts event cancels all pending prompts sent before it’s triggered. For example, if the app sends an abortPrompts event right after sending three prompt messages, the first prompt stops playing immediately, and the remaining two prompts won’t play. Use Case: Killing the previous prompt with the current Message. Syntax:print(voiceUtils.abortPrompt())
The “Message” parameter is Optional.
It supports .wav files and multiple messages, which must be sent as an array.
var message = [“[https://example.wav](https://example.wav)” , “welcome message”]
Example:
Send Dual Tone Multi-Frequency (DTMF)
Use this function to send DTMF digits from the app. The system sends the digits as Real-Time Transport Protocol (RTP) payloads following RFC 2833. Use Case: When one app interacts with another app and tries to give DTMF Input.
Example:
Pause and Play
The pause command waits for a specified number of seconds. Play is Optional; If you pass the message, it plays after the pause.
Example:
\
let length = 4,
Play
Use the play command to stream recorded audio to either a call or a text message. The message can be either a single string or an array of strings that includes both audio URLs and text messages. Syntax:print(voiceUtils.play(message))
Example:
Voicemails
Use Cases:- When you need to configure voicemail settings and notifications for customer calls.
- When you need to receive transcriptions of voicemail messages.
- When you need to collect and process customer voicemail content with metadata.
print(voiceUtils.voicemail(message,beepRequired,transcriptionRequired,notifyUrl,metaInfo,callControlParams))
Header Syntax:
Transfer Calls
ThevoiceUtils.transfer utility enables developers to programmatically transfer an active call to another conversational experience or an external phone number. It provides a simple interface to support seamless call routing within voice applications.
Syntax:
print(voiceUtils.transfer({ number: }));
The utility accepts one required header inside the configuration object:
Example:
print(voiceUtils.transfer({ number: "+1234567890" }));
In this example, the system transfers the call to +1234567890.
Use cases:
The voiceUtils.transfer utility transfers an ongoing call. It supports two primary use cases:
- Transfer to a Target Experience Flow: The system can transfer callers from one experience flow to another within the application. Use this for:
- Routing callers to a different IVR module.
- Moving users to specialized agent queues.
- Directing callers to an alternative automated flow based on context or customer input.
- Transfer to an External Phone Number: The system can transfer callers to external recipients outside the platform. Use this for:
- Connecting callers to third-party vendors.
- Redirecting to business partners or external support lines.
- Escalating calls to off-platform teams.
Raw Packet (JavaScript Code)
It’s recommended to use those call controls or Inbuilt Utility Functions rather than overriding using Raw JavaScript Code. If the Call Control Parameter or Inbuilt Utility Function doesn’t achieve something, then the developer can contact the Support Team.The platform doesn’t perform design-time validation of message overrides; they’re passed as is, increasing the likelihood of errors.