adhearsion 0.8.1 → 0.8.2

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 CHANGED
@@ -1,3 +1,11 @@
1
+ 0.8.2
2
+ - ManagerInterfaceResponse now include()s DRbUndumped, allowing send_action() to be called directly over DRb.
3
+ - Fixes an inconsequential bug when CTL-C'ing Adhearsion.
4
+
5
+ 0.8.1
6
+ - The sandbox component now comes
7
+ - Minor bug fixes
8
+
1
9
  0.8.0 rev 2
2
10
  - Added a few non-critical files to the .gemspec. They were ignored
3
11
 
data/EVENTS CHANGED
@@ -6,6 +6,6 @@
6
6
  - manager_interface
7
7
  - before_call
8
8
  - failed_call
9
- - call_hangup
9
+ - hungup_call
10
10
 
11
- # Note: This file is valid YAML for programatic parsing.
11
+ # Note: This file is valid YAML for programatic parsing.
data/Rakefile CHANGED
@@ -118,3 +118,10 @@ task :debug_gem do
118
118
  Thread.new { spec = eval("$SAFE = 3\n#{gemspec}") }.join
119
119
  puts "SUCCESS: Gemspec runs at the $SAFE level 3."
120
120
  end
121
+
122
+ desc 'Install the package as a gem.'
123
+ task :install_gem => [:clobber_package, :package] do
124
+ windows = /djgpp|(cyg|ms|bcc)win|mingw/ =~ RUBY_PLATFORM
125
+ gem = Dir['pkg/*.gem'].first
126
+ sh "#{'sudo ' unless windows}gem install --local #{gem}"
127
+ end
@@ -1,5 +1,4 @@
1
1
  ADHEARSION_FILES = %w{
2
- README.markdown
3
2
  adhearsion.gemspec
4
3
  app_generators/ahn/ahn_generator.rb
5
4
  app_generators/ahn/templates/.ahnrc
@@ -113,7 +112,7 @@ ADHEARSION_FILES = %w{
113
112
 
114
113
  Gem::Specification.new do |s|
115
114
  s.name = "adhearsion"
116
- s.version = "0.8.1"
115
+ s.version = "0.8.2"
117
116
 
118
117
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
119
118
  s.authors = ["Jay Phillips"]
@@ -1,3 +1,5 @@
1
+ # This file is for the "rake" tool which automates project-related tasks. If you need to automate things, you can create
2
+ # a new Rake task here. See http://rake.rubyforge.org for more info.
1
3
  require 'rubygems'
2
4
 
3
5
  begin
@@ -6,7 +6,6 @@ SANDBOX_VERSION = 1.0
6
6
  initialization do
7
7
  # We shouldn't start initializing until after the AGI server has initialized.
8
8
  Events.register_callback(:after_initialized) do
9
- ahn_log.sandbox "Fetching sandbox connection information"
10
9
 
11
10
  config = if COMPONENTS.sandbox.has_key? "connect_to"
12
11
  {"connect_to" => COMPONENTS.sandbox["connect_to"]}
@@ -30,8 +29,6 @@ initialization do
30
29
 
31
30
  host, port = config.values_at "host", "port"
32
31
 
33
- ahn_log.sandbox "Connecting to #{host}:#{port}"
34
-
35
32
  username, password = COMPONENTS.sandbox["username"], COMPONENTS.sandbox["password"]
36
33
 
37
34
  if username.blank? || password.blank? || username == "user123"
@@ -55,8 +52,6 @@ initialization do
55
52
  socket.puts identifying_hash
56
53
  response = socket.gets
57
54
  unless response
58
- ahn_log.sandbox "Communication with the sandbox ended before receiving any response. Trying again in 10 seconds."
59
- sleep 10
60
55
  next
61
56
  end
62
57
  response.chomp!
@@ -75,7 +70,7 @@ initialization do
75
70
  rescue => e
76
71
  ahn_log.error "Non-fatal exception in the AGI server: #{e.inspect} \n" + e.backtrace.join("\n")
77
72
  ensure
78
- socket.close
73
+ socket.close rescue nil
79
74
  end
80
75
  ahn_log.sandbox "AGI server finished serving call. Reconnecting to sandbox."
81
76
  else
@@ -9,4 +9,4 @@ port: 61613
9
9
 
10
10
  # subscriptions:
11
11
  # - start_call
12
- # - hangup_call
12
+ # - hungup_call
@@ -25,7 +25,7 @@
25
25
  # - events.shutdown
26
26
  # - events.asterisk.before_call
27
27
  # - events.asterisk.failed_call
28
- # - events.asterisk.call_hangup
28
+ # - events.asterisk.hungup_call
29
29
  #
30
30
  #
31
31
  # Note: events are mostly for components to register and expose to you.
@@ -128,15 +128,15 @@ module Adhearsion
128
128
  switch_to_root_directory
129
129
  catch_termination_signal
130
130
  bootstrap_rc
131
- daemonize! if should_daemonize?
132
131
  initialize_log_file
133
132
  load_all_init_files
134
133
  init_components_subsystem
135
134
  init_modules
136
135
  init_events_subsystem
137
- create_pid_file if pid_file
138
136
  load_components
139
137
  init_events_file
138
+ daemonize! if should_daemonize?
139
+ create_pid_file if pid_file
140
140
 
141
141
  ahn_log "Adhearsion initialized!"
142
142
 
@@ -11,7 +11,8 @@ module Adhearsion
11
11
  require_dependencies
12
12
  require_models
13
13
  @@config = Adhearsion::AHN_CONFIG.database
14
- ActiveRecord::Base.allow_concurrency = true
14
+ # You may need to uncomment the following line for older versions of ActiveRecord
15
+ # ActiveRecord::Base.allow_concurrency = true
15
16
  establish_connection
16
17
  create_call_hook_for_connection_cleanup
17
18
  end
@@ -17,7 +17,8 @@ module Adhearsion
17
17
  "It's not a directory!" unless File.directory?(rails_root)
18
18
  load_rails
19
19
  if defined? ActiveRecord
20
- ActiveRecord::Base.allow_concurrency = true
20
+ # You may need to uncomment the following line for older versions of ActiveRecord
21
+ # ActiveRecord::Base.allow_concurrency = true
21
22
  Events.register_callback([:asterisk, :before_call]) do
22
23
  ActiveRecord::Base.verify_active_connections!
23
24
  end
@@ -2,8 +2,8 @@ module Adhearsion #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0 unless defined? MAJOR
4
4
  MINOR = 8 unless defined? MINOR
5
- TINY = 1 unless defined? TINY
5
+ TINY = 2 unless defined? TINY
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.') unless defined? STRING
8
8
  end
9
- end
9
+ end
@@ -21,6 +21,9 @@ module Adhearsion
21
21
  # This is what happens 99.9% of the time.
22
22
 
23
23
  DialPlan::Manager.handle call
24
+ rescue Hangup
25
+ ahn_log.agi "HANGUP event for call with uniqueid #{call.variables[:uniqueid].inspect} and channel #{call.variables[:channel].inspect}"
26
+ call.hangup!
24
27
  rescue DialPlan::Manager::NoContextError => e
25
28
  ahn_log.agi e.message
26
29
  call.hangup!
@@ -34,8 +37,8 @@ module Adhearsion
34
37
  end
35
38
  rescue HungupExtensionCallException => hungup_call
36
39
  begin
37
- ahn_log.agi "Received \"h\" meta-call. Executing /asterisk/call_hangup event callbacks."
38
- Events.trigger [:asterisk, :call_hangup], hungup_call.call
40
+ ahn_log.agi "Received \"h\" meta-call. Executing /asterisk/hungup_call event callbacks."
41
+ Events.trigger [:asterisk, :hungup_call], hungup_call.call
39
42
  call.hangup!
40
43
  rescue => e
41
44
  ahn_log.agi.error e
@@ -78,4 +81,4 @@ module Adhearsion
78
81
  end
79
82
  end
80
83
  end
81
- end
84
+ end
@@ -48,6 +48,7 @@ module Adhearsion
48
48
 
49
49
  def read
50
50
  returning from_pbx.gets do |message|
51
+ raise Hangup if message.nil?
51
52
  ahn_log.agi.debug "<<< #{message}"
52
53
  end
53
54
  end
@@ -891,7 +892,7 @@ module Adhearsion
891
892
 
892
893
  def validate_digits(digits)
893
894
  returning digits.to_s do |digits_as_string|
894
- raise ArgumentError, "Can only be called with valid digits!" unless digits_as_string =~ /^\d+$/
895
+ raise ArgumentError, "Can only be called with valid digits!" unless digits_as_string =~ /^[0-9*#-]+$/
895
896
  end
896
897
  end
897
898
 
@@ -16,6 +16,10 @@ module Adhearsion
16
16
  end
17
17
  end
18
18
 
19
+ class Hangup < Exception
20
+ # At the moment, we'll just use this to end a call-handling Thread.
21
+ end
22
+
19
23
  ##
20
24
  # This manages the list of calls the Adhearsion service receives
21
25
  class Calls
@@ -32,7 +32,7 @@ module Theatre
32
32
  @returned_value_lock = Monitor.new
33
33
 
34
34
  # Used when wait() is called to notify all waiting threads by using a ConditionVariable
35
- @returned_value_blocker = Monitor::ConditionVariable.new @returned_value_lock
35
+ @returned_value_blocker = @returned_value_lock.new_cond#Monitor::ConditionVariable.new @returned_value_lock
36
36
  end
37
37
 
38
38
  def queued
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adhearsion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Phillips
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-21 00:00:00 -07:00
12
+ date: 2008-08-21 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -43,7 +43,6 @@ extensions: []
43
43
  extra_rdoc_files: []
44
44
 
45
45
  files:
46
- - README.markdown
47
46
  - adhearsion.gemspec
48
47
  - app_generators/ahn/ahn_generator.rb
49
48
  - app_generators/ahn/templates/.ahnrc
@@ -1,31 +0,0 @@
1
- Adhearsion
2
- ==========
3
-
4
- Adhearsion is an open-source voice application development framework. Adhearsion users write applications atop the framework with Ruby and **call into their code**.
5
-
6
- Adhearsion rests above a lower-level telephony platform, namely [Asterisk](http://asterisk.org), though there are experimental bindings for both [FreeSWITCH](http://freeswitch.org) and [Yate](http://yate.null.ro/pmwiki).
7
-
8
- Adhearsion has...
9
-
10
- * An elegant dialplan system for writing the code which controls a live phone call
11
- * A sophisticated Asterisk Manager Interface library with a lexer written in [Ragel](http://www.complang.org/ragel).
12
- * An events subsystem which maintains a Thread-pool for executing your namespaced callbacks. (supports AMI events too!)
13
- * A very useful component architecture with which you may write Adhearsion plugins and share them with the world.
14
- * JRuby compatibility for running atop the Java Virtual Machine and using virtually any Java library.
15
- * Good regression test coverage
16
-
17
- Use the public Adhearsion sandbox!
18
- ==================================
19
-
20
- Don't want to screw with setting up a telephony system? You can test your Adhearsion applications using our public sandbox!
21
-
22
- Visit [http://adhearsion.com/getting_started](http://adhearsion.com/getting_started) for more information!
23
-
24
- Yes, in minutes you can be controlling your cell phone for free! :)
25
-
26
- Documentation
27
- =============
28
-
29
- Visit [Adhearsion's website](http://adhearsion.com) for more information about the framework or visit the [wiki](http://docs.adhearsion.com) for documentation on how to use it.
30
-
31
- If you're having trouble, you may want to try asking your question on the IRC channel, [mailing list](http://groups.google.com/group/adhearsion) or, if you've found a bug, report it on the [bug tracker](http://adhearsion.lighthouseapp.com/projects/5871-adhearsion/overview).