Hello everybody!!! I really need your help guys, I am using the AGI mode in meetme application, and I want that AGI should wait for an input from the client/user i.e. a digit and then proceed, but I have used that AGI function agi->wait_for_digit(), but no use....my agi just passes, or ignores this function, where AGI should stop here and wait for the input.... .....my extension in my dialplan..... exten => 21,1,answer exten => 21,2,meetme(21|pb) ..........and here is my AGI........... #!/usr/bin/perl -w #use strict; $aginame="conf-background.agi"; use File::Copy cp; use Asterisk::AGI; $AGI = new Asterisk::AGI; my %input = $AGI->ReadParse(); $char=0; #while(1) { #$AGI->exec('WaitExten','25000'); #$char = $AGI->receive_char('600'); $char=chr($AGI->wait_for_digit('600')); print STDERR "input form rec char : $char\n"; if($char eq "*") { print STDERR "Dialing your number\n"; $srcfile="/tmp/mycall"; $dstfile="/var/spool/asterisk/outgoing/mycall"; open(MYCALL,">$srcfile") || die "Cant't open file :$srcfile $!\n"; print MYCALL "Channel:IAX2/bali:bali\@nain/25\@atif\n"; print MYCALL "MaxRetries:2\n"; print MYCALL "RetryTime:60\n"; print MYCALL "WaitTime:30\n"; print MYCALL "Context:atif\n"; print MYCALL "Extension:22\n"; print MYCALL "Priority:1\n"; close MYCALL; # cp($srcfile,$dstfile); print STDERR "dialing complete...\n"; } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20040511/e116c348/attachment.htm
Andy Powell
2004-May-11 05:56 UTC
[Asterisk-Users] AGI.pm wait_for_digit() not working for me!!!
Ok, the first think to do is check the permissions on the conf-background.agi ..asterisk needs to be able to run it ... The code I've listed below works fine for me: #!/usr/bin/perl use Asterisk::AGI; $AGI = new Asterisk::AGI; %input = $AGI->ReadParse(); $soundpath = "/var/lib/asterisk/sounds/"; $timeout = 10; while(1) { $input = chr($AGI->wait_for_digit($timeout)); if ($input eq "*") { $AGI->stream_file("$soundpath/banana-phone-song"); } if ($input eq "1") { exit 0; } } *********** REPLY SEPARATOR *********** On 11/05/2004 at 10:52 Atif wrote:>Hello everybody!!! > > > >I really need your help guys, I am using the AGI mode in meetme >application, >and I want that AGI should wait for an input from the client/user i.e. a >digit and then proceed, but I have used that AGI function >agi->wait_for_digit(), but no use....my agi just passes, or ignores this >function, > >where AGI should stop here and wait for the input.... > > > >.....my extension in my dialplan..... > >exten => 21,1,answer > >exten => 21,2,meetme(21|pb) > > > >..........and here is my AGI........... > >#!/usr/bin/perl -w > >#use strict; > > > >$aginame="conf-background.agi"; > >use File::Copy cp; > >use Asterisk::AGI; > >$AGI = new Asterisk::AGI; > >my %input = $AGI->ReadParse(); > > > >$char=0; > > > >#while(1) > >{ > > > > #$AGI->exec('WaitExten','25000'); > > #$char = $AGI->receive_char('600'); > > $char=chr($AGI->wait_for_digit('600')); > > > > print STDERR "input form rec char : $char\n"; > > > > if($char eq "*") > > { > > print STDERR "Dialing your number\n"; > > $srcfile="/tmp/mycall"; > > $dstfile="/var/spool/asterisk/outgoing/mycall"; > > open(MYCALL,">$srcfile") || die "Cant't open file :$srcfile >$!\n"; > > print MYCALL "Channel:IAX2/bali:bali\@nain/25\@atif\n"; > > print MYCALL "MaxRetries:2\n"; > > print MYCALL "RetryTime:60\n"; > > print MYCALL "WaitTime:30\n"; > > print MYCALL "Context:atif\n"; > > print MYCALL "Extension:22\n"; > > print MYCALL "Priority:1\n"; > > close MYCALL; > ># cp($srcfile,$dstfile); > > print STDERR "dialing complete...\n"; > > } > > >_______________________________________________ >Asterisk-Users mailing list >Asterisk-Users@lists.digium.com >http://lists.digium.com/mailman/listinfo/asterisk-users >To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users