View Source TwiML (TwiML v0.6.0)
Generate complex TwiML documents for Twilio in an elegant Elixir way.
Note
Please refer to the official TwiML documentation to verify that the TwiML verb actually supports content or the given attributes.
Examples
Say something:
iex> TwiML.say("Hello") |> TwiML.to_xml()
"""
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>Hello</Say>
</Response>\
"""
Say 2 things, one after the other:
iex> TwiML.say("Hello") |> TwiML.say("world") |> TwiML.to_xml()
"""
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>Hello</Say>
<Say>world</Say>
</Response>\
"""
Say something in another voice:
iex> TwiML.say("Hello", voice: "woman") |> TwiML.to_xml()
"""
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="woman">Hello</Say>
</Response>\
"""
Leaving the content empty for a TwiML verb, will create a TwiML element that has no body:
iex> TwiML.hangup() |> TwiML.to_xml()
"""
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Hangup/>
</Response>\
"""
You can embed TwiML tags into other tags using the into_*
function:
iex> TwiML.say("Lets say this inside the gather")
...> |> TwiML.into_gather(language: "en-US", input: "speech")
...> |> TwiML.to_xml()
"""
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather language="en-US" input="speech">
<Say>Lets say this inside the gather</Say>
</Gather>
</Response>\
"""
If you have multiple TwiML tags you want to embed, that works too:
iex> TwiML.say("Hi")
...> |> TwiML.say("We cool?")
...> |> TwiML.into_gather(language: "en-US", input: "speech", hints: "yes, no")
...> |> TwiML.to_xml()
"""
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather language="en-US" input="speech" hints="yes, no">
<Say>Hi</Say>
<Say>We cool?</Say>
</Gather>
</Response>\
"""
It is also possible to just include a few of the preceding tags into the body of
another element. The 1
decides that we want to only put the last element into
the Dial element's body:
iex> TwiML.say("Calling Yodel")
...> |> TwiML.number("+1 415-483-0400")
...> |> TwiML.into_dial(1)
...> |> TwiML.to_xml()
"""
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>Calling Yodel</Say>
<Dial>
<Number>+1 415-483-0400</Number>
</Dial>
</Response>\
"""
The into_*
functions can take the number of preceding tags, attributes or both
as arguments:
iex> TwiML.identity("venkman")
...> |> TwiML.into_client(1)
...> |> TwiML.identity("stantz")
...> |> TwiML.into_client(1, method: "GET")
...> |> TwiML.into_dial(caller: "+1 415-483-0400")
...> |> TwiML.to_xml()
"""
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial caller="+1 415-483-0400">
<Client>
<Identity>venkman</Identity>
</Client>
<Client method="GET">
<Identity>stantz</Identity>
</Client>
</Dial>
</Response>\
"""
Multiple calls to into_*
functions allow building complex nested TwiML
structures without losing readability in the code due to nested function calls:
iex> TwiML.identity("venkman")
...> |> TwiML.parameter(name: "first_name", value: "Peter")
...> |> TwiML.parameter(name: "last_name", value: "Venkman")
...> |> TwiML.into_client(3)
...> |> TwiML.into_dial(1)
...> |> TwiML.to_xml()
"""
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>
<Client>
<Identity>venkman</Identity>
<Parameter name="first_name" value="Peter"/>
<Parameter name="last_name" value="Venkman"/>
</Client>
</Dial>
</Response>\
"""
Attributes can be provided both as snake_case
or camelCase
, but the latter is preferred as the code looks more Elixir-like.
iex> TwiML.dial("+1 415-483-0400", recordingStatusCallback: "https://example.org", recording_status_callback_method: "POST")
...> |> TwiML.to_xml()
"""
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial recordingStatusCallback="https://example.org" recordingStatusCallbackMethod="POST">+1 415-483-0400</Dial>
</Response>\
"""
Safe binary strings, IO Data or CDATA are supported as well. Make sure to only mark actually safe data as safe!
iex> TwiML.say({:safe, "<tag>Hello World</tag>"})
...> |> TwiML.to_xml()
"""
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say><tag>Hello World</tag></Say>
</Response>\
"""
iex> TwiML.say({:iodata, [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]})
...> |> TwiML.to_xml()
"""
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>hello world</Say>
</Response>\
"""
iex> TwiML.say({:cdata, "<Hello>\\<World>"})
...> |> TwiML.to_xml()
"""
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say><![CDATA[<Hello>\\<World>]]></Say>
</Response>\
"""
This also works with attributes:
iex> TwiML.say({:safe, "<tag>Hello World</tag>"}, voice: "Polly.Joanna")
...> |> TwiML.to_xml()
"""
<?xml version="1.0" encoding="UTF-8\"?>
<Response>
<Say voice="Polly.Joanna"><tag>Hello World</tag></Say>
</Response>\
"""
iex> TwiML.say({:iodata, [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]}, voice: "Polly.Joanna")
...> |> TwiML.to_xml()
"""
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="Polly.Joanna">hello world</Say>
</Response>\
"""
iex> TwiML.say({:cdata, "<Hello>\\<World>"}, voice: "Polly.Joanna")
...> |> TwiML.to_xml()
"""
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="Polly.Joanna"><![CDATA[<Hello>\\<World>]]></Say>
</Response>\
"""
Comments can help with debugging (yes, they are somewhat ugly, until xml_builder
properly supports them):
iex> TwiML.comment("Blocked because of insufficient funds")
...> |> TwiML.reject()
...> |> TwiML.to_xml()
"""
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<!-->Blocked because of insufficient funds</!-->
<Reject/>
</Response>\
"""
And can also be chained:
iex> TwiML.say("Sorry, calls are currently unavailable")
...> |> TwiML.comment("Blocked because of insufficient funds")
...> |> TwiML.reject()
...> |> TwiML.to_xml()
"""
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>Sorry, calls are currently unavailable</Say>
<!-->Blocked because of insufficient funds</!-->
<Reject/>
</Response>\
"""
Attributes with a value of nil are excluded from the generated TwiML:
iex> TwiML.gather(input: "dtmf", finish_on_key: "", num_digits: nil)
...> |> TwiML.to_xml()
"""
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather input="dtmf" finishOnKey=""/>
</Response>\
"""
Summary
Types
Content which can be used within a TwiML verb. Refer to the XmlBuilder
documentation for more information.
A TwiML document contains one or more TwiML verbs. These verbs can have attributes and can wrap nested TwiML verbs.
TwiML Verbs
Generates an empty <Application>
verb.
Generates a <Application>
verb.
Appends or generates a <Application>
verb.
Appends a <Application>
verb with attributes.
Generates an empty <Autopilot>
verb.
Generates a <Autopilot>
verb.
Appends or generates a <Autopilot>
verb.
Appends a <Autopilot>
verb with attributes.
Generates an empty <Client>
verb.
Generates a <Client>
verb.
Appends or generates a <Client>
verb.
Appends a <Client>
verb with attributes.
Generates an empty <Conference>
verb.
Generates a <Conference>
verb.
Appends or generates a <Conference>
verb.
Appends a <Conference>
verb with attributes.
Generates an empty <Connect>
verb.
Generates a <Connect>
verb.
Appends or generates a <Connect>
verb.
Appends a <Connect>
verb with attributes.
Generates an empty <Dial>
verb.
Generates a <Dial>
verb.
Appends or generates a <Dial>
verb.
Appends a <Dial>
verb with attributes.
Generates an empty <Enqueue>
verb.
Generates a <Enqueue>
verb.
Appends or generates a <Enqueue>
verb.
Appends a <Enqueue>
verb with attributes.
Generates an empty <Gather>
verb.
Generates a <Gather>
verb.
Appends or generates a <Gather>
verb.
Appends a <Gather>
verb with attributes.
Generates an empty <Hangup>
verb.
Generates a <Hangup>
verb.
Appends or generates a <Hangup>
verb.
Appends a <Hangup>
verb with attributes.
Generates an empty <Identity>
verb.
Generates a <Identity>
verb.
Appends or generates a <Identity>
verb.
Appends a <Identity>
verb with attributes.
Wraps preceding TwiML verbs in a <Application>
verb.
Wraps preceding TwiML verbs in a <Application>
verb with attributes.
Wraps preceding TwiML verbs in a <Autopilot>
verb.
Wraps preceding TwiML verbs in a <Autopilot>
verb with attributes.
Wraps preceding TwiML verbs in a <Client>
verb.
Wraps preceding TwiML verbs in a <Client>
verb with attributes.
Wraps preceding TwiML verbs in a <Conference>
verb.
Wraps preceding TwiML verbs in a <Conference>
verb with attributes.
Wraps preceding TwiML verbs in a <Connect>
verb.
Wraps preceding TwiML verbs in a <Connect>
verb with attributes.
Wraps preceding TwiML verbs in a <Dial>
verb.
Wraps preceding TwiML verbs in a <Dial>
verb with attributes.
Wraps preceding TwiML verbs in a <Enqueue>
verb.
Wraps preceding TwiML verbs in a <Enqueue>
verb with attributes.
Wraps preceding TwiML verbs in a <Gather>
verb.
Wraps preceding TwiML verbs in a <Gather>
verb with attributes.
Wraps preceding TwiML verbs in a <Hangup>
verb.
Wraps preceding TwiML verbs in a <Hangup>
verb with attributes.
Wraps preceding TwiML verbs in a <Identity>
verb.
Wraps preceding TwiML verbs in a <Identity>
verb with attributes.
Wraps preceding TwiML verbs in a <Leave>
verb.
Wraps preceding TwiML verbs in a <Leave>
verb with attributes.
Wraps preceding TwiML verbs in a <Number>
verb.
Wraps preceding TwiML verbs in a <Number>
verb with attributes.
Wraps preceding TwiML verbs in a <Parameter>
verb.
Wraps preceding TwiML verbs in a <Parameter>
verb with attributes.
Wraps preceding TwiML verbs in a <Pause>
verb.
Wraps preceding TwiML verbs in a <Pause>
verb with attributes.
Wraps preceding TwiML verbs in a <Pay>
verb.
Wraps preceding TwiML verbs in a <Pay>
verb with attributes.
Wraps preceding TwiML verbs in a <Play>
verb.
Wraps preceding TwiML verbs in a <Play>
verb with attributes.
Wraps preceding TwiML verbs in a <Prompt>
verb.
Wraps preceding TwiML verbs in a <Prompt>
verb with attributes.
Wraps preceding TwiML verbs in a <Queue>
verb.
Wraps preceding TwiML verbs in a <Queue>
verb with attributes.
Wraps preceding TwiML verbs in a <Record>
verb.
Wraps preceding TwiML verbs in a <Record>
verb with attributes.
Wraps preceding TwiML verbs in a <Redirect>
verb.
Wraps preceding TwiML verbs in a <Redirect>
verb with attributes.
Wraps preceding TwiML verbs in a <Refer>
verb.
Wraps preceding TwiML verbs in a <Refer>
verb with attributes.
Wraps preceding TwiML verbs in a <Reject>
verb.
Wraps preceding TwiML verbs in a <Reject>
verb with attributes.
Wraps preceding TwiML verbs in a <Say>
verb.
Wraps preceding TwiML verbs in a <Say>
verb with attributes.
Wraps preceding TwiML verbs in a <Sim>
verb.
Wraps preceding TwiML verbs in a <Sim>
verb with attributes.
Wraps preceding TwiML verbs in a <Sip>
verb.
Wraps preceding TwiML verbs in a <Sip>
verb with attributes.
Wraps preceding TwiML verbs in a <Siprec>
verb.
Wraps preceding TwiML verbs in a <Siprec>
verb with attributes.
Wraps preceding TwiML verbs in a <Stream>
verb.
Wraps preceding TwiML verbs in a <Stream>
verb with attributes.
Wraps preceding TwiML verbs in a <VirtualAgent>
verb.
Wraps preceding TwiML verbs in a <VirtualAgent>
verb with attributes.
Generates an empty <Leave>
verb.
Generates a <Leave>
verb.
Appends or generates a <Leave>
verb.
Appends a <Leave>
verb with attributes.
Generates an empty <Number>
verb.
Generates a <Number>
verb.
Appends or generates a <Number>
verb.
Appends a <Number>
verb with attributes.
Generates an empty <Parameter>
verb.
Generates a <Parameter>
verb.
Appends or generates a <Parameter>
verb.
Appends a <Parameter>
verb with attributes.
Generates an empty <Pause>
verb.
Generates a <Pause>
verb.
Appends or generates a <Pause>
verb.
Appends a <Pause>
verb with attributes.
Generates an empty <Pay>
verb.
Generates a <Pay>
verb.
Appends or generates a <Pay>
verb.
Appends a <Pay>
verb with attributes.
Generates an empty <Play>
verb.
Generates a <Play>
verb.
Appends or generates a <Play>
verb.
Appends a <Play>
verb with attributes.
Generates an empty <Prompt>
verb.
Generates a <Prompt>
verb.
Appends or generates a <Prompt>
verb.
Appends a <Prompt>
verb with attributes.
Generates an empty <Queue>
verb.
Generates a <Queue>
verb.
Appends or generates a <Queue>
verb.
Appends a <Queue>
verb with attributes.
Generates an empty <Record>
verb.
Generates a <Record>
verb.
Appends or generates a <Record>
verb.
Appends a <Record>
verb with attributes.
Generates an empty <Redirect>
verb.
Generates a <Redirect>
verb.
Appends or generates a <Redirect>
verb.
Appends a <Redirect>
verb with attributes.
Generates an empty <Refer>
verb.
Generates a <Refer>
verb.
Appends or generates a <Refer>
verb.
Appends a <Refer>
verb with attributes.
Generates an empty <Reject>
verb.
Generates a <Reject>
verb.
Appends or generates a <Reject>
verb.
Appends a <Reject>
verb with attributes.
Generates an empty <Say>
verb.
Generates a <Say>
verb.
Appends or generates a <Say>
verb.
Appends a <Say>
verb with attributes.
Generates an empty <Sim>
verb.
Generates a <Sim>
verb.
Appends or generates a <Sim>
verb.
Appends a <Sim>
verb with attributes.
Generates an empty <Sip>
verb.
Generates a <Sip>
verb.
Appends or generates a <Sip>
verb.
Appends a <Sip>
verb with attributes.
Generates an empty <Siprec>
verb.
Generates a <Siprec>
verb.
Appends or generates a <Siprec>
verb.
Appends a <Siprec>
verb with attributes.
Generates an empty <Stream>
verb.
Generates a <Stream>
verb.
Appends or generates a <Stream>
verb.
Appends a <Stream>
verb with attributes.
Generates an empty <VirtualAgent>
verb.
Generates a <VirtualAgent>
verb.
Appends or generates a <VirtualAgent>
verb.
Appends a <VirtualAgent>
verb with attributes.
Functions
Generates a comment.
Appends a comment to the TwiML.
Generates a XML document from the provided verbs and arguments. For the
supported opts
, please refer to the documentation of
XmlBuilder.generate/2
.
Types
Content which can be used within a TwiML verb. Refer to the XmlBuilder
documentation for more information.
A TwiML document contains one or more TwiML verbs. These verbs can have attributes and can wrap nested TwiML verbs.
TwiML Verbs
@spec application() :: t()
Generates an empty <Application>
verb.
Generates a <Application>
verb.
There are three supported usages:
- Wraps
arg
in<Application>
if it'sTwiML.content/0
. - Creates an empty
<Application>
with attributes forarg
as a keyword list. - Appends an empty
<Application>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
@spec application(t(), keyword() | content()) :: t()
@spec application( content(), keyword() ) :: t()
Appends or generates a <Application>
verb.
There are two supported usages:
- Appends
<Application>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Application>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Application>
verb with attributes.
Adds a <Application>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec autopilot() :: t()
Generates an empty <Autopilot>
verb.
Generates a <Autopilot>
verb.
There are three supported usages:
- Wraps
arg
in<Autopilot>
if it'sTwiML.content/0
. - Creates an empty
<Autopilot>
with attributes forarg
as a keyword list. - Appends an empty
<Autopilot>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Autopilot>
verb.
There are two supported usages:
- Appends
<Autopilot>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Autopilot>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Autopilot>
verb with attributes.
Adds a <Autopilot>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec client() :: t()
Generates an empty <Client>
verb.
Generates a <Client>
verb.
There are three supported usages:
- Wraps
arg
in<Client>
if it'sTwiML.content/0
. - Creates an empty
<Client>
with attributes forarg
as a keyword list. - Appends an empty
<Client>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Client>
verb.
There are two supported usages:
- Appends
<Client>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Client>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Client>
verb with attributes.
Adds a <Client>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec conference() :: t()
Generates an empty <Conference>
verb.
Generates a <Conference>
verb.
There are three supported usages:
- Wraps
arg
in<Conference>
if it'sTwiML.content/0
. - Creates an empty
<Conference>
with attributes forarg
as a keyword list. - Appends an empty
<Conference>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Conference>
verb.
There are two supported usages:
- Appends
<Conference>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Conference>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Conference>
verb with attributes.
Adds a <Conference>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec connect() :: t()
Generates an empty <Connect>
verb.
Generates a <Connect>
verb.
There are three supported usages:
- Wraps
arg
in<Connect>
if it'sTwiML.content/0
. - Creates an empty
<Connect>
with attributes forarg
as a keyword list. - Appends an empty
<Connect>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Connect>
verb.
There are two supported usages:
- Appends
<Connect>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Connect>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Connect>
verb with attributes.
Adds a <Connect>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec dial() :: t()
Generates an empty <Dial>
verb.
Generates a <Dial>
verb.
There are three supported usages:
- Wraps
arg
in<Dial>
if it'sTwiML.content/0
. - Creates an empty
<Dial>
with attributes forarg
as a keyword list. - Appends an empty
<Dial>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Dial>
verb.
There are two supported usages:
- Appends
<Dial>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Dial>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Dial>
verb with attributes.
Adds a <Dial>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec enqueue() :: t()
Generates an empty <Enqueue>
verb.
Generates a <Enqueue>
verb.
There are three supported usages:
- Wraps
arg
in<Enqueue>
if it'sTwiML.content/0
. - Creates an empty
<Enqueue>
with attributes forarg
as a keyword list. - Appends an empty
<Enqueue>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Enqueue>
verb.
There are two supported usages:
- Appends
<Enqueue>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Enqueue>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Enqueue>
verb with attributes.
Adds a <Enqueue>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec gather() :: t()
Generates an empty <Gather>
verb.
Generates a <Gather>
verb.
There are three supported usages:
- Wraps
arg
in<Gather>
if it'sTwiML.content/0
. - Creates an empty
<Gather>
with attributes forarg
as a keyword list. - Appends an empty
<Gather>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Gather>
verb.
There are two supported usages:
- Appends
<Gather>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Gather>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Gather>
verb with attributes.
Adds a <Gather>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec hangup() :: t()
Generates an empty <Hangup>
verb.
Generates a <Hangup>
verb.
There are three supported usages:
- Wraps
arg
in<Hangup>
if it'sTwiML.content/0
. - Creates an empty
<Hangup>
with attributes forarg
as a keyword list. - Appends an empty
<Hangup>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Hangup>
verb.
There are two supported usages:
- Appends
<Hangup>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Hangup>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Hangup>
verb with attributes.
Adds a <Hangup>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec identity() :: t()
Generates an empty <Identity>
verb.
Generates a <Identity>
verb.
There are three supported usages:
- Wraps
arg
in<Identity>
if it'sTwiML.content/0
. - Creates an empty
<Identity>
with attributes forarg
as a keyword list. - Appends an empty
<Identity>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Identity>
verb.
There are two supported usages:
- Appends
<Identity>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Identity>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Identity>
verb with attributes.
Adds a <Identity>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec into_application(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Application>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Application>
if it's a keyword list. - Wraps all preceding verbs in
<Application>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Application>
if it's a positive integer.
@spec into_application(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Application>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Application>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Application>
usingattrs
as attribute if it's a positive integer.
@spec into_autopilot(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Autopilot>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Autopilot>
if it's a keyword list. - Wraps all preceding verbs in
<Autopilot>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Autopilot>
if it's a positive integer.
@spec into_autopilot(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Autopilot>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Autopilot>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Autopilot>
usingattrs
as attribute if it's a positive integer.
@spec into_client(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Client>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Client>
if it's a keyword list. - Wraps all preceding verbs in
<Client>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Client>
if it's a positive integer.
@spec into_client(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Client>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Client>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Client>
usingattrs
as attribute if it's a positive integer.
@spec into_conference(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Conference>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Conference>
if it's a keyword list. - Wraps all preceding verbs in
<Conference>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Conference>
if it's a positive integer.
@spec into_conference(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Conference>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Conference>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Conference>
usingattrs
as attribute if it's a positive integer.
@spec into_connect(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Connect>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Connect>
if it's a keyword list. - Wraps all preceding verbs in
<Connect>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Connect>
if it's a positive integer.
@spec into_connect(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Connect>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Connect>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Connect>
usingattrs
as attribute if it's a positive integer.
@spec into_dial(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Dial>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Dial>
if it's a keyword list. - Wraps all preceding verbs in
<Dial>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Dial>
if it's a positive integer.
@spec into_dial(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Dial>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Dial>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Dial>
usingattrs
as attribute if it's a positive integer.
@spec into_enqueue(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Enqueue>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Enqueue>
if it's a keyword list. - Wraps all preceding verbs in
<Enqueue>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Enqueue>
if it's a positive integer.
@spec into_enqueue(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Enqueue>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Enqueue>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Enqueue>
usingattrs
as attribute if it's a positive integer.
@spec into_gather(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Gather>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Gather>
if it's a keyword list. - Wraps all preceding verbs in
<Gather>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Gather>
if it's a positive integer.
@spec into_gather(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Gather>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Gather>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Gather>
usingattrs
as attribute if it's a positive integer.
@spec into_hangup(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Hangup>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Hangup>
if it's a keyword list. - Wraps all preceding verbs in
<Hangup>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Hangup>
if it's a positive integer.
@spec into_hangup(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Hangup>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Hangup>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Hangup>
usingattrs
as attribute if it's a positive integer.
@spec into_identity(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Identity>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Identity>
if it's a keyword list. - Wraps all preceding verbs in
<Identity>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Identity>
if it's a positive integer.
@spec into_identity(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Identity>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Identity>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Identity>
usingattrs
as attribute if it's a positive integer.
@spec into_leave(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Leave>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Leave>
if it's a keyword list. - Wraps all preceding verbs in
<Leave>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Leave>
if it's a positive integer.
@spec into_leave(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Leave>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Leave>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Leave>
usingattrs
as attribute if it's a positive integer.
@spec into_number(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Number>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Number>
if it's a keyword list. - Wraps all preceding verbs in
<Number>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Number>
if it's a positive integer.
@spec into_number(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Number>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Number>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Number>
usingattrs
as attribute if it's a positive integer.
@spec into_parameter(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Parameter>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Parameter>
if it's a keyword list. - Wraps all preceding verbs in
<Parameter>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Parameter>
if it's a positive integer.
@spec into_parameter(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Parameter>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Parameter>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Parameter>
usingattrs
as attribute if it's a positive integer.
@spec into_pause(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Pause>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Pause>
if it's a keyword list. - Wraps all preceding verbs in
<Pause>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Pause>
if it's a positive integer.
@spec into_pause(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Pause>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Pause>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Pause>
usingattrs
as attribute if it's a positive integer.
@spec into_pay(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Pay>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Pay>
if it's a keyword list. - Wraps all preceding verbs in
<Pay>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Pay>
if it's a positive integer.
@spec into_pay(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Pay>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Pay>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Pay>
usingattrs
as attribute if it's a positive integer.
@spec into_play(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Play>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Play>
if it's a keyword list. - Wraps all preceding verbs in
<Play>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Play>
if it's a positive integer.
@spec into_play(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Play>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Play>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Play>
usingattrs
as attribute if it's a positive integer.
@spec into_prompt(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Prompt>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Prompt>
if it's a keyword list. - Wraps all preceding verbs in
<Prompt>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Prompt>
if it's a positive integer.
@spec into_prompt(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Prompt>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Prompt>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Prompt>
usingattrs
as attribute if it's a positive integer.
@spec into_queue(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Queue>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Queue>
if it's a keyword list. - Wraps all preceding verbs in
<Queue>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Queue>
if it's a positive integer.
@spec into_queue(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Queue>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Queue>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Queue>
usingattrs
as attribute if it's a positive integer.
@spec into_record(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Record>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Record>
if it's a keyword list. - Wraps all preceding verbs in
<Record>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Record>
if it's a positive integer.
@spec into_record(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Record>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Record>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Record>
usingattrs
as attribute if it's a positive integer.
@spec into_redirect(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Redirect>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Redirect>
if it's a keyword list. - Wraps all preceding verbs in
<Redirect>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Redirect>
if it's a positive integer.
@spec into_redirect(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Redirect>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Redirect>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Redirect>
usingattrs
as attribute if it's a positive integer.
@spec into_refer(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Refer>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Refer>
if it's a keyword list. - Wraps all preceding verbs in
<Refer>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Refer>
if it's a positive integer.
@spec into_refer(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Refer>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Refer>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Refer>
usingattrs
as attribute if it's a positive integer.
@spec into_reject(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Reject>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Reject>
if it's a keyword list. - Wraps all preceding verbs in
<Reject>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Reject>
if it's a positive integer.
@spec into_reject(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Reject>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Reject>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Reject>
usingattrs
as attribute if it's a positive integer.
@spec into_say(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Say>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Say>
if it's a keyword list. - Wraps all preceding verbs in
<Say>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Say>
if it's a positive integer.
@spec into_say(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Say>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Say>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Say>
usingattrs
as attribute if it's a positive integer.
@spec into_sim(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Sim>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Sim>
if it's a keyword list. - Wraps all preceding verbs in
<Sim>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Sim>
if it's a positive integer.
@spec into_sim(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Sim>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Sim>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Sim>
usingattrs
as attribute if it's a positive integer.
@spec into_sip(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Sip>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Sip>
if it's a keyword list. - Wraps all preceding verbs in
<Sip>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Sip>
if it's a positive integer.
@spec into_sip(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Sip>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Sip>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Sip>
usingattrs
as attribute if it's a positive integer.
@spec into_siprec(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Siprec>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Siprec>
if it's a keyword list. - Wraps all preceding verbs in
<Siprec>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Siprec>
if it's a positive integer.
@spec into_siprec(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Siprec>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Siprec>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Siprec>
usingattrs
as attribute if it's a positive integer.
@spec into_stream(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <Stream>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<Stream>
if it's a keyword list. - Wraps all preceding verbs in
<Stream>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<Stream>
if it's a positive integer.
@spec into_stream(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <Stream>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<Stream>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<Stream>
usingattrs
as attribute if it's a positive integer.
@spec into_virtual_agent(t(), keyword() | :all | pos_integer()) :: t()
Wraps preceding TwiML verbs in a <VirtualAgent>
verb.
There are three supported usages:
- Uses
attrs_or_last_n_elements
as attributes to wrap all preceding verbs in<VirtualAgent>
if it's a keyword list. - Wraps all preceding verbs in
<VirtualAgent>
ifattrs_or_last_n_elements
is:all
. - Encloses the last
attrs_or_last_n_elements
verbs in<VirtualAgent>
if it's a positive integer.
@spec into_virtual_agent(t(), :all | pos_integer(), keyword()) :: t()
Wraps preceding TwiML verbs in a <VirtualAgent>
verb with attributes.
There are three supported usages:
- Wraps all preceding verbs in
<VirtualAgent>
usingattrs
as attributes iflast_n_elements
is:all
. - Encloses the last
last_n_elements
verbs in<VirtualAgent>
usingattrs
as attribute if it's a positive integer.
@spec leave() :: t()
Generates an empty <Leave>
verb.
Generates a <Leave>
verb.
There are three supported usages:
- Wraps
arg
in<Leave>
if it'sTwiML.content/0
. - Creates an empty
<Leave>
with attributes forarg
as a keyword list. - Appends an empty
<Leave>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Leave>
verb.
There are two supported usages:
- Appends
<Leave>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Leave>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Leave>
verb with attributes.
Adds a <Leave>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec number() :: t()
Generates an empty <Number>
verb.
Generates a <Number>
verb.
There are three supported usages:
- Wraps
arg
in<Number>
if it'sTwiML.content/0
. - Creates an empty
<Number>
with attributes forarg
as a keyword list. - Appends an empty
<Number>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Number>
verb.
There are two supported usages:
- Appends
<Number>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Number>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Number>
verb with attributes.
Adds a <Number>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec parameter() :: t()
Generates an empty <Parameter>
verb.
Generates a <Parameter>
verb.
There are three supported usages:
- Wraps
arg
in<Parameter>
if it'sTwiML.content/0
. - Creates an empty
<Parameter>
with attributes forarg
as a keyword list. - Appends an empty
<Parameter>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Parameter>
verb.
There are two supported usages:
- Appends
<Parameter>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Parameter>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Parameter>
verb with attributes.
Adds a <Parameter>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec pause() :: t()
Generates an empty <Pause>
verb.
Generates a <Pause>
verb.
There are three supported usages:
- Wraps
arg
in<Pause>
if it'sTwiML.content/0
. - Creates an empty
<Pause>
with attributes forarg
as a keyword list. - Appends an empty
<Pause>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Pause>
verb.
There are two supported usages:
- Appends
<Pause>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Pause>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Pause>
verb with attributes.
Adds a <Pause>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec pay() :: t()
Generates an empty <Pay>
verb.
Generates a <Pay>
verb.
There are three supported usages:
- Wraps
arg
in<Pay>
if it'sTwiML.content/0
. - Creates an empty
<Pay>
with attributes forarg
as a keyword list. - Appends an empty
<Pay>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Pay>
verb.
There are two supported usages:
- Appends
<Pay>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Pay>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Pay>
verb with attributes.
Adds a <Pay>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec play() :: t()
Generates an empty <Play>
verb.
Generates a <Play>
verb.
There are three supported usages:
- Wraps
arg
in<Play>
if it'sTwiML.content/0
. - Creates an empty
<Play>
with attributes forarg
as a keyword list. - Appends an empty
<Play>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Play>
verb.
There are two supported usages:
- Appends
<Play>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Play>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Play>
verb with attributes.
Adds a <Play>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec prompt() :: t()
Generates an empty <Prompt>
verb.
Generates a <Prompt>
verb.
There are three supported usages:
- Wraps
arg
in<Prompt>
if it'sTwiML.content/0
. - Creates an empty
<Prompt>
with attributes forarg
as a keyword list. - Appends an empty
<Prompt>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Prompt>
verb.
There are two supported usages:
- Appends
<Prompt>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Prompt>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Prompt>
verb with attributes.
Adds a <Prompt>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec queue() :: t()
Generates an empty <Queue>
verb.
Generates a <Queue>
verb.
There are three supported usages:
- Wraps
arg
in<Queue>
if it'sTwiML.content/0
. - Creates an empty
<Queue>
with attributes forarg
as a keyword list. - Appends an empty
<Queue>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Queue>
verb.
There are two supported usages:
- Appends
<Queue>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Queue>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Queue>
verb with attributes.
Adds a <Queue>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec record() :: t()
Generates an empty <Record>
verb.
Generates a <Record>
verb.
There are three supported usages:
- Wraps
arg
in<Record>
if it'sTwiML.content/0
. - Creates an empty
<Record>
with attributes forarg
as a keyword list. - Appends an empty
<Record>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Record>
verb.
There are two supported usages:
- Appends
<Record>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Record>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Record>
verb with attributes.
Adds a <Record>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec redirect() :: t()
Generates an empty <Redirect>
verb.
Generates a <Redirect>
verb.
There are three supported usages:
- Wraps
arg
in<Redirect>
if it'sTwiML.content/0
. - Creates an empty
<Redirect>
with attributes forarg
as a keyword list. - Appends an empty
<Redirect>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Redirect>
verb.
There are two supported usages:
- Appends
<Redirect>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Redirect>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Redirect>
verb with attributes.
Adds a <Redirect>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec refer() :: t()
Generates an empty <Refer>
verb.
Generates a <Refer>
verb.
There are three supported usages:
- Wraps
arg
in<Refer>
if it'sTwiML.content/0
. - Creates an empty
<Refer>
with attributes forarg
as a keyword list. - Appends an empty
<Refer>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Refer>
verb.
There are two supported usages:
- Appends
<Refer>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Refer>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Refer>
verb with attributes.
Adds a <Refer>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec reject() :: t()
Generates an empty <Reject>
verb.
Generates a <Reject>
verb.
There are three supported usages:
- Wraps
arg
in<Reject>
if it'sTwiML.content/0
. - Creates an empty
<Reject>
with attributes forarg
as a keyword list. - Appends an empty
<Reject>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Reject>
verb.
There are two supported usages:
- Appends
<Reject>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Reject>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Reject>
verb with attributes.
Adds a <Reject>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec say() :: t()
Generates an empty <Say>
verb.
Generates a <Say>
verb.
There are three supported usages:
- Wraps
arg
in<Say>
if it'sTwiML.content/0
. - Creates an empty
<Say>
with attributes forarg
as a keyword list. - Appends an empty
<Say>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Say>
verb.
There are two supported usages:
- Appends
<Say>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Say>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Say>
verb with attributes.
Adds a <Say>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec sim() :: t()
Generates an empty <Sim>
verb.
Generates a <Sim>
verb.
There are three supported usages:
- Wraps
arg
in<Sim>
if it'sTwiML.content/0
. - Creates an empty
<Sim>
with attributes forarg
as a keyword list. - Appends an empty
<Sim>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Sim>
verb.
There are two supported usages:
- Appends
<Sim>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Sim>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Sim>
verb with attributes.
Adds a <Sim>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec sip() :: t()
Generates an empty <Sip>
verb.
Generates a <Sip>
verb.
There are three supported usages:
- Wraps
arg
in<Sip>
if it'sTwiML.content/0
. - Creates an empty
<Sip>
with attributes forarg
as a keyword list. - Appends an empty
<Sip>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Sip>
verb.
There are two supported usages:
- Appends
<Sip>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Sip>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Sip>
verb with attributes.
Adds a <Sip>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec siprec() :: t()
Generates an empty <Siprec>
verb.
Generates a <Siprec>
verb.
There are three supported usages:
- Wraps
arg
in<Siprec>
if it'sTwiML.content/0
. - Creates an empty
<Siprec>
with attributes forarg
as a keyword list. - Appends an empty
<Siprec>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Siprec>
verb.
There are two supported usages:
- Appends
<Siprec>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Siprec>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Siprec>
verb with attributes.
Adds a <Siprec>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec stream() :: t()
Generates an empty <Stream>
verb.
Generates a <Stream>
verb.
There are three supported usages:
- Wraps
arg
in<Stream>
if it'sTwiML.content/0
. - Creates an empty
<Stream>
with attributes forarg
as a keyword list. - Appends an empty
<Stream>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
Appends or generates a <Stream>
verb.
There are two supported usages:
- Appends
<Stream>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<Stream>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <Stream>
verb with attributes.
Adds a <Stream>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
@spec virtual_agent() :: t()
Generates an empty <VirtualAgent>
verb.
Generates a <VirtualAgent>
verb.
There are three supported usages:
- Wraps
arg
in<VirtualAgent>
if it'sTwiML.content/0
. - Creates an empty
<VirtualAgent>
with attributes forarg
as a keyword list. - Appends an empty
<VirtualAgent>
toarg
if it'sTwiML.t/0
, enabling verb chaining (refer to Examples).
@spec virtual_agent(t(), keyword() | content()) :: t()
@spec virtual_agent( content(), keyword() ) :: t()
Appends or generates a <VirtualAgent>
verb.
There are two supported usages:
- Appends
<VirtualAgent>
toverbs_or_content
if it'sTwiML.t/0
, enabling verb chaining (see Examples). This verb wrapscontent_or_attrs
if it'sTwiML.content/0
, or includes attributes ifcontent_or_attrs
is a keyword list. - Generates
<VirtualAgent>
with attributes ifcontent_or_attrs
is a keyword list.
Appends a <VirtualAgent>
verb with attributes.
Adds a <VirtualAgent>
verb to verbs
using attrs
as attributes,
facilitating verb chaining (see Examples).
Functions
Generates a comment.
Examples
iex> TwiML.comment("Blocked because of insufficient funds")
...> |> TwiML.to_xml(format: :none)
~s(<?xml version="1.0" encoding="UTF-8"?><Response><!-->Blocked because of insufficient funds</!--></Response>)
Appends a comment to the TwiML.
Examples
iex> TwiML.reject() |> TwiML.comment("Blocked because of insufficient funds") |> TwiML.to_xml(format: :none)
~s(<?xml version="1.0" encoding="UTF-8"?><Response><Reject/><!-->Blocked because of insufficient funds</!--></Response>)
Generates a XML document from the provided verbs and arguments. For the
supported opts
, please refer to the documentation of
XmlBuilder.generate/2
.
Examples
iex> TwiML.say("Hello world")
...> |> TwiML.to_xml(format: :none)
~s(<?xml version="1.0" encoding="UTF-8"?><Response><Say>Hello world</Say></Response>)