punchblock 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # [develop](https://github.com/adhearsion/punchblock)
2
2
 
3
+ # [v1.5.1](https://github.com/adhearsion/punchblock/compare/v1.5.0...v1.5.1) - [2012-10-11](https://rubygems.org/gems/punchblock/versions/1.5.1)
4
+ * Update: Bump Celluloid dependency
5
+ * Bugfix: Input grammars referenced by URL now no longer specify a content type
6
+ * Bugfix: FreeSWITCH `Dial#from` values now parsed more flexibly
7
+
3
8
  # [v1.5.0](https://github.com/adhearsion/punchblock/compare/v1.4.1...v1.5.0) - [2012-10-01](https://rubygems.org/gems/punchblock/versions/1.5.0)
4
9
  * Feature: Input component now supports grammar URLs
5
10
  * Bugfix: Hanging up Asterisk calls now correctly specifies normal clearing cause
@@ -205,7 +205,8 @@ module Punchblock
205
205
  # @param [String] content_type Defaults to GRXML
206
206
  #
207
207
  def content_type=(content_type)
208
- write_attr 'content-type', content_type || grxml_content_type
208
+ return unless content_type
209
+ write_attr 'content-type', content_type
209
210
  end
210
211
 
211
212
  ##
@@ -223,6 +224,7 @@ module Punchblock
223
224
  # @param [String, RubySpeech::GRXML::Grammar] value the grammar document
224
225
  def value=(value)
225
226
  return unless value
227
+ self.content_type = grxml_content_type unless self.content_type
226
228
  if grxml? && !value.is_a?(RubySpeech::GRXML::Element)
227
229
  value = RubySpeech::GRXML.import value
228
230
  end
@@ -127,17 +127,17 @@ module Punchblock
127
127
  @direction = :outbound
128
128
 
129
129
  cid_number, cid_name = dial_command.from, nil
130
- dial_command.from.match(/(?<cid_name>.*) <(?<cid_number>.*)>/) do |m|
131
- cid_name = m[:cid_name]
130
+ dial_command.from.match(/(?<cid_name>.*)<(?<cid_number>.*)>/) do |m|
131
+ cid_name = m[:cid_name].strip
132
132
  cid_number = m[:cid_number]
133
133
  end
134
134
 
135
135
  options = {
136
- :return_ring_ready => true,
137
- :origination_uuid => id,
138
- :origination_caller_id_number => "'#{cid_number}'"
136
+ :return_ring_ready => true,
137
+ :origination_uuid => id
139
138
  }
140
- options[:origination_caller_id_name] = "'#{cid_name}'" if cid_name
139
+ options[:origination_caller_id_number] = "'#{cid_number}'" if cid_number.present?
140
+ options[:origination_caller_id_name] = "'#{cid_name}'" if cid_name.present?
141
141
  options[:originate_timeout] = dial_command.timeout/1000 if dial_command.timeout
142
142
  opts = options.inject([]) do |a, (k, v)|
143
143
  a << "#{k}=#{v}"
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Punchblock
4
- VERSION = "1.5.0"
4
+ VERSION = "1.5.1"
5
5
  end
data/punchblock.gemspec CHANGED
@@ -28,9 +28,9 @@ Gem::Specification.new do |s|
28
28
  s.add_runtime_dependency %q<state_machine>, ["~> 1.0"]
29
29
  s.add_runtime_dependency %q<future-resource>, ["~> 1.0"]
30
30
  s.add_runtime_dependency %q<has-guarded-handlers>, ["~> 1.3"]
31
- s.add_runtime_dependency %q<celluloid>, ["~> 0.11.1"]
32
- s.add_runtime_dependency %q<ruby_ami>, ["~> 1.2", ">= 1.2.1", "< 1.2.2"]
33
- s.add_runtime_dependency %q<ruby_fs>, ["~> 1.0", "< 1.0.1"]
31
+ s.add_runtime_dependency %q<celluloid>, ["~> 0.12", ">= 0.12.1"]
32
+ s.add_runtime_dependency %q<ruby_ami>, ["~> 1.2", ">= 1.2.1"]
33
+ s.add_runtime_dependency %q<ruby_fs>, ["~> 1.0"]
34
34
  s.add_runtime_dependency %q<ruby_speech>, ["~> 1.0"]
35
35
 
36
36
  s.add_development_dependency %q<bundler>, ["~> 1.0"]
@@ -122,7 +122,8 @@ module Punchblock
122
122
 
123
123
  subject { Input::Grammar.new :url => url }
124
124
 
125
- its(:url) { should be == url }
125
+ its(:url) { should be == url }
126
+ its(:content_type) { should be nil}
126
127
 
127
128
  describe "comparison" do
128
129
  it "should be the same with the same url" do
@@ -249,6 +249,36 @@ module Punchblock
249
249
  end
250
250
  end
251
251
 
252
+ context 'with a name and empty channel in the from field' do
253
+ let(:from_name) { 'Jane Smith' }
254
+ let(:from_number) { '' }
255
+ let(:from) { "#{from_name} <#{from_number}>" }
256
+
257
+ it 'sends an originate bgapi command with the cid fields set correctly' do
258
+ stream.expects(:bgapi).once.with "originate {return_ring_ready=true,origination_uuid=#{subject.id},origination_caller_id_name='#{from_name}'}#{to} &park()"
259
+ subject.dial dial_command
260
+ end
261
+ end
262
+
263
+ context 'with a number in the from field with angled brackets' do
264
+ let(:from_number) { '1001' }
265
+ let(:from) { "<#{from_number}>" }
266
+
267
+ it 'sends an originate bgapi command with the cid fields set correctly' do
268
+ stream.expects(:bgapi).once.with "originate {return_ring_ready=true,origination_uuid=#{subject.id},origination_caller_id_number='#{from_number}'}#{to} &park()"
269
+ subject.dial dial_command
270
+ end
271
+ end
272
+
273
+ context 'with an empty from attribute' do
274
+ let(:from) { '' }
275
+
276
+ it 'sends an originate bgapi command with the cid fields set correctly' do
277
+ stream.expects(:bgapi).once.with "originate {return_ring_ready=true,origination_uuid=#{subject.id}}#{to} &park()"
278
+ subject.dial dial_command
279
+ end
280
+ end
281
+
252
282
  context 'with a timeout specified' do
253
283
  let :dial_command_options do
254
284
  { :timeout => 10000 }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: punchblock
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-10-01 00:00:00.000000000 Z
14
+ date: 2012-10-11 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: niceogiri
@@ -116,7 +116,10 @@ dependencies:
116
116
  requirements:
117
117
  - - ~>
118
118
  - !ruby/object:Gem::Version
119
- version: 0.11.1
119
+ version: '0.12'
120
+ - - ! '>='
121
+ - !ruby/object:Gem::Version
122
+ version: 0.12.1
120
123
  type: :runtime
121
124
  prerelease: false
122
125
  version_requirements: !ruby/object:Gem::Requirement
@@ -124,7 +127,10 @@ dependencies:
124
127
  requirements:
125
128
  - - ~>
126
129
  - !ruby/object:Gem::Version
127
- version: 0.11.1
130
+ version: '0.12'
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: 0.12.1
128
134
  - !ruby/object:Gem::Dependency
129
135
  name: ruby_ami
130
136
  requirement: !ruby/object:Gem::Requirement
@@ -136,9 +142,6 @@ dependencies:
136
142
  - - ! '>='
137
143
  - !ruby/object:Gem::Version
138
144
  version: 1.2.1
139
- - - <
140
- - !ruby/object:Gem::Version
141
- version: 1.2.2
142
145
  type: :runtime
143
146
  prerelease: false
144
147
  version_requirements: !ruby/object:Gem::Requirement
@@ -150,9 +153,6 @@ dependencies:
150
153
  - - ! '>='
151
154
  - !ruby/object:Gem::Version
152
155
  version: 1.2.1
153
- - - <
154
- - !ruby/object:Gem::Version
155
- version: 1.2.2
156
156
  - !ruby/object:Gem::Dependency
157
157
  name: ruby_fs
158
158
  requirement: !ruby/object:Gem::Requirement
@@ -161,9 +161,6 @@ dependencies:
161
161
  - - ~>
162
162
  - !ruby/object:Gem::Version
163
163
  version: '1.0'
164
- - - <
165
- - !ruby/object:Gem::Version
166
- version: 1.0.1
167
164
  type: :runtime
168
165
  prerelease: false
169
166
  version_requirements: !ruby/object:Gem::Requirement
@@ -172,9 +169,6 @@ dependencies:
172
169
  - - ~>
173
170
  - !ruby/object:Gem::Version
174
171
  version: '1.0'
175
- - - <
176
- - !ruby/object:Gem::Version
177
- version: 1.0.1
178
172
  - !ruby/object:Gem::Dependency
179
173
  name: ruby_speech
180
174
  requirement: !ruby/object:Gem::Requirement
@@ -521,7 +515,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
521
515
  version: '0'
522
516
  segments:
523
517
  - 0
524
- hash: -689196999409732364
518
+ hash: -2734494276677076274
525
519
  required_rubygems_version: !ruby/object:Gem::Requirement
526
520
  none: false
527
521
  requirements: