Asterisk Function ODBC cannot be read

Asterisk PBXWhile trying to execute ODBC function in Asterisk dialplan error is thrown:
[Oct 27 14:20:21] ERROR[4601]: pbx.c:3380 ast_func_read: Function ODBC_INSERT cannot be read
— Executing [XXXXXXXXX@internal:5] Set(“SIP/out-0000001a”, “ins=”) in new stack

func_odbc.conf looks like this:

and my extensions.conf is:

All variables are correct, ODBC is also configured correctly (read from DB statements work).

There is a difference in syntax and logic between “read” and “write” functions.

In our func_odbc.conf we are trying to write VAL1 and but in fact we want to use ARG1. In the dialplan above, VAL1 is not set (it comes after the =)
So acting in the same way as for “read” functions we are trying to read a value from the function which is only a “write” function.
We need an “=” in our Set command to avoid errors, but it should be at the end. Also the function doesn’t need to be wrapped in ${} for writing:

Regarding ARG vs VAL, here is an example that uses both:

We use both VAL and ARG; then put this in the dialplan:

The final note: use escaping of input with SQL_ESC() and stay safe!
Good luck!

Want me to do this for you? Drop me a line: itgalaxyzzz {at} gmail [dot] com