Hello Diego, I don't know ruby but I was playing around with outbound socket as well. You have to start your TCPServer and then listen for connections on port 8084 (if you want it like it is standard). If the TCPServer gets a connect request from FS you have to Accept the connection. In .NET this is TCPServer.Accept(). This Returns a TCPClient Object which represents a dedicated connection for this specific call. A new call creates a new TCPClient Object. After that you first have to send a Connect Message ("Connect\n\n") to FS. FS will answer immediately with all data belongig to the call. If this all ist done you can send an Answer command and/or whatever you want. Hope this helps...Guido Btw.: If you find out how one can handle real blocked execution of commands I would like to know how. I tried to playback a long file and my problem was that FS answers immediately after FS accepts the command to play this file, but there is nothing that will ever give you a notice about the playback has ended, what is an unsolved problem for me. -------- Original Message -------- Subject: Re: [Freeswitch-users] Ruby and ESL help (03-Mai-2009 2:23) From: Diego Viola <diego.viola@gmail.com> To: gk@exram.de
I'm trying to do Event socket outbound btw.
On Sat, May 2, 2009 at 7:57 PM, Diego Viola <diego.viola@gmail.com> wrote:
Hello everyone,
I was trying to test ESL with Ruby, and I made this:
" require 'socket' require 'ESL'
TCPServer.new('127.0.0.1', '8084') con = ESL::ESLconnection.new('127.0.0.1', '8084', '') con.execute('answer') con.execute('playback', '/usr/local/freeswitch/sounds/music/8000/suite-espanola-op-47-leyenda.wav') "
I can connect from freeswitch with sync and async mode, but it doesn't do anything more than that, it doesn't execute my answer or playback, anyone knows what's wrong with it? I use the freeswitcher lib and it works great, but I also want to try ESL.
Thanks,
Diego
_______________________________________________ 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
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 On Sun, May 3, 2009 at 12:58 PM, Guido Kuth <gk@exram.de> wrote:
Hello Diego,
I don't know ruby but I was playing around with outbound socket as well. You have to start your TCPServer and then listen for connections on port 8084 (if you want it like it is standard). If the TCPServer gets a connect request from FS you have to Accept the connection. In .NET this is TCPServer.Accept(). This Returns a TCPClient Object which represents a dedicated connection for this specific call. A new call creates a new TCPClient Object. After that you first have to send a Connect Message ("Connect\n\n") to FS. FS will answer immediately with all data belongig to the call.
If this all ist done you can send an Answer command and/or whatever you want.
Hope this helps...Guido
Btw.: If you find out how one can handle real blocked execution of commands I would like to know how. I tried to playback a long file and my problem was that FS answers immediately after FS accepts the command to play this file, but there is nothing that will ever give you a notice about the playback has ended, what is an unsolved problem for me.
-------- Original Message -------- Subject: Re: [Freeswitch-users] Ruby and ESL help (03-Mai-2009 2:23) From: Diego Viola <diego.viola@gmail.com> To: gk@exram.de
I'm trying to do Event socket outbound btw.
On Sat, May 2, 2009 at 7:57 PM, Diego Viola <diego.viola@gmail.com> wrote:
Hello everyone,
I was trying to test ESL with Ruby, and I made this:
" require 'socket' require 'ESL'
TCPServer.new('127.0.0.1', '8084') con = ESL::ESLconnection.new('127.0.0.1', '8084', '') con.execute('answer') con.execute('playback', '/usr/local/freeswitch/sounds/music/8000/suite-espanola-op-47-leyenda.wav') "
I can connect from freeswitch with sync and async mode, but it doesn't do anything more than that, it doesn't execute my answer or playback, anyone knows what's wrong with it? I use the freeswitcher lib and it works great, but I also want to try ESL.
Thanks,
Diego
_______________________________________________ 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
This is how we do it in perl with ESL... it should be very similar in Ruby. You shouldn't have to manually use sendmsg if you tie the fd from the socket to ESL like we do in perl. /b require ESL; use IO::Socket::INET; my $ip = "127.0.0.1"; my $sock = new IO::Socket::INET ( LocalHost => $ip, LocalPort => '8040', Proto => 'tcp', Listen => 1, Reuse => 1 ); die "Could not create socket: $!\n" unless $sock; for(;;) { my $new_sock = $sock->accept(); my $pid = fork(); if ($pid) { close($new_sock); next; } my $host = $new_sock->sockhost(); my $fd = fileno($new_sock); my $con = new ESL::ESLconnection($fd); my $info = $con->getInfo(); print $info->serialize(); my $uuid = $info->getHeader("unique-id"); $con->execute("answer", "", $uuid); $con->execute("playback", "/ram/swimp.raw", $uuid); close($new_sock); } 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
I tried to use ESL::ESLconnection in ruby but I get this. [diego@localhost ruby]$ ruby test.rb test.rb:7:in `initialize': Wrong arguments for overloaded method 'ESLconnection.new'. (ArgumentError) Possible C/C++ prototypes are: ESLconnection.new(char const *host, char const *port, char const *password) ESLconnection.new(int socket) from test.rb:7:in `new' from test.rb:7 from test.rb:5:in `loop' from test.rb:5 [diego@localhost ruby]$ I made something like this: esl = ESL::ESLconnection.new(con) Where con is the accepted socket... should that work? Or do I have to specify host/port/password on the ESLconnection? Thanks, Diego On Sun, May 3, 2009 at 5:06 PM, Brian West <brian@freeswitch.org> wrote:
This is how we do it in perl with ESL... it should be very similar in Ruby. You shouldn't have to manually use sendmsg if you tie the fd from the socket to ESL like we do in perl. /b
require ESL; use IO::Socket::INET; my $ip = "127.0.0.1"; my $sock = new IO::Socket::INET ( LocalHost => $ip, LocalPort => '8040', Proto => 'tcp', Listen => 1, Reuse => 1 ); die "Could not create socket: $!\n" unless $sock; for(;;) { my $new_sock = $sock->accept(); my $pid = fork(); if ($pid) { close($new_sock); next; } my $host = $new_sock->sockhost(); my $fd = fileno($new_sock);
my $con = new ESL::ESLconnection($fd); my $info = $con->getInfo(); print $info->serialize(); my $uuid = $info->getHeader("unique-id"); $con->execute("answer", "", $uuid); $con->execute("playback", "/ram/swimp.raw", $uuid); close($new_sock); }
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
You have to pass it the file descriptor I suspect like we do in perl, python and lua. /b On May 3, 2009, at 4:17 PM, Diego Viola wrote:
esl = ESL::ESLconnection.new(con)
Brian West brian@freeswitch.org -- Meet us at ClueCon! http://www.cluecon.com
Ok, I'll try that. Thanks. Diego On Sun, May 3, 2009 at 5:25 PM, Brian West <brian@freeswitch.org> wrote:
You have to pass it the file descriptor I suspect like we do in perl, python and lua. /b On May 3, 2009, at 4:17 PM, Diego Viola wrote:
esl = ESL::ESLconnection.new(con)
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
Do I need to do something with the file descriptor or fileno first? Sorry, I don't know perl. Diego On Sun, May 3, 2009 at 5:17 PM, Diego Viola <diego.viola@gmail.com> wrote:
I tried to use ESL::ESLconnection in ruby but I get this.
[diego@localhost ruby]$ ruby test.rb test.rb:7:in `initialize': Wrong arguments for overloaded method 'ESLconnection.new'. (ArgumentError) Possible C/C++ prototypes are: ESLconnection.new(char const *host, char const *port, char const *password) ESLconnection.new(int socket) from test.rb:7:in `new' from test.rb:7 from test.rb:5:in `loop' from test.rb:5 [diego@localhost ruby]$
I made something like this:
esl = ESL::ESLconnection.new(con)
Where con is the accepted socket... should that work? Or do I have to specify host/port/password on the ESLconnection?
Thanks,
Diego
On Sun, May 3, 2009 at 5:06 PM, Brian West <brian@freeswitch.org> wrote:
This is how we do it in perl with ESL... it should be very similar in Ruby. You shouldn't have to manually use sendmsg if you tie the fd from the socket to ESL like we do in perl. /b
require ESL; use IO::Socket::INET; my $ip = "127.0.0.1"; my $sock = new IO::Socket::INET ( LocalHost => $ip, LocalPort => '8040', Proto => 'tcp', Listen => 1, Reuse => 1 ); die "Could not create socket: $!\n" unless $sock; for(;;) { my $new_sock = $sock->accept(); my $pid = fork(); if ($pid) { close($new_sock); next; } my $host = $new_sock->sockhost(); my $fd = fileno($new_sock);
my $con = new ESL::ESLconnection($fd); my $info = $con->getInfo(); print $info->serialize(); my $uuid = $info->getHeader("unique-id"); $con->execute("answer", "", $uuid); $con->execute("playback", "/ram/swimp.raw", $uuid); close($new_sock); }
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
What ever the equiv. function in ruby is. /b On May 3, 2009, at 4:26 PM, Diego Viola wrote:
Do I need to do something with the file descriptor or fileno first? Sorry, I don't know perl.
Diego
Brian West brian@freeswitch.org -- Meet us at ClueCon! http://www.cluecon.com
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
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 :D Diego On Sun, May 3, 2009 at 5:29 PM, Brian West <brian@freeswitch.org> wrote:
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
Will post some examples on the wiki now :) Diego On Sun, May 3, 2009 at 5:32 PM, Diego Viola <diego.viola@gmail.com> wrote:
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 :D
Diego
On Sun, May 3, 2009 at 5:29 PM, Brian West <brian@freeswitch.org> wrote:
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
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:
Will post some examples on the wiki now :)
Diego
On Sun, May 3, 2009 at 5:32 PM, Diego Viola <diego.viola@gmail.com> wrote:
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 :D
Diego
On Sun, May 3, 2009 at 5:29 PM, Brian West <brian@freeswitch.org> wrote:
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
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:
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:
Will post some examples on the wiki now :)
Diego
On Sun, May 3, 2009 at 5:32 PM, Diego Viola <diego.viola@gmail.com> wrote:
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 :D
Diego
On Sun, May 3, 2009 at 5:29 PM, Brian West <brian@freeswitch.org> wrote:
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
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ó:
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:
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:
Will post some examples on the wiki now :)
Diego
On Sun, May 3, 2009 at 5:32 PM, Diego Viola <diego.viola@gmail.com> wrote:
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 :D
Diego
On Sun, May 3, 2009 at 5:29 PM, Brian West <brian@freeswitch.org> wrote:
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
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:
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ó:
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:
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:
Will post some examples on the wiki now :)
Diego
On Sun, May 3, 2009 at 5:32 PM, Diego Viola <diego.viola@gmail.com> wrote:
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 :D
Diego
On Sun, May 3, 2009 at 5:29 PM, Brian West <brian@freeswitch.org> wrote:
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
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:
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:
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ó:
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:
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:
Will post some examples on the wiki now :)
Diego
On Sun, May 3, 2009 at 5:32 PM, Diego Viola <diego.viola@gmail.com> wrote:
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 :D
Diego
On Sun, May 3, 2009 at 5:29 PM, Brian West <brian@freeswitch.org> wrote: > 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
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 :() 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:
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:
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:
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ó:
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:
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:
Will post some examples on the wiki now :)
Diego
On Sun, May 3, 2009 at 5:32 PM, Diego Viola <diego.viola@gmail.com> wrote: > 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 :D > > Diego > > On Sun, May 3, 2009 at 5:29 PM, Brian West <brian@freeswitch.org> wrote: >> 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
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:
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 :() 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:
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:
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:
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ó:
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:
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: > Will post some examples on the wiki now :) > > Diego > > On Sun, May 3, 2009 at 5:32 PM, Diego Viola <diego.viola@gmail.com> wrote: >> 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 :D >> >> Diego >> >> On Sun, May 3, 2009 at 5:29 PM, Brian West <brian@freeswitch.org> wrote: >>> 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
Diego Viola <diego.viola@gmail.com> wrote:
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.
participants (5)
-
Brian West
-
Diego Viola
-
Guido Kuth
-
Jason White
-
Mikael Aleksander Bjerkeland