Richard Reina
2006-Feb-23 15:33 UTC
[Asterisk-Users] How to query a table from the keypad?
I am trying to give users the option to query our accts. payable database by supplying their PO number. I able to write queries via perl->DBI->mysql but have no idea how to get * to do it from the IVR. Is this possible? Can anyone point me in the right direction for help or examples? Thanks, Richard --------------------------------- What are the most popular cars? Find out at Yahoo! Autos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060223/49d2decc/attachment.htm
Hi Richard - What you want is AGI: http://www.voip-info.org/tiki-index.php?page=Asterisk+AGI You could write a perl script to read the PO number from stdin and spit back the balance (or whatever). To read the PO number from the user, use the Read() dialplan application. To play back the balance, you could use SayDigits() (but there's probably a more elegant solution specifically for speaking amounts of money). _____ From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Richard Reina Sent: Friday, 24 February 2006 9:34 AM To: asterisk-users@lists.digium.com Subject: [Asterisk-Users] How to query a table from the keypad? I am trying to give users the option to query our accts. payable database by supplying their PO number. I able to write queries via perl->DBI->mysql but have no idea how to get * to do it from the IVR. Is this possible? Can anyone point me in the right direction for help or examples? Thanks, Richard _____ What are the most popular cars? Find out at Yahoo! <http://us.rd.yahoo.com/evt=38382/_ylc=X3oDMTEzNWFva2Y2BF9TAzk3MTA3MDc2BHNlY wNtYWlsdGFncwRzbGsDMmF1dG9z/*http:/autos.yahoo.com/newcars/popular/thisweek. html%20%0d%0a> Autos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060223/ca300050/attachment.htm
Chris A. Icide
2006-Feb-26 11:22 UTC
[Asterisk-Users] How to query a table from the keypad?
Or you could skip the overhead associated with an AGI and use the dialplan command availabe after installing asterisk-addons MYSQL. exten => _X.,1,Read(PO-NUMBER,enter-yr-po-num) exten => _X.,2,MYSQL(Connect connid <dbhost> <dbuser> <dbpass> <dbname>) exten => _X.,3,MYSQL(Query resultid ${connid} SELECT balance FROM account-payables WHERE po_num=${PO-NUMBER}) exten => _X.,4,MYSQL(Fetch fetch ${resultid} AMOUNT-DUE) exten => _X.,5,MYSQL(Clear ${resultid}) Of course you will want to put in place all the error traps and when using this function I always have a check in my hangup routine to make sure I close the open mysql connection. So at the end of the above dialplan, you should have the value you want in the AMOUNT-DUE variable. -Chris Mike Pollitt wrote:> > Hi Richard ? > > What you want is AGI: > http://www.voip-info.org/tiki-index.php?page=Asterisk+AGI > > You could write a perl script to read the PO number from stdin and > spit back the balance (or whatever). To read the PO number from the > user, use the Read() dialplan application. To play back the balance, > you could use SayDigits() (but there?s probably a more elegant > solution specifically for speaking amounts of money). > > ------------------------------------------------------------------------ > > *From:* asterisk-users-bounces@lists.digium.com > [mailto:asterisk-users-bounces@lists.digium.com] *On Behalf Of > *Richard Reina > *Sent:* Friday, 24 February 2006 9:34 AM > *To:* asterisk-users@lists.digium.com > *Subject:* [Asterisk-Users] How to query a table from the keypad? > > I am trying to give users the option to query our accts. payable > database by supplying their PO number. I able to write queries via > perl->DBI->mysql but have no idea how to get * to do it from the IVR. > Is this possible? Can anyone point me in the right direction for help > or examples? > > Thanks, > > Richard > > ------------------------------------------------------------------------ > > > What are the most popular cars? Find out at Yahoo! Autos > <http://us.rd.yahoo.com/evt=38382/_ylc=X3oDMTEzNWFva2Y2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDMmF1dG9z/*http:/autos.yahoo.com/newcars/popular/thisweek.html%20%0d%0a> > > > ------------------------------------------------------------------------ > > _______________________________________________ > --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 >
Richard Reina
2006-Feb-27 11:46 UTC
[Asterisk-Users] How to query a table from the keypad?
Thanks Chris and Mike for the great ideas. Richard "Chris A. Icide" <chris@netgeeks.net> wrote: Or you could skip the overhead associated with an AGI and use the dialplan command availabe after installing asterisk-addons MYSQL. exten => _X.,1,Read(PO-NUMBER,enter-yr-po-num) exten => _X.,2,MYSQL(Connect connid ) exten => _X.,3,MYSQL(Query resultid ${connid} SELECT balance FROM account-payables WHERE po_num=${PO-NUMBER}) exten => _X.,4,MYSQL(Fetch fetch ${resultid} AMOUNT-DUE) exten => _X.,5,MYSQL(Clear ${resultid}) Of course you will want to put in place all the error traps and when using this function I always have a check in my hangup routine to make sure I close the open mysql connection. So at the end of the above dialplan, you should have the value you want in the AMOUNT-DUE variable. -Chris Mike Pollitt wrote:> > Hi Richard ? > > What you want is AGI: > http://www.voip-info.org/tiki-index.php?page=Asterisk+AGI > > You could write a perl script to read the PO number from stdin and > spit back the balance (or whatever). To read the PO number from the > user, use the Read() dialplan application. To play back the balance, > you could use SayDigits() (but there?s probably a more elegant > solution specifically for speaking amounts of money). > > ------------------------------------------------------------------------ > > *From:* asterisk-users-bounces@lists.digium.com > [mailto:asterisk-users-bounces@lists.digium.com] *On Behalf Of > *Richard Reina > *Sent:* Friday, 24 February 2006 9:34 AM > *To:* asterisk-users@lists.digium.com > *Subject:* [Asterisk-Users] How to query a table from the keypad? > > I am trying to give users the option to query our accts. payable > database by supplying their PO number. I able to write queries via > perl->DBI->mysql but have no idea how to get * to do it from the IVR. > Is this possible? Can anyone point me in the right direction for help > or examples? > > Thanks, > > Richard > > ------------------------------------------------------------------------ > > > What are the most popular cars? Find out at Yahoo! Autos > > > > ------------------------------------------------------------------------ > > _______________________________________________ > --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 >_______________________________________________ --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 --------------------------------- Yahoo! Mail Use Photomail to share photos without annoying attachments. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060227/59a719a9/attachment.htm