Class: Freec
- Includes:
- CallVariables, FreeswitchApplications
- Defined in:
- lib/freec_base.rb
Instance Attribute Summary collapse
-
#call_vars ⇒ Object
readonly
Returns the value of attribute call_vars.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#event_body ⇒ Object
readonly
Returns the value of attribute event_body.
-
#log ⇒ Object
readonly
Returns the value of attribute log.
Instance Method Summary collapse
- #execute_completed? ⇒ Boolean
-
#handle_call ⇒ Object
:nodoc:.
-
#initialize(io, log, config) ⇒ Freec
constructor
:nodoc:.
- #reset_wait_for ⇒ Object
- #wait_for(key, value) ⇒ Object
Methods included from CallVariables
#channel_destination_number, #sip_from_user, #sip_to_user
Methods included from FreeswitchApplications
#answer, #bridge, #execute_app, #hangup, #playback, #read, #record, #set_variable, #speak, #spell, #start_recording, #stop_recording, #transfer
Constructor Details
#initialize(io, log, config) ⇒ Freec
:nodoc:
15 16 17 18 19 20 21 22 |
# File 'lib/freec_base.rb', line 15 def initialize(io, log, config) #:nodoc: @call_vars = {} @want_events_from = [] @last_app_executed = 'initial_step' @io = io @log = log @config = config end |
Instance Attribute Details
#call_vars ⇒ Object (readonly)
Returns the value of attribute call_vars.
13 14 15 |
# File 'lib/freec_base.rb', line 13 def call_vars @call_vars end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
13 14 15 |
# File 'lib/freec_base.rb', line 13 def config @config end |
#event_body ⇒ Object (readonly)
Returns the value of attribute event_body.
13 14 15 |
# File 'lib/freec_base.rb', line 13 def event_body @event_body end |
#log ⇒ Object (readonly)
Returns the value of attribute log.
13 14 15 |
# File 'lib/freec_base.rb', line 13 def log @log end |
Instance Method Details
#execute_completed? ⇒ Boolean
52 53 54 |
# File 'lib/freec_base.rb', line 52 def execute_completed? channel_execute_complete? || channel_destroyed_after_bridge? || disconnect_notice? end |
#handle_call ⇒ Object
:nodoc:
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/freec_base.rb', line 24 def handle_call #:nodoc: call_initialization loop do subscribe_to_new_channel_events if last_event_dtmf? && respond_to?(:on_dtmf) callback(:on_dtmf, call_vars[:dtmf_digit]) elsif waiting_for_this_response? || execute_completed? reset_wait_for if waiting_for_this_response? reload_application_code break if disconnect_notice? || !callback(:step) end read_and_parse_response end callback(:on_hangup) hangup unless @io.closed? send_and_read('exit') unless @io.closed? end |
#reset_wait_for ⇒ Object
47 48 49 50 |
# File 'lib/freec_base.rb', line 47 def reset_wait_for wait_for(nil, nil) true end |
#wait_for(key, value) ⇒ Object
42 43 44 45 |
# File 'lib/freec_base.rb', line 42 def wait_for(key, value) @waiting_for_key = key && key.to_sym @waiting_for_value = value end |