Twilio.TwiML.VoiceResponse (twilio_elixir v0.1.1)

Copy Markdown View Source

TwiML for voice calls.

Example

alias Twilio.TwiML.VoiceResponse

VoiceResponse.new()
|> VoiceResponse.say("Hello!", voice: "alice")
|> VoiceResponse.gather(num_digits: 1, children: [
  VoiceResponse.say_element("Press 1 for sales.")
])
|> VoiceResponse.to_xml()

Summary

Functions

Create a Client noun for use inside Dial.

Dial a phone number or SIP endpoint.

Gather input from the caller (DTMF or speech).

Hang up the call.

Create a Number noun for use inside Dial.

Pause for a number of seconds.

Play an audio file.

Create a Queue noun for use inside Dial.

Record the caller.

Redirect to another TwiML URL.

Reject an incoming call.

Say text to the caller.

Create a Say element for use as a child (e.g. inside Gather).

Create a Sip noun for use inside Dial.

Types

t()

@type t() :: Twilio.TwiML.t()

Functions

client(identity, opts \\ [])

@spec client(
  String.t(),
  keyword()
) :: Twilio.TwiML.element()

Create a Client noun for use inside Dial.

dial(twiml, number \\ nil, opts \\ [])

@spec dial(t(), String.t() | nil, keyword()) :: t()

Dial a phone number or SIP endpoint.

enqueue(twiml, name, opts \\ [])

@spec enqueue(t(), String.t(), keyword()) :: t()

Enqueue a call.

gather(twiml, opts \\ [])

@spec gather(
  t(),
  keyword()
) :: t()

Gather input from the caller (DTMF or speech).

hangup(twiml)

@spec hangup(t()) :: t()

Hang up the call.

new()

@spec new() :: t()

number(phone_number, opts \\ [])

@spec number(
  String.t(),
  keyword()
) :: Twilio.TwiML.element()

Create a Number noun for use inside Dial.

pause(twiml, opts \\ [])

@spec pause(
  t(),
  keyword()
) :: t()

Pause for a number of seconds.

play(twiml, url, opts \\ [])

@spec play(t(), String.t(), keyword()) :: t()

Play an audio file.

queue(name, opts \\ [])

@spec queue(
  String.t(),
  keyword()
) :: Twilio.TwiML.element()

Create a Queue noun for use inside Dial.

record(twiml, opts \\ [])

@spec record(
  t(),
  keyword()
) :: t()

Record the caller.

redirect(twiml, url, opts \\ [])

@spec redirect(t(), String.t(), keyword()) :: t()

Redirect to another TwiML URL.

reject(twiml, opts \\ [])

@spec reject(
  t(),
  keyword()
) :: t()

Reject an incoming call.

say(twiml, message, opts \\ [])

@spec say(t(), String.t(), keyword()) :: t()

Say text to the caller.

say_element(message, opts \\ [])

@spec say_element(
  String.t(),
  keyword()
) :: Twilio.TwiML.element()

Create a Say element for use as a child (e.g. inside Gather).

sip(uri, opts \\ [])

@spec sip(
  String.t(),
  keyword()
) :: Twilio.TwiML.element()

Create a Sip noun for use inside Dial.

to_xml(twiml)

@spec to_xml(t()) :: String.t()