asterisk-ari 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.travis.yml +20 -0
- data/Gemfile +13 -0
- data/LICENSE.txt +22 -0
- data/README.md +38 -0
- data/Rakefile +8 -0
- data/asterisk-ari.gemspec +28 -0
- data/lib/ari.rb +2 -0
- data/lib/ari/client.rb +1441 -0
- data/lib/ari/errors.rb +38 -0
- data/lib/ari/http_services.rb +87 -0
- data/lib/ari/json.rb +23 -0
- data/lib/ari/response.rb +18 -0
- data/lib/ari/version.rb +3 -0
- data/spec/ari/client_spec.rb +158 -0
- data/spec/ari/errors_spec.rb +25 -0
- data/spec/ari/http_service_spec.rb +18 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_applications_list_returns_data.yml +38 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_asterisk_get_info_returns_data.yml +39 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_bridges_create_returns_data.yml +147 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_bridges_list_returns_data.yml +38 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_channels_list_returns_data.yml +38 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_device_states_list_returns_data.yml +38 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_endpoints_list_by_tech_returns_data.yml +38 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_endpoints_list_returns_data.yml +38 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_endpoints_send_message_returns_data.yml +38 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_global_var_asterisk_set_global_var_and_asterisk_get_global_var_returns_data.yml +73 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_recordings_list_stored_returns_data.yml +38 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_sounds_get_returns_data.yml +38 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_sounds_list_with_params_returns_data.yml +395 -0
- data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_sounds_list_without_params_returns_data.yml +395 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/support/config.yml +4 -0
- data/spec/support/config_loader.rb +2 -0
- data/spec/support/vcr.rb +14 -0
- metadata +164 -0
@@ -0,0 +1,147 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/bridges
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: type=mixing&bridgeId=1409571774&name=bridge_name&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
|
+
- Mon, 01 Sep 2014 11:50:26 GMT
|
27
|
+
Connection:
|
28
|
+
- close
|
29
|
+
Cache-Control:
|
30
|
+
- no-cache, no-store
|
31
|
+
Content-Type:
|
32
|
+
- application/json
|
33
|
+
Content-Length:
|
34
|
+
- '149'
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: '{"id":"1409571774","technology":"simple_bridge","bridge_type":"mixing","bridge_class":"stasis","creator":"Stasis","name":"bridge_name","channels":[]}'
|
38
|
+
http_version:
|
39
|
+
recorded_at: Mon, 01 Sep 2014 11:50:26 GMT
|
40
|
+
- request:
|
41
|
+
method: post
|
42
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/bridges/1409571774
|
43
|
+
body:
|
44
|
+
encoding: US-ASCII
|
45
|
+
string: type=holding&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: 200
|
58
|
+
message: OK
|
59
|
+
headers:
|
60
|
+
Server:
|
61
|
+
- Asterisk/12.5.0
|
62
|
+
Date:
|
63
|
+
- Mon, 01 Sep 2014 11:54:02 GMT
|
64
|
+
Connection:
|
65
|
+
- close
|
66
|
+
Cache-Control:
|
67
|
+
- no-cache, no-store
|
68
|
+
Content-Type:
|
69
|
+
- application/json
|
70
|
+
Content-Length:
|
71
|
+
- '140'
|
72
|
+
body:
|
73
|
+
encoding: UTF-8
|
74
|
+
string: '{"name":"","id":"1409571774","technology":"holding_bridge","bridge_type":"holding","bridge_class":"stasis","channels":[],"creator":"Stasis"}'
|
75
|
+
http_version:
|
76
|
+
recorded_at: Mon, 01 Sep 2014 11:54:02 GMT
|
77
|
+
- request:
|
78
|
+
method: get
|
79
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/bridges/1409571774?method=get
|
80
|
+
body:
|
81
|
+
encoding: US-ASCII
|
82
|
+
string: ''
|
83
|
+
headers:
|
84
|
+
Accept-Encoding:
|
85
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
86
|
+
Accept:
|
87
|
+
- "*/*"
|
88
|
+
User-Agent:
|
89
|
+
- Ruby
|
90
|
+
response:
|
91
|
+
status:
|
92
|
+
code: 200
|
93
|
+
message: OK
|
94
|
+
headers:
|
95
|
+
Server:
|
96
|
+
- Asterisk/12.5.0
|
97
|
+
Date:
|
98
|
+
- Mon, 01 Sep 2014 11:54:02 GMT
|
99
|
+
Connection:
|
100
|
+
- close
|
101
|
+
Cache-Control:
|
102
|
+
- no-cache, no-store
|
103
|
+
Content-Type:
|
104
|
+
- application/json
|
105
|
+
Content-Length:
|
106
|
+
- '140'
|
107
|
+
body:
|
108
|
+
encoding: UTF-8
|
109
|
+
string: '{"name":"","id":"1409571774","technology":"holding_bridge","bridge_type":"holding","bridge_class":"stasis","channels":[],"creator":"Stasis"}'
|
110
|
+
http_version:
|
111
|
+
recorded_at: Mon, 01 Sep 2014 11:54:02 GMT
|
112
|
+
- request:
|
113
|
+
method: delete
|
114
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/bridges/1409571774
|
115
|
+
body:
|
116
|
+
encoding: US-ASCII
|
117
|
+
string: method=delete
|
118
|
+
headers:
|
119
|
+
Accept-Encoding:
|
120
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
121
|
+
Accept:
|
122
|
+
- "*/*"
|
123
|
+
User-Agent:
|
124
|
+
- Ruby
|
125
|
+
Content-Type:
|
126
|
+
- application/x-www-form-urlencoded
|
127
|
+
response:
|
128
|
+
status:
|
129
|
+
code: 204
|
130
|
+
message: No Content
|
131
|
+
headers:
|
132
|
+
Server:
|
133
|
+
- Asterisk/12.5.0
|
134
|
+
Date:
|
135
|
+
- Mon, 01 Sep 2014 11:55:09 GMT
|
136
|
+
Connection:
|
137
|
+
- close
|
138
|
+
Cache-Control:
|
139
|
+
- no-cache, no-store
|
140
|
+
Content-Length:
|
141
|
+
- '0'
|
142
|
+
body:
|
143
|
+
encoding: UTF-8
|
144
|
+
string: ''
|
145
|
+
http_version:
|
146
|
+
recorded_at: Mon, 01 Sep 2014 11:55:09 GMT
|
147
|
+
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/bridges?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
|
+
- Mon, 01 Sep 2014 11:40:21 GMT
|
25
|
+
Connection:
|
26
|
+
- close
|
27
|
+
Cache-Control:
|
28
|
+
- no-cache, no-store
|
29
|
+
Content-Type:
|
30
|
+
- application/json
|
31
|
+
Content-Length:
|
32
|
+
- '2'
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: "[]"
|
36
|
+
http_version:
|
37
|
+
recorded_at: Mon, 01 Sep 2014 11:40:21 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/channels?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
|
+
- Mon, 01 Sep 2014 12:58:28 GMT
|
25
|
+
Connection:
|
26
|
+
- close
|
27
|
+
Cache-Control:
|
28
|
+
- no-cache, no-store
|
29
|
+
Content-Type:
|
30
|
+
- application/json
|
31
|
+
Content-Length:
|
32
|
+
- '2'
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: "[]"
|
36
|
+
http_version:
|
37
|
+
recorded_at: Mon, 01 Sep 2014 12:58:28 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/deviceStates?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
|
+
- Mon, 01 Sep 2014 13:37:05 GMT
|
25
|
+
Connection:
|
26
|
+
- close
|
27
|
+
Cache-Control:
|
28
|
+
- no-cache, no-store
|
29
|
+
Content-Type:
|
30
|
+
- application/json
|
31
|
+
Content-Length:
|
32
|
+
- '2'
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: "[]"
|
36
|
+
http_version:
|
37
|
+
recorded_at: Mon, 01 Sep 2014 13:37:05 GMT
|
38
|
+
recorded_with: VCR 2.9.2
|
data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_endpoints_list_by_tech_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/endpoints/SIP?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
|
+
- Mon, 01 Sep 2014 13:23:30 GMT
|
25
|
+
Connection:
|
26
|
+
- close
|
27
|
+
Cache-Control:
|
28
|
+
- no-cache, no-store
|
29
|
+
Content-Type:
|
30
|
+
- application/json
|
31
|
+
Content-Length:
|
32
|
+
- '73'
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: '[{"technology":"SIP","resource":"200","state":"online","channel_ids":[]}]'
|
36
|
+
http_version:
|
37
|
+
recorded_at: Mon, 01 Sep 2014 13:23:30 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/endpoints?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
|
+
- Mon, 01 Sep 2014 13:22:55 GMT
|
25
|
+
Connection:
|
26
|
+
- close
|
27
|
+
Cache-Control:
|
28
|
+
- no-cache, no-store
|
29
|
+
Content-Type:
|
30
|
+
- application/json
|
31
|
+
Content-Length:
|
32
|
+
- '148'
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: '[{"technology":"SIP","resource":"200","state":"online","channel_ids":[]},{"technology":"IAX2","resource":"demo","state":"unknown","channel_ids":[]}]'
|
36
|
+
http_version:
|
37
|
+
recorded_at: Mon, 01 Sep 2014 13:22:55 GMT
|
38
|
+
recorded_with: VCR 2.9.2
|
data/spec/fixtures/vcr_cassettes/ARI_Client/api_request_endpoints_send_message_returns_data.yml
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/endpoints/sendMessage
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: to=SIP&from=IAX2&body=body&method=put
|
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: 202
|
21
|
+
message: Accepted
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- Asterisk/12.5.0
|
25
|
+
Date:
|
26
|
+
- Mon, 01 Sep 2014 13:25:21 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: Mon, 01 Sep 2014 13:25:21 GMT
|
38
|
+
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/asterisk/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
|
+
- Mon, 01 Sep 2014 11:31:50 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: Mon, 01 Sep 2014 11:31:50 GMT
|
38
|
+
- request:
|
39
|
+
method: get
|
40
|
+
uri: http://asterisk:asterisk@127.0.0.1:8088/ari/asterisk/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
|
+
- Mon, 01 Sep 2014 11:31:50 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: Mon, 01 Sep 2014 11:31:50 GMT
|
73
|
+
recorded_with: VCR 2.9.2
|