Hi anthony, I was in a need of flushing the events buffer without reading it.I've done the following ESL(Async) program to flush the events. First I register for events. I answered the call and playback some message. Now the events would have been queued. I, then send "noevents". After sending that, I again register for events, and when I receive the events, I've not got the old events. I got only new events. But I don't know whether it is exactly a way to flush the events or not. I just need your suggestions or your thoughts on this. Here is the script: use lib "/usr/local/freeswitch/scripts/esl"; require ESL; use IO::Socket::INET; use Data::Dumper; my $ip = "192.168..0.0"; my $sock = new IO::Socket::INET ( LocalHost => $ip, LocalPort => '8447', Proto => 'tcp', Listen => 2, Reuse => 1 ); die "Could not create socket: $!\n" unless $sock; my $con; 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); print "Host name is $host\n"; $con = new ESL::ESLconnection($fd); my $info = $con->getInfo(); my $uuid = $info->getHeader("unique-id"); printf "Connected call %s, from %s to %s\n", $uuid, $info->getHeader("caller-caller-id-number"), $info->getHeader("caller-destination-number"); $con->filter("Unique-Id", $uuid); $con->events("plain", "all"); $con->execute("answer"); $con->setEventLock("true"); $con->execute("playback","/usr/local/freeswitch/sounds/en/us/callie/ivr/8000/ivr-welcome_to_freeswitch.wav"); $con->send("noevents"); sleep(5); $con->events("plain", "all"); while(my $e = $con->recvEvent()) { print $e->serialize(); } } Anthony Minessale-2 wrote:
read them in a timed loop of some small number of MS until you get a timeout meaning you have flushed them all.
On Fri, Oct 30, 2009 at 1:57 AM, velusamy velu <velu.technical@gmail.com>wrote:
Dear All, I receiving the events in while loop by using recvEventTimed method in ESL.pm. I have to flush that Event buffer after some particular time. How can I do it?
Thanks, Velusamy
_______________________________________________ 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 <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
_______________________________________________ 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
-- View this message in context: http://old.nabble.com/Flushing-the-Event-buffer-in-Perl-Event-Socket-tp26125... Sent from the Freeswitch-users mailing list archive at Nabble.com.