Last active
December 15, 2015 22:19
-
-
Save bradleyd/5332596 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [2013-04-06 01:16:36] ERROR Celluloid: Punchblock::Translator::Asterisk::Call crashed! | |
| Celluloid::DeadActorError: attempted to call a dead actor | |
| /var/lib/gems/1.9.1/gems/celluloid-0.13.0/lib/celluloid/actor.rb:66:in `rescue in call' | |
| /var/lib/gems/1.9.1/gems/celluloid-0.13.0/lib/celluloid/actor.rb:63:in `call' | |
| /var/lib/gems/1.9.1/gems/celluloid-0.13.0/lib/celluloid/legacy.rb:14:in `method_missing' | |
| /home/bradleyd/.bundler/ruby/1.9.1/punchblock-9111e71fe8df/lib/punchblock/translator/asterisk/component/re | |
| cord.rb:28:in `block in execute' | |
| /var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:105:in `call' | |
| /var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:105:in `call_handler' | |
| /var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:91:in `block (3 levels) in | |
| trigger_handler' | |
| /var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:87:in `catch' | |
| /var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:87:in `block (2 levels) in trigger_handler' | |
| /var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:85:in `each' | |
| /var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:85:in `find' | |
| /var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:85:in `block in trigger_handler' | |
| /var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:84:in `catch' | |
| /var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:84:in `trigger_handler' | |
| /home/bradleyd/.bundler/ruby/1.9.1/punchblock-9111e71fe8df/lib/punchblock/translator/asterisk/call.rb:155:in `process_ami_event' | |
| /var/lib/gems/1.9.1/gems/celluloid-0.13.0/lib/celluloid/calls.rb:11:in `public_send' | |
| /var/lib/gems/1.9.1/gems/celluloid-0.13.0/lib/celluloid/calls.rb:11:in `dispatch' | |
| /var/lib/gems/1.9.1/gems/celluloid-0.13.0/lib/celluloid/calls.rb:96:in `dispatch' | |
| /var/lib/gems/1.9.1/gems/celluloid-0.13.0/lib/celluloid/actor.rb:326:in `block in handle_message' | |
| /var/lib/gems/1.9.1/gems/celluloid-0.13.0/lib/celluloid/tasks/task_fiber.rb:28:in `block in initialize' | |
| [2013-04-06 01:16:36] DEBUG Adhearsion::OutboundCall: c86fd0d6-9e6e-4284-92e8-6290c22cbcb2: Receiving message: #<Punchblock::Event::Asterisk::AMI::Event name="VarSet", attributes_hash={:privilege=>"dialplan,all", :channel=>"SIP/sip1-00000054", :variable=>"RTPAUDIOQOSRTT", :value=>"minrtt=0.000000;maxrtt=0.000000;avgrtt=0.000000;stdevrtt=0.000000;", :uniqueid=>"1365210979.96"}, target_call_id="c86fd0d6-9e6e-4284-92e8-6290c22cbcb2", component_id=nil, target_mixer_name=nil> | |
| [2013-04-06 01:16:36] ERROR Adhearsion::Initializer: <Celluloid::DeadActorError> attempted to call a dead actor | |
| /var/lib/gems/1.9.1/gems/celluloid-0.13.0/lib/celluloid/actor.rb:66:in `rescue in call' | |
| /var/lib/gems/1.9.1/gems/celluloid-0.13.0/lib/celluloid/actor.rb:63:in `call' | |
| /var/lib/gems/1.9.1/gems/celluloid-0.13.0/lib/celluloid/legacy.rb:14:in `method_missing' | |
| /home/bradleyd/.bundler/ruby/1.9.1/punchblock-9111e71fe8df/lib/punchblock/translator/asterisk/component/record.rb:28:in `block in execute' | |
| /var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:105:in `call' | |
| /var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:105:in `call_handler' | |
| /var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:91:in `block (3 levels) in | |
| /var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:87:in `catch' | |
| /var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:87:in `block (2 levels) in trigger_handler' | |
| /var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:85:in `each' | |
| /var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:85:in `find' | |
| /var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:85:in `block in trigger_handler' | |
| /var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:84:in `catch' | |
| /var/lib/gems/1.9.1/gems/has-guarded-handlers-1.5.0/lib/has_guarded_handlers.rb:84:in `trigger_handler' | |
| /home/bradleyd/.bundler/ruby/1.9.1/punchblock-9111e71fe8df/lib/punchblock/translator/asterisk/call.rb:155:in `process_ami_event' | |
| /var/lib/gems/1.9.1/gems/celluloid-0.13.0/lib/celluloid/calls.rb:11:in `public_send' | |
| /var/lib/gems/1.9.1/gems/celluloid-0.13.0/lib/celluloid/calls.rb:11:in `dispatch' | |
| /var/lib/gems/1.9.1/gems/celluloid-0.13.0/lib/celluloid/calls.rb:96:in `dispatch' | |
| /var/lib/gems/1.9.1/gems/celluloid-0.13.0/lib/celluloid/actor.rb:326:in `block in handle_message' | |
| /var/lib/gems/1.9.1/gems/celluloid-0.13.0/lib/celluloid/tasks/task_fiber.rb:28:in `block in initialize' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ForwardCallController < Adhearsion::CallController | |
| def run | |
| play_tones 'ring' | |
| @schedule = metadata[:schedule] | |
| @res = forward_call | |
| handle_call_result | |
| end | |
| def forward_call | |
| return dial "SIP/#{@schedule.forward_number}@sip1", forward_call_parameters | |
| end | |
| def forward_call_parameters | |
| { | |
| :for => 20.seconds, | |
| :confirm => ScreeningCallController, | |
| :confirm_metadata => { | |
| screen_call: screen_call?}, | |
| :from => "John Doe <#{call.to}>" | |
| } | |
| end | |
| def handle_call_result | |
| logger.info "Call result: #{@res}" | |
| end | |
| def screen_call? | |
| @schedule.forwarding_number.screen_call? | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # encoding: utf-8 | |
| # this records the entire call | |
| class RecordCallController < Adhearsion::CallController | |
| def run | |
| record :async => true do |event| | |
| logger.debug "Async recording saved to #{event.recording.uri}" | |
| end | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ScreeningCallController < Adhearsion::CallController | |
| def run | |
| invoke RecordCallController if metadata[:record_call] | |
| screen_callee if metadata[:screen_call] | |
| end | |
| def screen_callee | |
| result = ask "you have a call", " press 1 to accept", " press 2 to decline", :timeout => 5, :limit => 1 | |
| if result.response != "1" | |
| # @note this may not be needed here | |
| hangup | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment