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." 
--
_____________________________________________________________________
-- 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

Reply via email to