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@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@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@hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org
pstn:+19193869900