Hello all, I have been trying to solve this problem for days, with no luck. When I run an AGI script from my extensions.conf, it seems no matter what I do, the "WAIT FOR DIGIT" command will not work. The system just flies past it without waiting a single millisecond, and of course my script crashes because it doesn't have the input it needs. I have run 3 different versions of Asterisk in the hopes of clearing this up, and presently am on 1.2.12.1. My script is simple: ------------------------------------------------------------------------ #!/usr/bin/perl use POSIX; $| = 1; sub trim { my @out = @_; for (@out) { s/^\s+//; s/\s+$//; } return wantarray ? @out : $out[0]; } while(<STDIN>) { chomp; last unless length($_); if (/^agi_(\w+)\:\s+(.*)$/) { $AGI{$1} = $2; } } print "EXEC Ringing\n"; print "EXEC Wait 1\n"; print "EXEC Answer\n"; print "EXEC Festival 'Please enter the extension you want to call'\n"; $target = ""; print "WAIT FOR DIGIT 5000\n"; $target .= <STDIN>; print "WAIT FOR DIGIT 5000\n"; $target .= <STDIN>; print "WAIT FOR DIGIT 5000\n"; $target .= <STDIN>; print STDERR "Result was $target\n"; ------------------------------------------------------------------------ That's all there is to it, but it won't work. Can anyone help? Thanks!!! ~Joel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060914/4d26c93a/attachment.htm
Joel Lansden wrote:> Hello all, > > I have been trying to solve this problem for days, with no luck. > > When I run an AGI script from my extensions.conf, it seems no matter > what I do, the "WAIT FOR DIGIT" command will not work. The system just > flies past it without waiting a single millisecond, and of course my > script crashes because it doesn't have the input it needs. I have run 3 > different versions of Asterisk in the hopes of clearing this up, and > presently am on 1.2.12.1. > > My script is simple: > ------------------------------------------------------------------------ > > #!/usr/bin/perl > > use POSIX; > > $| = 1; > > sub trim { > my @out = @_; > for (@out) > { > s/^\s+//; > s/\s+$//; > } > return wantarray ? @out : $out[0]; > } > > while(<STDIN>) { > chomp; > last unless length($_); > if (/^agi_(\w+)\:\s+(.*)$/) { > $AGI{$1} = $2; > } > } > > print "EXEC Ringing\n"; > print "EXEC Wait 1\n"; > print "EXEC Answer\n"; > print "EXEC Festival 'Please enter the extension you want to call'\n"; > $target = ""; > > print "WAIT FOR DIGIT 5000\n"; > $target .= <STDIN>; > print "WAIT FOR DIGIT 5000\n"; > $target .= <STDIN>; > print "WAIT FOR DIGIT 5000\n"; > $target .= <STDIN>; > > print STDERR "Result was $target\n"; > ------------------------------------------------------------------------ > > That's all there is to it, but it won't work. > > Can anyone help? > Thanks!!! > > ~JoelHi, are you using SIP? note that you NEED to answer before launch the AGI. -- patoVala Linux User#280504 Hablando en http://www.elprimoalcahuete.com "La pr?ctica vale m?s que la gram?tica. "
I changed things so that the dialplan would answer, THEN launch the script, but this made no difference. The script still won't wait for DTMF tones from the caller. ~Joel -----Original Message----- From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Pato Valarezo Sent: Thursday, September 14, 2006 11:43 AM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] WAIT FOR DIGIT not working Joel Lansden wrote:> Hello all, > > I have been trying to solve this problem for days, with no luck. > > When I run an AGI script from my extensions.conf, it seems no matter > what I do, the "WAIT FOR DIGIT" command will not work. The system just > flies past it without waiting a single millisecond, and of course my > script crashes because it doesn't have the input it needs. I have run 3 > different versions of Asterisk in the hopes of clearing this up, and > presently am on 1.2.12.1. > > My script is simple: > ------------------------------------------------------------------------ > > #!/usr/bin/perl > > use POSIX; > > $| = 1; > > sub trim { > my @out = @_; > for (@out) > { > s/^\s+//; > s/\s+$//; > } > return wantarray ? @out : $out[0]; > } > > while(<STDIN>) { > chomp; > last unless length($_); > if (/^agi_(\w+)\:\s+(.*)$/) { > $AGI{$1} = $2; > } > } > > print "EXEC Ringing\n"; > print "EXEC Wait 1\n"; > print "EXEC Answer\n"; > print "EXEC Festival 'Please enter the extension you want to call'\n"; > $target = ""; > > print "WAIT FOR DIGIT 5000\n"; > $target .= <STDIN>; > print "WAIT FOR DIGIT 5000\n"; > $target .= <STDIN>; > print "WAIT FOR DIGIT 5000\n"; > $target .= <STDIN>; > > print STDERR "Result was $target\n"; > ------------------------------------------------------------------------ > > That's all there is to it, but it won't work. > > Can anyone help? > Thanks!!! > > ~JoelHi, are you using SIP? note that you NEED to answer before launch the AGI. -- patoVala Linux User#280504 Hablando en http://www.elprimoalcahuete.com "La pr?ctica vale m?s que la gram?tica. " _______________________________________________ --Bandwidth and Colocation provided by Easynews.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
prints print really to stdout?, flushed the output?> $target = ""; > > print "WAIT FOR DIGIT 5000\n"; > $target .= <STDIN>; > print "WAIT FOR DIGIT 5000\n"; > $target .= <STDIN>; > print "WAIT FOR DIGIT 5000\n"; > $target .= <STDIN>; > >
Hi . I had the same problem but downloaded a test script and wait for digit worked. the only visible difference is that I wat nos using strict, so I am rewriting the AGI with use strict; Hope this help. On 9/14/06, Joel Lansden <Joel@digitalparadise.net> wrote:> > Hello all, > > I have been trying to solve this problem for days, with no luck. > > When I run an AGI script from my extensions.conf, it seems no matter what > I do, the "WAIT FOR DIGIT" command will not work. The system just flies > past it without waiting a single millisecond, and of course my script > crashes because it doesn't have the input it needs. I have run 3 different > versions of Asterisk in the hopes of clearing this up, and presently am on > 1.2.12.1. > > My script is simple: > ------------------------------------------------------------------------ > > #!/usr/bin/perl > > use POSIX; > > $| = 1; > > sub trim { > my @out = @_; > for (@out) > { > s/^\s+//; > s/\s+$//; > } > return wantarray ? @out : $out[0]; > } > > while(<STDIN>) { > chomp; > last unless length($_); > if (/^agi_(\w+)\:\s+(.*)$/) { > $AGI{$1} = $2; > } > } > > print "EXEC Ringing\n"; > print "EXEC Wait 1\n"; > print "EXEC Answer\n"; > print "EXEC Festival 'Please enter the extension you want to call'\n"; > $target = ""; > > print "WAIT FOR DIGIT 5000\n"; > $target .= <STDIN>; > print "WAIT FOR DIGIT 5000\n"; > $target .= <STDIN>; > print "WAIT FOR DIGIT 5000\n"; > $target .= <STDIN>; > > print STDERR "Result was $target\n"; > ------------------------------------------------------------------------ > > That's all there is to it, but it won't work. > > Can anyone help? > Thanks!!! > > ~Joel > > > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com -- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users > >-- Camilo Echeverry Your life would be very empty if you had nothing to regret. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20070213/f683128f/attachment.htm