asterisk-ari-client 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 +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +85 -0
- data/Rakefile +54 -0
- data/asterisk-ari-client.gemspec +32 -0
- data/examples/list_channels.rb +14 -0
- data/examples/websocket.rb +33 -0
- data/lib/ari.rb +12 -0
- data/lib/ari/client.rb +124 -0
- data/lib/ari/generators/api.rb +23 -0
- data/lib/ari/generators/attribute.rb +35 -0
- data/lib/ari/generators/model.rb +38 -0
- data/lib/ari/generators/operation.rb +43 -0
- data/lib/ari/generators/parameter.rb +35 -0
- data/lib/ari/generators/property.rb +32 -0
- data/lib/ari/generators/resource_generator.rb +94 -0
- data/lib/ari/generators/templates/model.rb.erb +36 -0
- data/lib/ari/generators/templates/resource.rb.erb +97 -0
- data/lib/ari/list_resource.rb +23 -0
- data/lib/ari/model.rb +26 -0
- data/lib/ari/models.rb +47 -0
- data/lib/ari/models/.DS_Store +0 -0
- data/lib/ari/models/application_replaced.rb +17 -0
- data/lib/ari/models/asterisk_info.rb +35 -0
- data/lib/ari/models/bridge_attended_transfer.rb +63 -0
- data/lib/ari/models/bridge_blind_transfer.rb +35 -0
- data/lib/ari/models/bridge_created.rb +23 -0
- data/lib/ari/models/bridge_destroyed.rb +23 -0
- data/lib/ari/models/bridge_merged.rb +27 -0
- data/lib/ari/models/build_info.rb +19 -0
- data/lib/ari/models/caller_id.rb +19 -0
- data/lib/ari/models/channel_caller_id.rb +23 -0
- data/lib/ari/models/channel_created.rb +23 -0
- data/lib/ari/models/channel_destroyed.rb +23 -0
- data/lib/ari/models/channel_dialplan.rb +23 -0
- data/lib/ari/models/channel_dtmf_received.rb +23 -0
- data/lib/ari/models/channel_entered_bridge.rb +27 -0
- data/lib/ari/models/channel_hangup_request.rb +23 -0
- data/lib/ari/models/channel_left_bridge.rb +27 -0
- data/lib/ari/models/channel_state_change.rb +23 -0
- data/lib/ari/models/channel_talking_finished.rb +23 -0
- data/lib/ari/models/channel_talking_started.rb +23 -0
- data/lib/ari/models/channel_userevent.rb +35 -0
- data/lib/ari/models/channel_varset.rb +23 -0
- data/lib/ari/models/config_info.rb +27 -0
- data/lib/ari/models/device_state_changed.rb +23 -0
- data/lib/ari/models/dial.rb +31 -0
- data/lib/ari/models/dialed.rb +17 -0
- data/lib/ari/models/dialplan_cep.rb +19 -0
- data/lib/ari/models/endpoint_state_change.rb +23 -0
- data/lib/ari/models/format_lang_pair.rb +19 -0
- data/lib/ari/models/live_recording.rb +19 -0
- data/lib/ari/models/message.rb +19 -0
- data/lib/ari/models/missing_params.rb +19 -0
- data/lib/ari/models/playback_finished.rb +23 -0
- data/lib/ari/models/playback_started.rb +23 -0
- data/lib/ari/models/recording_failed.rb +23 -0
- data/lib/ari/models/recording_finished.rb +23 -0
- data/lib/ari/models/recording_started.rb +23 -0
- data/lib/ari/models/set_id.rb +19 -0
- data/lib/ari/models/stasis_end.rb +23 -0
- data/lib/ari/models/stasis_start.rb +27 -0
- data/lib/ari/models/status_info.rb +27 -0
- data/lib/ari/models/stored_recording.rb +19 -0
- data/lib/ari/models/system_info.rb +19 -0
- data/lib/ari/models/text_message.rb +23 -0
- data/lib/ari/models/text_message_received.rb +27 -0
- data/lib/ari/models/text_message_variable.rb +19 -0
- data/lib/ari/models/variable.rb +19 -0
- data/lib/ari/request_error.rb +8 -0
- data/lib/ari/resource.rb +37 -0
- data/lib/ari/resources.rb +11 -0
- data/lib/ari/resources/application.rb +101 -0
- data/lib/ari/resources/asterisk.rb +72 -0
- data/lib/ari/resources/bridge.rb +286 -0
- data/lib/ari/resources/channel.rb +610 -0
- data/lib/ari/resources/device_state.rb +98 -0
- data/lib/ari/resources/endpoint.rb +124 -0
- data/lib/ari/resources/event.rb +25 -0
- data/lib/ari/resources/mailbox.rb +99 -0
- data/lib/ari/resources/playback.rb +86 -0
- data/lib/ari/resources/recording.rb +241 -0
- data/lib/ari/resources/sound.rb +64 -0
- data/lib/ari/server_error.rb +8 -0
- data/lib/asterisk/ari/client.rb +10 -0
- data/lib/asterisk/ari/client/version.rb +7 -0
- data/test/fixtures/bridge_create.json +74 -0
- data/test/fixtures/bridge_get.json +74 -0
- data/test/fixtures/bridges_list.json +76 -0
- data/test/fixtures/channel_get.json +83 -0
- data/test/fixtures/channel_originate.json +83 -0
- data/test/fixtures/channel_originate_with_id.json +83 -0
- data/test/fixtures/channels_list.json +105 -0
- data/test/lib/asterisk-ari-client/.DS_Store +0 -0
- data/test/lib/asterisk-ari-client/bridge_test.rb +46 -0
- data/test/lib/asterisk-ari-client/channel_test.rb +59 -0
- data/test/test_helper.rb +42 -0
- metadata +265 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
#------------------------------------------------------------------------------
|
2
|
+
#
|
3
|
+
# WARNING !
|
4
|
+
#
|
5
|
+
# This is a generated file. DO NOT EDIT THIS FILE! Your changes will
|
6
|
+
# be lost the next time this file is regenerated.
|
7
|
+
#
|
8
|
+
# This file was generated using asterisk-ari-client ruby gem.
|
9
|
+
#
|
10
|
+
#------------------------------------------------------------------------------
|
11
|
+
|
12
|
+
module Ari
|
13
|
+
class Sound < Resource
|
14
|
+
|
15
|
+
attr_reader :id, :text, :formats
|
16
|
+
|
17
|
+
def formats=(val)
|
18
|
+
@formats ||= FormatLangPair.new(val)
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
# GET /sounds
|
23
|
+
#
|
24
|
+
# Sounds
|
25
|
+
#
|
26
|
+
#
|
27
|
+
# Parameters:
|
28
|
+
#
|
29
|
+
# lang - Lookup sound for a specific language.
|
30
|
+
# format - Lookup sound in a specific format.
|
31
|
+
#
|
32
|
+
def self.list(options = {})
|
33
|
+
path = '/sounds'
|
34
|
+
response = client(options).get(path, options)
|
35
|
+
response.map { |hash| Sound.new(hash.merge(client: options[:client])) }
|
36
|
+
end
|
37
|
+
|
38
|
+
# GET /sounds/%{soundId}
|
39
|
+
#
|
40
|
+
# Individual sound
|
41
|
+
#
|
42
|
+
#
|
43
|
+
# Parameters:
|
44
|
+
#
|
45
|
+
# soundId (required) - Sound's id
|
46
|
+
#
|
47
|
+
def self.get(options = {})
|
48
|
+
raise ArgumentError.new("Parameter soundId must be passed in options hash.") unless options[:soundId]
|
49
|
+
path = '/sounds/%{soundId}' % options
|
50
|
+
response = client(options).get(path, options)
|
51
|
+
Sound.new(response.merge(client: options[:client]))
|
52
|
+
end
|
53
|
+
|
54
|
+
def get(options = {})
|
55
|
+
self.class.get(options.merge(soundId: self.id, client: @client))
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
Ari::Client.send :define_method, 'sounds' do
|
63
|
+
Ari::ListResource.new(self, Ari::Sound)
|
64
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
{
|
2
|
+
"http_interactions": [
|
3
|
+
{
|
4
|
+
"request": {
|
5
|
+
"method": "post",
|
6
|
+
"uri": "http://192.168.1.23:8088/ari/bridges?api_key=asterisk:asterisk&app=dialplan&type=mixing,dtmf_events,proxy_media",
|
7
|
+
"body": {
|
8
|
+
"encoding": "UTF-8",
|
9
|
+
"string": ""
|
10
|
+
},
|
11
|
+
"headers": {
|
12
|
+
"Content-Type": [
|
13
|
+
"json"
|
14
|
+
],
|
15
|
+
"Accept": [
|
16
|
+
"application/json"
|
17
|
+
],
|
18
|
+
"Accept-Charset": [
|
19
|
+
"utf-8"
|
20
|
+
],
|
21
|
+
"User-Agent": [
|
22
|
+
"asterisk-ari-client/0.0.1 ruby/2.2.0"
|
23
|
+
],
|
24
|
+
"Accept-Encoding": [
|
25
|
+
"gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
|
26
|
+
]
|
27
|
+
}
|
28
|
+
},
|
29
|
+
"response": {
|
30
|
+
"status": {
|
31
|
+
"code": 200,
|
32
|
+
"message": "OK"
|
33
|
+
},
|
34
|
+
"headers": {
|
35
|
+
"Server": [
|
36
|
+
"Asterisk/12.5.0"
|
37
|
+
],
|
38
|
+
"Date": [
|
39
|
+
"Sun, 05 Oct 2014 11:25:39 GMT"
|
40
|
+
],
|
41
|
+
"Connection": [
|
42
|
+
"close"
|
43
|
+
],
|
44
|
+
"Cache-Control": [
|
45
|
+
"no-cache, no-store"
|
46
|
+
],
|
47
|
+
"Content-Type": [
|
48
|
+
"application/json"
|
49
|
+
],
|
50
|
+
"Content-Length": [
|
51
|
+
"164"
|
52
|
+
]
|
53
|
+
},
|
54
|
+
"body": {
|
55
|
+
"encoding": "UTF-8",
|
56
|
+
"string": {
|
57
|
+
"id": "310e4c2d-85cc-4267-90e4-491217040d80",
|
58
|
+
"channels": [
|
59
|
+
|
60
|
+
],
|
61
|
+
"name": "",
|
62
|
+
"technology": "simple_bridge",
|
63
|
+
"bridge_class": "stasis",
|
64
|
+
"creator": "Stasis",
|
65
|
+
"bridge_type": "mixing"
|
66
|
+
}
|
67
|
+
},
|
68
|
+
"http_version": null
|
69
|
+
},
|
70
|
+
"recorded_at": "Mon, 06 Oct 2014 17:55:00 GMT"
|
71
|
+
}
|
72
|
+
],
|
73
|
+
"recorded_with": "VCR 2.9.3"
|
74
|
+
}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
{
|
2
|
+
"http_interactions": [
|
3
|
+
{
|
4
|
+
"request": {
|
5
|
+
"method": "get",
|
6
|
+
"uri": "http://192.168.1.23:8088/ari/bridges/310e4c2d-85cc-4267-90e4-491217040d80?api_key=asterisk:asterisk&app=dialplan&bridgeId=310e4c2d-85cc-4267-90e4-491217040d80",
|
7
|
+
"body": {
|
8
|
+
"encoding": "US-ASCII",
|
9
|
+
"string": ""
|
10
|
+
},
|
11
|
+
"headers": {
|
12
|
+
"Content-Type": [
|
13
|
+
"json"
|
14
|
+
],
|
15
|
+
"Accept": [
|
16
|
+
"application/json"
|
17
|
+
],
|
18
|
+
"Accept-Charset": [
|
19
|
+
"utf-8"
|
20
|
+
],
|
21
|
+
"User-Agent": [
|
22
|
+
"asterisk-ari-client/0.0.1 ruby/2.2.0"
|
23
|
+
],
|
24
|
+
"Accept-Encoding": [
|
25
|
+
"gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
|
26
|
+
]
|
27
|
+
}
|
28
|
+
},
|
29
|
+
"response": {
|
30
|
+
"status": {
|
31
|
+
"code": 200,
|
32
|
+
"message": "OK"
|
33
|
+
},
|
34
|
+
"headers": {
|
35
|
+
"Server": [
|
36
|
+
"Asterisk/12.5.0"
|
37
|
+
],
|
38
|
+
"Date": [
|
39
|
+
"Sun, 05 Oct 2014 11:28:11 GMT"
|
40
|
+
],
|
41
|
+
"Connection": [
|
42
|
+
"close"
|
43
|
+
],
|
44
|
+
"Cache-Control": [
|
45
|
+
"no-cache, no-store"
|
46
|
+
],
|
47
|
+
"Content-Type": [
|
48
|
+
"application/json"
|
49
|
+
],
|
50
|
+
"Content-Length": [
|
51
|
+
"164"
|
52
|
+
]
|
53
|
+
},
|
54
|
+
"body": {
|
55
|
+
"encoding": "UTF-8",
|
56
|
+
"string": {
|
57
|
+
"id": "310e4c2d-85cc-4267-90e4-491217040d80",
|
58
|
+
"channels": [
|
59
|
+
|
60
|
+
],
|
61
|
+
"name": "",
|
62
|
+
"technology": "simple_bridge",
|
63
|
+
"bridge_class": "stasis",
|
64
|
+
"creator": "Stasis",
|
65
|
+
"bridge_type": "mixing"
|
66
|
+
}
|
67
|
+
},
|
68
|
+
"http_version": null
|
69
|
+
},
|
70
|
+
"recorded_at": "Mon, 06 Oct 2014 17:57:31 GMT"
|
71
|
+
}
|
72
|
+
],
|
73
|
+
"recorded_with": "VCR 2.9.3"
|
74
|
+
}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
{
|
2
|
+
"http_interactions": [
|
3
|
+
{
|
4
|
+
"request": {
|
5
|
+
"method": "get",
|
6
|
+
"uri": "http://192.168.1.23:8088/ari/bridges?api_key=asterisk:asterisk&app=dialplan",
|
7
|
+
"body": {
|
8
|
+
"encoding": "US-ASCII",
|
9
|
+
"string": ""
|
10
|
+
},
|
11
|
+
"headers": {
|
12
|
+
"Content-Type": [
|
13
|
+
"json"
|
14
|
+
],
|
15
|
+
"Accept": [
|
16
|
+
"application/json"
|
17
|
+
],
|
18
|
+
"Accept-Charset": [
|
19
|
+
"utf-8"
|
20
|
+
],
|
21
|
+
"User-Agent": [
|
22
|
+
"asterisk-ari-client/0.0.1 ruby/2.2.0"
|
23
|
+
],
|
24
|
+
"Accept-Encoding": [
|
25
|
+
"gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
|
26
|
+
]
|
27
|
+
}
|
28
|
+
},
|
29
|
+
"response": {
|
30
|
+
"status": {
|
31
|
+
"code": 200,
|
32
|
+
"message": "OK"
|
33
|
+
},
|
34
|
+
"headers": {
|
35
|
+
"Server": [
|
36
|
+
"Asterisk/12.5.0"
|
37
|
+
],
|
38
|
+
"Date": [
|
39
|
+
"Sun, 05 Oct 2014 11:19:10 GMT"
|
40
|
+
],
|
41
|
+
"Connection": [
|
42
|
+
"close"
|
43
|
+
],
|
44
|
+
"Cache-Control": [
|
45
|
+
"no-cache, no-store"
|
46
|
+
],
|
47
|
+
"Content-Type": [
|
48
|
+
"application/json"
|
49
|
+
],
|
50
|
+
"Content-Length": [
|
51
|
+
"166"
|
52
|
+
]
|
53
|
+
},
|
54
|
+
"body": {
|
55
|
+
"encoding": "UTF-8",
|
56
|
+
"string": [
|
57
|
+
{
|
58
|
+
"id": "88301dbb-538a-4460-9c5d-bb659c48b320",
|
59
|
+
"channels": [
|
60
|
+
|
61
|
+
],
|
62
|
+
"name": "",
|
63
|
+
"technology": "simple_bridge",
|
64
|
+
"bridge_class": "stasis",
|
65
|
+
"creator": "Stasis",
|
66
|
+
"bridge_type": "mixing"
|
67
|
+
}
|
68
|
+
]
|
69
|
+
},
|
70
|
+
"http_version": null
|
71
|
+
},
|
72
|
+
"recorded_at": "Mon, 06 Oct 2014 17:48:31 GMT"
|
73
|
+
}
|
74
|
+
],
|
75
|
+
"recorded_with": "VCR 2.9.3"
|
76
|
+
}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
{
|
2
|
+
"http_interactions": [
|
3
|
+
{
|
4
|
+
"request": {
|
5
|
+
"method": "get",
|
6
|
+
"uri": "http://192.168.1.23:8088/ari/channels/1412509919.30?api_key=asterisk:asterisk&app=dialplan&channelId=1412509919.30",
|
7
|
+
"body": {
|
8
|
+
"encoding": "US-ASCII",
|
9
|
+
"string": ""
|
10
|
+
},
|
11
|
+
"headers": {
|
12
|
+
"Content-Type": [
|
13
|
+
"json"
|
14
|
+
],
|
15
|
+
"Accept": [
|
16
|
+
"application/json"
|
17
|
+
],
|
18
|
+
"Accept-Charset": [
|
19
|
+
"utf-8"
|
20
|
+
],
|
21
|
+
"User-Agent": [
|
22
|
+
"asterisk-ari-client/0.0.1 ruby/2.2.0"
|
23
|
+
],
|
24
|
+
"Accept-Encoding": [
|
25
|
+
"gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
|
26
|
+
]
|
27
|
+
}
|
28
|
+
},
|
29
|
+
"response": {
|
30
|
+
"status": {
|
31
|
+
"code": 200,
|
32
|
+
"message": "OK"
|
33
|
+
},
|
34
|
+
"headers": {
|
35
|
+
"Server": [
|
36
|
+
"Asterisk/12.5.0"
|
37
|
+
],
|
38
|
+
"Date": [
|
39
|
+
"Sun, 05 Oct 2014 11:52:24 GMT"
|
40
|
+
],
|
41
|
+
"Connection": [
|
42
|
+
"close"
|
43
|
+
],
|
44
|
+
"Cache-Control": [
|
45
|
+
"no-cache, no-store"
|
46
|
+
],
|
47
|
+
"Content-Type": [
|
48
|
+
"application/json"
|
49
|
+
],
|
50
|
+
"Content-Length": [
|
51
|
+
"301"
|
52
|
+
]
|
53
|
+
},
|
54
|
+
"body": {
|
55
|
+
"encoding": "UTF-8",
|
56
|
+
"string": {
|
57
|
+
"id": "1412509919.30",
|
58
|
+
"state": "Ringing",
|
59
|
+
"name": "PJSIP/1ca410-mac-0000000f",
|
60
|
+
"caller": {
|
61
|
+
"name": "",
|
62
|
+
"number": ""
|
63
|
+
},
|
64
|
+
"connected": {
|
65
|
+
"name": "",
|
66
|
+
"number": ""
|
67
|
+
},
|
68
|
+
"accountcode": "1ca4106c-20b2-11e4-9f50-03cba5fbf325",
|
69
|
+
"dialplan": {
|
70
|
+
"context": "default",
|
71
|
+
"exten": "s",
|
72
|
+
"priority": 1
|
73
|
+
},
|
74
|
+
"creationtime": "2014-10-05T11:51:59.997+0000"
|
75
|
+
}
|
76
|
+
},
|
77
|
+
"http_version": null
|
78
|
+
},
|
79
|
+
"recorded_at": "Mon, 06 Oct 2014 18:21:44 GMT"
|
80
|
+
}
|
81
|
+
],
|
82
|
+
"recorded_with": "VCR 2.9.3"
|
83
|
+
}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
{
|
2
|
+
"http_interactions": [
|
3
|
+
{
|
4
|
+
"request": {
|
5
|
+
"method": "post",
|
6
|
+
"uri": "http://192.168.1.23:8088/ari/channels?api_key=asterisk:asterisk&app=dialplan&endpoint=PJSIP/1ca410-mac&extension=11",
|
7
|
+
"body": {
|
8
|
+
"encoding": "UTF-8",
|
9
|
+
"string": ""
|
10
|
+
},
|
11
|
+
"headers": {
|
12
|
+
"Content-Type": [
|
13
|
+
"json"
|
14
|
+
],
|
15
|
+
"Accept": [
|
16
|
+
"application/json"
|
17
|
+
],
|
18
|
+
"Accept-Charset": [
|
19
|
+
"utf-8"
|
20
|
+
],
|
21
|
+
"User-Agent": [
|
22
|
+
"asterisk-ari-client/0.0.1 ruby/2.2.0"
|
23
|
+
],
|
24
|
+
"Accept-Encoding": [
|
25
|
+
"gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
|
26
|
+
]
|
27
|
+
}
|
28
|
+
},
|
29
|
+
"response": {
|
30
|
+
"status": {
|
31
|
+
"code": 200,
|
32
|
+
"message": "OK"
|
33
|
+
},
|
34
|
+
"headers": {
|
35
|
+
"Server": [
|
36
|
+
"Asterisk/12.5.0"
|
37
|
+
],
|
38
|
+
"Date": [
|
39
|
+
"Sun, 05 Oct 2014 04:37:53 GMT"
|
40
|
+
],
|
41
|
+
"Connection": [
|
42
|
+
"close"
|
43
|
+
],
|
44
|
+
"Cache-Control": [
|
45
|
+
"no-cache, no-store"
|
46
|
+
],
|
47
|
+
"Content-Type": [
|
48
|
+
"application/json"
|
49
|
+
],
|
50
|
+
"Content-Length": [
|
51
|
+
"298"
|
52
|
+
]
|
53
|
+
},
|
54
|
+
"body": {
|
55
|
+
"encoding": "UTF-8",
|
56
|
+
"string": {
|
57
|
+
"id": "1412483873.19",
|
58
|
+
"state": "Down",
|
59
|
+
"name": "PJSIP/1ca410-mac-0000000a",
|
60
|
+
"caller": {
|
61
|
+
"name": "",
|
62
|
+
"number": ""
|
63
|
+
},
|
64
|
+
"connected": {
|
65
|
+
"name": "",
|
66
|
+
"number": ""
|
67
|
+
},
|
68
|
+
"accountcode": "1ca4106c-20b2-11e4-9f50-03cba5fbf325",
|
69
|
+
"dialplan": {
|
70
|
+
"context": "default",
|
71
|
+
"exten": "s",
|
72
|
+
"priority": 1
|
73
|
+
},
|
74
|
+
"creationtime": "2014-10-05T04:37:53.366+0000"
|
75
|
+
}
|
76
|
+
},
|
77
|
+
"http_version": null
|
78
|
+
},
|
79
|
+
"recorded_at": "Sun, 05 Oct 2014 18:43:11 GMT"
|
80
|
+
}
|
81
|
+
],
|
82
|
+
"recorded_with": "VCR 2.9.3"
|
83
|
+
}
|