jicksta-adhearsion 0.8.2 → 0.8.3

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,14 @@
1
+ 0.8.3
2
+
3
+ 0.8.2
4
+ - When a call hangs up, Adhearsion will no longer show random exceptions (that were okay) and instead allows the user to rescue a Hangup exception.
5
+ - ManagerInterfaceResponse now include()s DRbUndumped, allowing send_action() to be called directly over DRb.
6
+ - Fixes an inconsequential bug when CTL-C'ing Adhearsion.
7
+
8
+ 0.8.1
9
+ - The sandbox component now comes
10
+ - Minor bug fixes
11
+
1
12
  0.8.0 rev 2
2
13
  - Added a few non-critical files to the .gemspec. They were ignored
3
14
 
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
data/adhearsion.gemspec CHANGED
@@ -112,7 +112,7 @@ ADHEARSION_FILES = %w{
112
112
 
113
113
  Gem::Specification.new do |s|
114
114
  s.name = "adhearsion"
115
- s.version = "0.8.2"
115
+ s.version = "0.8.3"
116
116
 
117
117
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
118
118
  s.authors = ["Jay Phillips"]
@@ -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
 
@@ -2,7 +2,7 @@ module Adhearsion #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0 unless defined? MAJOR
4
4
  MINOR = 8 unless defined? MINOR
5
- TINY = 2 unless defined? TINY
5
+ TINY = 3 unless defined? TINY
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.') unless defined? STRING
8
8
  end
@@ -161,12 +161,13 @@ module Adhearsion
161
161
  execute "SendDTMF", digits.to_s
162
162
  end
163
163
 
164
+ # The with_next_message method...
164
165
  def with_next_message(&block)
165
166
  raise LocalJumpError, "Must supply a block" unless block_given?
166
167
  block.call(next_message)
167
168
  end
168
169
 
169
- # This command shouled be used to advance to the next message in the Asterisk Comedian Voicemail application
170
+ # This command should be used to advance to the next message in the Asterisk Comedian Voicemail application
170
171
  def next_message
171
172
  @call.inbox.pop
172
173
  end
@@ -438,6 +439,9 @@ module Adhearsion
438
439
  raise Adhearsion::VoIP::DSL::Dialplan::ControlPassingException.new(context)
439
440
  end
440
441
 
442
+ # The queue method puts a call into a call queue to be answered by an agent registered with that queue.
443
+ # A full description may be found here: http://www.voip-info.org/wiki-Asterisk+cmd+Queue
444
+ # The queue method takes a queue_name as an argument to place the caller in the appropriate queue.
441
445
  def queue(queue_name)
442
446
  queue_name = queue_name.to_s
443
447
 
@@ -558,6 +562,9 @@ module Adhearsion
558
562
  raw_response("SET VARIABLE %s %p" % [variable_name.to_s, value.to_s]) == "200 result=1"
559
563
  end
560
564
 
565
+ # The variable method allows you to either set or get a channel variable from Asterisk
566
+ # The method takes a hash key/value pair if you would like to set a variable
567
+ # Or a single string with the variable to get from Asterisk
561
568
  def variable(*args)
562
569
  if args.last.kind_of? Hash
563
570
  assignments = args.pop
@@ -574,6 +581,11 @@ module Adhearsion
574
581
  end
575
582
  end
576
583
 
584
+ # Use the voicemail method to send a caller to a voicemail box to leave a message.
585
+ # A complete description is avilable at:
586
+ # http://www.voip-info.org/tiki-index.php?page=Asterisk+cmd+VoiceMail
587
+ # The method takes the mailbox_number of the user to leave a message for and a
588
+ # greeting_option that will determine which message gets played to the caller.
577
589
  def voicemail(*args)
578
590
  options_hash = args.last.kind_of?(Hash) ? args.pop : {}
579
591
  mailbox_number = args.shift
@@ -606,6 +618,9 @@ module Adhearsion
606
618
  end
607
619
  end
608
620
 
621
+ # The voicemail_main method puts a caller into the voicemail system to fetch their voicemail
622
+ # or set options for their voicemail box. A full description may be found here:
623
+ # http://www.voip-info.org/wiki-Asterisk+cmd+VoiceMailMain
609
624
  def voicemail_main(options={})
610
625
  mailbox, context, folder = options.values_at :mailbox, :context, :folder
611
626
  authenticate = options.has_key?(:authenticate) ? options[:authenticate] : true
@@ -730,6 +745,7 @@ module Adhearsion
730
745
 
731
746
  protected
732
747
 
748
+ # wait_for_digits waits for the input of digits based on the number of milliseconds
733
749
  def wait_for_digit(timeout=-1)
734
750
  timeout *= 1_000 if timeout != -1
735
751
  result = result_digit_from raw_response("WAIT FOR DIGIT #{timeout.to_i}")
@@ -744,12 +760,14 @@ module Adhearsion
744
760
  nil
745
761
  end
746
762
 
763
+ # set_callier_id_number method allows setting of the callerid number of the call
747
764
  def set_caller_id_number(caller_id)
748
765
  return unless caller_id
749
766
  raise ArgumentError, "Caller ID must be numerical" if caller_id.to_s !~ /^\d+$/
750
767
  raw_response %(SET CALLERID %p) % caller_id
751
768
  end
752
769
 
770
+ # set_caller_id_name method allows the setting of the callerid name of the call
753
771
  def set_caller_id_name(caller_id_name)
754
772
  return unless caller_id_name
755
773
  variable "CALLERID(name)" => caller_id_name
@@ -891,7 +909,7 @@ module Adhearsion
891
909
 
892
910
  def validate_digits(digits)
893
911
  returning digits.to_s do |digits_as_string|
894
- raise ArgumentError, "Can only be called with valid digits!" unless digits_as_string =~ /^\d+$/
912
+ raise ArgumentError, "Can only be called with valid digits!" unless digits_as_string =~ /^[0-9*#-]+$/
895
913
  end
896
914
  end
897
915
 
@@ -298,6 +298,8 @@ module Adhearsion
298
298
  ########### ###########
299
299
  ####### #######
300
300
 
301
+ # ping sends an action to the Asterisk Manager Interface that returns a pong
302
+ # more details here: http://www.voip-info.org/wiki/index.php?page=Asterisk+Manager+API+Action+Ping
301
303
  def ping
302
304
  deprecation_warning
303
305
  send_action "Ping"
@@ -310,6 +312,29 @@ module Adhearsion
310
312
  " See http://docs.adhearsion.com/AMI for more information."
311
313
  end
312
314
 
315
+ # The originate method launches a call to Asterisk, full details here:
316
+ # http://www.voip-info.org/tiki-index.php?page=Asterisk+Manager+API+Action+Originate
317
+ # Takes these arguments as a hash:
318
+ #
319
+ # Channel: Channel on which to originate the call (The same as you specify in the Dial application command)
320
+ # Context: Context to use on connect (must use Exten & Priority with it)
321
+ # Exten: Extension to use on connect (must use Context & Priority with it)
322
+ # Priority: Priority to use on connect (must use Context & Exten with it)
323
+ # Timeout: Timeout (in milliseconds) for the originating connection to happen(defaults to 30000 milliseconds)
324
+ # CallerID: CallerID to use for the call
325
+ # Variable: Channels variables to set (max 32). Variables will be set for both channels (local and connected).
326
+ # Account: Account code for the call
327
+ # Application: Application to use on connect (use Data for parameters)
328
+ # Data : Data if Application parameter is used
329
+ # Async: For the origination to be asynchronous (allows multiple calls to be generated without waiting for a response)
330
+ # ActionID: The request identifier. It allows you to identify the response to this request.
331
+ # You may use a number or a string. Useful when you make several simultaneous requests.
332
+ #
333
+ # For example:
334
+ # originate { :channel => 'SIP/1000@sipnetworks.com',
335
+ # :context => 'my_context',
336
+ # :exten => 's',
337
+ # :priority => '1' }
313
338
  def originate(options={})
314
339
  deprecation_warning
315
340
  options = options.clone
@@ -335,11 +360,15 @@ module Adhearsion
335
360
  call_and_exec caller, "Dial", :args => dial_args, :caller_id => opts[:caller_id]
336
361
  end
337
362
 
363
+ # hangup terminates a call accepts a channel as the argument
364
+ # full details here: http://www.voip-info.org/wiki/index.php?page=Asterisk+Manager+API+Action+Hangup
338
365
  def hangup(channel)
339
366
  deprecation_warning
340
367
  send_action "Hangup", :channel => channel
341
368
  end
342
369
 
370
+ # call_and_exec allows you to make a call to a channel and then execute an Astersik application
371
+ # on that call
343
372
  def call_and_exec(channel, app, opts={})
344
373
  deprecation_warning
345
374
  args = { :channel => channel, :application => app }
@@ -348,6 +377,10 @@ module Adhearsion
348
377
  originate args
349
378
  end
350
379
 
380
+ # call_into_context is syntactic sugar for the Asterisk originate command that allows you to
381
+ # lanuch a call into a particular context. For example:
382
+ #
383
+ # call_into_context('SIP/1000@sipnetworks.com', 'my_context', { :variables => { :session_guid => new_guid }})
351
384
  def call_into_context(channel, context, options={})
352
385
  deprecation_warning
353
386
  args = {:channel => channel, :context => context}
@@ -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: jicksta-adhearsion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Phillips
@@ -14,6 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubigen
17
+ type: :runtime
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
@@ -23,6 +24,7 @@ dependencies:
23
24
  version:
24
25
  - !ruby/object:Gem::Dependency
25
26
  name: log4r
27
+ type: :runtime
26
28
  version_requirement:
27
29
  version_requirements: !ruby/object:Gem::Requirement
28
30
  requirements: