Skip to contentSkip to navigationSkip to topbar
On this page

TwiML™ Voice: <Application>


The <Dial> verb's <Application> noun allows you to connect a call to another Twilio account without losing the original call leg's context (e.g. the original "From" number). Rather than dialing a phone number or SIP endpoint, you can <Dial> a TwiML App directly with <Dial><Application>. <Dial><Application> also supports sending custom parameters using <Parameter>.

You can also direct a call to a TwiML App within your TwiML account using <Dial><Application>.

Note: Simultaneous dialing is NOT supported when performing <Dial><Application>.

(information)

Info

This page covers <Application>'s attributes, supported TwiML nouns, and supported <Dial> attributes.

To learn more about how use <Dial><Application>, how Twilio handles <Dial><Application> instructions, and an example scenario, go to the <Dial><Application> Usage page.


Table of Contents

table-of-contents page anchor

The TwiML example below shows the most basic use of <Dial><Application>.

Basic <Dial><Application>Link to code sample: Basic <Dial><Application>
1
const VoiceResponse = require('twilio').twiml.VoiceResponse;
2
3
const response = new VoiceResponse();
4
const dial = response.dial();
5
const application = dial.application();
6
application.applicationSid('AP1234567890abcdef1234567890abcd');
7
8
console.log(response.toString());

Output

1
<?xml version="1.0" encoding="UTF-8"?>
2
<Response>
3
<Dial>
4
<Application>
5
<ApplicationSid>AP1234567890abcdef1234567890abcd</ApplicationSid>
6
</Application>
7
</Dial>
8
</Response>

<Application> attributes

application-attributes page anchor

<Application> supports the following attributes:

AttributeAllowed ValuesDefault Value
customerId optionala string up to 256 characters in lengthThe Twilio Account SID that is providing the <Dial><Application> TwiML instructions
copyParentTo optionaltrue, falsefalse

customerId

customerid page anchor

<Application>'s customerId attribute allows you to set an identifier for the "sender" of the <Dial><Application>. The customerId will be sent as a parameter in Twilio's request to the TwiML App's Voice Request URL.

The customerId attribute can be any string up to 256 characters.

The default value of the customerId attribute is the Account SID associated with the <Dial><Application> TwiML.

The customerId attribute is optional.

<Dial><Application> with customerId attributeLink to code sample: <Dial><Application> with customerId attribute
1
const VoiceResponse = require('twilio').twiml.VoiceResponse;
2
3
const response = new VoiceResponse();
4
const dial = response.dial();
5
const application = dial.application({
6
customerId: 'CustomerFriendlyName'
7
});
8
application.applicationSid('AP1234567890abcdef1234567890abcd');
9
10
console.log(response.toString());

Output

1
<?xml version="1.0" encoding="UTF-8"?>
2
<Response>
3
<Dial>
4
<Application customerId="CustomerFriendlyName">
5
<ApplicationSid>AP1234567890abcdef1234567890abcd</ApplicationSid>
6
</Application>
7
</Dial>
8
</Response>

<Application>'s copyParentTo attribute, when set to true, uses the parent call's To parameter as the To parameter in the request to the TwiML App's Voice URL.

When the copyParentTo value is false, the To field is the dialed TwiML App's SID.

The default value of the copyParentTo attribute is false.

The copyParentTo attribute is optional.

<Dial><Application> with copyParentTo attributeLink to code sample: <Dial><Application> with copyParentTo attribute
1
const VoiceResponse = require('twilio').twiml.VoiceResponse;
2
3
const response = new VoiceResponse();
4
const dial = response.dial();
5
const application = dial.application({
6
copyParentTo: true
7
});
8
application.applicationSid('AP1234567890abcdef1234567890abcd');
9
10
console.log(response.toString());

Output

1
<?xml version="1.0" encoding="UTF-8"?>
2
<Response>
3
<Dial>
4
<Application copyParentTo="true">
5
<ApplicationSid>AP1234567890abcdef1234567890abcd</ApplicationSid>
6
</Application>
7
</Dial>
8
</Response>

<Application> accepts nested <ApplicationSid> and <Parameter> nouns.

<ApplicationSid> is required, while <Parameter> is optional.

In order to use <Dial><Application>, an <ApplicationSid> noun must be nested within <Application>'s opening and closing tags.

Between <ApplicationSid>'s opening and closing tags, specify the SID of the TwiML App that you wish to dial.

1
const VoiceResponse = require('twilio').twiml.VoiceResponse;
2
3
const response = new VoiceResponse();
4
const dial = response.dial();
5
const application = dial.application();
6
application.applicationSid('AP1234567890abcdef1234567890abcd');
7
8
console.log(response.toString());

Output

1
<?xml version="1.0" encoding="UTF-8"?>
2
<Response>
3
<Dial>
4
<Application>
5
<ApplicationSid>AP1234567890abcdef1234567890abcd</ApplicationSid>
6
</Application>
7
</Dial>
8
</Response>

<Dial><Application> supports <Parameter> nouns, which allows you to pass custom parameters in Twilio's request to the receiving TwiML App's Voice URL.

You may nest one or more <Parameter> nouns within <Application>.

Each <Parameter> noun nested inside <Application> represents a key/value pair of information you wish to send in Twilio's request to the TwiML App's Voice URL.

The <Parameter> noun has two attributes:

  • name - the name of your custom parameter
  • value - the value of your custom parameter

Each custom parameter is passed as a request parameter in Twilio's request to the TwiML App's Voice URL. In the request, each custom parameter's name is prefixed with Param_.

The TwiML example below shows how to use <Dial><Application> with nested <Parameter> nouns.

1
const VoiceResponse = require('twilio').twiml.VoiceResponse;
2
3
const response = new VoiceResponse();
4
const dial = response.dial();
5
const application = dial.application();
6
application.applicationSid('AP1234567890abcdef1234567890abcd');
7
application.parameter({
8
name: 'AccountNumber',
9
value: '12345'
10
});
11
application.parameter({
12
name: 'TicketNumber',
13
value: '9876'
14
});
15
16
console.log(response.toString());

Output

1
<?xml version="1.0" encoding="UTF-8"?>
2
<Response>
3
<Dial>
4
<Application>
5
<ApplicationSid>AP1234567890abcdef1234567890abcd</ApplicationSid>
6
<Parameter name="AccountNumber" value="12345"/>
7
<Parameter name="TicketNumber" value="9876"/>
8
</Application>
9
</Dial>
10
</Response>

For the example above, the body of Twilio's request to the TwiML App's Voice URL will contain Param_AccountNumber: "12345" and Param_TicketNumber: "9876".


Supported <Dial> attributes

supported-dial-attributes page anchor

<Application> supports the following <Dial> attributes:

<Dial><Application> supports sending custom parameters from the dialed party back to the originating <Dial>'s action URL. Learn more on the <Dial><Application> Usage page.

Note: REFER support via referUrl is NOT supported when using <Dial><Application>.

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.