Class: Adhearsion::DialPlan::ExecutionEnvironment
- Defined in:
- lib/adhearsion/voip/dial_plan.rb
Overview
Executable environment for a dial plan in the scope of a call. This class has all the dialplan methods mixed into it.
Instance Attribute Summary collapse
-
#call ⇒ Object
readonly
Returns the value of attribute call.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(call, entry_point) ⇒ ExecutionEnvironment
constructor
A new instance of ExecutionEnvironment.
- #run ⇒ Object
-
#stage! ⇒ Object
Adds the methods to this ExecutionEnvironment which make it useful.
Constructor Details
#initialize(call, entry_point) ⇒ ExecutionEnvironment
Returns a new instance of ExecutionEnvironment.
48 49 50 |
# File 'lib/adhearsion/voip/dial_plan.rb', line 48 def initialize(call, entry_point) @call, @entry_point = call, entry_point end |
Instance Attribute Details
#call ⇒ Object (readonly)
Returns the value of attribute call.
47 48 49 |
# File 'lib/adhearsion/voip/dial_plan.rb', line 47 def call @call end |
Class Method Details
.create(*args) ⇒ Object
42 43 44 |
# File 'lib/adhearsion/voip/dial_plan.rb', line 42 def create(*args) new(*args).tap { |instance| instance.stage! } end |
Instance Method Details
#run ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/adhearsion/voip/dial_plan.rb', line 62 def run raise "Cannot run ExecutionEnvironment without an entry point!" unless entry_point current_context = entry_point answer if AHN_CONFIG.automatically_answer_incoming_calls begin instance_eval(¤t_context) rescue Adhearsion::VoIP::DSL::Dialplan::ControlPassingException => exception current_context = exception.target retry end end |
#stage! ⇒ Object
Adds the methods to this ExecutionEnvironment which make it useful. e.g. dialplan-related methods, call variables, and component methods.
56 57 58 59 60 |
# File 'lib/adhearsion/voip/dial_plan.rb', line 56 def stage! extend_with_voip_commands! extend_with_call_variables! extend_with_dialplan_component_methods! end |