C.37. ODBC_USER_DATABASE()

ODBC_USER_DATABASE(var1[,var2[,...]])
Runs the SQL query defined in func_odbc.conf and returns the result, if any. The values defined in func_odbc.conf, such as ${VAL1}, ${VAL2}, ..., ${ARG1}, ${ARG2}, ... are replaced by the corresponding values provided when the function is called.
func_odbc.conf:
[USER_DATABASE]
dsn=my_database
read=SELECT name FROM list WHERE number='${ARG1}'
write=UPDATE list SET name=${ARG1} WHERE number='${VAL1}'
extensions.conf:
; Query (read):
exten => 123,1,Set(Name=${ODBC_USER_DATABASE(${EXTEN})})

; Update (write):
exten => 123,1,Set(ODBC_USER_DATABASE(${CALLERID(name)})=1000)