The <Number> element specifies a phone number to dial.

You can use multiple <Number> elements within a <Dial> element to simultaneously call multiple numbers. The first call to pick up is connected to the current call and the rest are hung up.

Note: When dialing multiple numbers simultaneously, if confirmSound and confirmKey are specified for the Dial element, the phone which confirms the key correctly will be bridged while all others will fail.

Element Attributes

The <Number> element supports the following attributes that modify its behavior:

Attribute Name Allowed Values Default Value
sendDigits any digits none
sendOnPreanswer ‘true’ or ‘false’ false
gateways
*mandatory
Valid FreeSWITCH gateway strings separated by comma none
gatewayCodecs Valid codecs for each gatway separated by comma none
gatewayTimeouts Timeouts for each gateway separated by comma none
gatewayRetries Number of times each gateway must be retried separated by comma none
extraDialString Extra FreeSWITCH dialstring to be added while dialing out to number none

sendDigits

The sendDigits attribute tells Plivo to play DTMF tones when the call is answered. This is useful when dialing a phone number and an extension. Plivo will dial the number, and when the automated system picks up, send the DTMF tones to connect to the extension.

sendOnPreanswer

If sendOnPreanswer attribute is ‘true’, sendDigits is executed when called party is in early media instead of answer state.

gateways

This should be valid FreeSWITCH gateway strings separated by comma. If multiple gateways are specified, all the gateways will be tried sequentially for failover for the specified number of retries. E.g. 'user/,sofia/gateway/PSTNgateway1/,sofia/gateway/PSTNgateway2/'

gatewayCodecs

Through this parameter you can choose the valid codec(s) to be used for each FreeSWITCH gateway. E.g.'PCMA,PCMU','G729,PCMU','PCMA,G729'

gatewayTimeouts

As the name suggests, gatewayTimeouts indicates the timeouts (in seconds) for each FreeSWITCH gateway. E.g "10,10,10". Here Plivo will use 10 seconds timeouts while trying to dial a call through each of the three gateways.

gatewayRetries

The number of times each of the gateways must be tried. E.g. "2,1,1" Here gateway 1 will be tried twice and others gateways will be tried once each.

extraDialString

E.g. "bridge_early_media=true,hangup_after_bridge=true" This will add these channel variables to the dialstring in FreeSWITCH while dialing a number. You can use any channel variables supported by FreeSWITCH for granular control. Please refer to this link for more details

Examples

Example 1: Using sendDigits

In this case, we want to dial the 2410 extension at +1-555-123-4567. We use a <Number> noun to describe the phone number and give it the attribute sendDigits. We want to wait before sending the extension, so we add a few leading ‘w’ characters. Each ‘w’ character tells Plivo to wait 0.5 seconds instead of playing a digit.

1
2
3
4
5
6
7
8
<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Dial>
        <Number sendDigits="wwww2410" gateways="sofia/gateway/PSTNgateway1/,sofia/gateway/PSTNgateway2/" gatewayCodecs="'PCMA,PCMU','G729,PCMU'">
            15551234567
        </Number>
    </Dial>
</Response>

Example 2: Simultaneous Dialing

In this case we use several <Number> tags to dial three phone numbers at the same time. The first of these calls to answer will be connected to the current caller, while the rest of the connection attempts are canceled.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Dial>
        <Number gateways="sofia/gateway/PSTNgateway1/,sofia/gateway/PSTNgateway2/" gatewayCodecs="'PCMA,PCMU','G729,PCMU'"> 
            18887654321
        </Number>
        <Number gateways="sofia/gateway/PSTNgateway1/,sofia/gateway/PSTNgateway2/" gatewayCodecs="'PCMA,PCMU','G729,PCMU'">
            15551234567
        </Number>
        <Number gateways="user/" gatewayCodecs="'PCMA,PCMU'">
            1000
        </Number>
    </Dial>
</Response>

Simultaneous dialing is useful when you have many phones that you want to ring. The first call that connects will cancel all other tries.

Comments are closed.