Function [name] cannot be read [in func_odbc.conf]

I have been able to write to my database and pull information. However when I upgraded from 1.6.1.18 to 1.6.2*, I can no longer write entries to the database. The functions remain the same and I receive this error:

Here is my gunc_odbc.conf

[db2log]
dsn=ksn
writesql=INSERT INTO knpgroup/callog (clpsrc,cldate,cltime,clpdst,cltype,clerrm) VALUES ('${CALLERID(number)}','${STRFTIME(${EPOCH},,%Y%m%d)}','${STRFTIME(${EPOCH},,%H%M%S)}','${CALLERID(dnid)}','${ARG1}','${ARG2}')[/code]

And here is my dialplan:
[code];If the extension is number 7, answer the extension, and hangup
exten => 7,1,Answer()
exten => 7,n,Set(runST=${ODBC_db2log(A,)})
exten => 7,n,Playback(hello)
exten => 7,n,Read(empNumber,employee-number,5,,,10)

;Test if the user is signed in
;If I'm I got to 50 and ask if tasks are completed
exten => 7,n,Set(lastcode=${ODBC_db2gtime(${empNumber})})
exten => 7,n,GotoIf($["${lastcode}" = "I"]?50)

#[... tons of redirection code I did not include]

;Close Call, exit call
exten => 7,9000,Playback(goodby)
exten => 7,n,Set(runST=${ODBC_db2log(H,)})
exten => 7,n,Hangup()

See whole stack bellow:

[quote] == Using SIP RTP CoS mark 5
– Executing [7@myphones:1] Answer(“SIP/1000-00000001”, “”) in new stack
[Mar 14 15:39:32] ERROR[2046]: pbx.c:3381 ast_func_read: Function ODBC_db2log cannot be read
– Executing [7@myphones:2] Set(“SIP/1000-00000001”, “runST=”) in new stack
– Executing [7@myphones:3] Playback(“SIP/1000-00000001”, “hello”) in new stack
– <SIP/1000-00000001> Playing ‘hello.ulaw’ (language ‘en’)
– Executing [7@myphones:4] Read(“SIP/1000-00000001”, “empNumber,employee-number,5,10”) in new stack
– Accepting a maximum of 5 digits.
– <SIP/1000-00000001> Playing ‘employee-number.ulaw’ (language ‘en’)
– User entered ‘71408’
– Executing [7@myphones:5] Set(“SIP/1000-00000001”, “lastcode=”) in new stack
– Executing [7@myphones:6] GotoIf(“SIP/1000-00000001”, “0?50”) in new stack
[Mar 14 15:39:34] ERROR[2046]: pbx.c:3381 ast_func_read: Function ODBC_db2tlog cannot be read
– Executing [7@myphones:7] Set(“SIP/1000-00000001”, “runST=”) in new stack
– Executing [7@myphones:8] Playback(“SIP/1000-00000001”, “signed-in”) in new stack
– <SIP/1000-00000001> Playing ‘signed-in.ulaw’ (language ‘en’)
– Executing [7@myphones:9] Goto(“SIP/1000-00000001”, “9000”) in new stack
– Goto (myphones,7,9000)
– Executing [7@myphones:9000] Playback(“SIP/1000-00000001”, “goodby”) in new stack
– <SIP/1000-00000001> Playing ‘goodby.ulaw’ (language ‘en’)
== Spawn extension (myphones, 7, 9000) exited non-zero on ‘SIP/1000-00000001’
– Executing [h@myphones:1] Answer(“SIP/1000-00000001”, “”) in new stack
== Spawn extension (myphones, h, 1) exited non-zero on ‘SIP/1000-00000001’
[/quote]

I’ve written you once about “writesql” and “readsql” to be realized in same method of func_odbc.conf. Have you tried this?

It may look like this:

[db2log]
dsn=ksn
writesql=INSERT INTO knpgroup/callog (clpsrc,cldate,cltime,clpdst,cltype,clerrm) VALUES ('${CALLERID(number)}','${STRFTIME(${EPOCH},,%Y%m%d)}','${STRFTIME(${EPOCH},,%H%M%S)}','${CALLERID(dnid)}','${ARG1}','${ARG2}')
read=SELECT 1 FROM dual

And, by the way, I wonder if INSERT in mysql returns some value. If it so - excuse me for ignorance )

Next staircase thought. If you are not to set values by your method, you can build you dialplan like this:

exten => 7,n,NoOp(${ODBC_db2log(A,)})

I’m still getting the error, I reinstalled the odbc driver and still can’t communicate to the database.

I got the automatic all records to write to the same DSN, just a different table in the same database. The automatic DSN is now working but my calling a func_odbc function does not work.

Another note, If I use the readsql command instead of the write sql command the database is updated? Does this mead my func_odbc extension has problem code maybe a new version needs to be installed?

I’m assuming after the upgrade it might be a configuration. Here is my “module reload”

-- Added extension 's' priority 1 to app_queue_gosub_virtual_context (0xb772bfc0) -- Registered extension context 'parkedcalls' (0xb7708910) in local table 0xb770ab78; registrar: features -- merging incls/swits/igpats from old(parkedcalls) to new(parkedcalls) context, registrar = pbx_config -- Added extension '700' priority 1 to parkedcalls (0xb7708910) -- Registered extension context 'app_dial_gosub_virtual_context' (0xb7711e48) in local table 0xb770ab78; registrar: app_dial -- merging incls/swits/igpats from old(app_dial_gosub_virtual_context) to new(app_dial_gosub_virtual_context) context, registrar = pbx_config -- Added extension 's' priority 1 to app_dial_gosub_virtual_context (0xb7711e48) -- Registered extension context 'myphones' (0xb77010c0) in local table 0xb770ab78; registrar: pbx_ael -- merging incls/swits/igpats from old(myphones) to new(myphones) context, registrar = pbx_config -- Added extension '201' priority 3 to myphones (0xb77010c0) -- Added extension '201' priority 2 to myphones (0xb77010c0) -- Added extension '201' priority 1 to myphones (0xb77010c0) -- Registered extension context 'ael-default' (0xb771bb70) in local table 0xb770ab78; registrar: pbx_ael -- merging incls/swits/igpats from old(ael-default) to new(ael-default) context, registrar = pbx_config -- Including context 'ael-demo' in context 'ael-default' -- Registered extension context 'ael-demo' (0xb7703c78) in local table 0xb770ab78; registrar: pbx_ael -- merging incls/swits/igpats from old(ael-demo) to new(ael-demo) context, registrar = pbx_config -- Added extension 'i' priority 1 to ael-demo (0xb7703c78) -- Added extension 't' priority 1 to ael-demo (0xb7703c78) -- Added extension '#' priority 2 to ael-demo (0xb7703c78) -- Added extension '#' priority 1 to ael-demo (0xb7703c78) -- Added extension '8500' priority 2 to ael-demo (0xb7703c78) -- Added extension '8500' priority 1 to ael-demo (0xb7703c78) -- Added extension '_1234' priority 1 to ael-demo (0xb7703c78) -- Added extension '600' priority 4 to ael-demo (0xb7703c78) -- Added extension '600' priority 3 to ael-demo (0xb7703c78) -- Added extension '600' priority 2 to ael-demo (0xb7703c78) -- Added extension '600' priority 1 to ael-demo (0xb7703c78) -- Added extension '500' priority 4 to ael-demo (0xb7703c78) -- Added extension '500' priority 3 to ael-demo (0xb7703c78) -- Added extension '500' priority 2 to ael-demo (0xb7703c78) -- Added extension '500' priority 1 to ael-demo (0xb7703c78) -- Added extension '1000' priority 1 to ael-demo (0xb7703c78) -- Added extension '3' priority 2 to ael-demo (0xb7703c78) -- Added extension '3' priority 1 to ael-demo (0xb7703c78) -- Added extension '2' priority 2 to ael-demo (0xb7703c78) -- Added extension '2' priority 1 to ael-demo (0xb7703c78) -- Added extension 's' priority 12 to ael-demo (0xb7703c78) -- Added extension 's' priority 11 to ael-demo (0xb7703c78) -- Added extension 's' priority 10 to ael-demo (0xb7703c78) -- Added extension 's' priority 9 to ael-demo (0xb7703c78) -- Added extension 's' priority 8 to ael-demo (0xb7703c78) -- Added extension 's' priority 7 to ael-demo (0xb7703c78) -- Added extension 's' priority 6 to ael-demo (0xb7703c78) -- Added extension 's' priority 5 to ael-demo (0xb7703c78) -- Added extension 's' priority 4 to ael-demo (0xb7703c78) -- Added extension 's' priority 3 to ael-demo (0xb7703c78) -- Added extension 's' priority 2 to ael-demo (0xb7703c78) -- Added extension 's' priority 1 to ael-demo (0xb7703c78) -- Time to scan old dialplan and merge leftovers back into the new: 0.000567 sec -- Time to restore hints and swap in new dialplan: 0.000004 sec -- Time to delete the old dialplan: 0.000083 sec -- Total time merge_contexts_delete: 0.000654 sec -- Reloading module 'res_http_post.so' (HTTP POST support) -- Reloading module 'cdr_custom.so' (Customizable Comma Separated Values CDR Backend) -- Reloading module 'codec_g726.so' (ITU G.726-32kbps G726 Transcoder) -- Reloading module 'res_clialiases.so' (CLI Aliases) -- Reloading module 'cdr_manager.so' (Asterisk Manager Interface CDR Backend) -- Reloading module 'func_odbc.so' (ODBC lookups) == Parsing '/etc/asterisk/func_odbc.conf': == Found == Unregistered custom function ODBC_db2tlog == Unregistered custom function ODBC_db2gcalls == Unregistered custom function ODBC_db2gtime == Unregistered custom function ODBC_db2read == Unregistered custom function ODBC_db2test == Unregistered custom function db2_log == Unregistered custom function ODBC_PRESENCE == Unregistered custom function ODBC_ANTIGF == Unregistered custom function ODBC_SQL == Registered custom function 'ODBC_SQL' == Registered custom function 'ODBC_ANTIGF' == Registered custom function 'ODBC_PRESENCE' == Registered custom function 'db2_log' == Registered custom function 'ODBC_db2test' == Registered custom function 'ODBC_db2read' == Registered custom function 'ODBC_db2gtime' == Registered custom function 'ODBC_db2gcalls' == Registered custom function 'ODBC_db2tlog' -- Reloading module 'cdr_odbc.so' (ODBC CDR Backend) -- Reloading module 'chan_sip.so' (Session Initiation Protocol (SIP)) Reloading SIP -- Reloading module 'cdr_adaptive_odbc.so' (Adaptive ODBC CDR backend) == Parsing '/etc/asterisk/cdr_adaptive_odbc.conf': == Found -- Reloading module 'codec_adpcm.so' (Adaptive Differential PCM Coder/Decoder) -- Reloading module 'pbx_ael.so' (Asterisk Extension Language Compiler) [Mar 15 12:52:56] NOTICE[4733]: pbx_ael.c:122 pbx_load_module: Starting AEL load process. [Mar 15 12:52:56] NOTICE[4733]: pbx_ael.c:135 pbx_load_module: AEL load process: parsed config file name '/etc/asterisk/extensions.ael'. [Mar 15 12:52:56] WARNING[4733]: ael/pval.c:2448 check_pval_item: Warning: file /etc/asterisk/extensions.ael, line 83-83: macro call to ael-std-exten-ael cannot be found in the AEL code! [Mar 15 12:52:56] NOTICE[4733]: pbx_ael.c:138 pbx_load_module: AEL load process: checked config file name '/etc/asterisk/extensions.ael'. == Setting global variable 'CONSOLE' to '"Console/dsp"' == Setting global variable 'IAXINFO' to 'guest' == Setting global variable 'TRUNK' to '"DAHDI/G2"' == Setting global variable 'TRUNKMSD' to '1' -- Registered extension context 'ael-demo' (0xb7723b28) in local table 0xb772a110; registrar: pbx_ael -- Registered extension context 'ael-default' (0xb771b980) in local table 0xb772a110; registrar: pbx_ael -- Including context 'ael-demo' in context 'ael-default' -- Registered extension context 'myphones' (0xb7747128) in local table 0xb772a110; registrar: pbx_ael -- Added extension 's' priority 1 to ael-demo (0xb7723b28) -- Added extension 's' priority 2 to ael-demo (0xb7723b28) -- Added extension 's' priority 3 to ael-demo (0xb7723b28) -- Added extension 's' priority 4 to ael-demo (0xb7723b28) -- Added extension 's' priority 5 to ael-demo (0xb7723b28) -- Added extension 's' priority 6 to ael-demo (0xb7723b28) -- Added extension 's' priority 7 to ael-demo (0xb7723b28) -- Added extension 's' priority 8 to ael-demo (0xb7723b28) -- Added extension 's' priority 9 to ael-demo (0xb7723b28) -- Added extension 's' priority 10 to ael-demo (0xb7723b28) -- Added extension 's' priority 11 to ael-demo (0xb7723b28) -- Added extension 's' priority 12 to ael-demo (0xb7723b28) -- Added extension '2' priority 1 to ael-demo (0xb7723b28) -- Added extension '2' priority 2 to ael-demo (0xb7723b28) -- Added extension '3' priority 1 to ael-demo (0xb7723b28) -- Added extension '3' priority 2 to ael-demo (0xb7723b28) -- Added extension '1000' priority 1 to ael-demo (0xb7723b28) -- Added extension '500' priority 1 to ael-demo (0xb7723b28) -- Added extension '500' priority 2 to ael-demo (0xb7723b28) -- Added extension '500' priority 3 to ael-demo (0xb7723b28) -- Added extension '500' priority 4 to ael-demo (0xb7723b28) -- Added extension '600' priority 1 to ael-demo (0xb7723b28) -- Added extension '600' priority 2 to ael-demo (0xb7723b28) -- Added extension '600' priority 3 to ael-demo (0xb7723b28) -- Added extension '600' priority 4 to ael-demo (0xb7723b28) -- Added extension '_1234' priority 1 to ael-demo (0xb7723b28) -- Added extension '8500' priority 1 to ael-demo (0xb7723b28) -- Added extension '8500' priority 2 to ael-demo (0xb7723b28) -- Added extension '#' priority 1 to ael-demo (0xb7723b28) -- Added extension '#' priority 2 to ael-demo (0xb7723b28) -- Added extension 't' priority 1 to ael-demo (0xb7723b28) -- Added extension 'i' priority 1 to ael-demo (0xb7723b28) -- Added extension '201' priority 1 to myphones (0xb7747128) -- Added extension '201' priority 2 to myphones (0xb7747128) -- Added extension '201' priority 3 to myphones (0xb7747128) [Mar 15 12:52:56] NOTICE[4733]: pbx_ael.c:145 pbx_load_module: AEL load process: compiled config file name '/etc/asterisk/extensions.ael'. -- Registered extension context 'app_dial_gosub_virtual_context' (0xb7723b98) in local table 0xb772a110; registrar: app_dial -- merging incls/swits/igpats from old(app_dial_gosub_virtual_context) to new(app_dial_gosub_virtual_context) context, registrar = pbx_ael -- Added extension 's' priority 1 to app_dial_gosub_virtual_context (0xb7723b98) -- Registered extension context 'parkedcalls' (0xb7745c78) in local table 0xb772a110; registrar: features -- merging incls/swits/igpats from old(parkedcalls) to new(parkedcalls) context, registrar = pbx_ael -- Added extension '700' priority 1 to parkedcalls (0xb7745c78) -- Registered extension context 'app_queue_gosub_virtual_context' (0xb770e5f0) in local table 0xb772a110; registrar: app_queue -- merging incls/swits/igpats from old(app_queue_gosub_virtual_context) to new(app_queue_gosub_virtual_context) context, registrar = pbx_ael -- Added extension 's' priority 1 to app_queue_gosub_virtual_context (0xb770e5f0) -- Registered extension context 'myphones-2' (0xb7724960) in local table 0xb772a110; registrar: pbx_config -- merging incls/swits/igpats from old(myphones-2) to new(myphones-2) context, registrar = pbx_ael -- Added extension '_.' priority 6 to myphones-2 (0xb7724960) -- Added extension '_.' priority 5 to myphones-2 (0xb7724960) -- Added extension '_.' priority 4 to myphones-2 (0xb7724960) -- Added extension '_.' priority 3 to myphones-2 (0xb7724960) -- Added extension '_.' priority 2 to myphones-2 (0xb7724960) -- Added extension '_.' priority 1 to myphones-2 (0xb7724960) -- Added extension '#5' priority 11 to myphones-2 (0xb7724960) -- Added extension '#5' priority 10 to myphones-2 (0xb7724960) -- Added extension '#5' priority 9 to myphones-2 (0xb7724960) -- Added extension '#5' priority 8 to myphones-2 (0xb7724960) -- Added extension '#5' priority 7 to myphones-2 (0xb7724960) -- Added extension '#5' priority 6 to myphones-2 (0xb7724960) -- Added extension '#5' priority 5 to myphones-2 (0xb7724960) -- Added extension '#5' priority 4 to myphones-2 (0xb7724960) -- Added extension '#5' priority 3 to myphones-2 (0xb7724960) -- Added extension '#5' priority 2 to myphones-2 (0xb7724960) -- Added extension '#5' priority 1 to myphones-2 (0xb7724960) -- Added extension '7' priority 9002 to myphones-2 (0xb7724960) -- Added extension '7' priority 9001 to myphones-2 (0xb7724960) -- Added extension '7' priority 9000 to myphones-2 (0xb7724960) -- Added extension '7' priority 105 to myphones-2 (0xb7724960) -- Added extension '7' priority 104 to myphones-2 (0xb7724960) -- Added extension '7' priority 103 to myphones-2 (0xb7724960) -- Reloading module 'codec_alaw.so' (A-law Coder/Decoder) Reloading MGCP -- Reloading module 'codec_speex.so' (Speex Coder/Decoder) -- Reloading module 'chan_agent.so' (Agent Proxy Channel)

Surely. But you may still try just using NoOp(${odbc_my_method(${my_arg})}), I don’t think it will eat much time to make a try both ways.

I don’t think new version is needed. We’re using 1.4.21 version and are not experiencing your problems using similar approaches.

You’ve said earlier, that in general you don’t have problems with communication to database, just some methods don’t work fine. Now it’s something else?

And I don’t see anything strange in your “module reload”, but in this case it may be still my ignorance =).

I was having trouble writing to the database. Yes I use NoOp for write. I am also only using the “readsql=” syntax as opposed to the “writesql=” (of which would most-likely not return my new error message).

I am now getting this error message on a write, well a warning message. The good news is I can now communicate 100% with the database, the bad news is the warning messages… but they are trivial if they don’t slow my phones down.

WARNING[6003]: func_odbc.c:517 acf_odbc_read: Error -1 in FETCH [INSERT INTO knpgroup/callog (clpsrc,cldate,cltime,clpdst,cltype,clerrm) VALUES ('+17166047620','20110315','210017','+17166148818','H','')]

here is the code (PS, I’ve moved on from extensions to AEL. The syntax is just much cleaner for me…)

NoOp(${db2_log(A,)}); Playback(hello); Read(empNumber,employee-number,5,,,10);

I’ve looked briefly through source code of acf_odbc_read function and around.
Seems that it’s a warning specific for “read=…” part of func_odbc method.
So you’re right - you’ll not get this message if using “write=…” syntax for method defining.

Such a warning signals that your statement was not taken as successful, but neither it was a “found no rows…”. Then cursor is closed and no data is taken as query result output for next variable assigning.

So it’s more correct to use “write=…” syntax for queries which do not return any result.

The write command does not work. The only way I write data to the database is with the read command.
Thus I belie I have problem code or the module itself needs repair.

Maybe to try to dialplan like this to make use of “write” method:

exten => 7,n,Set(${ODBC_db2log(A,)}=0)

It’s suggestion, because personally we are mostly using only “read” method and mainly do not use verbosity above 3, at which this warning appears only.

It appears at verbosity 3.

I can give that a try, I will after my demo.

In source code of asterisk 1.4.21 it’s so:

if (option_verbose > 3) {
                        ast_log(LOG_WARNING, "Error %d in FETCH [%s]\n", res, sql);

So it’s possible only if “option_verbose = 1” stands for verbosity level 0, I didn’t get so deep. It’s so or it’s changed in later versions (and I don’t think it has).

Yes, it starts at zero and I change it to level 3 which would be verbosity 4.