You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
deathsyn edited this page Mar 10, 2011
·
1 revision
An Outbound Event Listener Example that reads and returns DTMF input:
Simply just create a subclass of FSR::Listner::Outbound and all new calls/sessions will invoke the "session_initiated" callback method.
NOTE: 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/rubyrequire'fsr'require'fsr/listener/outbound'classOutboundDemo < FSR::Listener::Outbounddefsession_initiatedexten=@session.headers[:caller_caller_id_number]FSR::Log.info"*** Answering incoming call from #{exten}"answerdoFSR::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.to_s.strip} from #{exten}"# Tell the caller what they enteredspeak("Got the DTMF of: #{read_var.to_s.strip}")do#Hangup the callhangupendendendendendFSR.start_oes!OutboundDemo,:port=>8084,:host=>"127.0.0.1"