ruby_ami 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # develop
2
2
 
3
+ # 1.0.1 - 2012-04-25
4
+ * Bugfix: Actions which do not receive a response within 10s will allow further actions to be executed. Synchronous originate has a 60s timeout.
5
+
3
6
  # 1.0.0 - 2012-03-09
4
7
  * Bugfix: Remove rcov
5
8
  * Bump to 1.0.0 since we're in active use
data/Gemfile CHANGED
@@ -1,9 +1,3 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in ruby_ami.gemspec
4
3
  gemspec
5
-
6
- if RUBY_PLATFORM =~ /darwin/
7
- gem 'growl_notify'
8
- gem 'rb-fsevent'
9
- end
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # RubyAMI
1
+ # RubyAMI [![Build Status](https://secure.travis-ci.org/adhearsion/ruby_ami.png?branch=master)](http://travis-ci.org/adhearsion/ruby_ami)
2
2
  RubyAMI is an AMI client library in Ruby and based on EventMachine with the sole purpose of providing an connection to the Asterisk Manager Interface. RubyAMI does not provide any features beyond connection management and protocol parsing. Actions are sent over the wire, and responses come back via callbacks. It's up to you to match these up into something useful. In this regard, RubyAMI is very similar to [Blather](https://github.com/sprsquish/blather) for XMPP or [Punchblock](https://github.com/adhearsion/punchblock), the Ruby 3PCC library. In fact, Punchblock uses RubyAMI under the covers for its Asterisk implementation, including an implementation of AsyncAGI.
3
3
 
4
4
  ## Installation
@@ -120,6 +120,10 @@ module RubyAMI
120
120
  end
121
121
  alias :== :eql?
122
122
 
123
+ def sync_timeout
124
+ name.downcase == 'originate' && !headers['async'] ? 60 : 10
125
+ end
126
+
123
127
  ##
124
128
  # This class will be removed once this AMI library fully supports all known protocol anomalies.
125
129
  #
@@ -19,7 +19,9 @@ module RubyAMI
19
19
  @actions_write_blocker.wait
20
20
  _send_action action
21
21
  begin
22
- action.response
22
+ action.response action.sync_timeout
23
+ rescue Timeout::Error => e
24
+ logger.error "Timed out waiting for a response to #{action}"
23
25
  rescue RubyAMI::Error
24
26
  nil
25
27
  end
@@ -1,3 +1,3 @@
1
1
  module RubyAMI
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/ruby_ami.gemspec CHANGED
@@ -18,15 +18,15 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
- s.add_runtime_dependency %q<activesupport>, [">= 3.0.9"]
21
+ s.add_runtime_dependency %q<activesupport>, ["~> 3.0"]
22
22
  s.add_runtime_dependency %q<uuidtools>, [">= 0"]
23
23
  s.add_runtime_dependency %q<eventmachine>, [">= 0"]
24
24
  s.add_runtime_dependency %q<future-resource>, [">= 0"]
25
25
  s.add_runtime_dependency %q<girl_friday>, [">= 0"]
26
- s.add_runtime_dependency %q<countdownlatch>, [">= 1.0.0"]
26
+ s.add_runtime_dependency %q<countdownlatch>, ["~> 1.0"]
27
27
  s.add_runtime_dependency %q<i18n>, [">= 0"]
28
28
 
29
- s.add_development_dependency %q<bundler>, ["~> 1.0.0"]
29
+ s.add_development_dependency %q<bundler>, ["~> 1.0"]
30
30
  s.add_development_dependency %q<rspec>, [">= 2.5.0"]
31
31
  s.add_development_dependency %q<cucumber>, [">= 0"]
32
32
  s.add_development_dependency %q<ci_reporter>, [">= 1.6.3"]
@@ -36,4 +36,5 @@ Gem::Specification.new do |s|
36
36
  s.add_development_dependency %q<simplecov>, [">= 0"]
37
37
  s.add_development_dependency %q<simplecov-rcov>, [">= 0"]
38
38
  s.add_development_dependency %q<guard-rspec>
39
+ s.add_development_dependency %q<ruby_gntp>
39
40
  end
@@ -159,5 +159,29 @@ module RubyAMI
159
159
 
160
160
  it { should_not == :foo }
161
161
  end
162
+
163
+ describe "#sync_timeout" do
164
+ it "should be 10 seconds" do
165
+ subject.sync_timeout.should be == 10
166
+ end
167
+
168
+ context "for an asynchronous Originate" do
169
+ let(:name) { 'Originate' }
170
+ let(:headers) { {:async => true} }
171
+
172
+ it "should be 60 seconds" do
173
+ subject.sync_timeout.should be == 10
174
+ end
175
+ end
176
+
177
+ context "for a synchronous Originate" do
178
+ let(:name) { 'Originate' }
179
+ let(:headers) { {:async => false} }
180
+
181
+ it "should be 60 seconds" do
182
+ subject.sync_timeout.should be == 60
183
+ end
184
+ end
185
+ end
162
186
  end # Action
163
187
  end # RubyAMI
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_ami
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,27 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-09 00:00:00.000000000 Z
12
+ date: 2012-04-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &2156179340 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 3.0.9
21
+ version: '3.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2156179340
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: uuidtools
27
- requirement: &2156178740 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *2156178740
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: eventmachine
38
- requirement: &2156178040 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: '0'
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *2156178040
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: future-resource
49
- requirement: &2156152540 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: '0'
55
70
  type: :runtime
56
71
  prerelease: false
57
- version_requirements: *2156152540
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: girl_friday
60
- requirement: &2156151600 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ! '>='
@@ -65,21 +85,31 @@ dependencies:
65
85
  version: '0'
66
86
  type: :runtime
67
87
  prerelease: false
68
- version_requirements: *2156151600
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: countdownlatch
71
- requirement: &2156150780 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
- - - ! '>='
99
+ - - ~>
75
100
  - !ruby/object:Gem::Version
76
- version: 1.0.0
101
+ version: '1.0'
77
102
  type: :runtime
78
103
  prerelease: false
79
- version_requirements: *2156150780
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '1.0'
80
110
  - !ruby/object:Gem::Dependency
81
111
  name: i18n
82
- requirement: &2156150040 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
83
113
  none: false
84
114
  requirements:
85
115
  - - ! '>='
@@ -87,21 +117,31 @@ dependencies:
87
117
  version: '0'
88
118
  type: :runtime
89
119
  prerelease: false
90
- version_requirements: *2156150040
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
91
126
  - !ruby/object:Gem::Dependency
92
127
  name: bundler
93
- requirement: &2156149080 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
94
129
  none: false
95
130
  requirements:
96
131
  - - ~>
97
132
  - !ruby/object:Gem::Version
98
- version: 1.0.0
133
+ version: '1.0'
99
134
  type: :development
100
135
  prerelease: false
101
- version_requirements: *2156149080
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: '1.0'
102
142
  - !ruby/object:Gem::Dependency
103
143
  name: rspec
104
- requirement: &2156147520 !ruby/object:Gem::Requirement
144
+ requirement: !ruby/object:Gem::Requirement
105
145
  none: false
106
146
  requirements:
107
147
  - - ! '>='
@@ -109,10 +149,15 @@ dependencies:
109
149
  version: 2.5.0
110
150
  type: :development
111
151
  prerelease: false
112
- version_requirements: *2156147520
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: 2.5.0
113
158
  - !ruby/object:Gem::Dependency
114
159
  name: cucumber
115
- requirement: &2156146800 !ruby/object:Gem::Requirement
160
+ requirement: !ruby/object:Gem::Requirement
116
161
  none: false
117
162
  requirements:
118
163
  - - ! '>='
@@ -120,10 +165,15 @@ dependencies:
120
165
  version: '0'
121
166
  type: :development
122
167
  prerelease: false
123
- version_requirements: *2156146800
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
124
174
  - !ruby/object:Gem::Dependency
125
175
  name: ci_reporter
126
- requirement: &2156146060 !ruby/object:Gem::Requirement
176
+ requirement: !ruby/object:Gem::Requirement
127
177
  none: false
128
178
  requirements:
129
179
  - - ! '>='
@@ -131,10 +181,15 @@ dependencies:
131
181
  version: 1.6.3
132
182
  type: :development
133
183
  prerelease: false
134
- version_requirements: *2156146060
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: 1.6.3
135
190
  - !ruby/object:Gem::Dependency
136
191
  name: yard
137
- requirement: &2156145420 !ruby/object:Gem::Requirement
192
+ requirement: !ruby/object:Gem::Requirement
138
193
  none: false
139
194
  requirements:
140
195
  - - ~>
@@ -142,10 +197,15 @@ dependencies:
142
197
  version: 0.6.0
143
198
  type: :development
144
199
  prerelease: false
145
- version_requirements: *2156145420
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ~>
204
+ - !ruby/object:Gem::Version
205
+ version: 0.6.0
146
206
  - !ruby/object:Gem::Dependency
147
207
  name: rake
148
- requirement: &2156144640 !ruby/object:Gem::Requirement
208
+ requirement: !ruby/object:Gem::Requirement
149
209
  none: false
150
210
  requirements:
151
211
  - - ! '>='
@@ -153,10 +213,15 @@ dependencies:
153
213
  version: '0'
154
214
  type: :development
155
215
  prerelease: false
156
- version_requirements: *2156144640
216
+ version_requirements: !ruby/object:Gem::Requirement
217
+ none: false
218
+ requirements:
219
+ - - ! '>='
220
+ - !ruby/object:Gem::Version
221
+ version: '0'
157
222
  - !ruby/object:Gem::Dependency
158
223
  name: mocha
159
- requirement: &2156065360 !ruby/object:Gem::Requirement
224
+ requirement: !ruby/object:Gem::Requirement
160
225
  none: false
161
226
  requirements:
162
227
  - - ! '>='
@@ -164,10 +229,15 @@ dependencies:
164
229
  version: '0'
165
230
  type: :development
166
231
  prerelease: false
167
- version_requirements: *2156065360
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ none: false
234
+ requirements:
235
+ - - ! '>='
236
+ - !ruby/object:Gem::Version
237
+ version: '0'
168
238
  - !ruby/object:Gem::Dependency
169
239
  name: simplecov
170
- requirement: &2156064660 !ruby/object:Gem::Requirement
240
+ requirement: !ruby/object:Gem::Requirement
171
241
  none: false
172
242
  requirements:
173
243
  - - ! '>='
@@ -175,10 +245,15 @@ dependencies:
175
245
  version: '0'
176
246
  type: :development
177
247
  prerelease: false
178
- version_requirements: *2156064660
248
+ version_requirements: !ruby/object:Gem::Requirement
249
+ none: false
250
+ requirements:
251
+ - - ! '>='
252
+ - !ruby/object:Gem::Version
253
+ version: '0'
179
254
  - !ruby/object:Gem::Dependency
180
255
  name: simplecov-rcov
181
- requirement: &2156064140 !ruby/object:Gem::Requirement
256
+ requirement: !ruby/object:Gem::Requirement
182
257
  none: false
183
258
  requirements:
184
259
  - - ! '>='
@@ -186,10 +261,31 @@ dependencies:
186
261
  version: '0'
187
262
  type: :development
188
263
  prerelease: false
189
- version_requirements: *2156064140
264
+ version_requirements: !ruby/object:Gem::Requirement
265
+ none: false
266
+ requirements:
267
+ - - ! '>='
268
+ - !ruby/object:Gem::Version
269
+ version: '0'
190
270
  - !ruby/object:Gem::Dependency
191
271
  name: guard-rspec
192
- requirement: &2156063580 !ruby/object:Gem::Requirement
272
+ requirement: !ruby/object:Gem::Requirement
273
+ none: false
274
+ requirements:
275
+ - - ! '>='
276
+ - !ruby/object:Gem::Version
277
+ version: '0'
278
+ type: :development
279
+ prerelease: false
280
+ version_requirements: !ruby/object:Gem::Requirement
281
+ none: false
282
+ requirements:
283
+ - - ! '>='
284
+ - !ruby/object:Gem::Version
285
+ version: '0'
286
+ - !ruby/object:Gem::Dependency
287
+ name: ruby_gntp
288
+ requirement: !ruby/object:Gem::Requirement
193
289
  none: false
194
290
  requirements:
195
291
  - - ! '>='
@@ -197,7 +293,12 @@ dependencies:
197
293
  version: '0'
198
294
  type: :development
199
295
  prerelease: false
200
- version_requirements: *2156063580
296
+ version_requirements: !ruby/object:Gem::Requirement
297
+ none: false
298
+ requirements:
299
+ - - ! '>='
300
+ - !ruby/object:Gem::Version
301
+ version: '0'
201
302
  description: A Ruby client library for the Asterisk Management Interface build on
202
303
  eventmachine.
203
304
  email:
@@ -258,7 +359,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
258
359
  version: '0'
259
360
  segments:
260
361
  - 0
261
- hash: 4125080480231007262
362
+ hash: -2979332282969643621
262
363
  required_rubygems_version: !ruby/object:Gem::Requirement
263
364
  none: false
264
365
  requirements:
@@ -267,10 +368,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
267
368
  version: '0'
268
369
  segments:
269
370
  - 0
270
- hash: 4125080480231007262
371
+ hash: -2979332282969643621
271
372
  requirements: []
272
373
  rubyforge_project: ruby_ami
273
- rubygems_version: 1.8.10
374
+ rubygems_version: 1.8.21
274
375
  signing_key:
275
376
  specification_version: 3
276
377
  summary: Futzing with AMI so you don't have to