twilio-ruby 5.2.0 → 5.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/.travis.yml +1 -1
- data/CHANGES.md +9 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/sync/v1/service/sync_stream/stream_message.rb +150 -0
- data/lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb +401 -0
- data/lib/twilio-ruby/rest/sync/v1/service.rb +33 -0
- data/lib/twilio-ruby/rest/wireless/v1/sim/data_session.rb +311 -0
- data/lib/twilio-ruby/rest/wireless/v1/sim.rb +23 -0
- data/lib/twilio-ruby/twiml/fax_response.rb +40 -0
- data/lib/twilio-ruby/twiml/messaging_response.rb +66 -103
- data/lib/twilio-ruby/twiml/twiml.rb +52 -48
- data/lib/twilio-ruby/twiml/voice_response.rb +385 -769
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/sync/v1/service/sync_stream/stream_message_spec.rb +47 -0
- data/spec/integration/sync/v1/service/sync_stream_spec.rb +201 -0
- data/spec/integration/sync/v1/service_spec.rb +8 -4
- data/spec/integration/wireless/v1/sim/data_session_spec.rb +85 -0
- data/spec/integration/wireless/v1/sim_spec.rb +3 -0
- data/spec/twiml/messaging_response_spec.rb +6 -6
- data/spec/twiml/voice_response_spec.rb +3 -3
- metadata +13 -3
@@ -1,141 +1,104 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
1
7
|
module Twilio
|
2
8
|
module TwiML
|
3
|
-
|
9
|
+
##
|
10
|
+
# <Response> TwiML for Messages
|
4
11
|
class MessagingResponse < TwiML
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
12
|
+
def initialize(**keyword_args)
|
13
|
+
super(**keyword_args)
|
14
|
+
@name = 'Response'
|
15
|
+
|
9
16
|
yield(self) if block_given?
|
10
17
|
end
|
11
18
|
|
12
|
-
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
# method::
|
19
|
-
# action:: action URL
|
20
|
-
# status_callback:: callback URL
|
19
|
+
##
|
20
|
+
# Create a new <Message> element
|
21
|
+
# message:: Message Body
|
22
|
+
# to:: Phone Number to send Message to
|
23
|
+
# from:: Phone Number to send Message from
|
24
|
+
# action:: Action URL
|
25
|
+
# method:: Action URL Method
|
21
26
|
# keyword_args:: additional attributes
|
22
|
-
|
23
|
-
|
24
|
-
# A <Response> element with a <Message> child element
|
25
|
-
def message(body: nil, to: nil, from: nil, method: nil, action: nil, status_callback: nil, **keyword_args)
|
26
|
-
message = Message.new(
|
27
|
-
body: body,
|
28
|
-
to: to,
|
29
|
-
from: from,
|
30
|
-
method: method,
|
31
|
-
action: action,
|
32
|
-
status_callback: status_callback,
|
33
|
-
**keyword_args
|
34
|
-
)
|
27
|
+
def message(message: nil, to: nil, from: nil, action: nil, method: nil, **keyword_args)
|
28
|
+
message = Message.new(message: message, to: to, from: from, action: action, method: method, **keyword_args)
|
35
29
|
|
36
30
|
yield(message) if block_given?
|
37
31
|
append(message)
|
38
32
|
end
|
39
33
|
|
40
|
-
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
# keyword_args:: attributes
|
46
|
-
#
|
47
|
-
# == Returns:
|
48
|
-
# A <Response> element with an <Redirect> child element
|
34
|
+
##
|
35
|
+
# Create a new <Redirect> element
|
36
|
+
# url:: Redirect URL
|
37
|
+
# method:: Redirect URL method
|
38
|
+
# keyword_args:: additional attributes
|
49
39
|
def redirect(url, method: nil, **keyword_args)
|
50
40
|
append(Redirect.new(url, method: method, **keyword_args))
|
51
41
|
end
|
52
42
|
end
|
53
43
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
# == Parameters:
|
59
|
-
# body:: message body
|
60
|
-
# keyword_args:: additional attributes
|
61
|
-
#
|
62
|
-
# == Returns:
|
63
|
-
# A <Message> element
|
64
|
-
def initialize(body: nil, **keyword_args)
|
44
|
+
##
|
45
|
+
# <Redirect> TwiML Verb
|
46
|
+
class Redirect < TwiML
|
47
|
+
def initialize(url, **keyword_args)
|
65
48
|
super(**keyword_args)
|
66
|
-
@
|
49
|
+
@name = 'Redirect'
|
50
|
+
@value = url
|
67
51
|
yield(self) if block_given?
|
68
52
|
end
|
53
|
+
end
|
69
54
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
def body(body)
|
79
|
-
append(Body.new(body))
|
55
|
+
##
|
56
|
+
# <Message> TwiML Verb
|
57
|
+
class Message < TwiML
|
58
|
+
def initialize(message: nil, **keyword_args)
|
59
|
+
super(**keyword_args)
|
60
|
+
@name = 'Message'
|
61
|
+
@value = message unless message.nil?
|
62
|
+
yield(self) if block_given?
|
80
63
|
end
|
81
64
|
|
82
|
-
|
83
|
-
#
|
84
|
-
#
|
85
|
-
# body:: body of message
|
65
|
+
##
|
66
|
+
# Create a new <Body> element
|
67
|
+
# message:: Message Body
|
86
68
|
# keyword_args:: additional attributes
|
87
|
-
|
88
|
-
|
89
|
-
# A <Message> element with a <Media> child element
|
90
|
-
def media(url)
|
91
|
-
append(Media.new(url))
|
69
|
+
def body(message, **keyword_args)
|
70
|
+
append(Body.new(message, **keyword_args))
|
92
71
|
end
|
93
|
-
end
|
94
72
|
|
95
|
-
|
96
|
-
|
97
|
-
#
|
98
|
-
#
|
99
|
-
|
100
|
-
|
101
|
-
#
|
102
|
-
# == Returns:
|
103
|
-
# A <Body> element
|
104
|
-
def initialize(body)
|
105
|
-
super()
|
106
|
-
@value = body
|
73
|
+
##
|
74
|
+
# Create a new <Media> element
|
75
|
+
# url:: Media URL
|
76
|
+
# keyword_args:: additional attributes
|
77
|
+
def media(url, **keyword_args)
|
78
|
+
append(Media.new(url, **keyword_args))
|
107
79
|
end
|
108
80
|
end
|
109
81
|
|
110
|
-
|
82
|
+
##
|
83
|
+
# <Media> TwiML Noun
|
111
84
|
class Media < TwiML
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
# url:: media URL location
|
116
|
-
#
|
117
|
-
# == Returns:
|
118
|
-
# A <Media> element
|
119
|
-
def initialize(url)
|
120
|
-
super()
|
85
|
+
def initialize(url, **keyword_args)
|
86
|
+
super(**keyword_args)
|
87
|
+
@name = 'Media'
|
121
88
|
@value = url
|
89
|
+
yield(self) if block_given?
|
122
90
|
end
|
123
91
|
end
|
124
92
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
# == Parameters:
|
130
|
-
# url:: redirect URL location
|
131
|
-
# keyword_args:: additional attributes
|
132
|
-
#
|
133
|
-
# == Returns:
|
134
|
-
# A <Redirect> element
|
135
|
-
def initialize(url, **keyword_args)
|
93
|
+
##
|
94
|
+
# <Body> TwiML Noun
|
95
|
+
class Body < TwiML
|
96
|
+
def initialize(message, **keyword_args)
|
136
97
|
super(**keyword_args)
|
137
|
-
@
|
98
|
+
@name = 'Body'
|
99
|
+
@value = message
|
100
|
+
yield(self) if block_given?
|
138
101
|
end
|
139
102
|
end
|
140
103
|
end
|
141
|
-
end
|
104
|
+
end
|
@@ -1,68 +1,72 @@
|
|
1
1
|
require 'libxml'
|
2
2
|
|
3
|
+
##
|
4
|
+
# This code was generated by
|
5
|
+
# \ / _ _ _| _ _
|
6
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
7
|
+
# / /
|
8
|
+
|
3
9
|
module Twilio
|
4
10
|
module TwiML
|
5
|
-
class TwiMLError < StandardError
|
6
|
-
end
|
11
|
+
class TwiMLError < StandardError; end
|
7
12
|
|
8
|
-
# TwiML Base Class
|
9
13
|
class TwiML
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
@attrs[TwiML.to_lower_camel_case(key)] = val unless val.nil?
|
14
|
+
attr_accessor :name, :indent
|
15
|
+
|
16
|
+
def initialize(indent: false, **keyword_args)
|
17
|
+
@name = self.class.name.split('::').last
|
18
|
+
@indent = indent
|
19
|
+
@value = nil
|
20
|
+
@verbs = []
|
21
|
+
@attrs = {}
|
22
|
+
|
23
|
+
keyword_args.each do |key, val|
|
24
|
+
@attrs[TwiML.to_lower_camel_case(key)] = val unless val.nil?
|
25
|
+
end
|
23
26
|
end
|
24
|
-
end
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
def self.to_lower_camel_case(symbol)
|
29
|
+
# Symbols don't have the .split method, so convert to string first
|
30
|
+
result = symbol.to_s.split('_').map(&:capitalize).join
|
31
|
+
result[0].downcase + result[1..result.length]
|
32
|
+
end
|
31
33
|
|
32
|
-
|
33
|
-
|
34
|
+
def to_s(xml_declaration = true)
|
35
|
+
xml = self.xml.to_s(indent: indent)
|
34
36
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
alias to_xml to_s
|
37
|
+
return ('<?xml version="1.0" encoding="UTF-8"?>' + xml) if xml_declaration
|
38
|
+
xml
|
39
|
+
end
|
39
40
|
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
def xml
|
42
|
+
# create XML element
|
43
|
+
value = (@value.is_a?(String) or @value == nil) ? @value : JSON.generate(@value)
|
44
|
+
elem = LibXML::XML::Node.new(@name, value)
|
43
45
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
46
|
+
# set element attributes
|
47
|
+
keys = @attrs.keys.sort
|
48
|
+
keys.each do |key|
|
49
|
+
value = @attrs[key]
|
48
50
|
|
49
|
-
|
50
|
-
|
51
|
-
|
51
|
+
value_is_boolean = value.is_a?(TrueClass) || value.is_a?(FalseClass)
|
52
|
+
elem[key] = value_is_boolean ? value.to_s.downcase : value.to_s
|
53
|
+
end
|
54
|
+
|
55
|
+
@verbs.each do |verb|
|
56
|
+
elem << verb.xml
|
57
|
+
end
|
52
58
|
|
53
|
-
|
54
|
-
elem << verb.xml
|
59
|
+
elem
|
55
60
|
end
|
56
61
|
|
57
|
-
|
58
|
-
|
62
|
+
def append(verb)
|
63
|
+
raise TwiMLError, 'Only appending of TwiML is allowed' unless verb.is_a?(TwiML)
|
59
64
|
|
60
|
-
|
61
|
-
|
65
|
+
@verbs << verb
|
66
|
+
self
|
67
|
+
end
|
62
68
|
|
63
|
-
|
64
|
-
self
|
65
|
-
end
|
69
|
+
alias to_xml to_s
|
66
70
|
end
|
67
71
|
end
|
68
|
-
end
|
72
|
+
end
|
@@ -1,916 +1,532 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
1
7
|
module Twilio
|
2
8
|
module TwiML
|
3
|
-
|
9
|
+
##
|
10
|
+
# <Response> TwiML for Voice
|
4
11
|
class VoiceResponse < TwiML
|
5
|
-
|
6
|
-
|
7
|
-
super()
|
12
|
+
def initialize(**keyword_args)
|
13
|
+
super(**keyword_args)
|
8
14
|
@name = 'Response'
|
15
|
+
|
9
16
|
yield(self) if block_given?
|
10
17
|
end
|
11
18
|
|
12
|
-
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
# recording_status_callback_method:: status callback URL method
|
19
|
+
##
|
20
|
+
# Create a new <Dial> element
|
21
|
+
# number:: Phone number to dial
|
22
|
+
# action:: Action URL
|
23
|
+
# method:: Action URL method
|
24
|
+
# timeout:: Time to wait for answer
|
25
|
+
# hangup_on_star:: Hangup call on star press
|
26
|
+
# time_limit:: Max time length
|
27
|
+
# caller_id:: Caller ID to display
|
28
|
+
# record:: Record the call
|
29
|
+
# trim:: Trim the recording
|
30
|
+
# recording_status_callback:: Recording status callback URL
|
31
|
+
# recording_status_callback_method:: Recording status callback URL method
|
26
32
|
# keyword_args:: additional attributes
|
27
|
-
|
28
|
-
|
29
|
-
# A <Response> element with a <Dial> child element
|
30
|
-
def dial(
|
31
|
-
number: nil,
|
32
|
-
action: nil,
|
33
|
-
method: nil,
|
34
|
-
timeout: nil,
|
35
|
-
hangup_on_star: nil,
|
36
|
-
time_limit: nil,
|
37
|
-
caller_id: nil,
|
38
|
-
record: nil,
|
39
|
-
trim: nil,
|
40
|
-
recording_status_callback: nil,
|
41
|
-
recording_status_callback_method: nil,
|
42
|
-
**keyword_args
|
43
|
-
)
|
44
|
-
|
45
|
-
dial = Dial.new(
|
46
|
-
number: number,
|
47
|
-
action: action,
|
48
|
-
method: method,
|
49
|
-
timeout: timeout,
|
50
|
-
hangup_on_star: hangup_on_star,
|
51
|
-
time_limit: time_limit,
|
52
|
-
caller_id: caller_id,
|
53
|
-
record: record,
|
54
|
-
trim: trim,
|
55
|
-
recording_status_callback: recording_status_callback,
|
56
|
-
recording_status_callback_method: recording_status_callback_method,
|
57
|
-
**keyword_args
|
58
|
-
)
|
33
|
+
def dial(number: nil, action: nil, method: nil, timeout: nil, hangup_on_star: nil, time_limit: nil, caller_id: nil, record: nil, trim: nil, recording_status_callback: nil, recording_status_callback_method: nil, **keyword_args)
|
34
|
+
dial = Dial.new(number: number, action: action, method: method, timeout: timeout, hangup_on_star: hangup_on_star, time_limit: time_limit, caller_id: caller_id, record: record, trim: trim, recording_status_callback: recording_status_callback, recording_status_callback_method: recording_status_callback_method, **keyword_args)
|
59
35
|
|
60
36
|
yield(dial) if block_given?
|
61
37
|
append(dial)
|
62
38
|
end
|
63
39
|
|
64
|
-
|
65
|
-
#
|
66
|
-
#
|
67
|
-
# keyword_args:: attributes
|
68
|
-
#
|
69
|
-
# == Returns:
|
70
|
-
# A <Response> element with an <Echo> child element
|
40
|
+
##
|
41
|
+
# Create a new <Echo> element
|
42
|
+
# keyword_args:: additional attributes
|
71
43
|
def echo(**keyword_args)
|
72
44
|
append(Echo.new(**keyword_args))
|
73
45
|
end
|
74
46
|
|
75
|
-
|
76
|
-
#
|
77
|
-
#
|
78
|
-
#
|
79
|
-
#
|
80
|
-
#
|
81
|
-
#
|
82
|
-
#
|
83
|
-
# workflow_sid:: TaskRouter workflow SID
|
47
|
+
##
|
48
|
+
# Create a new <Enqueue> element
|
49
|
+
# name:: Friendly name
|
50
|
+
# action:: Action URL
|
51
|
+
# method:: Action URL method
|
52
|
+
# wait_url:: Wait URL
|
53
|
+
# wait_url_method:: Wait URL method
|
54
|
+
# workflow_sid:: TaskRouter Workflow SID
|
84
55
|
# keyword_args:: additional attributes
|
85
|
-
|
86
|
-
|
87
|
-
# A <Response> element with an <Enqueue> child element
|
88
|
-
def enqueue(
|
89
|
-
name,
|
90
|
-
action: nil,
|
91
|
-
method: nil,
|
92
|
-
wait_url: nil,
|
93
|
-
wait_url_method: nil,
|
94
|
-
workflow_sid: nil,
|
95
|
-
**keyword_args
|
96
|
-
)
|
97
|
-
|
98
|
-
enqueue = Enqueue.new(
|
99
|
-
name,
|
100
|
-
action: action,
|
101
|
-
method: method,
|
102
|
-
wait_url: wait_url,
|
103
|
-
wait_url_method: wait_url_method,
|
104
|
-
workflow_sid: workflow_sid,
|
105
|
-
**keyword_args
|
106
|
-
)
|
56
|
+
def enqueue(name: nil, action: nil, method: nil, wait_url: nil, wait_url_method: nil, workflow_sid: nil, **keyword_args)
|
57
|
+
enqueue = Enqueue.new(name: name, action: action, method: method, wait_url: wait_url, wait_url_method: wait_url_method, workflow_sid: workflow_sid, **keyword_args)
|
107
58
|
|
108
59
|
yield(enqueue) if block_given?
|
109
60
|
append(enqueue)
|
110
61
|
end
|
111
62
|
|
112
|
-
|
113
|
-
#
|
114
|
-
#
|
115
|
-
# action::
|
116
|
-
# method::
|
117
|
-
# timeout::
|
118
|
-
# finish_on_key::
|
119
|
-
# num_digits:: digits to collect
|
120
|
-
# partial_result_callback:: callback
|
121
|
-
# partial_result_callback_method:: callback method
|
122
|
-
# language::
|
123
|
-
# hints::
|
124
|
-
# barge_in::
|
125
|
-
# acknowledge_sound_url:: url to hit when sound starts
|
63
|
+
##
|
64
|
+
# Create a new <Gather> element
|
65
|
+
# input:: Input type Twilio should accept
|
66
|
+
# action:: Action URL
|
67
|
+
# method:: Action URL method
|
68
|
+
# timeout:: Time to wait to gather input
|
69
|
+
# finish_on_key:: Finish gather on key
|
70
|
+
# num_digits:: Number of digits to collect
|
71
|
+
# partial_result_callback:: Partial result callback URL
|
72
|
+
# partial_result_callback_method:: Partial result callback URL method
|
73
|
+
# language:: Language to use
|
74
|
+
# hints:: Speech recognition hints
|
75
|
+
# barge_in:: Stop playing media upon speech
|
126
76
|
# keyword_args:: additional attributes
|
127
|
-
|
128
|
-
|
129
|
-
# A <Response> element with a <Gather> child element
|
130
|
-
def gather(
|
131
|
-
action: nil,
|
132
|
-
method: nil,
|
133
|
-
timeout: nil,
|
134
|
-
finish_on_key: nil,
|
135
|
-
num_digits: nil,
|
136
|
-
partial_result_callback: nil,
|
137
|
-
partial_result_callback_method: nil,
|
138
|
-
language: nil,
|
139
|
-
hints: nil,
|
140
|
-
barge_in: nil,
|
141
|
-
acknowledge_sound_url: nil,
|
142
|
-
**keyword_args
|
143
|
-
)
|
144
|
-
|
145
|
-
gather = Gather.new(
|
146
|
-
action: action,
|
147
|
-
method: method,
|
148
|
-
timeout: timeout,
|
149
|
-
finish_on_key: finish_on_key,
|
150
|
-
num_digits: num_digits,
|
151
|
-
partial_result_callback: partial_result_callback,
|
152
|
-
partial_result_callback_method: partial_result_callback_method,
|
153
|
-
language: language,
|
154
|
-
hints: hints,
|
155
|
-
barge_in: barge_in,
|
156
|
-
acknowledge_sound_url: acknowledge_sound_url,
|
157
|
-
**keyword_args
|
158
|
-
)
|
77
|
+
def gather(input: nil, action: nil, method: nil, timeout: nil, finish_on_key: nil, num_digits: nil, partial_result_callback: nil, partial_result_callback_method: nil, language: nil, hints: nil, barge_in: nil, **keyword_args)
|
78
|
+
gather = Gather.new(input: input, action: action, method: method, timeout: timeout, finish_on_key: finish_on_key, num_digits: num_digits, partial_result_callback: partial_result_callback, partial_result_callback_method: partial_result_callback_method, language: language, hints: hints, barge_in: barge_in, **keyword_args)
|
159
79
|
|
160
80
|
yield(gather) if block_given?
|
161
81
|
append(gather)
|
162
82
|
end
|
163
83
|
|
164
|
-
|
165
|
-
#
|
166
|
-
#
|
167
|
-
|
168
|
-
|
169
|
-
append(Hangup.new)
|
84
|
+
##
|
85
|
+
# Create a new <Hangup> element
|
86
|
+
# keyword_args:: additional attributes
|
87
|
+
def hangup(**keyword_args)
|
88
|
+
append(Hangup.new(**keyword_args))
|
170
89
|
end
|
171
90
|
|
172
|
-
|
173
|
-
#
|
174
|
-
#
|
175
|
-
|
176
|
-
|
177
|
-
append(Leave.new)
|
91
|
+
##
|
92
|
+
# Create a new <Leave> element
|
93
|
+
# keyword_args:: additional attributes
|
94
|
+
def leave(**keyword_args)
|
95
|
+
append(Leave.new(**keyword_args))
|
178
96
|
end
|
179
97
|
|
180
|
-
|
181
|
-
#
|
182
|
-
#
|
183
|
-
#
|
184
|
-
|
185
|
-
|
186
|
-
# A <Response> element with a <Pause> child element
|
187
|
-
def pause(length: nil)
|
188
|
-
append(Pause.new(length: length))
|
98
|
+
##
|
99
|
+
# Create a new <Pause> element
|
100
|
+
# length:: Length in seconds to pause
|
101
|
+
# keyword_args:: additional attributes
|
102
|
+
def pause(length: nil, **keyword_args)
|
103
|
+
append(Pause.new(length: length, **keyword_args))
|
189
104
|
end
|
190
105
|
|
191
|
-
|
192
|
-
#
|
193
|
-
#
|
194
|
-
#
|
195
|
-
#
|
196
|
-
# digits:: play DTMF tones during a call
|
106
|
+
##
|
107
|
+
# Create a new <Play> element
|
108
|
+
# url:: Media URL
|
109
|
+
# loop:: Times to loop media
|
110
|
+
# digits:: Play DTMF tones for digits
|
197
111
|
# keyword_args:: additional attributes
|
198
|
-
#
|
199
|
-
# == Returns:
|
200
|
-
# A <Response> element with a <Play> child element
|
201
112
|
def play(url: nil, loop: nil, digits: nil, **keyword_args)
|
202
|
-
append(Play.new(
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
#
|
211
|
-
#
|
212
|
-
#
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
#
|
219
|
-
#
|
220
|
-
#
|
221
|
-
#
|
222
|
-
#
|
223
|
-
#
|
113
|
+
append(Play.new(url: url, loop: loop, digits: digits, **keyword_args))
|
114
|
+
end
|
115
|
+
|
116
|
+
##
|
117
|
+
# Create a new <Queue> element
|
118
|
+
# name:: Queue name
|
119
|
+
# url:: Action URL
|
120
|
+
# method:: Action URL method
|
121
|
+
# reservation_sid:: TaskRouter Reservation SID
|
122
|
+
# post_work_activity_sid:: TaskRouter Activity SID
|
123
|
+
# keyword_args:: additional attributes
|
124
|
+
def queue(name, url: nil, method: nil, reservation_sid: nil, post_work_activity_sid: nil, **keyword_args)
|
125
|
+
append(Queue.new(name, url: url, method: method, reservation_sid: reservation_sid, post_work_activity_sid: post_work_activity_sid, **keyword_args))
|
126
|
+
end
|
127
|
+
|
128
|
+
##
|
129
|
+
# Create a new <Record> element
|
130
|
+
# action:: Action URL
|
131
|
+
# method:: Action URL method
|
132
|
+
# timeout:: Timeout to begin recording
|
133
|
+
# finish_on_key:: Finish recording on key
|
134
|
+
# max_length:: Max time to record in seconds
|
135
|
+
# play_beep:: Play beep
|
136
|
+
# trim:: Trim the recording
|
137
|
+
# recording_status_callback:: Status callback URL
|
138
|
+
# recording_status_callback_method:: Status callback URL method
|
139
|
+
# transcribe:: Transcribe the recording
|
140
|
+
# transcribe_callback:: Transcribe callback URL
|
224
141
|
# keyword_args:: additional attributes
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
max_length: nil,
|
234
|
-
play_beep: nil,
|
235
|
-
trim: nil,
|
236
|
-
recording_status_callback: nil,
|
237
|
-
recording_status_callback_method: nil,
|
238
|
-
transcribe: nil,
|
239
|
-
transcribe_callback: nil,
|
240
|
-
**keyword_args
|
241
|
-
)
|
242
|
-
append(Record.new(
|
243
|
-
action: action,
|
244
|
-
method: method,
|
245
|
-
timeout: timeout,
|
246
|
-
finish_on_key: finish_on_key,
|
247
|
-
max_length: max_length,
|
248
|
-
play_beep: play_beep,
|
249
|
-
trim: trim,
|
250
|
-
recording_status_callback: recording_status_callback,
|
251
|
-
recording_status_callback_method: recording_status_callback_method,
|
252
|
-
transcribe: transcribe,
|
253
|
-
transcribe_callback: transcribe_callback,
|
254
|
-
**keyword_args
|
255
|
-
))
|
256
|
-
end
|
257
|
-
|
258
|
-
# Create a <Redirect> element
|
259
|
-
#
|
260
|
-
# == Parameters:
|
261
|
-
# url:: redirect URL
|
262
|
-
# method:: redirect method
|
142
|
+
def record(action: nil, method: nil, timeout: nil, finish_on_key: nil, max_length: nil, play_beep: nil, trim: nil, recording_status_callback: nil, recording_status_callback_method: nil, transcribe: nil, transcribe_callback: nil, **keyword_args)
|
143
|
+
append(Record.new(action: action, method: method, timeout: timeout, finish_on_key: finish_on_key, max_length: max_length, play_beep: play_beep, trim: trim, recording_status_callback: recording_status_callback, recording_status_callback_method: recording_status_callback_method, transcribe: transcribe, transcribe_callback: transcribe_callback, **keyword_args))
|
144
|
+
end
|
145
|
+
|
146
|
+
##
|
147
|
+
# Create a new <Redirect> element
|
148
|
+
# url:: Redirect URL
|
149
|
+
# method:: Redirect URL method
|
263
150
|
# keyword_args:: additional attributes
|
264
|
-
#
|
265
|
-
# == Returns:
|
266
|
-
# A <Response> element with a <Redirect> child element
|
267
151
|
def redirect(url, method: nil, **keyword_args)
|
268
152
|
append(Redirect.new(url, method: method, **keyword_args))
|
269
153
|
end
|
270
154
|
|
271
|
-
|
272
|
-
#
|
273
|
-
#
|
274
|
-
# reason:: rejection reason
|
155
|
+
##
|
156
|
+
# Create a new <Reject> element
|
157
|
+
# reason:: Rejection reason
|
275
158
|
# keyword_args:: additional attributes
|
276
|
-
#
|
277
|
-
# == Returns:
|
278
|
-
# A <Response> element with a <Reject> child element
|
279
159
|
def reject(reason: nil, **keyword_args)
|
280
160
|
append(Reject.new(reason: reason, **keyword_args))
|
281
161
|
end
|
282
162
|
|
283
|
-
|
284
|
-
#
|
285
|
-
#
|
286
|
-
#
|
287
|
-
# loop::
|
288
|
-
# language::
|
289
|
-
# voice:: voice to use
|
163
|
+
##
|
164
|
+
# Create a new <Say> element
|
165
|
+
# message:: Message to say
|
166
|
+
# voice:: Voice to use
|
167
|
+
# loop:: Times to loop message
|
168
|
+
# language:: Message langauge
|
290
169
|
# keyword_args:: additional attributes
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
# Create a <Sms> element
|
305
|
-
#
|
306
|
-
# == Parameters:
|
307
|
-
# body:: body of message
|
308
|
-
# to:: to phone number
|
309
|
-
# from_:: from phone number
|
310
|
-
# method:: action URL method
|
311
|
-
# action:: action URL
|
312
|
-
# status_callback:: status callback URL
|
170
|
+
def say(message, voice: nil, loop: nil, language: nil, **keyword_args)
|
171
|
+
append(Say.new(message, voice: voice, loop: loop, language: language, **keyword_args))
|
172
|
+
end
|
173
|
+
|
174
|
+
##
|
175
|
+
# Create a new <Sms> element
|
176
|
+
# message:: Message body
|
177
|
+
# to:: Number to send message to
|
178
|
+
# from:: Number to send message from
|
179
|
+
# action:: Action URL
|
180
|
+
# method:: Action URL method
|
181
|
+
# status_callback:: Status callback URL
|
313
182
|
# keyword_args:: additional attributes
|
314
|
-
|
315
|
-
|
316
|
-
# A <Response> element with a <Sms> child element
|
317
|
-
def sms(body, to: nil, from: nil, method: nil, action: nil, status_callback: nil, **keyword_args)
|
318
|
-
append(Sms.new(
|
319
|
-
body,
|
320
|
-
to: to,
|
321
|
-
from: from,
|
322
|
-
method: method,
|
323
|
-
action: action,
|
324
|
-
status_callback: status_callback,
|
325
|
-
**keyword_args
|
326
|
-
))
|
183
|
+
def sms(message, to: nil, from: nil, action: nil, method: nil, status_callback: nil, **keyword_args)
|
184
|
+
append(Sms.new(message, to: to, from: from, action: action, method: method, status_callback: status_callback, **keyword_args))
|
327
185
|
end
|
328
186
|
end
|
329
187
|
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
# == Parameters:
|
335
|
-
# number:: phone number to dial
|
336
|
-
# keyword_args:: additional attributes
|
337
|
-
#
|
338
|
-
# == Returns:
|
339
|
-
# A <Dial> element
|
340
|
-
def initialize(number: nil, **keyword_args)
|
188
|
+
##
|
189
|
+
# <Sms> TwiML Noun
|
190
|
+
class Sms < TwiML
|
191
|
+
def initialize(message, **keyword_args)
|
341
192
|
super(**keyword_args)
|
342
|
-
@
|
193
|
+
@name = 'Sms'
|
194
|
+
@value = message
|
343
195
|
yield(self) if block_given?
|
344
196
|
end
|
345
|
-
|
346
|
-
# Create a <Client> element
|
347
|
-
#
|
348
|
-
# == Parameters:
|
349
|
-
# name:: name of client
|
350
|
-
# method:: action URL method
|
351
|
-
# url:: action URL
|
352
|
-
# status_callback_event:: events to call status callback
|
353
|
-
# status_callback_method:: status callback URL method
|
354
|
-
# status_callback:: status callback URL
|
355
|
-
# keyword_args:: additional attributes
|
356
|
-
#
|
357
|
-
# == Returns:
|
358
|
-
# A <Dial> element with a <Client> child element
|
359
|
-
def client(
|
360
|
-
name,
|
361
|
-
method: nil,
|
362
|
-
url: nil,
|
363
|
-
status_callback_event: nil,
|
364
|
-
status_callback_method: nil,
|
365
|
-
status_callback: nil,
|
366
|
-
**keyword_args
|
367
|
-
)
|
368
|
-
append(Client.new(
|
369
|
-
name,
|
370
|
-
method: method,
|
371
|
-
url: url,
|
372
|
-
status_callback_event: status_callback_event,
|
373
|
-
status_callback_method: status_callback_method,
|
374
|
-
status_callback: status_callback,
|
375
|
-
**keyword_args
|
376
|
-
))
|
377
|
-
end
|
378
|
-
|
379
|
-
# Create a <Conference> element
|
380
|
-
#
|
381
|
-
# == Parameters:
|
382
|
-
# name:: name of conference
|
383
|
-
# muted:: join the conference muted
|
384
|
-
# start_conference_on_enter:: start the conference on enter
|
385
|
-
# end_conference_on_exit:: end the conference on exit
|
386
|
-
# max_participants:: max number of people in conference
|
387
|
-
# beep:: play beep when joining
|
388
|
-
# record:: record the conference
|
389
|
-
# trim:: trim the recording
|
390
|
-
# wait_method:: wait URL method
|
391
|
-
# wait_url:: wait URL to play
|
392
|
-
# event_callback_url:: event callback URL
|
393
|
-
# status_callback_event:: events to call status callback
|
394
|
-
# status_callback:: status callback URL
|
395
|
-
# status_callback_method:: status callback URL method
|
396
|
-
# recording_status_callback:: recording status callback URL
|
397
|
-
# recording_status_callback_method:: recording status callback URL method
|
398
|
-
# keyword_args:: additional attributes
|
399
|
-
#
|
400
|
-
# == Returns:
|
401
|
-
# A <Dial> element with a <Conference> child element
|
402
|
-
def conference(
|
403
|
-
name,
|
404
|
-
muted: nil,
|
405
|
-
start_conference_on_enter: nil,
|
406
|
-
end_conference_on_exit: nil,
|
407
|
-
max_participants: nil,
|
408
|
-
beep: nil,
|
409
|
-
record: nil,
|
410
|
-
trim: nil,
|
411
|
-
wait_url: nil,
|
412
|
-
wait_method: nil,
|
413
|
-
event_callback_url: nil,
|
414
|
-
status_callback: nil,
|
415
|
-
status_callback_event: nil,
|
416
|
-
status_callback_method: nil,
|
417
|
-
recording_status_callback: nil,
|
418
|
-
recording_status_callback_method: nil,
|
419
|
-
**keyword_args
|
420
|
-
)
|
421
|
-
append(Conference.new(
|
422
|
-
name,
|
423
|
-
muted: muted,
|
424
|
-
start_conference_on_enter: start_conference_on_enter,
|
425
|
-
end_conference_on_exit: end_conference_on_exit,
|
426
|
-
max_participants: max_participants,
|
427
|
-
beep: beep,
|
428
|
-
record: record,
|
429
|
-
trim: trim,
|
430
|
-
wait_url: wait_url,
|
431
|
-
wait_method: wait_method,
|
432
|
-
event_callback_url: event_callback_url,
|
433
|
-
status_callback: status_callback,
|
434
|
-
status_callback_event: status_callback_event,
|
435
|
-
status_callback_method: status_callback_method,
|
436
|
-
recording_status_callback: recording_status_callback,
|
437
|
-
recording_status_callback_method: recording_status_callback_method,
|
438
|
-
**keyword_args
|
439
|
-
))
|
440
|
-
end
|
441
|
-
|
442
|
-
# Create a <Number> element
|
443
|
-
#
|
444
|
-
# == Parameters:
|
445
|
-
# number:: phone number to dial
|
446
|
-
# send_digits:: play DTMF tones when the call is answered
|
447
|
-
# url:: TwiML URL
|
448
|
-
# method:: TwiML URL method
|
449
|
-
# status_callback_event:: events to call status callback
|
450
|
-
# status_callback:: status callback URL
|
451
|
-
# status_callback_method:: status callback URL method
|
452
|
-
# keyword_args:: additional attributes
|
453
|
-
#
|
454
|
-
# == Returns:
|
455
|
-
# A <Dial> element with a <Number> child element
|
456
|
-
def number(
|
457
|
-
number,
|
458
|
-
send_digits: nil,
|
459
|
-
url: nil,
|
460
|
-
method: nil,
|
461
|
-
status_callback: nil,
|
462
|
-
status_callback_event: nil,
|
463
|
-
status_callback_method: nil,
|
464
|
-
**keyword_args
|
465
|
-
)
|
466
|
-
append(Number.new(
|
467
|
-
number,
|
468
|
-
send_digits: send_digits,
|
469
|
-
url: url,
|
470
|
-
method: method,
|
471
|
-
status_callback: status_callback,
|
472
|
-
status_callback_event: status_callback_event,
|
473
|
-
status_callback_method: status_callback_method,
|
474
|
-
**keyword_args
|
475
|
-
))
|
476
|
-
end
|
477
|
-
|
478
|
-
# Create a <Queue> element
|
479
|
-
#
|
480
|
-
# == Parameters:
|
481
|
-
# queue_name:: queue name
|
482
|
-
# url:: action URL
|
483
|
-
# method:: action URL method
|
484
|
-
# reservation_sid:: TaskRouter reservation SID
|
485
|
-
# post_work_activity_sid:: TaskRouter activity SID
|
486
|
-
# keyword_args:: additional attributes
|
487
|
-
#
|
488
|
-
# == Returns:
|
489
|
-
# A <Dial> element with a <Queue> child element
|
490
|
-
def queue(
|
491
|
-
queue_name,
|
492
|
-
url: nil,
|
493
|
-
method: nil,
|
494
|
-
reservation_sid: nil,
|
495
|
-
post_work_activity_sid: nil,
|
496
|
-
**keyword_args
|
497
|
-
)
|
498
|
-
append(Queue.new(
|
499
|
-
queue_name,
|
500
|
-
url: url,
|
501
|
-
method: method,
|
502
|
-
reservation_sid: reservation_sid,
|
503
|
-
post_work_activity_sid: post_work_activity_sid,
|
504
|
-
**keyword_args
|
505
|
-
))
|
506
|
-
end
|
507
|
-
|
508
|
-
# Create a <Sim> element
|
509
|
-
#
|
510
|
-
# == Parameters:
|
511
|
-
# sid:: sim sid
|
512
|
-
# keyword_args:: additional attributes
|
513
|
-
#
|
514
|
-
# == Returns:
|
515
|
-
# A <Dial> element with a <Sim> child element
|
516
|
-
def sim(sid, **keyword_args)
|
517
|
-
append(Sim.new(sid, **keyword_args))
|
518
|
-
end
|
519
|
-
|
520
|
-
# Create a <Sip> element
|
521
|
-
#
|
522
|
-
# == Parameters:
|
523
|
-
# uri:: sip url
|
524
|
-
# username:: sip username
|
525
|
-
# password:: sip password
|
526
|
-
# url:: action URL
|
527
|
-
# method:: action URL method
|
528
|
-
# status_callback_event:: events to call status callback
|
529
|
-
# status_callback:: status callback URL
|
530
|
-
# status_callback_method:: status callback URL method
|
531
|
-
# keyword_args:: additional attributes
|
532
|
-
#
|
533
|
-
# == Returns:
|
534
|
-
# A <Dial> element with a <Sip> child element
|
535
|
-
def sip(
|
536
|
-
uri,
|
537
|
-
username: nil,
|
538
|
-
password: nil,
|
539
|
-
url: nil,
|
540
|
-
method: nil,
|
541
|
-
status_callback: nil,
|
542
|
-
status_callback_event: nil,
|
543
|
-
status_callback_method: nil,
|
544
|
-
**keyword_args
|
545
|
-
)
|
546
|
-
append(Sip.new(
|
547
|
-
uri,
|
548
|
-
username: username,
|
549
|
-
password: password,
|
550
|
-
url: url,
|
551
|
-
method: method,
|
552
|
-
status_callback: status_callback,
|
553
|
-
status_callback_event: status_callback_event,
|
554
|
-
status_callback_method: status_callback_method,
|
555
|
-
**keyword_args
|
556
|
-
))
|
557
|
-
end
|
558
197
|
end
|
559
198
|
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
# == Parameters:
|
565
|
-
# name:: name of client
|
566
|
-
# keyword_args:: additional attributes
|
567
|
-
#
|
568
|
-
# == Returns:
|
569
|
-
# A <Client> element
|
570
|
-
def initialize(name, **keyword_args)
|
199
|
+
##
|
200
|
+
# <Say> TwiML Verb
|
201
|
+
class Say < TwiML
|
202
|
+
def initialize(message, **keyword_args)
|
571
203
|
super(**keyword_args)
|
572
|
-
@
|
204
|
+
@name = 'Say'
|
205
|
+
@value = message
|
206
|
+
yield(self) if block_given?
|
573
207
|
end
|
574
208
|
end
|
575
209
|
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
# == Parameters:
|
581
|
-
# name:: name of conference
|
582
|
-
# keyword_args:: additional attributes
|
583
|
-
#
|
584
|
-
# == Returns:
|
585
|
-
# A <Conference> element
|
586
|
-
def initialize(name, **keyword_args)
|
210
|
+
##
|
211
|
+
# <Reject> TwiML Verb
|
212
|
+
class Reject < TwiML
|
213
|
+
def initialize(**keyword_args)
|
587
214
|
super(**keyword_args)
|
588
|
-
@
|
215
|
+
@name = 'Reject'
|
216
|
+
|
217
|
+
yield(self) if block_given?
|
589
218
|
end
|
590
219
|
end
|
591
220
|
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
# == Parameters:
|
597
|
-
# number:: phone number
|
598
|
-
# keyword_args:: additional attributes
|
599
|
-
#
|
600
|
-
# == Returns:
|
601
|
-
# A <Number> element
|
602
|
-
def initialize(number, **keyword_args)
|
221
|
+
##
|
222
|
+
# <Redirect> TwiML Verb
|
223
|
+
class Redirect < TwiML
|
224
|
+
def initialize(url, **keyword_args)
|
603
225
|
super(**keyword_args)
|
604
|
-
@
|
226
|
+
@name = 'Redirect'
|
227
|
+
@value = url
|
228
|
+
yield(self) if block_given?
|
605
229
|
end
|
606
230
|
end
|
607
231
|
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
# == Parameters:
|
613
|
-
# queue_name:: name of queues
|
614
|
-
# keyword_args:: additional attributes
|
615
|
-
#
|
616
|
-
# == Returns:
|
617
|
-
# A <Queue> element
|
618
|
-
def initialize(queue_name, **keyword_args)
|
232
|
+
##
|
233
|
+
# <Record> TwiML Verb
|
234
|
+
class Record < TwiML
|
235
|
+
def initialize(**keyword_args)
|
619
236
|
super(**keyword_args)
|
620
|
-
@
|
237
|
+
@name = 'Record'
|
238
|
+
|
239
|
+
yield(self) if block_given?
|
621
240
|
end
|
622
241
|
end
|
623
242
|
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
# == Parameters:
|
629
|
-
# sid:: sim sid
|
630
|
-
# keyword_args:: additional attributes
|
631
|
-
#
|
632
|
-
# == Returns:
|
633
|
-
# A <Sim> element
|
634
|
-
def initialize(sid, **keyword_args)
|
243
|
+
##
|
244
|
+
# <Queue> TwiML Noun
|
245
|
+
class Queue < TwiML
|
246
|
+
def initialize(name, **keyword_args)
|
635
247
|
super(**keyword_args)
|
636
|
-
@
|
248
|
+
@name = 'Queue'
|
249
|
+
@value = name
|
250
|
+
yield(self) if block_given?
|
637
251
|
end
|
638
252
|
end
|
639
253
|
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
# == Parameters:
|
645
|
-
# uri:: sip uri
|
646
|
-
# keyword_args:: additional attributes
|
647
|
-
#
|
648
|
-
# == Returns:
|
649
|
-
# A <Sip> element
|
650
|
-
def initialize(uri, **keyword_args)
|
254
|
+
##
|
255
|
+
# <Play> TwiML Verb
|
256
|
+
class Play < TwiML
|
257
|
+
def initialize(url: nil, **keyword_args)
|
651
258
|
super(**keyword_args)
|
652
|
-
@
|
259
|
+
@name = 'Play'
|
260
|
+
@value = url unless url.nil?
|
261
|
+
yield(self) if block_given?
|
653
262
|
end
|
654
263
|
end
|
655
264
|
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
#
|
660
|
-
# == Parameters:
|
661
|
-
# keyword_args:: additional attributes
|
662
|
-
#
|
663
|
-
# == Returns:
|
664
|
-
# A <Echo> element
|
265
|
+
##
|
266
|
+
# <Pause> TwiML Verb
|
267
|
+
class Pause < TwiML
|
665
268
|
def initialize(**keyword_args)
|
666
269
|
super(**keyword_args)
|
270
|
+
@name = 'Pause'
|
271
|
+
|
272
|
+
yield(self) if block_given?
|
667
273
|
end
|
668
274
|
end
|
669
275
|
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
# == Parameters:
|
675
|
-
# name:: queue name
|
676
|
-
# keyword_args:: additional attributes
|
677
|
-
#
|
678
|
-
# == Returns:
|
679
|
-
# A <Enqueue> element
|
680
|
-
def initialize(name, **keyword_args)
|
276
|
+
##
|
277
|
+
# <Leave> TwiML Verb
|
278
|
+
class Leave < TwiML
|
279
|
+
def initialize(**keyword_args)
|
681
280
|
super(**keyword_args)
|
682
|
-
@
|
683
|
-
yield(self) if block_given?
|
684
|
-
end
|
281
|
+
@name = 'Leave'
|
685
282
|
|
686
|
-
|
687
|
-
#
|
688
|
-
# == Parameters:
|
689
|
-
# attributes:: attributes for a task
|
690
|
-
# keyword_args:: additional attributes
|
691
|
-
#
|
692
|
-
# == Returns:
|
693
|
-
# An <Enqueue> element with a <Task> child element
|
694
|
-
def task(attributes, **keyword_args)
|
695
|
-
append(Task.new(attributes, **keyword_args))
|
283
|
+
yield(self) if block_given?
|
696
284
|
end
|
697
285
|
end
|
698
286
|
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
# == Parameters:
|
704
|
-
# attributes:: attributes for a task
|
705
|
-
# keyword_args:: additional attributes
|
706
|
-
#
|
707
|
-
# == Returns:
|
708
|
-
# A <Task> element
|
709
|
-
def initialize(attributes, **keyword_args)
|
287
|
+
##
|
288
|
+
# <Hangup> TwiML Verb
|
289
|
+
class Hangup < TwiML
|
290
|
+
def initialize(**keyword_args)
|
710
291
|
super(**keyword_args)
|
711
|
-
@
|
292
|
+
@name = 'Hangup'
|
293
|
+
|
294
|
+
yield(self) if block_given?
|
712
295
|
end
|
713
296
|
end
|
714
297
|
|
715
|
-
|
298
|
+
##
|
299
|
+
# <Gather> TwiML Verb
|
716
300
|
class Gather < TwiML
|
717
|
-
# Create a <Gather> element
|
718
|
-
#
|
719
|
-
# == Parameters:
|
720
|
-
# keyword_args:: additional attributes
|
721
|
-
#
|
722
|
-
# == Returns:
|
723
|
-
# A <Gather> element
|
724
301
|
def initialize(**keyword_args)
|
725
302
|
super(**keyword_args)
|
303
|
+
@name = 'Gather'
|
304
|
+
|
726
305
|
yield(self) if block_given?
|
727
306
|
end
|
728
307
|
|
729
|
-
|
730
|
-
#
|
731
|
-
#
|
732
|
-
#
|
733
|
-
#
|
734
|
-
#
|
735
|
-
#
|
736
|
-
|
308
|
+
##
|
309
|
+
# Create a new <Say> element
|
310
|
+
# message:: Message to say
|
311
|
+
# voice:: Voice to use
|
312
|
+
# loop:: Times to loop message
|
313
|
+
# language:: Message langauge
|
314
|
+
# keyword_args:: additional attributes
|
315
|
+
def say(message, voice: nil, loop: nil, language: nil, **keyword_args)
|
316
|
+
append(Say.new(message, voice: voice, loop: loop, language: language, **keyword_args))
|
317
|
+
end
|
318
|
+
|
319
|
+
##
|
320
|
+
# Create a new <Pause> element
|
321
|
+
# length:: Length in seconds to pause
|
737
322
|
# keyword_args:: additional attributes
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
**keyword_args
|
748
|
-
))
|
749
|
-
end
|
750
|
-
|
751
|
-
# Create a <Play> element
|
752
|
-
#
|
753
|
-
# == Parameters:
|
754
|
-
# url:: media URL
|
755
|
-
# loop:: times to loop
|
756
|
-
# digits:: digits to simulate
|
323
|
+
def pause(length: nil, **keyword_args)
|
324
|
+
append(Pause.new(length: length, **keyword_args))
|
325
|
+
end
|
326
|
+
|
327
|
+
##
|
328
|
+
# Create a new <Play> element
|
329
|
+
# url:: Media URL
|
330
|
+
# loop:: Times to loop media
|
331
|
+
# digits:: Play DTMF tones for digits
|
757
332
|
# keyword_args:: additional attributes
|
758
|
-
#
|
759
|
-
# == Returns:
|
760
|
-
# A <Gather> element with a <Play> child element
|
761
333
|
def play(url: nil, loop: nil, digits: nil, **keyword_args)
|
762
|
-
append(Play.new(
|
763
|
-
url: url,
|
764
|
-
loop: loop,
|
765
|
-
digits: digits,
|
766
|
-
**keyword_args
|
767
|
-
))
|
768
|
-
end
|
769
|
-
|
770
|
-
# Create a <Pause> element
|
771
|
-
#
|
772
|
-
# == Parameters:
|
773
|
-
# length:: time to pause
|
774
|
-
#
|
775
|
-
# == Returns:
|
776
|
-
# A <Gather> element with a <Pause> child element
|
777
|
-
def pause(length: nil)
|
778
|
-
append(Pause.new(length: length))
|
334
|
+
append(Play.new(url: url, loop: loop, digits: digits, **keyword_args))
|
779
335
|
end
|
780
336
|
end
|
781
337
|
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
# == Parameters:
|
787
|
-
# keyword_args:: additional attributes
|
788
|
-
#
|
789
|
-
# == Returns:
|
790
|
-
# A <Pause> element
|
791
|
-
def initialize(**keyword_args)
|
338
|
+
##
|
339
|
+
# <Enqueue> TwiML Noun
|
340
|
+
class Enqueue < TwiML
|
341
|
+
def initialize(name: nil, **keyword_args)
|
792
342
|
super(**keyword_args)
|
343
|
+
@name = 'Enqueue'
|
344
|
+
@value = name unless name.nil?
|
345
|
+
yield(self) if block_given?
|
793
346
|
end
|
794
|
-
end
|
795
347
|
|
796
|
-
|
797
|
-
|
798
|
-
#
|
799
|
-
#
|
800
|
-
# == Parameters:
|
801
|
-
# url:: media URL
|
348
|
+
##
|
349
|
+
# Create a new <Task> element
|
350
|
+
# body:: TaskRouter task attributes
|
802
351
|
# keyword_args:: additional attributes
|
803
|
-
|
804
|
-
|
805
|
-
# A <Play> element
|
806
|
-
def initialize(url: nil, **keyword_args)
|
807
|
-
super(**keyword_args)
|
808
|
-
@value = url
|
352
|
+
def task(body, **keyword_args)
|
353
|
+
append(Task.new(body, **keyword_args))
|
809
354
|
end
|
810
355
|
end
|
811
356
|
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
#
|
816
|
-
# == Parameters:
|
817
|
-
# body:: message body
|
818
|
-
# keyword_args:: additional attributes
|
819
|
-
#
|
820
|
-
# == Returns:
|
821
|
-
# A <Say> element
|
357
|
+
##
|
358
|
+
# <Task> TwiML Noun
|
359
|
+
class Task < TwiML
|
822
360
|
def initialize(body, **keyword_args)
|
823
361
|
super(**keyword_args)
|
362
|
+
@name = 'Task'
|
824
363
|
@value = body
|
364
|
+
yield(self) if block_given?
|
825
365
|
end
|
826
366
|
end
|
827
367
|
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
#
|
832
|
-
# == Parameters:
|
833
|
-
# keyword_args:: additional attributes
|
834
|
-
#
|
835
|
-
# == Returns:
|
836
|
-
# A <hangup_on_star> element
|
368
|
+
##
|
369
|
+
# <Echo> TwiML Verb
|
370
|
+
class Echo < TwiML
|
837
371
|
def initialize(**keyword_args)
|
838
372
|
super(**keyword_args)
|
373
|
+
@name = 'Echo'
|
374
|
+
|
375
|
+
yield(self) if block_given?
|
839
376
|
end
|
840
377
|
end
|
841
378
|
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
379
|
+
##
|
380
|
+
# <Dial> TwiML Verb
|
381
|
+
class Dial < TwiML
|
382
|
+
def initialize(number: nil, **keyword_args)
|
383
|
+
super(**keyword_args)
|
384
|
+
@name = 'Dial'
|
385
|
+
@value = number unless number.nil?
|
386
|
+
yield(self) if block_given?
|
387
|
+
end
|
388
|
+
|
389
|
+
##
|
390
|
+
# Create a new <Client> element
|
391
|
+
# name:: Client name
|
392
|
+
# url:: Client URL
|
393
|
+
# method:: Client URL Method
|
394
|
+
# status_callback_event:: Events to trigger status callback
|
395
|
+
# status_callback:: Status Callback URL
|
396
|
+
# status_callback_method:: Status Callback URL Method
|
397
|
+
# keyword_args:: additional attributes
|
398
|
+
def client(name, url: nil, method: nil, status_callback_event: nil, status_callback: nil, status_callback_method: nil, **keyword_args)
|
399
|
+
append(Client.new(name, url: url, method: method, status_callback_event: status_callback_event, status_callback: status_callback, status_callback_method: status_callback_method, **keyword_args))
|
400
|
+
end
|
401
|
+
|
402
|
+
##
|
403
|
+
# Create a new <Conference> element
|
404
|
+
# name:: Conference name
|
405
|
+
# muted:: Join the conference muted
|
406
|
+
# beep:: Play beep when joining
|
407
|
+
# start_conference_on_enter:: Start the conference on enter
|
408
|
+
# end_conference_on_exit:: End the conferenceon exit
|
409
|
+
# wait_url:: Wait URL
|
410
|
+
# wait_method:: Wait URL method
|
411
|
+
# max_participants:: Maximum number of participants
|
412
|
+
# record:: Record the conference
|
413
|
+
# region:: Conference region
|
414
|
+
# whisper:: Call whisper
|
415
|
+
# trim:: Trim the conference recording
|
416
|
+
# status_callback_event:: Events to call status callback URL
|
417
|
+
# status_callback:: Status callback URL
|
418
|
+
# status_callback_method:: Status callback URL method
|
419
|
+
# recording_status_callback:: Recording status callback URL
|
420
|
+
# recording_status_callback_method:: Recording status callback URL method
|
421
|
+
# event_callback_url:: Event callback URL
|
422
|
+
# keyword_args:: additional attributes
|
423
|
+
def conference(name, muted: nil, beep: nil, start_conference_on_enter: nil, end_conference_on_exit: nil, wait_url: nil, wait_method: nil, max_participants: nil, record: nil, region: nil, whisper: nil, trim: nil, status_callback_event: nil, status_callback: nil, status_callback_method: nil, recording_status_callback: nil, recording_status_callback_method: nil, event_callback_url: nil, **keyword_args)
|
424
|
+
append(Conference.new(name, muted: muted, beep: beep, start_conference_on_enter: start_conference_on_enter, end_conference_on_exit: end_conference_on_exit, wait_url: wait_url, wait_method: wait_method, max_participants: max_participants, record: record, region: region, whisper: whisper, trim: trim, status_callback_event: status_callback_event, status_callback: status_callback, status_callback_method: status_callback_method, recording_status_callback: recording_status_callback, recording_status_callback_method: recording_status_callback_method, event_callback_url: event_callback_url, **keyword_args))
|
425
|
+
end
|
426
|
+
|
427
|
+
##
|
428
|
+
# Create a new <Number> element
|
429
|
+
# number:: Phone Number to dial
|
430
|
+
# send_digits:: DTMF tones to play when the call is answered
|
431
|
+
# url:: TwiML URL
|
432
|
+
# method:: TwiML URL method
|
433
|
+
# status_callback_event:: Events to call status callback
|
434
|
+
# status_callback:: Status callback URL
|
435
|
+
# status_callback_method:: Status callback URL method
|
847
436
|
# keyword_args:: additional attributes
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
437
|
+
def number(number, send_digits: nil, url: nil, method: nil, status_callback_event: nil, status_callback: nil, status_callback_method: nil, **keyword_args)
|
438
|
+
append(Number.new(number, send_digits: send_digits, url: url, method: method, status_callback_event: status_callback_event, status_callback: status_callback, status_callback_method: status_callback_method, **keyword_args))
|
439
|
+
end
|
440
|
+
|
441
|
+
##
|
442
|
+
# Create a new <Queue> element
|
443
|
+
# name:: Queue name
|
444
|
+
# url:: Action URL
|
445
|
+
# method:: Action URL method
|
446
|
+
# reservation_sid:: TaskRouter Reservation SID
|
447
|
+
# post_work_activity_sid:: TaskRouter Activity SID
|
448
|
+
# keyword_args:: additional attributes
|
449
|
+
def queue(name, url: nil, method: nil, reservation_sid: nil, post_work_activity_sid: nil, **keyword_args)
|
450
|
+
append(Queue.new(name, url: url, method: method, reservation_sid: reservation_sid, post_work_activity_sid: post_work_activity_sid, **keyword_args))
|
451
|
+
end
|
452
|
+
|
453
|
+
##
|
454
|
+
# Create a new <Sim> element
|
455
|
+
# sim_sid:: SIM SID
|
456
|
+
# keyword_args:: additional attributes
|
457
|
+
def sim(sim_sid, **keyword_args)
|
458
|
+
append(Sim.new(sim_sid, **keyword_args))
|
459
|
+
end
|
460
|
+
|
461
|
+
##
|
462
|
+
# Create a new <Sip> element
|
463
|
+
# sip_url:: SIP URL
|
464
|
+
# username:: SIP Username
|
465
|
+
# password:: SIP Password
|
466
|
+
# url:: Action URL
|
467
|
+
# method:: Action URL method
|
468
|
+
# status_callback_event:: Status callback events
|
469
|
+
# status_callback:: Status callback URL
|
470
|
+
# status_callback_method:: Status callback URL method
|
471
|
+
# keyword_args:: additional attributes
|
472
|
+
def sip(sip_url, username: nil, password: nil, url: nil, method: nil, status_callback_event: nil, status_callback: nil, status_callback_method: nil, **keyword_args)
|
473
|
+
append(Sip.new(sip_url, username: username, password: password, url: url, method: method, status_callback_event: status_callback_event, status_callback: status_callback, status_callback_method: status_callback_method, **keyword_args))
|
474
|
+
end
|
475
|
+
end
|
476
|
+
|
477
|
+
##
|
478
|
+
# <Sip> TwiML Noun
|
479
|
+
class Sip < TwiML
|
480
|
+
def initialize(sip_url, **keyword_args)
|
852
481
|
super(**keyword_args)
|
482
|
+
@name = 'Sip'
|
483
|
+
@value = sip_url
|
484
|
+
yield(self) if block_given?
|
853
485
|
end
|
854
486
|
end
|
855
487
|
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
# == Parameters:
|
861
|
-
# keyword_args:: additional attributes
|
862
|
-
#
|
863
|
-
# == Returns:
|
864
|
-
# A <Record> element
|
865
|
-
def initialize(**keyword_args)
|
488
|
+
##
|
489
|
+
# <Sim> TwiML Noun
|
490
|
+
class Sim < TwiML
|
491
|
+
def initialize(sim_sid, **keyword_args)
|
866
492
|
super(**keyword_args)
|
493
|
+
@name = 'Sim'
|
494
|
+
@value = sim_sid
|
495
|
+
yield(self) if block_given?
|
867
496
|
end
|
868
497
|
end
|
869
498
|
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
# == Parameters:
|
875
|
-
# url:: TwiML URL
|
876
|
-
# keyword_args:: additional attributes
|
877
|
-
#
|
878
|
-
# == Returns:
|
879
|
-
# A <Redirect> element
|
880
|
-
def initialize(url, **keyword_args)
|
499
|
+
##
|
500
|
+
# <Number> TwiML Noun
|
501
|
+
class Number < TwiML
|
502
|
+
def initialize(number, **keyword_args)
|
881
503
|
super(**keyword_args)
|
882
|
-
@
|
504
|
+
@name = 'Number'
|
505
|
+
@value = number
|
506
|
+
yield(self) if block_given?
|
883
507
|
end
|
884
508
|
end
|
885
509
|
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
# == Parameters:
|
891
|
-
# keyword_args:: additional attributes
|
892
|
-
#
|
893
|
-
# == Returns:
|
894
|
-
# A <Reject> element
|
895
|
-
def initialize(**keyword_args)
|
510
|
+
##
|
511
|
+
# <Conference> TwiML Noun
|
512
|
+
class Conference < TwiML
|
513
|
+
def initialize(name, **keyword_args)
|
896
514
|
super(**keyword_args)
|
515
|
+
@name = 'Conference'
|
516
|
+
@value = name
|
517
|
+
yield(self) if block_given?
|
897
518
|
end
|
898
519
|
end
|
899
520
|
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
# == Parameters:
|
905
|
-
# body:: message body
|
906
|
-
# keyword_args:: additional attributes
|
907
|
-
#
|
908
|
-
# == Returns:
|
909
|
-
# A <Sms> element
|
910
|
-
def initialize(body, **keyword_args)
|
521
|
+
##
|
522
|
+
# <Client> TwiML Noun
|
523
|
+
class Client < TwiML
|
524
|
+
def initialize(name, **keyword_args)
|
911
525
|
super(**keyword_args)
|
912
|
-
@
|
526
|
+
@name = 'Client'
|
527
|
+
@value = name
|
528
|
+
yield(self) if block_given?
|
913
529
|
end
|
914
530
|
end
|
915
531
|
end
|
916
|
-
end
|
532
|
+
end
|