Dial
Definition
The Dial
verb connects the calling party with the dialed party. Once the call is set up, the participants can start talking.
When the call is ended successfully, or the dialed number is not reached, or the call is terminated, CarrierX will make a POST
or GET
request to the action
URL.
The verbs listed after the Dial
verb, which has an action
URL specified, will not be executed.
If no action
URL is set, the call flow will move to the next verbs in the FlexML instructions.
You can also place a phone number inside the Number
noun. This is done to allow specifying the additional parameters (e.g., sendDigits
) when dialing a phone number. Refer to the this section for more information about the Number
noun.
Additionally, you can use the Number
noun for the simultaneous ring to several numbers feature.
Supported Attributes
These attributes can be used to modify the Dial
verb. They are inserted as name-value pairs in the start-tag.
Attribute | Data Type | Description |
---|---|---|
action | string | The link to another set of FlexML instructions. A request will be made to this URL when the call is ended or if the dialed party is not available. If no action URL is set, the rest of the verbs in the current FlexML instructions will be executed. The URL can be absolute or relative. |
callerId | string | The phone number that will appear on the caller ID of the called party. This phone number must be on the account, or have custom permission set up. |
callerName | string | The calling party CNAME that is used in the from field. |
confirmKey | string | The key that the called party must press to start the phone talk. Values accepted in this field are: 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 , # , and * . |
confirmSound | string | The URL of the audio that contains the instructions for the key from the confirmKey field. It informs the called party which key they must press to start the talk. |
containerSid | string | The secure ID of the container to which the recording will be written. |
hangupOnStar | boolean | If this value is set to true , pressing * will hang up the call with the dialed number, and continue with the next FlexML instructions. Until * is pressed, the rest of the FlexML instructions will not be executed. |
method | string | The type of request made to the action URL. Values accepted in this field are POST or GET . The default value is POST . |
record | string | Determines whether or not to record the outbound call until hangup. Values accepted in this field are:
do-not-record . |
recordDirection | string | The direction of the call that will be recorded. Values accepted in this field are:
any . |
recordingStatusCallback | string | A callback is sent to this URL after the recording has ended. |
recordingStatusCallbackEvent | string | The comma-separated list of events to be notified about. Options are completed , to indicate that the recording is successful, and failed , to indicate that the recording has failed. The default value is "completed,failed" . |
recordingStatusCallbackMethod | string | The method, either POST or GET that the callback to recordingStatusCallback is sent. The default value is POST . |
ringing | string | Phone ringing management. Values accepted in this field are:
|
timeLimit | integer | The maximum number of seconds that the call will last. The default value is 0 , meaning that the call time is not limited. |
timeout | integer | The number of seconds to wait for the destination number to answer. After the call times out, a request is made to the action URL. The default value is 30 . |
trim | string | Determines whether or not silence is removed from the beginning or ending of a recording. To trim the silence in the recording, set this field to trim-silence . The default value is do-not-trim . |
Example
To simply dial the number, include it directly inside the Dial
verb without using the Number
noun. In this case, FlexML instructions cannot include any additional parameters for the dialed number. In this example, the phone number inside the Dial
tags will be dialed. The call total time will be limited to 15
seconds. The called party will be able to hang up by pressing the *
key. If an action URL is added to the Dial
verb as an attribute, a request will be made to that URL if the phone number cannot be reached, or when the call ends.
<Response>
<Dial timeLimit="15" hangupOnStar="true">15162065340</Dial>
</Response>
Number Noun
The Number
noun can be nested inside the Dial
verb. It contains the DID number to be dialed. It supports the following attributes:
Attribute | Data Type | Description |
---|---|---|
sendDigits | string | The DTMF tones that will be played when the call is answered. This is especially useful when dialing a phone number with an extension. Values accepted in this field are: 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , # , * , , , and the combinations of these characters. Each comma character defines a 0.5-second delay. |
CarrierX allows dialing to several numbers at once using the Number
noun. Refer to the Simultaneous Ring to Several Numbers section of the Dial
verb for more information about this.
Query Arguments
In this example, two X-
headers will be sent when dialing the phone number specified in the Number
noun nested inside the Dial
verb.
<Response>
<Dial>
<Number>15162065340?X-CustomHeader1=ABC&X-CustomHeader2=DEF</Number>
</Dial>
</Response>
The additional query arguments can be used to send custom headers inside the Number
noun. Use the ?
character after the phone number to add these headers. Several headers are joined with the XML-encoded &
character.
Only X-
headers are accepted as query arguments, any other headers or strings will be filtered out and not sent.
If you choose to send custom headers when dialing a phone number, you will need to additionally set the relay_sip_headers
parameter of the Trunk object associated with your FlexML endpoint to successfully pass these headers to the destination.
Example
In this example, once the call is answered, the wait of two seconds will be performed (the total length of four ,
characters, each equal to 0.5-second delay), after that the 1928
DTMF tones will be played to the dialed number.
<Response>
<Dial>
<Number sendDigits=",,,,1928">15162065340</Number>
</Dial>
</Response>
Simultaneous Ring to Several Numbers
CarrierX supports dialing to several numbers at once. You need to specify the numbers in the Number noun tags inside the Dial
verb. The first person to answer will be connected to the calling party. The calls to the other numbers will be hung up.
CarrierX supports up to 10 concurrent rings using the FlexML Dial
verb.
You can see an example of the code that uses the simultaneous rings feature in our sample application, which is a part of the No-code CarrierX Apps collection.
Example
In this example, the phone numbers in the Number
tags will be dialed all at the same time. The first person to answer is connected to the calling party.
<Response>
<Dial>
<Number>12345645585</Number>
<Number>96846465465</Number>
<Number>98133217461</Number>
</Dial>
</Response>
Nesting Rules
- You can nest the Number noun within the
Dial
verb. - You cannot nest the
Dial
verb within other FlexML verbs.