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

Diego Viola diego.viola at gmail.com
Sun May 3 14:00:50 PDT 2009


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 at 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 at gmail.com>
> To:      gk at exram.de
>
>> I'm trying to do Event socket outbound btw.
>>
>> On Sat, May 2, 2009 at 7:57 PM, Diego Viola <diego.viola at 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 at 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 at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>




More information about the FreeSWITCH-users mailing list