CTRDataSyncFunction Lambda Function
After the contact record (previously called contact trace record or CTR) is created in Amazon, this Lambda function automatically syncs contact record data to the VoiceCall object. It finalizes the values of multiple VoiceCall object fields.
This function is available to Salesforce Voice with Amazon Connect and Salesforce Voice with Partner Telephony from Amazon Connect customers who are using an Amazon Connect instance and connecting to a Kinesis stream. The configuration is automatically performed when you create a contact center in Voice.
This function performs these actions:
- Synchronizes data between a contact record from Amazon and a VoiceCall record by taking the data from the Amazon contact record and updating the VoiceCallrecord.
- As part of the update, if the function finds that a VoiceCall record doesn’t exist, it creates one. This behavior is useful for missed or abandoned calls.
- If the CallDisposition field in the VoiceCall record isn’t set, sets it to Completed.
This data is synced between the Data model for Amazon Connect contact records and a VoiceCall record:
| Amazon Connect Contact Record Attribute | VoiceCall Field | Notes |
|---|---|---|
| InitiationTimestamp | CallStartDateTime | |
| DisconnectTimestamp | CallEndDateTime | |
| InitiationTimestamp and DisconnectTimestamp | CallDurationInSeconds | At the end of a call, the CallDurationInSeconds value is temporarily the difference between CallAcceptDateTime (when a rep accepts a call) and CallEndDateTime (when a call disconnects). This value doesn’t include queue and ring time before a rep accepts a call. However, when post-call CTR sync runs, the system calculates the CallDurationInSeconds value as the difference between CallStartDateTime and CallEndDateTime. This value includes the queue and ring time before a rep accepts a call. Also, when post-call CTR sync runs, the system may overwrite CallEndDateTime with the DisconnectTimestamp value supplied from the contact record. |
| Agent.ConnectedToAgentTimestamp | CallAcceptDateTime | The CallAcceptDateTime value matches the Agent.ConnectedToAgentTimestamp value, even if it’s null. If a call didn’t connect on the vendor side, Salesforce passes an empty string for CallAcceptDateTime. |
| Agent.CustomerHoldDuration | CustomerHoldDuration | The DurationInSeconds field on the VoiceCallRecording record gets its value by adding Agent.CustomerHoldDuration and Agent.AgentInteractionDuration from the Amazon contact record. |
| Agent.LongestHoldDuration | LongestHoldDuration | |
| Agent.NumberOfHolds | NumberOfHolds | |
| Agent.AgentInteractionDuration | This value doesn’t map to a VoiceCall field. However, the DurationInSeconds field on the VoiceCallRecording record gets its value by adding Agent.CustomerHoldDuration and Agent.AgentInteractionDuration from the Amazon contact record. | |
| Queue.EnqueueTimestamp | CallQueuedDateTime | |
| Queue.Name | QueueName | |
| InitiationMethod | CallType (only when creating a new record) | This value is used to infer values for ToPhoneNumber and FromPhoneNumber. Also used for the CallType field if creating a new VoiceCall record. Supported InitiationMethod values include:
|
| SystemEndpoint.Address | ToPhoneNumber or FromPhoneNumber | If InitiationMethod is Inbound, the value maps to ToPhoneNumber (when creating a new record). If InitiationMethod is Outbound, this value maps to FromPhoneNumber. |
| CustomerEndpoint.Address | ToPhoneNumber or FromPhoneNumber | If InitiationMethod is Inbound, the value maps to FromPhoneNumber. If initiationMethod is Outbound, this value maps to ToPhoneNumber (when creating a new record). |
| Recording.Location | CallRecordingId | The VoiceCall record creates a reference to the VoiceCallRecording record by using the CallRecordingId reference ID field. |
The data synchronization automatically starts when a contact record is generated. You don’t need to call this function manually.
The CustomerHoldDuration and NumberOfHolds fields don’t have values until after the CTRDataSyncFunction Lambda function runs. To determine if the Lambda function is done, search for these values in these fields.
-
Customize Synced Contact Record Fields Using CTRDataSyncFunction
Although the provided CTRDataSyncFunction Lambda automatically syncs many of the fields between Amazon’s contact record (previously called contact trace record or CTR) and a VoiceCall record, you can customize this function to sync more fields.