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.
52 53 54 |
# File 'lib/adhearsion/voip/dial_plan.rb', line 52 def initialize(call, entry_point) @call, @entry_point = call, entry_point end |
Instance Attribute Details
#call ⇒ Object (readonly)
Returns the value of attribute call.
51 52 53 |
# File 'lib/adhearsion/voip/dial_plan.rb', line 51 def call @call end |
Class Method Details
.create(*args) ⇒ Object
46 47 48 |
# File 'lib/adhearsion/voip/dial_plan.rb', line 46 def create(*args) new(*args).tap { |instance| instance.stage! } end |
Instance Method Details
#run ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/adhearsion/voip/dial_plan.rb', line 66 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.
60 61 62 63 64 |
# File 'lib/adhearsion/voip/dial_plan.rb', line 60 def stage! extend_with_voip_commands! extend_with_call_variables! extend_with_dialplan_component_methods! end |