Error checking an ODBC function call

I have a function defined in func_odbc and I call it from my dial plan with


This works fine. However, I would like to provide some kind of error checking on this function call so that if the ODBC connection fails or whatever I can play an appropriate message to the user.

Do functions in func_odbc return any kind of value I can access?

Any help appreciated…


Check the ODBCROWS channel variable. From the func_odbc source:

/* Output the affected rows, for all cases. In the event of failure, we * flag this as -1 rows. Note that this is different from 0 affected rows * which would be the case if we succeeded in our query, but the values did * not change. */ snprintf(varname, sizeof(varname), "%d", (int)rows); pbx_builtin_setvar_helper(chan, "ODBCROWS", varname);

Thanks, that worked a treat :smile: