Automating call recording for outbound calls using Apex
If enabled for your account, you can create a custom rule that determines whether Vonage Contact Center records a call based on the outbound, or dialed, number.
The custom rule that you create takes precedence for individual calls over your default Vonage Contact Center account settings. You can use this feature in various ways depending on how your Salesforce org is set up.
Your custom rule applies to all outbound calls, whether they were initiated using Connect or Click to dial.
To automate outbound call recording, create a custom Apex class that implements the VCCCore.ISelectCallRecording
interface and defines the GetIsCallRecordingRequired
method. Your GetIsCallRecordingRequired
method must describe the logic that determines whether or not to record the call for a given number and return a VCCCore.CallRecordingResult
object that tells Vonage Contact Center the outcome.
To create the custom class, familiarize yourself with creating Apex classes in Salesforce. For information on creating Apex classes, see Salesforce help.
VCCCore.
ISelectCallRecording
 interface definition:
global interface ISelectCallRecording {
VCCCore.CallRecordingResult GetIsCallRecordingRequired(String clickToDialJson);
}
The clickToDialJson
 contains the outbound phone number in JSON format: {"outboundNumber":"4155551212"}
. You do not need to provide clickToDialJson
 because Vonage Contact Center passes the value to the method for you when an agent initiates an outbound call. The GetIsCallRecordingRequired
method in your class must return a VCCCore.CallRecordingResult
object.
When creating your new class, you must declare both the class and the method as global so that the Vonage Contact Center managed package can access the class and invoke the method.
To get the outboundNumber
from the clickToDialJson
, use an Apex JSON parser as in the  getOutboundNumberFromJson
method in our example. Future releases of Vonage Contact Center may add some extra attributes to the context, so if use any other method to get the outboundNumber
(such as regular expressions or string splitting), your class may stop working.
When you have created your class, you must ensure that Vonage Contact Center uses the class. For information about configuring the class that Vonage Contact Center uses to automate call recording, see Configuring custom settings for optional Vonage Contact Center features in Salesforce.
Vonage Contact Center uses the values in the returned CallRecordingResult
object to determine whether or not to record the call:
Value | Data Type | Description |
---|---|---|
isRecordingRequired | Boolean |
|
isError | Boolean | If true, isError indicates to Vonage that an error occurred in your custom code. |
errorMessage | String | If isError is true, this string should contain a useful error message. |
Constructors available on VCCCore.CallRecordingResult
:
global CallRecordingResult(Boolean isRecordingRequired)
global CallRecordingResult(Boolean isError, String errorMessage)
If an error occurs when an agent makes a call that triggers the apex code, a message appears in the agent's ContactPad. This message alerts them that the default call recording settings for the account have been applied and suggests that they contact their system administrator.
For general assistance, please contact Customer Support.
For help using this documentation, please send an email to docs_feedback@vonage.com. We're happy to hear from you. Your contribution helps everyone at Vonage! Please include the name of the page in your email.