adhearsion 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,8 +11,9 @@ module Adhearsion
11
11
  # Converts a config file into a Hash of contexts mapping to two dimensional array of pairs
12
12
  def create_sanitary_hash_from(config_file_content)
13
13
  almost_sanitized = Hash[*config_file_content.
14
+ split("\n"). # Split the lines into an Array
14
15
  grep(/^\s*[^;\s]/). # Grep lines that aren't commented out
15
- join. # Convert them into one String again
16
+ join("\n"). # Convert them into one String again
16
17
  split(SECTION_TITLE). # Separate them into sections
17
18
  map(&:strip). # Remove all whitespace
18
19
  reject(&:empty?). # Get rid of indices that were only whitespace
@@ -98,4 +99,4 @@ module Adhearsion
98
99
  end
99
100
  end
100
101
  end
101
- end
102
+ end
@@ -40,7 +40,7 @@ module Adhearsion
40
40
 
41
41
  def read_configuration
42
42
  normalized_file = self.class.normalize_configuration execute(read_command)
43
- normalized_file.split(/^\[([-_\w]+)\]$/)[1..-1].enum_slice(2).map do |(name,properties)|
43
+ normalized_file.split(/^\[([-_\w]+)\]$/)[1..-1].each_slice(2).map do |(name,properties)|
44
44
  [name, hash_from_properties(properties)]
45
45
  end
46
46
  end
@@ -31,7 +31,7 @@ module Adhearsion
31
31
 
32
32
  CAUSAL_EVENT_NAMES = %w[queuestatus sippeers iaxpeers parkedcalls
33
33
  dahdishowchannels coreshowchannels dbget
34
- status konferencelist] unless defined? CAUSAL_EVENT_NAMES
34
+ status agents konferencelist] unless defined? CAUSAL_EVENT_NAMES
35
35
 
36
36
  RETRY_SLEEP = 5
37
37
 
@@ -364,8 +364,8 @@ module Adhearsion
364
364
  options = options.clone
365
365
  options[:callerid] = options.delete :caller_id if options.has_key? :caller_id
366
366
  options[:exten] = options.delete :extension if options.has_key? :extension
367
- if options[:variables] && options[:variables].kind_of?(Hash)
368
- options[:variable] = options[:variables].map {|pair| pair.join('=')}.join(@coreSettings["ArgumentDelimiter"])
367
+ if options.has_key?(:variables) && options[:variables].kind_of?(Hash)
368
+ options[:variable] = options.delete(:variables).map {|pair| pair.join('=')}.join(@coreSettings["ArgumentDelimiter"])
369
369
  end
370
370
  send_action "Originate", options
371
371
  end
@@ -40,9 +40,10 @@ module Adhearsion
40
40
  @data = ""
41
41
  @current_pointer = 0
42
42
  @ragel_stack = []
43
+ @ami_version = 0.0
43
44
 
44
45
 
45
- # line 46 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb"
46
+ # line 47 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb"
46
47
  class << self
47
48
  attr_accessor :_ami_protocol_parser_actions
48
49
  private :_ami_protocol_parser_actions, :_ami_protocol_parser_actions=
@@ -859,7 +860,7 @@ end
859
860
  self.ami_protocol_parser_en_response_follows = 268;
860
861
 
861
862
 
862
- # line 863 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb"
863
+ # line 864 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb"
863
864
  begin
864
865
  @current_pointer ||= 0
865
866
  @data_ending_pointer ||= @data.length
@@ -870,7 +871,7 @@ begin
870
871
  @ragel_act = 0
871
872
  end
872
873
 
873
- # line 98 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
874
+ # line 99 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
874
875
  ##
875
876
 
876
877
  end
@@ -882,7 +883,7 @@ end
882
883
 
883
884
  def resume!
884
885
 
885
- # line 886 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb"
886
+ # line 887 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb"
886
887
  begin
887
888
  _klen, _trans, _keys, _acts, _nacts = nil
888
889
  _goto_level = 0
@@ -916,7 +917,7 @@ begin
916
917
  begin
917
918
  @token_start = @current_pointer
918
919
  end
919
- # line 920 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb"
920
+ # line 921 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb"
920
921
  end # from state action switch
921
922
  end
922
923
  if _trigger_goto
@@ -936,9 +937,9 @@ begin
936
937
  break if _upper < _lower
937
938
  _mid = _lower + ( (_upper - _lower) >> 1 )
938
939
 
939
- if @data[ @current_pointer] < _ami_protocol_parser_trans_keys[_mid]
940
+ if @data[ @current_pointer].ord < _ami_protocol_parser_trans_keys[_mid]
940
941
  _upper = _mid - 1
941
- elsif @data[ @current_pointer] > _ami_protocol_parser_trans_keys[_mid]
942
+ elsif @data[ @current_pointer].ord > _ami_protocol_parser_trans_keys[_mid]
942
943
  _lower = _mid + 1
943
944
  else
944
945
  _trans += (_mid - _keys)
@@ -957,9 +958,9 @@ begin
957
958
  loop do
958
959
  break if _upper < _lower
959
960
  _mid = _lower + (((_upper-_lower) >> 1) & ~1)
960
- if @data[ @current_pointer] < _ami_protocol_parser_trans_keys[_mid]
961
+ if @data[ @current_pointer].ord < _ami_protocol_parser_trans_keys[_mid]
961
962
  _upper = _mid - 2
962
- elsif @data[ @current_pointer] > _ami_protocol_parser_trans_keys[_mid+1]
963
+ elsif @data[ @current_pointer].ord > _ami_protocol_parser_trans_keys[_mid+1]
963
964
  _lower = _mid + 2
964
965
  else
965
966
  _trans += ((_mid - _keys) >> 1)
@@ -1388,7 +1389,7 @@ end
1388
1389
  end
1389
1390
  end
1390
1391
  end
1391
- # line 1392 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb"
1392
+ # line 1393 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb"
1392
1393
  end # action switch
1393
1394
  end
1394
1395
  end
@@ -1413,7 +1414,7 @@ when 29 then
1413
1414
  begin
1414
1415
  @ragel_act = 0
1415
1416
  end
1416
- # line 1417 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb"
1417
+ # line 1418 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb"
1417
1418
  end # to state action switch
1418
1419
  end
1419
1420
  if _trigger_goto
@@ -1444,7 +1445,7 @@ end
1444
1445
  end
1445
1446
  end
1446
1447
 
1447
- # line 108 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1448
+ # line 109 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1448
1449
  ##
1449
1450
  end
1450
1451
 
@@ -77,6 +77,7 @@ module Adhearsion
77
77
  @data = ""
78
78
  @current_pointer = 0
79
79
  @ragel_stack = []
80
+ @ami_version = 0.0
80
81
 
81
82
  %%{
82
83
  # All other variables become local, letting Ruby garbage collect them. This
@@ -293,6 +293,7 @@ module Adhearsion
293
293
 
294
294
  def define_singleton_accessor_with_pair(key, value, recipient=self)
295
295
  recipient.metaclass.send :attr_accessor, key unless recipient.class.respond_to?("#{key}=")
296
+ recipient.metaclass.send :public, key, "#{key}=".to_sym
296
297
  recipient.send "#{key}=", value
297
298
  end
298
299
 
@@ -456,7 +457,7 @@ module Adhearsion
456
457
  end
457
458
 
458
459
  def separate_line_into_key_value_pair(line)
459
- line.match(/^([^:]+):\s?(.+)/).captures
460
+ line.match(/^([^:]+):(?:\s?(.+)|$)/).captures
460
461
  end
461
462
  end
462
463
 
@@ -15,7 +15,11 @@ begin
15
15
  puts "https://adhearsion.lighthouseapp.com/projects/5871/tickets/92-menu-method-under-jruby-does-not-appear-to-work"
16
16
  puts "****************************************************************************"
17
17
  end
18
- rescue NameError # In case JRUBY_VERSION is not defined.
18
+ rescue NameError
19
+ # In case JRUBY_VERSION is not defined.
20
+ rescue ArgumentError
21
+ # Needed to handle ActiveSupport's handling of missing constants
22
+ # with anonymous modules under Ruby 1.9
19
23
  end
20
24
 
21
25
  module Adhearsion
@@ -45,8 +45,8 @@ module Adhearsion
45
45
 
46
46
  class ContextsEnvelope
47
47
 
48
- keep = %w"define_method instance_eval meta_def meta_eval metaclass"
49
- (instance_methods - keep).each { |m| undef_method m unless m =~ /^__/ }
48
+ keep = [:define_method, :instance_eval, :meta_def, :meta_eval, :metaclass, :methods, :object_id]
49
+ (instance_methods.map{|m| m.to_sym} - keep).each { |m| undef_method m unless m.to_s =~ /^__/ }
50
50
 
51
51
  def initialize
52
52
  @parsed_contexts = {}
@@ -19,7 +19,7 @@ module Adhearsion
19
19
  end
20
20
  end
21
21
 
22
- (instance_methods - %w{instance_eval object_id}).each { |m| undef_method m unless m =~ /^__/ }
22
+ (instance_methods.map{|m| m.to_sym} - [:instance_eval, :object_id, :class]).each { |m| undef_method m unless m.to_s =~ /^__/ }
23
23
 
24
24
  attr_reader :__real_num, :__real_string
25
25
 
@@ -36,6 +36,19 @@ module Adhearsion
36
36
  @__real_string.respond_to?(m) || m == :__real_num || m == :__real_string
37
37
  end
38
38
 
39
+ def ==(x)
40
+ return x.is_a?(Fixnum) ? x == @__real_num : x == @__real_string
41
+ end
42
+ alias :=== :==
43
+
44
+ def is_a?(obj)
45
+ case obj.to_s
46
+ when "Fixnum" then true
47
+ when "String" then true
48
+ end
49
+ end
50
+ alias :kind_of? :is_a?
51
+
39
52
  end
40
53
 
41
54
  # The PhoneNumber class is used by one object throughout Adhearsion: the AGI
@@ -74,7 +87,7 @@ end
74
87
  # These monkey patches are necessary for the NumericalString to work, unfortunately.
75
88
  class Class
76
89
  def alias_method_once(new_name, old_name)
77
- unless instance_methods.include?(new_name.to_s)
90
+ unless instance_methods.map{|m| m.to_sym}.include?(new_name.to_sym)
78
91
  alias_method(new_name, old_name)
79
92
  end
80
93
  end
@@ -112,4 +125,4 @@ class << String
112
125
  def ===(arg)
113
126
  arg.respond_to?(:__real_string) || original_threequal(arg)
114
127
  end
115
- end
128
+ end
@@ -33,7 +33,7 @@ module Adhearsion
33
33
  end
34
34
 
35
35
  def separate_pairs(lines)
36
- lines.inject({}) do |h,line|
36
+ lines.split("\n").inject({}) do |h,line|
37
37
  h.tap do |hash|
38
38
  k,v = line.split(/\s*:\s*/)
39
39
  hash[k] = URI.unescape(v).strip if k && v
@@ -10,7 +10,6 @@ module Adhearsion
10
10
  end
11
11
 
12
12
  def method_missing(match_payload, *patterns, &block)
13
- name_string = match_payload.to_s
14
13
  if patterns.any?
15
14
  patterns.each do |pattern|
16
15
  @patterns << MatchCalculator.build_with_pattern(pattern, match_payload)
@@ -61,7 +61,7 @@ module Theatre
61
61
 
62
62
  class BlankSlateMessageRecorder
63
63
 
64
- (instance_methods - %w{instance_eval object_id}).each { |method| undef_method method unless method =~ /^__/ }
64
+ (instance_methods.map{|m| m.to_sym} - [:instance_eval, :object_id]).each { |method| undef_method method unless method.to_s =~ /^__/ }
65
65
 
66
66
  def initialize(&notify_on_completion)
67
67
  @notify_on_completion = notify_on_completion
@@ -81,4 +81,4 @@ module Theatre
81
81
  end
82
82
 
83
83
  end
84
- end
84
+ end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adhearsion
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
4
  prerelease: false
6
5
  segments:
7
6
  - 1
8
7
  - 0
9
- - 0
10
- version: 1.0.0
8
+ - 1
9
+ version: 1.0.1
11
10
  platform: ruby
12
11
  authors:
13
12
  - Jay Phillips
@@ -17,115 +16,138 @@ autorequire:
17
16
  bindir: bin
18
17
  cert_chain: []
19
18
 
20
- date: 2010-10-28 00:00:00 -04:00
19
+ date: 2011-02-22 00:00:00 -05:00
21
20
  default_executable:
22
21
  dependencies:
23
22
  - !ruby/object:Gem::Dependency
24
- name: log4r
23
+ name: bundler
25
24
  prerelease: false
26
25
  requirement: &id001 !ruby/object:Gem::Requirement
27
26
  none: false
28
27
  requirements:
29
28
  - - ">="
30
29
  - !ruby/object:Gem::Version
31
- hash: 29
32
30
  segments:
33
31
  - 1
34
32
  - 0
35
- - 5
36
- version: 1.0.5
33
+ - 10
34
+ version: 1.0.10
37
35
  type: :runtime
38
36
  version_requirements: *id001
39
37
  - !ruby/object:Gem::Dependency
40
- name: activesupport
38
+ name: log4r
41
39
  prerelease: false
42
40
  requirement: &id002 !ruby/object:Gem::Requirement
43
41
  none: false
44
42
  requirements:
45
43
  - - ">="
46
44
  - !ruby/object:Gem::Version
47
- hash: 11
48
45
  segments:
49
- - 2
50
46
  - 1
51
47
  - 0
52
- version: 2.1.0
48
+ - 5
49
+ version: 1.0.5
53
50
  type: :runtime
54
51
  version_requirements: *id002
55
52
  - !ruby/object:Gem::Dependency
56
- name: rubigen
53
+ name: activesupport
57
54
  prerelease: false
58
55
  requirement: &id003 !ruby/object:Gem::Requirement
59
56
  none: false
60
57
  requirements:
61
58
  - - ">="
62
59
  - !ruby/object:Gem::Version
63
- hash: 27
64
60
  segments:
61
+ - 2
65
62
  - 1
66
63
  - 0
67
- - 6
68
- version: 1.0.6
69
- type: :development
64
+ version: 2.1.0
65
+ type: :runtime
70
66
  version_requirements: *id003
71
67
  - !ruby/object:Gem::Dependency
72
- name: rspec
68
+ name: i18n
73
69
  prerelease: false
74
70
  requirement: &id004 !ruby/object:Gem::Requirement
75
71
  none: false
76
72
  requirements:
77
- - - <
73
+ - - ">="
78
74
  - !ruby/object:Gem::Version
79
- hash: 15
80
75
  segments:
81
- - 2
82
- - 0
83
76
  - 0
84
- version: 2.0.0
85
- type: :development
77
+ version: "0"
78
+ type: :runtime
86
79
  version_requirements: *id004
87
80
  - !ruby/object:Gem::Dependency
88
- name: test-unit
81
+ name: rubigen
89
82
  prerelease: false
90
83
  requirement: &id005 !ruby/object:Gem::Requirement
91
84
  none: false
92
85
  requirements:
93
86
  - - ">="
94
87
  - !ruby/object:Gem::Version
95
- hash: 3
96
88
  segments:
89
+ - 1
90
+ - 5
91
+ - 6
92
+ version: 1.5.6
93
+ type: :runtime
94
+ version_requirements: *id005
95
+ - !ruby/object:Gem::Dependency
96
+ name: rubigen
97
+ prerelease: false
98
+ requirement: &id006 !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ segments:
104
+ - 1
105
+ - 5
106
+ - 6
107
+ version: 1.5.6
108
+ type: :development
109
+ version_requirements: *id006
110
+ - !ruby/object:Gem::Dependency
111
+ name: rspec
112
+ prerelease: false
113
+ requirement: &id007 !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ segments:
119
+ - 2
120
+ - 4
97
121
  - 0
98
- version: "0"
122
+ version: 2.4.0
99
123
  type: :development
100
- version_requirements: *id005
124
+ version_requirements: *id007
101
125
  - !ruby/object:Gem::Dependency
102
126
  name: flexmock
103
127
  prerelease: false
104
- requirement: &id006 !ruby/object:Gem::Requirement
128
+ requirement: &id008 !ruby/object:Gem::Requirement
105
129
  none: false
106
130
  requirements:
107
131
  - - ">="
108
132
  - !ruby/object:Gem::Version
109
- hash: 3
110
133
  segments:
111
134
  - 0
112
135
  version: "0"
113
136
  type: :development
114
- version_requirements: *id006
137
+ version_requirements: *id008
115
138
  - !ruby/object:Gem::Dependency
116
- name: active_record
139
+ name: activerecord
117
140
  prerelease: false
118
- requirement: &id007 !ruby/object:Gem::Requirement
141
+ requirement: &id009 !ruby/object:Gem::Requirement
119
142
  none: false
120
143
  requirements:
121
144
  - - ">="
122
145
  - !ruby/object:Gem::Version
123
- hash: 3
124
146
  segments:
125
147
  - 0
126
148
  version: "0"
127
149
  type: :development
128
- version_requirements: *id007
150
+ version_requirements: *id009
129
151
  description: Adhearsion is an open-source telephony development framework
130
152
  email: dev&Adhearsion.com
131
153
  executables:
@@ -160,6 +182,7 @@ files:
160
182
  - app_generators/ahn/templates/dialplan.rb
161
183
  - app_generators/ahn/templates/events.rb
162
184
  - app_generators/ahn/templates/Rakefile
185
+ - app_generators/ahn/templates/Gemfile
163
186
  - app_generators/ahn/templates/README
164
187
  - app_generators/ahn/USAGE
165
188
  - bin/ahn
@@ -252,11 +275,12 @@ files:
252
275
  - lib/theatre/version.rb
253
276
  - LICENSE
254
277
  - Rakefile
278
+ - Gemfile
255
279
  has_rdoc: true
256
280
  homepage: http://adhearsion.com
257
281
  licenses: []
258
282
 
259
- post_install_message: " *******************************************************************\n * NOTE: You must manually install the \"rubigen\" gem to create *\n * new Adhearsion applications. *\n * *\n * The Rubigen package is no longer automatically installed due to *\n * dependency conflicts with ActiveSupport 3.0. *\n * Users of existing Adhearsion applications can safely ignore *\n * this message. *\n *******************************************************************\n"
283
+ post_install_message:
260
284
  rdoc_options: []
261
285
 
262
286
  require_paths:
@@ -266,7 +290,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
266
290
  requirements:
267
291
  - - ">="
268
292
  - !ruby/object:Gem::Version
269
- hash: 3
270
293
  segments:
271
294
  - 0
272
295
  version: "0"
@@ -275,7 +298,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
275
298
  requirements:
276
299
  - - ">="
277
300
  - !ruby/object:Gem::Version
278
- hash: 3
279
301
  segments:
280
302
  - 0
281
303
  version: "0"