FreeSWITCHeR: A Ruby Event Socket Abstraction Library
Ruby fans everywhere will be happy to know that, in the words of Bougyman, "Ruby Loves FreeSWITCH!" How so? Consider the FreeSWITCHeR project, an open source Ruby library that acts as an abstraction layer for the FreeSWITCH event socket.
FreeSWITCHeR is a FreeSWITCH event socket abstraction library built upon the Ruby event machine. It allows for connecting to - and controlling of - multiple FreeSWITCH instances from a single controller. The following is a sample "get digits" listener program that uses the FreeSWITCH outbound event socket paradigm:
require "rubygems"
require "fsr"
require "fsr/outbound"
class GetDigits < FSR::Listener::Outbound
def session_initiated
exten = session.headers[:caller_caller_id]
answer do
read("/path/to/smooth.wav") do |read_var|
FSR::Log.info("Received #{read_var} from #{exten}")
end
end
end
end
FSR.start_oes! GetDigits, :port => 8084, :host => "127.0.0.1"
Start the program and then send a call to the socket application in the dialplan to see it work. The program will capture DTMFs from the call, play a wav file, and read the digits back to the caller. It will also display the captured digits to standard output.
The fsr library also has an inbound event socket listener module and a command socket module which allows for more traditional sending of api and bgapi commands to a FreeSWITCH machine. The fsr docs page has a lot of interesting information. The fsr developers welcome all Ruby programmers to try out this new abstraction library.











Need java socket library
i am eagerly waiting for a java socket library.
Such as asterisk-java to asterisk.
Wait no more!
The guys just added a Java ESL component! Check it out:
http://fisheye.freeswitch.org/changelog/FreeSWITCH/?cs=13950
If you know Java and you are hoping to program stuff on the FS event socket then please check out this new addition and report back any bugs as well as success. We would also love some wiki examples.
-MC
mod_php????
i am eagerly waiting for a php socket library
Same here! :)
Same here! :)
Check out SwK contrib directory
Check out SwK contrib directory, he has some good PHP+ESL scripts in there. Or libs/esl/php.
There is one already, ESL
There is one already, ESL supports PHP.
http://wiki.freeswitch.org/wiki/Esl
Very nice work
I have been using this library to develop my own application, a calling card system that works with FSR, along with mod_nibblebill and mod_limit, very nice work indeed :).
I recommend this library to any Ruby developer that is interested in making apps that work with FreeSWITCH.
Keep up the great work, FSR rocks.
Diego