Re: [asterisk-users] What is wrong in m

2011-06-07 Thread Steve Edwards

On Tue, 7 Jun 2011, Bruce B wrote:

What is wrong in below asterisk application? The output should be 
content of field booth_status from table booths:


I don't see 'booth_status' or 'booths' anywhere below.


[extension-status]
exten = _X.,1,MYSQL(Connect connid 127.0.0.1 root password my-extensions)
exten = _X.,n,MYSQL(Query allow_call ${connid} SELECT extension_status FROM 
mytable WHERE extension=${CALLERID(num)} ORDER BY id DESC LIMIT 1)
exten = _X.,n,NoOp(allow_call is: ${allow_call})


0) The verbose() application is a 'better practice' than relying on the 
obtuse side effect of noop().


1) If you execute the above snippet, what shows on the console log?

2) If you snip the select statement from the console log and paste it into 
the mysql application's command line interface, what do you get?


I've never used the dialplan MySQL interface so I may be missing something 
obvious. (I prefer to do database activities in AGIs.)


--
Thanks in advance,
-
Steve Edwards   sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
Newline  Fax: +1-760-731-3000--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] What is wrong in m

2011-06-07 Thread Sherwood McGowan
The problem is the OP never performs a Fetch of the data returned by the 
Query...

From the VoIP-info page for Cmd MYSQL

MYSQL(Query resultid ${connid} query-string) 

Executes standard MySQL query contained in query-string using established 
connection identified by ${connid}. Result of query is stored in ${resultid}. 

MYSQL(Fetch fetchid ${resultid} var1\ var2\ ...\ varN) 

If any rows are available to select, ${fetchid} is set to 1 and a single row is 
fetched from a result set contained in ${resultid}. The return fields are 
assigned to ${var1}, ${var2} ... ${varN} respectively. If no rows are left to 
select, ${fetchid} is set to 0 and ${var1}, ${var2} ... ${varN} remain 
unchanged. --
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users