ODBC Problem

Hey all,

I’m struggling with ODBC in asterisk, basically, it doesn’t work :smile:

in my dialplan i have: -

exten => *789,1,Answer()
exten => *789,n,Set(TEST_TESTWRITE()=1234567)
exten => *789,n,Hangup()

which references to this in func_odbc.conf: -

[TESTWRITE]
dsn=asterisk
writesql=INSERT INTO Asterisktbl (Incoming_number) Values ${VAL1}
prefix=TEST

Doing an “odbc show” comes up with this: -

ODBC DSN Settings

Name: asterisk
DSN: asterisk-connector
Last connection attempt: 1970-01-01 01:00:00
Pooled: No
Connected: Yes

Which leads me to believe that parts setup correctly.

Unfortunately all I get is this: -

== Using SIP RTP CoS mark 5
== Extension Changed 806[exelhints] new state InUse for Notify User 802
– Executing [*789@from-intsystems:1] Answer(“SIP/806-00000efe”, “”) in new stack
– Executing [*789@from-intsystems:2] Set(“SIP/806-00000efe”, “TEST_TESTWRITE()=1234567”) in new stack
[Mar 1 17:06:23] ERROR[8626]: pbx.c:3572 ast_func_write: Function TEST_TESTWRITE not registered
– Executing [*789@from-intsystems:3] Hangup(“SIP/806-00000efe”, “”) in new stack
== Spawn extension (from-intsystems, *789, 3) exited non-zero on ‘SIP/806-00000efe’
== Extension Changed 806[exelhints] new state Idle for Notify User 802

And i’m stumped, i’m running Asterisk 1.8.2.3, i’d really appreciate some help

Oh, and the box can connect fine manually

isql -vvv asterisk-connector
±--------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
±--------------------------------------+
SQL>

aha, fixed…a bit

seems asterisk needed to restart to pick up everything correctly.

i’m still having problems with my syntax though: -

writesql=INSERT INTO Asterisktbl (Incoming_number) VALUES ${VAL1}

VAL1 would be “1234567” passed from the dialplan in this case, and the column is varchar with a max length of 32

INSERT INTO Asterisktbl (Incoming_number) VALUES (’${VAL1}’)

Also… FWIW

Works, instead of having to restart to pick up syntax changes.