Skip to contentSkip to navigationSkip to topbar
Rate this page:
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>

basic-dialapplication page anchor
Node.js
Python
C#
Java
PHP
Ruby

_10
const VoiceResponse = require('twilio').twiml.VoiceResponse;
_10
_10
const response = new VoiceResponse();
_10
const dial = response.dial();
_10
const application = dial.application();
_10
application.applicationSid('AP1234567890abcdef1234567890abcd');
_10
_10
console.log(response.toString());

Output

_10
<?xml version="1.0" encoding="UTF-8"?>
_10
<Response>
_10
<Dial>
_10
<Application>
_10
<ApplicationSid>AP1234567890abcdef1234567890abcd</ApplicationSid>
_10
</Application>
_10
</Dial>
_10
</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 attribute

dialapplication-with-customerid-attribute page anchor
Node.js
Python
C#
Java
PHP
Ruby

_10
const VoiceResponse = require('twilio').twiml.VoiceResponse;
_10
_10
const response = new VoiceResponse();
_10
const dial = response.dial();
_10
const application = dial.application({
_10
customerId: 'CustomerFriendlyName'
_10
});
_10
application.applicationSid('AP1234567890abcdef1234567890abcd');
_10
_10
console.log(response.toString());

Output

_10
<?xml version="1.0" encoding="UTF-8"?>
_10
<Response>
_10
<Dial>
_10
<Application customerId="CustomerFriendlyName">
_10
<ApplicationSid>AP1234567890abcdef1234567890abcd</ApplicationSid>
_10
</Application>
_10
</Dial>
_10
</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 attribute

dialapplication-with-copyparentto-attribute page anchor
Node.js
Python
C#
Java
PHP
Ruby

_10
const VoiceResponse = require('twilio').twiml.VoiceResponse;
_10
_10
const response = new VoiceResponse();
_10
const dial = response.dial();
_10
const application = dial.application({
_10
copyParentTo: true
_10
});
_10
application.applicationSid('AP1234567890abcdef1234567890abcd');
_10
_10
console.log(response.toString());

Output

_10
<?xml version="1.0" encoding="UTF-8"?>
_10
<Response>
_10
<Dial>
_10
<Application copyParentTo="true">
_10
<ApplicationSid>AP1234567890abcdef1234567890abcd</ApplicationSid>
_10
</Application>
_10
</Dial>
_10
</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.

Basic <Dial><Application>

basic-dialapplication-1 page anchor
Node.js
Python
C#
Java
PHP
Ruby

_10
const VoiceResponse = require('twilio').twiml.VoiceResponse;
_10
_10
const response = new VoiceResponse();
_10
const dial = response.dial();
_10
const application = dial.application();
_10
application.applicationSid('AP1234567890abcdef1234567890abcd');
_10
_10
console.log(response.toString());

Output

_10
<?xml version="1.0" encoding="UTF-8"?>
_10
<Response>
_10
<Dial>
_10
<Application>
_10
<ApplicationSid>AP1234567890abcdef1234567890abcd</ApplicationSid>
_10
</Application>
_10
</Dial>
_10
</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.

<Dial> <Application> with <Parameter>

dial-application-with-parameter page anchor
Node.js
Python
C#
Java
PHP
Ruby

_16
const VoiceResponse = require('twilio').twiml.VoiceResponse;
_16
_16
const response = new VoiceResponse();
_16
const dial = response.dial();
_16
const application = dial.application();
_16
application.applicationSid('AP1234567890abcdef1234567890abcd');
_16
application.parameter({
_16
name: 'AccountNumber',
_16
value: '12345'
_16
});
_16
application.parameter({
_16
name: 'TicketNumber',
_16
value: '9876'
_16
});
_16
_16
console.log(response.toString());

Output

_10
<?xml version="1.0" encoding="UTF-8"?>
_10
<Response>
_10
<Dial>
_10
<Application>
_10
<ApplicationSid>AP1234567890abcdef1234567890abcd</ApplicationSid>
_10
<Parameter name="AccountNumber" value="12345"/>
_10
<Parameter name="TicketNumber" value="9876"/>
_10
</Application>
_10
</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>.


Rate this page: