[Freeswitch-users] nixevent behavior

lakshmanan ganapathy lakindia89 at gmail.com
Mon Feb 1 02:57:25 PST 2010


Thanks antony.. That work's well. I also understood the functionality of
send and sendRecv. Thanks..



On Sat, Jan 30, 2010 at 10:18 PM, Anthony Minessale <
anthony.minessale at gmail.com> wrote:

> use $e = $con->sendRecv("command");
>
> every time
> for each send you do you must do a recv so this does both.
>
>
> On Sat, Jan 30, 2010 at 8:48 AM, lakshmanan ganapathy <
> lakindia89 at gmail.com> wrote:
>
>> Dear all
>>
>> I've done the following sample script to experiment the nixevent. I found
>> some difference in behavior because of nixevent. Let me explain my question
>> down the script.
>>
>> require ESL;
>> use IO::Socket::INET;
>>
>> my $ip = "192.168.1.222";
>> my $sock = new IO::Socket::INET ( LocalHost => $ip,  LocalPort => '8447',
>> Proto => 'tcp',  Listen => 1,  Reuse => 1 );
>> die "Could not create socket: $!\n" unless $sock;
>> for(;;) {
>>     my $new_sock = $sock->accept();
>>     next if (not defined ($new_sock));
>>     my $pid = fork();
>>     if ($pid) {
>>         close($new_sock);
>>         next;
>>     }
>>     print "CHILD PID: $$\n";
>>     my $host = $new_sock->sockhost();
>>     my $fd = fileno($new_sock);
>>
>>     my $con = new ESL::ESLconnection($fd);
>>     my $info = $con->getInfo();
>>
>>     my $uuid = $info->getHeader("unique-id");
>>
>>     printf "Connected call %s, from %s\n", $uuid,
>> $info->getHeader("caller-caller-id-number");
>>     my $r=$con->execute("answer");
>>     $con->events("plain","all");
>> ##########################
>>     $con->send("nixevent DTMF");
>>     my $val=$con->api("create_uuid");
>>     $val = $val->getBody();            # LINE 1
>>     chomp($val);
>>     print "UUID is $val\n";
>>     my $e = $con->recvEvent();
>>     $val = $e->getBody();               # LINE 2
>>     chomp($val);
>>     print "UUID is $val\n";
>>     close($new_sock);
>> }
>>
>> # If the line ($con->send("nixevent DTMF");) is commented, then the result
>> of create_uuid is obtained in LINE 1.
>> # else, the result isn't obtained in the LINE 1 and it has nothing. The
>> result is obtained only when I do a recvEvent,
>> # followed by a getBody (LINE 2)
>>
>> Just want to know why the behavior differs when nixevent is present???
>>
>>
>> _______________________________________________
>> 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
>>
>>
>
>
> --
> Anthony Minessale II
>
> FreeSWITCH http://www.freeswitch.org/
> ClueCon http://www.cluecon.com/
> Twitter: http://twitter.com/FreeSWITCH_wire
>
> AIM: anthm
> MSN:anthony_minessale at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
> IRC: irc.freenode.net #freeswitch
>
> FreeSWITCH Developer Conference
> sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
> iax:guest at conference.freeswitch.org/888
> googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
> pstn:+19193869900
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100201/13ce2f90/attachment-0002.html 


More information about the FreeSWITCH-users mailing list