Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] Re-2: Ruby and ESL help

Goto page Previous  1, 2
 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
diego.viola at gmail.com
Guest





PostPosted: Thu May 07, 2009 3:45 pm    Post subject: [Freeswitch-users] Re-2: Ruby and ESL help Reply with quote

It seems like EM (EventMachine) can't be used with ESL.

16:41 < diegoviola> thedonvaughn: i see, so ESL itself can't be used with EM?
16:41 < wyhaines> You can't just hand the socket from EM to ESL.
16:42 < thedonvaughn> prolly not
16:42 < thedonvaughn> and if tmm1 doesn't know how, then i'm going to say no Sad)
16:42 < wyhaines> EM will invoke callbacks on your protocol object
when data comes in (receive_data), and goes out (send_data). When the
connection is
closed (unbind), etc....
16:43 < wyhaines> To use ESL, you'd have collect data form
receive_data into a buffer, and pass that into ESL, and ESL would have
to support being used in
that way.
16:43 < diegoviola> ok then i will just use FSR
16:43 < wyhaines> However, it looks like ESL wants to control the
socket, which won't work because EM is already controlling the socket.

That conversation was in #eventmachine.

Diego

On Thu, May 7, 2009 at 4:11 PM, Diego Viola <diego.viola@gmail.com> wrote:
Quote:
Ok, this seems to work:

require 'rubygems'
require 'eventmachine'

module CallingCard
       def post_init
               send_data "sendmsg\ncall-command:
execute\nexecute-app-name: answer\n\n"
               send_data "sendmsg\ncall-command:
execute\nexecute-app-name: playback\nexecute-app-arg:
tone_stream://%(10000,0,350,440)\n\n"
       end
end

EventMachine::run {
       EventMachine::start_server "127.0.0.1", 8084, CallingCard
}

But what about ESL? :/

Diego

On Thu, May 7, 2009 at 12:03 PM, Diego Viola <diego.viola@gmail.com> wrote:
Quote:
I see, but it should work with ESL too right?

Diego

On Thu, May 7, 2009 at 7:55 AM, Mikael Aleksander Bjerkeland
<mikael@bjerkeland.com> wrote:
Quote:
EventMachine is very different to TCPSocket and is definitely not a
drop-in replacement. Take a look at FreeSWITCHeR
(http://code.rubyists.com/projects/fs/repository) and see how they
implemented EventMachine.


More info about EventMachine and specifically #start_server is here:
http://eventmachine.rubyforge.org/EventMachine.html#M000385




El jue, 07-05-2009 a las 02:11 -0400, Diego Viola escribió:
Quote:
Hi guys,

It's me again, does anyone knows why this doesn't work?

require 'rubygems'
require 'eventmachine'
require 'ESL'

EventMachine.run {
        con = EventMachine::start_server "127.0.0.1", 8084 do
                fd = con.to_i
                esl = ESL::ESLconnection.new(fd)
                esl.execute('answer')
        end
}

But using it with the normal TCPServer works? I'm trying to use ESL
with EventMachine, but it doesn't appear to work. Although it does
with the normal TCPServer.

Thanks,

On Sun, May 3, 2009 at 5:43 PM, Diego Viola <diego.viola@gmail.com> wrote:
Quote:
http://wiki.freeswitch.org/wiki/Event_Socket_Library#Ruby_Example

Added.

On Sun, May 3, 2009 at 5:33 PM, Diego Viola <diego.viola@gmail.com> wrote:
Quote:
Will post some examples on the wiki now Smile

Diego

On Sun, May 3, 2009 at 5:32 PM, Diego Viola <diego.viola@gmail.com> wrote:
Quote:
NICE! It works, it works =D

require 'socket'
require 'ESL'

server = TCPServer.new(8084)
loop do
con = server.accept
fd = con.to_i
esl = ESL::ESLconnection.new(fd)
esl.execute('answer')
esl.execute('playback', 'tone_stream://%(10000,0,350,440)')
end

Thanks everyone Very Happy

Diego

On Sun, May 3, 2009 at 5:29 PM, Brian West <brian@freeswitch.org> wrote:
Quote:
I think its con.fileno in this case?  Not sure.
/b
On May 3, 2009, at 4:00 PM, Diego Viola wrote:

Yep, it works Guido.

require 'socket'

server = TCPServer.new(8084)
loop do
       con = server.accept
       con.puts "connect\n\n"
       con.puts "sendmsg\ncall-command: execute\nexecute-app-name:
answer\n\n"
       con.puts "sendmsg\ncall-command: execute\nexecute-app-name:
playback\nexecute-app-arg: tone_stream://%(10000,0,350,440)\n\n"
end

Thanks for the tip =D

Brian West
brian@freeswitch.org
-- Meet us at ClueCon!  http://www.cluecon.com





_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org






_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org


_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org




_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Back to top
diego.viola at gmail.com
Guest





PostPosted: Thu May 07, 2009 7:48 pm    Post subject: [Freeswitch-users] Re-2: Ruby and ESL help Reply with quote

Hi guys,

Nevermind with the ESL and EM thing.

I was wondering what the getBody() getHeader() and other ESL stuff
does behind the scenes, in raw socket, do you know?

Thanks,

Diego

On Thu, May 7, 2009 at 4:44 PM, Diego Viola <diego.viola@gmail.com> wrote:
Quote:
It seems like EM (EventMachine) can't be used with ESL.

16:41 < diegoviola> thedonvaughn: i see, so ESL itself can't be used with EM?
16:41 < wyhaines> You can't just hand the socket from EM to ESL.
16:42 < thedonvaughn> prolly not
16:42 < thedonvaughn> and if tmm1 doesn't know how, then i'm going to say no Sad)
16:42 < wyhaines> EM will invoke callbacks on your protocol object
when data comes in (receive_data), and goes out (send_data).  When the
connection is
                 closed (unbind), etc....
16:43 < wyhaines> To use ESL, you'd have collect data form
receive_data into a buffer, and pass that into ESL, and ESL would have
to support being used in
                 that way.
16:43 < diegoviola> ok then i will just use FSR
16:43 < wyhaines> However, it looks like ESL wants to control the
socket, which won't work because EM is already controlling the socket.

That conversation was in #eventmachine.

Diego

On Thu, May 7, 2009 at 4:11 PM, Diego Viola <diego.viola@gmail.com> wrote:
Quote:
Ok, this seems to work:

require 'rubygems'
require 'eventmachine'

module CallingCard
       def post_init
               send_data "sendmsg\ncall-command:
execute\nexecute-app-name: answer\n\n"
               send_data "sendmsg\ncall-command:
execute\nexecute-app-name: playback\nexecute-app-arg:
tone_stream://%(10000,0,350,440)\n\n"
       end
end

EventMachine::run {
       EventMachine::start_server "127.0.0.1", 8084, CallingCard
}

But what about ESL? :/

Diego

On Thu, May 7, 2009 at 12:03 PM, Diego Viola <diego.viola@gmail.com> wrote:
Quote:
I see, but it should work with ESL too right?

Diego

On Thu, May 7, 2009 at 7:55 AM, Mikael Aleksander Bjerkeland
<mikael@bjerkeland.com> wrote:
Quote:
EventMachine is very different to TCPSocket and is definitely not a
drop-in replacement. Take a look at FreeSWITCHeR
(http://code.rubyists.com/projects/fs/repository) and see how they
implemented EventMachine.


More info about EventMachine and specifically #start_server is here:
http://eventmachine.rubyforge.org/EventMachine.html#M000385




El jue, 07-05-2009 a las 02:11 -0400, Diego Viola escribió:
Quote:
Hi guys,

It's me again, does anyone knows why this doesn't work?

require 'rubygems'
require 'eventmachine'
require 'ESL'

EventMachine.run {
        con = EventMachine::start_server "127.0.0.1", 8084 do
                fd = con.to_i
                esl = ESL::ESLconnection.new(fd)
                esl.execute('answer')
        end
}

But using it with the normal TCPServer works? I'm trying to use ESL
with EventMachine, but it doesn't appear to work. Although it does
with the normal TCPServer.

Thanks,

On Sun, May 3, 2009 at 5:43 PM, Diego Viola <diego.viola@gmail.com> wrote:
Quote:
http://wiki.freeswitch.org/wiki/Event_Socket_Library#Ruby_Example

Added.

On Sun, May 3, 2009 at 5:33 PM, Diego Viola <diego.viola@gmail.com> wrote:
Quote:
Will post some examples on the wiki now Smile

Diego

On Sun, May 3, 2009 at 5:32 PM, Diego Viola <diego.viola@gmail.com> wrote:
Quote:
NICE! It works, it works =D

require 'socket'
require 'ESL'

server = TCPServer.new(8084)
loop do
con = server.accept
fd = con.to_i
esl = ESL::ESLconnection.new(fd)
esl.execute('answer')
esl.execute('playback', 'tone_stream://%(10000,0,350,440)')
end

Thanks everyone Very Happy

Diego

On Sun, May 3, 2009 at 5:29 PM, Brian West <brian@freeswitch.org> wrote:
Quote:
I think its con.fileno in this case?  Not sure.
/b
On May 3, 2009, at 4:00 PM, Diego Viola wrote:

Yep, it works Guido.

require 'socket'

server = TCPServer.new(8084)
loop do
       con = server.accept
       con.puts "connect\n\n"
       con.puts "sendmsg\ncall-command: execute\nexecute-app-name:
answer\n\n"
       con.puts "sendmsg\ncall-command: execute\nexecute-app-name:
playback\nexecute-app-arg: tone_stream://%(10000,0,350,440)\n\n"
end

Thanks for the tip =D

Brian West
brian@freeswitch.org
-- Meet us at ClueCon!  http://www.cluecon.com





_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org






_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org


_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org





_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Back to top
jason at jasonjgw.net
Guest





PostPosted: Thu May 07, 2009 7:54 pm    Post subject: [Freeswitch-users] Re-2: Ruby and ESL help Reply with quote

Diego Viola <diego.viola@gmail.com> wrote:
Quote:
Hi guys,

Nevermind with the ESL and EM thing.

I was wondering what the getBody() getHeader() and other ESL stuff
does behind the scenes, in raw socket, do you know?

Why not read the source code? This is free software and open-source, after
all.


_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services