asterisk-ari 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +21 -0
- data/lib/ari/client.rb +23 -10
- data/lib/ari/version.rb +1 -1
- data/spec/ari/client_spec.rb +109 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_applications_get_returns_data.yml +38 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_applications_subscribe_returns_data.yml +77 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_channels_get_channel_var_returns_data.yml +77 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_channels_get_returns_data.yml +38 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_channels_hangup_returns_data.yml +38 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_channels_record_returns_data.yml +42 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_channels_set_channel_var_returns_data.yml +73 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_events_user_event_returns_data.yml +38 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_recordings_cancel_returns_data.yml +38 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_recordings_get_live_returns_data.yml +38 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_recordings_get_stored_returns_data.yml +38 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_recordings_mute_returns_data.yml +108 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_recordings_pause_returns_data.yml +73 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c8569117da7e3c018f932c830f65c363366051f
|
4
|
+
data.tar.gz: f7929186c5985ac3d056b05f53764b0c3af3a64c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26dd9b94bd1677b8786997513eef6325c47c3718f3755b9989fe1070bf10d1345967aee137d8eb5312ca5aaa35a888beaec8d29d94f61e5d7494fcde937cd94a
|
7
|
+
data.tar.gz: 3fe5a2955154be440ea137bc1056973f687c7571ca9453e3ef74d47e07ce02a5d861c9fd0a04dbc525ee85e17989b08acab4b4adbf7bbbcfe3edafb613651e88
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# ARI
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/asterisk-ari.svg)](http://badge.fury.io/rb/asterisk-ari)
|
4
|
+
[![Build Status](https://travis-ci.org/t-k/asterisk-ari-ruby.png)](https://travis-ci.org/t-k/asterisk-ari-ruby)
|
5
|
+
|
3
6
|
ARI is a Ruby client library for the [Asterisk REST Interface (ARI)](https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=29395573)
|
4
7
|
|
5
8
|
## Installation
|
@@ -31,6 +34,24 @@ result = client.bridges_create({type: "mixing", bridgeId: "bridge_id", name: "br
|
|
31
34
|
result = client.bridges_get result["id"]
|
32
35
|
# => {"id"=>"bridge_id", "creator"=>"Stasis", "technology"=>"simple_bridge", "bridge_type"=>"mixing", "bridge_class"=>"stasis", "name"=>"bridge_name", "channels"=>[]}
|
33
36
|
```
|
37
|
+
Check http://www.rubydoc.info/github/t-k/asterisk-ari-ruby/master/ARI/Client for other APIs.
|
38
|
+
|
39
|
+
Error handling
|
40
|
+
--
|
41
|
+
```ruby
|
42
|
+
begin
|
43
|
+
result = client.asterisk_set_global_var
|
44
|
+
rescue ARI::ServerError => e # handle 5xx request
|
45
|
+
puts e.response_body
|
46
|
+
puts e.error_info
|
47
|
+
rescue ARI::APIError => e # handle 4xx request
|
48
|
+
puts e.response_body
|
49
|
+
# => {"message":"Variable name is required"}
|
50
|
+
puts e.error_info
|
51
|
+
# {:http_status=>400, :body=>"{\"message\":\"Variable name is required\"}", :data=>{"message"=>"Variable name is required"}}
|
52
|
+
rescue
|
53
|
+
end
|
54
|
+
```
|
34
55
|
|
35
56
|
## TODO
|
36
57
|
|
data/lib/ari/client.rb
CHANGED
@@ -923,17 +923,30 @@ module ARI
|
|
923
923
|
# get "events"
|
924
924
|
# end
|
925
925
|
|
926
|
-
#
|
927
|
-
#
|
928
|
-
#
|
929
|
-
#
|
930
|
-
#
|
926
|
+
# POST
|
927
|
+
# /events/user/:eventName
|
928
|
+
# void
|
929
|
+
# Generate a user event.
|
930
|
+
#
|
931
931
|
# @see https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Events+REST+API#Asterisk12EventsRESTAPI-userEvent
|
932
|
-
#
|
933
|
-
#
|
934
|
-
#
|
935
|
-
#
|
936
|
-
#
|
932
|
+
#
|
933
|
+
# @param [String] event_name event_name
|
934
|
+
# @param [Hash] params
|
935
|
+
# @option param [String] application #required The name of the application that will receive this event
|
936
|
+
# @option param [String] source URI for event source (channel:{channelId}, bridge:{bridgeId}, endpoint:{tech}/{resource}, deviceState:{deviceName}. Allows comma separated values.
|
937
|
+
#
|
938
|
+
# Body parameter
|
939
|
+
#
|
940
|
+
# variables: containers - The "variables" key in the body object holds custom key/value pairs to add to the user event. Ex. { "variables": { "key": "value" } }
|
941
|
+
#
|
942
|
+
# Error Responses
|
943
|
+
#
|
944
|
+
# 404 - Application does not exist.
|
945
|
+
# 422 - Event source not found.
|
946
|
+
# 400 - Invalid even tsource URI or userevent data.
|
947
|
+
def events_user_event(event_name, params = {})
|
948
|
+
post "events/user/#{event_name}", params
|
949
|
+
end
|
937
950
|
|
938
951
|
# Recordings REST API
|
939
952
|
|
data/lib/ari/version.rb
CHANGED
data/spec/ari/client_spec.rb
CHANGED
@@ -86,6 +86,45 @@ describe ARI::Client do
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
+
describe "#channels_get" do
|
90
|
+
it "returns data" do
|
91
|
+
id = "1409619856.0"
|
92
|
+
result = @client.channels_get(id)
|
93
|
+
result["id"].should == id
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe "#channels_record" do
|
98
|
+
it "returns data" do
|
99
|
+
id = "1409624128.10"
|
100
|
+
name = "/tmp/record"
|
101
|
+
format = "sln192"
|
102
|
+
result = @client.channels_record(id, {:name => name, :format => format, :maxDurationSeconds => 10})
|
103
|
+
result["name"].should == name
|
104
|
+
result["format"].should == format
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe "#channels_set_channel_var" do
|
109
|
+
it "returns data" do
|
110
|
+
id = "1409624128.10"
|
111
|
+
key = "FOO"
|
112
|
+
value = "BAR"
|
113
|
+
result = @client.channels_set_channel_var(id, {:variable => key, :value => value})
|
114
|
+
result.should == ""
|
115
|
+
result = @client.channels_get_channel_var(id, {:variable => key})
|
116
|
+
result["value"].should == value
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe "#channels_hangup" do
|
121
|
+
it "returns data" do
|
122
|
+
id = "1409619856.0"
|
123
|
+
result = @client.channels_hangup(id)
|
124
|
+
result.should == ""
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
89
128
|
describe "#endpoints_list" do
|
90
129
|
it "returns data" do
|
91
130
|
result = @client.endpoints_list
|
@@ -107,6 +146,13 @@ describe ARI::Client do
|
|
107
146
|
end
|
108
147
|
end
|
109
148
|
|
149
|
+
describe "#events_user_event" do
|
150
|
+
it "returns data" do
|
151
|
+
result = @client.events_user_event("ApplicationReplaced", {application: "hello-world"})
|
152
|
+
result.should == ""
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
110
156
|
describe "#recordings_list_stored" do
|
111
157
|
it "returns data" do
|
112
158
|
result = @client.recordings_list_stored
|
@@ -114,6 +160,50 @@ describe ARI::Client do
|
|
114
160
|
end
|
115
161
|
end
|
116
162
|
|
163
|
+
describe "#recordings_get_stored" do
|
164
|
+
it "returns data" do
|
165
|
+
name = "/tmp/record"
|
166
|
+
result = @client.recordings_get_stored(name)
|
167
|
+
result[0]["name"].should == "tmp/record"
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
describe "#recordings_get_live" do
|
172
|
+
it "returns data" do
|
173
|
+
name = "record2"
|
174
|
+
result = @client.recordings_get_live(name)
|
175
|
+
result["name"].should == name
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
describe "#recordings_pause" do
|
180
|
+
it "returns data" do
|
181
|
+
name = "record2"
|
182
|
+
result = @client.recordings_pause(name)
|
183
|
+
result.should == ""
|
184
|
+
result = @client.recordings_unpause(name)
|
185
|
+
result.should == ""
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
describe "#recordings_mute" do
|
190
|
+
it "returns data" do
|
191
|
+
name = "record2"
|
192
|
+
result = @client.recordings_mute(name)
|
193
|
+
result.should == ""
|
194
|
+
result = @client.recordings_unmute(name)
|
195
|
+
result.should == ""
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
describe "#recordings_cancel" do
|
200
|
+
it "returns data" do
|
201
|
+
name = "record2"
|
202
|
+
result = @client.recordings_cancel(name)
|
203
|
+
result.should == ""
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
117
207
|
describe "#sounds_list" do
|
118
208
|
context "without params" do
|
119
209
|
it "returns data" do
|
@@ -146,6 +236,25 @@ describe ARI::Client do
|
|
146
236
|
end
|
147
237
|
end
|
148
238
|
|
239
|
+
describe "#applications_get" do
|
240
|
+
it "returns data" do
|
241
|
+
name = "hello-world"
|
242
|
+
result = @client.applications_get name
|
243
|
+
result["name"].should == name
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
describe "#applications_subscribe" do
|
248
|
+
it "returns data" do
|
249
|
+
name = "hello-world"
|
250
|
+
source = "channel:1409624128.10"
|
251
|
+
result = @client.applications_subscribe(name, {:eventSource => source})
|
252
|
+
result["name"].should == name
|
253
|
+
result = @client.applications_unsubscribe(name, {:eventSource => source})
|
254
|
+
result["name"].should == name
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
149
258
|
describe "#device_states_list" do
|
150
259
|
it "returns data" do
|
151
260
|
result = @client.device_states_list
|
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/applications/hello-world?method=get
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- Asterisk/12.5.0
|
23
|
+
Date:
|
24
|
+
- Tue, 02 Sep 2014 02:57:26 GMT
|
25
|
+
Connection:
|
26
|
+
- close
|
27
|
+
Cache-Control:
|
28
|
+
- no-cache, no-store
|
29
|
+
Content-Type:
|
30
|
+
- application/json
|
31
|
+
Content-Length:
|
32
|
+
- '106'
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: '{"name":"hello-world","channel_ids":["1409624128.10"],"endpoint_ids":[],"bridge_ids":[],"device_names":[]}'
|
36
|
+
http_version:
|
37
|
+
recorded_at: Tue, 02 Sep 2014 02:57:26 GMT
|
38
|
+
recorded_with: VCR 2.9.2
|
data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_applications_subscribe_returns_data.yml
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/applications/hello-world/subscription
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: eventSource=channel%3A1409624128.10&method=post
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Content-Type:
|
17
|
+
- application/x-www-form-urlencoded
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- Asterisk/12.5.0
|
25
|
+
Date:
|
26
|
+
- Tue, 02 Sep 2014 03:12:33 GMT
|
27
|
+
Connection:
|
28
|
+
- close
|
29
|
+
Cache-Control:
|
30
|
+
- no-cache, no-store
|
31
|
+
Content-Type:
|
32
|
+
- application/json
|
33
|
+
Content-Length:
|
34
|
+
- '106'
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: '{"name":"hello-world","channel_ids":["1409624128.10"],"endpoint_ids":[],"bridge_ids":[],"device_names":[]}'
|
38
|
+
http_version:
|
39
|
+
recorded_at: Tue, 02 Sep 2014 03:12:33 GMT
|
40
|
+
- request:
|
41
|
+
method: delete
|
42
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/applications/hello-world/subscription
|
43
|
+
body:
|
44
|
+
encoding: US-ASCII
|
45
|
+
string: eventSource=channel%3A1409624128.10&method=delete
|
46
|
+
headers:
|
47
|
+
Accept-Encoding:
|
48
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
49
|
+
Accept:
|
50
|
+
- "*/*"
|
51
|
+
User-Agent:
|
52
|
+
- Ruby
|
53
|
+
Content-Type:
|
54
|
+
- application/x-www-form-urlencoded
|
55
|
+
response:
|
56
|
+
status:
|
57
|
+
code: 200
|
58
|
+
message: OK
|
59
|
+
headers:
|
60
|
+
Server:
|
61
|
+
- Asterisk/12.5.0
|
62
|
+
Date:
|
63
|
+
- Tue, 02 Sep 2014 03:13:36 GMT
|
64
|
+
Connection:
|
65
|
+
- close
|
66
|
+
Cache-Control:
|
67
|
+
- no-cache, no-store
|
68
|
+
Content-Type:
|
69
|
+
- application/json
|
70
|
+
Content-Length:
|
71
|
+
- '106'
|
72
|
+
body:
|
73
|
+
encoding: UTF-8
|
74
|
+
string: '{"name":"hello-world","channel_ids":["1409624128.10"],"endpoint_ids":[],"bridge_ids":[],"device_names":[]}'
|
75
|
+
http_version:
|
76
|
+
recorded_at: Tue, 02 Sep 2014 03:13:36 GMT
|
77
|
+
recorded_with: VCR 2.9.2
|
data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_channels_get_channel_var_returns_data.yml
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/channels/1409620106.2/variable
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: variable=FOO&value=BAR&method=post
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Content-Type:
|
17
|
+
- application/x-www-form-urlencoded
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 409
|
21
|
+
message: Conflict
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- Asterisk/12.5.0
|
25
|
+
Date:
|
26
|
+
- Tue, 02 Sep 2014 01:15:09 GMT
|
27
|
+
Connection:
|
28
|
+
- close
|
29
|
+
Cache-Control:
|
30
|
+
- no-cache, no-store
|
31
|
+
Content-Type:
|
32
|
+
- application/json
|
33
|
+
Content-Length:
|
34
|
+
- '47'
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: '{"message":"Channel not in Stasis application"}'
|
38
|
+
http_version:
|
39
|
+
recorded_at: Tue, 02 Sep 2014 01:15:09 GMT
|
40
|
+
- request:
|
41
|
+
method: post
|
42
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/channels/1409620562.4/variable
|
43
|
+
body:
|
44
|
+
encoding: US-ASCII
|
45
|
+
string: variable=FOO&value=BAR&method=post
|
46
|
+
headers:
|
47
|
+
Accept-Encoding:
|
48
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
49
|
+
Accept:
|
50
|
+
- "*/*"
|
51
|
+
User-Agent:
|
52
|
+
- Ruby
|
53
|
+
Content-Type:
|
54
|
+
- application/x-www-form-urlencoded
|
55
|
+
response:
|
56
|
+
status:
|
57
|
+
code: 409
|
58
|
+
message: Conflict
|
59
|
+
headers:
|
60
|
+
Server:
|
61
|
+
- Asterisk/12.5.0
|
62
|
+
Date:
|
63
|
+
- Tue, 02 Sep 2014 01:16:28 GMT
|
64
|
+
Connection:
|
65
|
+
- close
|
66
|
+
Cache-Control:
|
67
|
+
- no-cache, no-store
|
68
|
+
Content-Type:
|
69
|
+
- application/json
|
70
|
+
Content-Length:
|
71
|
+
- '47'
|
72
|
+
body:
|
73
|
+
encoding: UTF-8
|
74
|
+
string: '{"message":"Channel not in Stasis application"}'
|
75
|
+
http_version:
|
76
|
+
recorded_at: Tue, 02 Sep 2014 01:16:28 GMT
|
77
|
+
recorded_with: VCR 2.9.2
|
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/channels/1409619856.0?method=get
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- Asterisk/12.5.0
|
23
|
+
Date:
|
24
|
+
- Tue, 02 Sep 2014 01:06:08 GMT
|
25
|
+
Connection:
|
26
|
+
- close
|
27
|
+
Cache-Control:
|
28
|
+
- no-cache, no-store
|
29
|
+
Content-Type:
|
30
|
+
- application/json
|
31
|
+
Content-Length:
|
32
|
+
- '256'
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: '{"id":"1409619856.0","caller":{"name":"","number":"200"},"name":"SIP/200-00000000","state":"Up","dialplan":{"context":"sipuser","exten":"8000","priority":3},"connected":{"name":"","number":""},"accountcode":"","creationtime":"2014-09-02T10:04:16.253+0900"}'
|
36
|
+
http_version:
|
37
|
+
recorded_at: Tue, 02 Sep 2014 01:06:08 GMT
|
38
|
+
recorded_with: VCR 2.9.2
|
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: delete
|
5
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/channels/1409619856.0
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: method=delete
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Content-Type:
|
17
|
+
- application/x-www-form-urlencoded
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 204
|
21
|
+
message: No Content
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- Asterisk/12.5.0
|
25
|
+
Date:
|
26
|
+
- Tue, 02 Sep 2014 01:07:19 GMT
|
27
|
+
Connection:
|
28
|
+
- close
|
29
|
+
Cache-Control:
|
30
|
+
- no-cache, no-store
|
31
|
+
Content-Length:
|
32
|
+
- '0'
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: ''
|
36
|
+
http_version:
|
37
|
+
recorded_at: Tue, 02 Sep 2014 01:07:19 GMT
|
38
|
+
recorded_with: VCR 2.9.2
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/channels/1409624128.10/record
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: name=%2Ftmp%2Frecord&format=sln192&maxDurationSeconds=10&method=post
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Content-Type:
|
17
|
+
- application/x-www-form-urlencoded
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 201
|
21
|
+
message: Created
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- Asterisk/12.5.0
|
25
|
+
Date:
|
26
|
+
- Tue, 02 Sep 2014 02:34:50 GMT
|
27
|
+
Connection:
|
28
|
+
- close
|
29
|
+
Cache-Control:
|
30
|
+
- no-cache, no-store
|
31
|
+
Location:
|
32
|
+
- "/recordings/live/%2Ftmp%2Frecord"
|
33
|
+
Content-Type:
|
34
|
+
- application/json
|
35
|
+
Content-Length:
|
36
|
+
- '94'
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"name":"/tmp/record","format":"sln192","state":"queued","target_uri":"channel:1409624128.10"}'
|
40
|
+
http_version:
|
41
|
+
recorded_at: Tue, 02 Sep 2014 02:34:50 GMT
|
42
|
+
recorded_with: VCR 2.9.2
|
data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_channels_set_channel_var_returns_data.yml
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/channels/1409624128.10/variable
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: variable=FOO&value=BAR&method=post
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Content-Type:
|
17
|
+
- application/x-www-form-urlencoded
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 204
|
21
|
+
message: No Content
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- Asterisk/12.5.0
|
25
|
+
Date:
|
26
|
+
- Tue, 02 Sep 2014 02:22:40 GMT
|
27
|
+
Connection:
|
28
|
+
- close
|
29
|
+
Cache-Control:
|
30
|
+
- no-cache, no-store
|
31
|
+
Content-Length:
|
32
|
+
- '0'
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: ''
|
36
|
+
http_version:
|
37
|
+
recorded_at: Tue, 02 Sep 2014 02:22:40 GMT
|
38
|
+
- request:
|
39
|
+
method: get
|
40
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/channels/1409624128.10/variable?method=get&variable=FOO
|
41
|
+
body:
|
42
|
+
encoding: US-ASCII
|
43
|
+
string: ''
|
44
|
+
headers:
|
45
|
+
Accept-Encoding:
|
46
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
47
|
+
Accept:
|
48
|
+
- "*/*"
|
49
|
+
User-Agent:
|
50
|
+
- Ruby
|
51
|
+
response:
|
52
|
+
status:
|
53
|
+
code: 200
|
54
|
+
message: OK
|
55
|
+
headers:
|
56
|
+
Server:
|
57
|
+
- Asterisk/12.5.0
|
58
|
+
Date:
|
59
|
+
- Tue, 02 Sep 2014 02:22:40 GMT
|
60
|
+
Connection:
|
61
|
+
- close
|
62
|
+
Cache-Control:
|
63
|
+
- no-cache, no-store
|
64
|
+
Content-Type:
|
65
|
+
- application/json
|
66
|
+
Content-Length:
|
67
|
+
- '15'
|
68
|
+
body:
|
69
|
+
encoding: UTF-8
|
70
|
+
string: '{"value":"BAR"}'
|
71
|
+
http_version:
|
72
|
+
recorded_at: Tue, 02 Sep 2014 02:22:40 GMT
|
73
|
+
recorded_with: VCR 2.9.2
|
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/events/user/ApplicationReplaced
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: application=hello-world&method=post
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Content-Type:
|
17
|
+
- application/x-www-form-urlencoded
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 204
|
21
|
+
message: No Content
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- Asterisk/12.5.0
|
25
|
+
Date:
|
26
|
+
- Tue, 02 Sep 2014 02:18:05 GMT
|
27
|
+
Connection:
|
28
|
+
- close
|
29
|
+
Cache-Control:
|
30
|
+
- no-cache, no-store
|
31
|
+
Content-Length:
|
32
|
+
- '0'
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: ''
|
36
|
+
http_version:
|
37
|
+
recorded_at: Tue, 02 Sep 2014 02:18:05 GMT
|
38
|
+
recorded_with: VCR 2.9.2
|
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: delete
|
5
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/recordings/live/record2
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: method=delete
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Content-Type:
|
17
|
+
- application/x-www-form-urlencoded
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 204
|
21
|
+
message: No Content
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- Asterisk/12.5.0
|
25
|
+
Date:
|
26
|
+
- Tue, 02 Sep 2014 02:52:37 GMT
|
27
|
+
Connection:
|
28
|
+
- close
|
29
|
+
Cache-Control:
|
30
|
+
- no-cache, no-store
|
31
|
+
Content-Length:
|
32
|
+
- '0'
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: ''
|
36
|
+
http_version:
|
37
|
+
recorded_at: Tue, 02 Sep 2014 02:52:37 GMT
|
38
|
+
recorded_with: VCR 2.9.2
|
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/recordings/live/record2?method=get
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- Asterisk/12.5.0
|
23
|
+
Date:
|
24
|
+
- Tue, 02 Sep 2014 02:49:50 GMT
|
25
|
+
Connection:
|
26
|
+
- close
|
27
|
+
Cache-Control:
|
28
|
+
- no-cache, no-store
|
29
|
+
Content-Type:
|
30
|
+
- application/json
|
31
|
+
Content-Length:
|
32
|
+
- '93'
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: '{"name":"record2","format":"sln192","state":"recording","target_uri":"channel:1409624128.10"}'
|
36
|
+
http_version:
|
37
|
+
recorded_at: Tue, 02 Sep 2014 02:49:50 GMT
|
38
|
+
recorded_with: VCR 2.9.2
|
data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_recordings_get_stored_returns_data.yml
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/recordings/stored//tmp/record?method=get
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- Asterisk/12.5.0
|
23
|
+
Date:
|
24
|
+
- Tue, 02 Sep 2014 02:37:35 GMT
|
25
|
+
Connection:
|
26
|
+
- close
|
27
|
+
Cache-Control:
|
28
|
+
- no-cache, no-store
|
29
|
+
Content-Type:
|
30
|
+
- application/json
|
31
|
+
Content-Length:
|
32
|
+
- '41'
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: '[{"name":"tmp/record","format":"sln192"}]'
|
36
|
+
http_version:
|
37
|
+
recorded_at: Tue, 02 Sep 2014 02:37:35 GMT
|
38
|
+
recorded_with: VCR 2.9.2
|
@@ -0,0 +1,108 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/recordings/live/record2/mute
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: method=post
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Content-Type:
|
17
|
+
- application/x-www-form-urlencoded
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 204
|
21
|
+
message: No Content
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- Asterisk/12.5.0
|
25
|
+
Date:
|
26
|
+
- Tue, 02 Sep 2014 02:50:37 GMT
|
27
|
+
Connection:
|
28
|
+
- close
|
29
|
+
Cache-Control:
|
30
|
+
- no-cache, no-store
|
31
|
+
Content-Length:
|
32
|
+
- '0'
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: ''
|
36
|
+
http_version:
|
37
|
+
recorded_at: Tue, 02 Sep 2014 02:50:37 GMT
|
38
|
+
- request:
|
39
|
+
method: delete
|
40
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/recordings/live/record2/mute
|
41
|
+
body:
|
42
|
+
encoding: US-ASCII
|
43
|
+
string: method=delete
|
44
|
+
headers:
|
45
|
+
Accept-Encoding:
|
46
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
47
|
+
Accept:
|
48
|
+
- "*/*"
|
49
|
+
User-Agent:
|
50
|
+
- Ruby
|
51
|
+
Content-Type:
|
52
|
+
- application/x-www-form-urlencoded
|
53
|
+
response:
|
54
|
+
status:
|
55
|
+
code: 204
|
56
|
+
message: No Content
|
57
|
+
headers:
|
58
|
+
Server:
|
59
|
+
- Asterisk/12.5.0
|
60
|
+
Date:
|
61
|
+
- Tue, 02 Sep 2014 02:50:37 GMT
|
62
|
+
Connection:
|
63
|
+
- close
|
64
|
+
Cache-Control:
|
65
|
+
- no-cache, no-store
|
66
|
+
Content-Length:
|
67
|
+
- '0'
|
68
|
+
body:
|
69
|
+
encoding: UTF-8
|
70
|
+
string: ''
|
71
|
+
http_version:
|
72
|
+
recorded_at: Tue, 02 Sep 2014 02:50:37 GMT
|
73
|
+
- request:
|
74
|
+
method: delete
|
75
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/recordings/live/record2
|
76
|
+
body:
|
77
|
+
encoding: US-ASCII
|
78
|
+
string: method=delete
|
79
|
+
headers:
|
80
|
+
Accept-Encoding:
|
81
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
82
|
+
Accept:
|
83
|
+
- "*/*"
|
84
|
+
User-Agent:
|
85
|
+
- Ruby
|
86
|
+
Content-Type:
|
87
|
+
- application/x-www-form-urlencoded
|
88
|
+
response:
|
89
|
+
status:
|
90
|
+
code: 204
|
91
|
+
message: No Content
|
92
|
+
headers:
|
93
|
+
Server:
|
94
|
+
- Asterisk/12.5.0
|
95
|
+
Date:
|
96
|
+
- Tue, 02 Sep 2014 02:52:37 GMT
|
97
|
+
Connection:
|
98
|
+
- close
|
99
|
+
Cache-Control:
|
100
|
+
- no-cache, no-store
|
101
|
+
Content-Length:
|
102
|
+
- '0'
|
103
|
+
body:
|
104
|
+
encoding: UTF-8
|
105
|
+
string: ''
|
106
|
+
http_version:
|
107
|
+
recorded_at: Tue, 02 Sep 2014 02:52:37 GMT
|
108
|
+
recorded_with: VCR 2.9.2
|
@@ -0,0 +1,73 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/recordings/live/record2/pause
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: method=post
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Content-Type:
|
17
|
+
- application/x-www-form-urlencoded
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 204
|
21
|
+
message: No Content
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- Asterisk/12.5.0
|
25
|
+
Date:
|
26
|
+
- Tue, 02 Sep 2014 02:51:52 GMT
|
27
|
+
Connection:
|
28
|
+
- close
|
29
|
+
Cache-Control:
|
30
|
+
- no-cache, no-store
|
31
|
+
Content-Length:
|
32
|
+
- '0'
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: ''
|
36
|
+
http_version:
|
37
|
+
recorded_at: Tue, 02 Sep 2014 02:51:52 GMT
|
38
|
+
- request:
|
39
|
+
method: delete
|
40
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/recordings/live/record2/pause
|
41
|
+
body:
|
42
|
+
encoding: US-ASCII
|
43
|
+
string: method=delete
|
44
|
+
headers:
|
45
|
+
Accept-Encoding:
|
46
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
47
|
+
Accept:
|
48
|
+
- "*/*"
|
49
|
+
User-Agent:
|
50
|
+
- Ruby
|
51
|
+
Content-Type:
|
52
|
+
- application/x-www-form-urlencoded
|
53
|
+
response:
|
54
|
+
status:
|
55
|
+
code: 204
|
56
|
+
message: No Content
|
57
|
+
headers:
|
58
|
+
Server:
|
59
|
+
- Asterisk/12.5.0
|
60
|
+
Date:
|
61
|
+
- Tue, 02 Sep 2014 02:51:52 GMT
|
62
|
+
Connection:
|
63
|
+
- close
|
64
|
+
Cache-Control:
|
65
|
+
- no-cache, no-store
|
66
|
+
Content-Length:
|
67
|
+
- '0'
|
68
|
+
body:
|
69
|
+
encoding: UTF-8
|
70
|
+
string: ''
|
71
|
+
http_version:
|
72
|
+
recorded_at: Tue, 02 Sep 2014 02:51:52 GMT
|
73
|
+
recorded_with: VCR 2.9.2
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asterisk-ari
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tatsuo Kaniwa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -103,6 +103,7 @@ extra_rdoc_files: []
|
|
103
103
|
files:
|
104
104
|
- ".gitignore"
|
105
105
|
- ".travis.yml"
|
106
|
+
- CHANGELOG.md
|
106
107
|
- Gemfile
|
107
108
|
- LICENSE.txt
|
108
109
|
- README.md
|
@@ -118,17 +119,30 @@ files:
|
|
118
119
|
- spec/ari/client_spec.rb
|
119
120
|
- spec/ari/errors_spec.rb
|
120
121
|
- spec/ari/http_service_spec.rb
|
122
|
+
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_applications_get_returns_data.yml
|
121
123
|
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_applications_list_returns_data.yml
|
124
|
+
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_applications_subscribe_returns_data.yml
|
122
125
|
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_asterisk_get_info_returns_data.yml
|
123
126
|
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_bridges_create_returns_data.yml
|
124
127
|
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_bridges_list_returns_data.yml
|
128
|
+
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_channels_get_channel_var_returns_data.yml
|
129
|
+
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_channels_get_returns_data.yml
|
130
|
+
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_channels_hangup_returns_data.yml
|
125
131
|
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_channels_list_returns_data.yml
|
132
|
+
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_channels_record_returns_data.yml
|
133
|
+
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_channels_set_channel_var_returns_data.yml
|
126
134
|
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_device_states_list_returns_data.yml
|
127
135
|
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_endpoints_list_by_tech_returns_data.yml
|
128
136
|
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_endpoints_list_returns_data.yml
|
129
137
|
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_endpoints_send_message_returns_data.yml
|
138
|
+
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_events_user_event_returns_data.yml
|
130
139
|
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_global_var_asterisk_set_global_var_and_asterisk_get_global_var_returns_data.yml
|
140
|
+
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_recordings_cancel_returns_data.yml
|
141
|
+
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_recordings_get_live_returns_data.yml
|
142
|
+
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_recordings_get_stored_returns_data.yml
|
131
143
|
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_recordings_list_stored_returns_data.yml
|
144
|
+
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_recordings_mute_returns_data.yml
|
145
|
+
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_recordings_pause_returns_data.yml
|
132
146
|
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_sounds_get_returns_data.yml
|
133
147
|
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_sounds_list_with_params_returns_data.yml
|
134
148
|
- spec/fixtures/vcr_cassettes/ARI_Client/api_request_sounds_list_without_params_returns_data.yml
|