README in freeswitcher-0.4.2 vs README in freeswitcher-0.4.3
- old
+ new
@@ -20,11 +20,11 @@
--------------------------------------------------------------------
Simply just create a subclass of FSR::Listner::Outbound and all
new calls/sessions will invoke the "session_initiated" callback method.
-<b>NOTE</b>: FSR uses blocks within the 'session_inititated' method to ensure that the next "freeswich command" is not executed until the previous "Freeswitch command" has finished. This is kicked off by "answer do"
+<b>NOTE</b>: FSR uses blocks within the 'session_inititated' method to ensure that the next "freeswich command" is not executed until the previous "Freeswitch command" has finished. (Basically a continuation) This is kicked off by "answer do".
#!/usr/bin/ruby
require 'fsr'
require 'fsr/listener/outbound'
@@ -35,13 +35,13 @@
FSR::Log.info "*** Answering incoming call from #{exten}"
answer do
FSR::Log.info "***Reading DTMF from #{exten}"
read("/home/freeswitch/freeswitch/sounds/music/8000/sweet.wav", 4, 10, "input", 7000) do |read_var|
- FSR::Log.info "***Success, grabbed #{read_var.strip} from #{exten}"
+ FSR::Log.info "***Success, grabbed #{read_var.to_s.strip} from #{exten}"
# Tell the caller what they entered
- speak("Got the DTMF of: #{read_var}") do
+ speak("Got the DTMF of: #{read_var.to_s.strip}") do
#Hangup the call
hangup
end
end
end
@@ -60,21 +60,21 @@
require 'fsr'
require "fsr/listener/inbound"
# EXAMPLE 1
# This adds a hook on CHANNEL_CREATE events. You can also create a method to handle the event you're after. See the next example
- FSL::Inbound.add_event_hook(:CHANNEL_CREATE) {|event| FSR::Log.info "*** [#{event.content[:unique_id]}] Channel created - greetings from the hook!" }
+ FSL::Inbound.add_event_hook(:CHANNEL_CREATE) { FSR::Log.info "*** [#{event.content[:unique_id]}] Channel created - greetings from the hook!" }
# EXAMPLE 2
# Define a method to handle CHANNEL_HANGUP events.
def custom_channel_hangup_handler(event)
FSR::Log.info "*** [#{event.content[:unique_id]}] Channel hangup. The event:"
pp event
end
# This adds a hook for EXAMPLE 2
- FSL::Inbound.add_event_hook(:CHANNEL_HANGUP) {|event| custom_channel_hangup_handler(event) }
+ FSL::Inbound.add_event_hook(:CHANNEL_HANGUP) { custom_channel_hangup_handler(event) }
# Start FSR Inbound Listener
FSR.start_ies!(FSL::Inbound, :host => "localhost", :port => 8021)
@@ -88,10 +88,10 @@
require "fsr/listener/inbound"
class IesDemo < FSR::Listener::Inbound
- def on_event(event)
+ def on_event
pp event.headers
pp event.content[:event_name]
end
end