A lightning:clickToDial component respects any existing click-to-dial commands for computer-telephony integrations (CTI) with Salesforce, such as Open CTI and Voice.
To dial phone numbers in the component, you must first enable the phone system. After the phone system is enabled, when a user clicks on a phone number the component notifies the phone system that the number was clicked. Then, the component passes along any information that's required by the phone system to make an outbound call.
Here's an example of how you can use a lightning:clickToDial component. The first phone number doesn't have a recordId or any parameters. The second phone number has a recordId. The third phone number has a recordId and parameters.
<aura:component> <lightning:clickToDial value="14155555551"/> <lightning:clickToDial value="14155555552" recordId="5003000000D9duF"/> <lightning:clickToDial value="14155555553" recordId="5003000000D8cuI" params="accountSid=xxx, sourceId=xxx, apiVersion=123"/> </aura:component>
Open CTI Usage Considerations
The lightning:clickToDial component works in conjunction with the Open CTI for Lightning Experience API methods, enableClickToDial, disableClickToDial, and onClickToDial. For more information, see the Open CTI Developer Guide. The component doesn't support iFrames, which means that it can’t be used in utilities, such as a phone utility, or Lightning Out apps that are hosted on iFrames.
To dial phone numbers using lightning:clickToDial, first enable the phone system with the Open CTI method enableClickToDial. To disable the phone system, use the Open CTI method disableClickToDial.
When a phone number is clicked, the onClickToDial listener that’s registered with the Open CTI method onClickToDial is invoked.
lightning:clickToDial can contain a recordId attribute. If you pass this attribute, the payload that’s passed to the Open CTI method onClickToDial contains the record information associated with this record ID. For example, record name and object type. If the recordId isn’t passed, no record information is provided to the onClickToDial handler.
A formatted phone number follows the North American format of 123 456 7890.
Attribute Name | Attribute type | Description | Required? |
---|---|---|---|
body | Component[] | The body of the component. In markup, this is everything in the body of the tag. | |
class | String | A CSS class for the outer element, in addition to the component's base classes. | |
title | String | Displays tooltip text when the mouse moves over the element. | |
value | String | The phone number. | Yes |
recordId | String | The Salesforce record Id that's associated with the phone number. | |
params | String | Comma-separated list of parameters to pass to the third-party phone system. |