Hello everybody: This could be a stupid question, or may be not; I'm not sure 'cause I have not a very wide experience working with Asterisk, actually I just started last week. I need to make an IVR system work and I choose working with AGIs, written in Perl. The available documentation I've found show it as a very simple proccess, but it doesn't work for me... and I don't know why yet. To describe you my stage y must start with my configuration in the extensions.conf file. This single line should describe it: exten => 771,1,AGI,myagi.agi Then, this is my code... #!/usr/bin/perl use Asterisk::AGI; $AGI = new Asterisk::AGI; my %input = $AGI->ReadParse(); $AGI->answer(); my $pin = $AGI->get_data("beep"); exit(0); Can somebody tell me why the number I enter after the "beep" is not then stored in $pin ? I'll really preciate any help. Thanks in advance V?ctor Cartes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20041005/8ef5cd33/attachment.htm
Hi Victor I'm not sure but do you have to specify a timeout and a maximum number of digits like $filename = "beep"; $timeout = 1500; $maxdigits = 1; my $pin = $AGI->get_data($filename, $timeout, $maxdigits) Regards Robb Victor Cartes wrote:> Hello everybody: > > This could be a stupid question, or may be not; I'm not sure > 'cause I have not a very wide experience working with Asterisk, > actually I just started last week. I need to make an IVR system work > and I choose working with AGIs, written in Perl. > > The available documentation I've found show it as a very simple > proccess, but it doesn't work for me... and I don't know why yet. To > describe you my stage y must start with my configuration in the > extensions.conf file. This single line should describe it: > > > exten => 771,1,AGI,myagi.agi > > > Then, this is my code... > > #!/usr/bin/perl > > use Asterisk::AGI; > $AGI = new Asterisk::AGI; > my %input = $AGI->ReadParse(); > > $AGI->answer(); > > my $pin = $AGI->get_data("beep"); > > exit(0); > > Can somebody tell me why the number I enter after the "beep" is not > then stored in $pin ? > > I'll really preciate any help. > > Thanks in advance > > V?ctor Cartes > > > >------------------------------------------------------------------------ > >_______________________________________________ >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 >
There is a whole extra set of stuff you can do to collect digits depending on how you want to terminate the collecting(number of digits, specified digits, timer, after sound file is streamed, allow interrupt of stream sound file, amount of time between digit presses, etc...). You can take a look at one of the scripts I use in the astGUIclient suite. Just download the package(http://astguiclient.sf.net/) and look at the call_park_L.agi script. Hope this helps, MATT--- -----Original Message----- From: Victor Cartes [mailto:vcartes-ast@conexion.com.py] Sent: Tuesday, October 05, 2004 2:56 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [Asterisk-Users] Asterisk Perl AGI Thanks Robb, but I think that it works with default values if you only specify the stream file. I already tried specifying the timeout and maxdigits parameters also, but it didn't work neither. the experience was similar. I really don't know what else to try. Thanks once more. V?ctor ----- Original Message ----- From: "Robert Boardman" <robb@boardman.me.uk> To: "Asterisk Users Mailing List - Non-Commercial Discussion" <asterisk-users@lists.digium.com> Sent: Tuesday, October 05, 2004 2:42 PM Subject: Re: [Asterisk-Users] Asterisk Perl AGI> Hi Victor I'm not sure but > > do you have to specify a timeout and a maximum number of digits like > > $filename = "beep"; > $timeout = 1500; > $maxdigits = 1; > my $pin = $AGI->get_data($filename, $timeout, $maxdigits) > > Regards > Robb > > Victor Cartes wrote: > > > Hello everybody: > > > > This could be a stupid question, or may be not; I'm not sure > > 'cause I have not a very wide experience working with Asterisk, > > actually I just started last week. I need to make an IVR system work > > and I choose working with AGIs, written in Perl. > > > > The available documentation I've found show it as a very simple > > proccess, but it doesn't work for me... and I don't know why yet. To > > describe you my stage y must start with my configuration in the > > extensions.conf file. This single line should describe it: > > > > > > exten => 771,1,AGI,myagi.agi > > > > > > Then, this is my code... > > > > #!/usr/bin/perl > > > > use Asterisk::AGI; > > $AGI = new Asterisk::AGI; > > my %input = $AGI->ReadParse(); > > > > $AGI->answer(); > > > > my $pin = $AGI->get_data("beep"); > > > > exit(0); > > > > Can somebody tell me why the number I enter after the "beep" is not > > then stored in $pin ? > > > > I'll really preciate any help. > > > > Thanks in advance > > > > V?ctor Cartes > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >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 > > > > _______________________________________________ > 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_______________________________________________ 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
> -----Original Message----- > From: Victor Cartes [mailto:vcartes-ast@conexion.com.py] > Sent: Tuesday, October 05, 2004 3:30 PM > To: Asterisk Users Mailing List - Non-Commercial Discussion > Subject: Re: [Asterisk-Users] Asterisk Perl AGI > > > ... I'm afraid it's still don't working. >> >>exten => 771,1,AGI,myagi.agi >What is the first thing you should always do before running an agi? ANSWER!!! Try this: exten => 771,1,Answer exten => 771,2,AGI,myagi.agi Good luck, Robert Jackson
On Tue, 5 Oct 2004, Victor Cartes wrote:> Hello everybody: > > This could be a stupid question, or may be not; I'm not sure 'cause > I have not a very wide experience working with Asterisk, actually I just > started last week. I need to make an IVR system work and I choose > working with AGIs, written in Perl. > > The available documentation I've found show it as a very simple > proccess, but it doesn't work for me... and I don't know why yet. To > describe you my stage y must start with my configuration in the > extensions.conf file. This single line should describe it: > > > exten => 771,1,AGI,myagi.agiVictor, Have you looked at res_perl yet? It is included in the Asterisk-Addons package and allows you to load a single Perl Interpreter for the Asterisk process (like mod_perl for apache) and call scripts directly from the dial-plan. It should scale a heck of a lot better than AGI, and give you a lot more flexibility, as it exposes the entire Asterisk API. -- Vice President of N2Net, a New Age Consulting Service, Inc. Company http://www.n2net.net Where everything clicks into place! KP-216-121-ST
Victor Cartes wrote: [cut]> > exten => 771,1,AGI,myagi.agi > > > Then, this is my code... > > #!/usr/bin/perl > > use Asterisk::AGI; > $AGI = new Asterisk::AGI; > my %input = $AGI->ReadParse(); > > $AGI->answer(); > > my $pin = $AGI->get_data("beep"); > > exit(0); > > Can somebody tell me why the number I enter after the "beep" is not then > stored in $pin ?I have this block in one of my agi's, and it works for me: my $retval = $agi->get_data('ivr-benvenuti', 10000, 1); $agi->hangup unless ($retval eq 1); Hope this helps. Cheers, Simone.