Map Telephony Error Codes to Salesforce Outbound Call Errors
When an outbound call fails, intercept the error in your connector implementation, and map it to a specific Salesforce error constant by populating the error.type field. Return the rejected Promise containing the specific error type to show a descriptive error message to the rep in the Omni-Channel console.
This mapping is optional. If you don’t populate the error.type field, or if the provided type is null, Salesforce defaults to the generic CAN_NOT_START_THE_CALL error type.
Map your telephony system’s error codes to the Salesforce error constants to trigger specific messages for the rep:
AGENT_AT_MAXIMUM_CAPACITY: Rep has reached the maximum number of allowed concurrent calls defined by your system.
AGENT_NOT_INITIALIZED: Rep’s softphone or connection ID isn’t initialized yet.
PHONE_NUMBER_NOT_VALID: The dialed number doesn’t exist or is invalid.
PHONE_NUMBER_NOT_VALID_E164_FORMAT: The dialed number is valid but requires E.164 formatting.
AREA_CODE_NOT_IN_DIALABLE_LIST: The dialed number belongs to a region or country code that is restricted.
UNAUTHORIZED_SERVICE_CALL: Rep doesn’t have the necessary permissions to make this call or has exceeded the system call limits.
OUTBOUND_QUEUE_MISCONFIGURED: The routing queue associated with the outbound call is missing required settings.
CALL_THROTTLED: The call failed because rate limits are exceeded.
TIMEOUT_ERROR: The connection attempt to the telephony server timed out.
UNABLE_TO_CONNECT_TO_AGENT: The system failed to establish a connection between the rep and the telephony server due to network issues or rep configuration errors.
If an outbound call fails:
Intercept the specific error code in your system.
Create a standard Error object and set the error.type field to the corresponding Salesforce error constant. For example, Constants.VOICE_ERROR_TYPE.AGENT_AT_MAXIMUM_CAPACITY.
Reject the Promise using the modified error object.
Salesforce receives the rejected Promise, logs the specific error type, and shows the error message to the rep in the Omni-Channel console.
In this example implementation, the standard Error object is instantiated using the message received from your telephony system. The AGENT_AT_MAXIMUM_CAPACITY Salesforce error constant is assigned to the error.type field. A rejected Promise containing this error object is returned to map the error scenario to provide a descriptive error message to the rep.
1// for rep at max capacity2const error = new Error(partnerError.message);3error.type = Constants.VOICE_ERROR_TYPE.AGENT_AT_MAXIMUM_CAPACITY;4return Promise.reject(error);