[asterisk-users] MySQL query from extensions?

Barton Fisher bhfisher at icpage.com
Fri Apr 13 17:16:59 MST 2007


Sorry, me again..
I'm at a loss as to why your example worked and mine didn't - I was 
using one of the last examples I found during my searches.
Can you tell me when/why I need to use the escape or quotes?  Is there 
some basic rule to follow?  I'm asking because there is
a confusing mix of examples on google search and I'm not sure how to know.

Also, if I wish to expand the query to return additional fields (for 
example online & owner) How would I add these to query and populate the 
variables?

Thanks

Bart

Yossi Ben Hagai wrote:
> That's the correct syntax:
>
> exten => s,1,Noop()
> exten => s,n,MYSQL(Connect connid localhost root passw0rd dax)
>
> exten => s,n,MYSQL(Query resultid ${connid} SELECT\ password\ FROM\ 
> dnislookup\ WHERE\ dnis=${IVR-Exten})
> exten => s,n,MYSQL(Fetch fetchid ${resultid} password)
>
> exten => s,n,MYSQL(Clear ${password})
> exten => s,n,MYSQL(Disconnect ${connid})
> exten => s,n,returnpes
>
> On 4/14/07, *Barton Fisher* <bhfisher at icpage.com 
> <mailto:bhfisher at icpage.com>> wrote:
>
>     Sorry,
>     From the logs I see:
>
>     Apr 13 13:32:06 WARNING[19854] app_addon_sql_mysql.c: Identifier 0,
>     identifier_type 2 not found in identifier list
>     Apr 13 13:32:06 WARNING[19854] app_addon_sql_mysql.c: aMYSQL_fetch:
>     Invalid result identifier 0 passed
>
>     Using this:
>
>     exten => s,1,Noop()
>     exten => s,n,MYSQL(Connect connid localhost root passw0rd dax)
>     exten => s,n,MYSQL(Query resultid ${connid} SELECT\ password\ FROM\
>     dnislookup\ WHERE\ dnis=\'${IVR-Exten}\')
>     exten => s,n,MYSQL(Fetch fetchid ${password} password)
>     exten => s,n,MYSQL(Clear ${password})
>     exten => s,n,MYSQL(Disconnect ${connid})
>     exten => s,n,return
>
>     Bart
>
>     Alex Balashov wrote:
>     > On Fri, 13 Apr 2007, Barton Fisher said something to this effect:
>     >
>     >> What wrong with this:
>     >
>     >   Well... what is wrong with it?  :-)
>     >
>     >   I'm not trying to be funny, but, what are the symptoms that it
>     > doesn't work?  Error output on Asterisk
>     console?  Logs?  Anything you
>     > can provide would be helpful.
>     >
>     > -- Alex
>     >
>     > --
>     > Alex Balashov <sasha at presidium.org <mailto:sasha at presidium.org>>
>     > _______________________________________________
>     > --Bandwidth and Colocation provided by Easynews.com
>     <http://Easynews.com> --
>     >
>     > asterisk-users mailing list
>     > To UNSUBSCRIBE or update options visit:
>     >   http://lists.digium.com/mailman/listinfo/asterisk-users
>     >
>     >
>     >
>     > __________ NOD32 2187 (20070413) Information __________
>     >
>     > This message was checked by NOD32 antivirus system.
>     > http://www.eset.com
>     >
>     >
>     >
>
>
>
>     _______________________________________________
>     --Bandwidth and Colocation provided by Easynews.com
>     <http://Easynews.com> --
>
>     asterisk-users mailing list
>     To UNSUBSCRIBE or update options visit:
>       http://lists.digium.com/mailman/listinfo/asterisk-users
>
>





More information about the asterisk-users mailing list