[asterisk-users] FUNC_ODBC expr must be non-null

Doug Lytle support at drdos.info
Tue May 1 12:55:50 CDT 2012


I'm slowly, but surely converting a 1.4.x dial-plan to an Asterisk 10.3.1 dial-plan, while also converting from mysql to func_odbc. The part of my dial plan that handles the blacklisting of phone numbers reads as: 

[tele_query] 

exten => s,1,Set(torture.calls=0) 
exten => s,n,Set(ARRAY(torture.phone,torture.calls,torture.name)=${ODBC_TORTURE_QUERY(${CALLERID(number)})}) 
exten => s,n,Set(torture.calls=${IF($[ ${torture.calls} = 1]?2:1)}) 
exten => s,n,Return() 

The problem line is the 3rd Set. What this line does (At least under 1.4.x) is, if the variable ${torture.calls} = 1, then change it to 2, if it has any other value, then change it to 1. 

I initialize the torture.calls at the beginning of the subroutine, but when the query runs and there is no database entry, it returns null. 

At that point, it fails. 

Any suggestions on how to get func_odbc to either leave the initial value alone or is there a better way of handling this? 

func_odbc.conf entry: 

[TORTURE_QUERY] 
dsn=MySQL-torture 
readsql=SELECT phone, calls, name FROM TMP WHERE phone = ${ARG1} 

Thanks! 

Doug 

-- 

Ben Franklin quote: 

"Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety." 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120501/cedec28f/attachment.htm>


More information about the asterisk-users mailing list