ODBC Connection Failure – Can It Be Fatal?

Home » Asterisk Users » ODBC Connection Failure – Can It Be Fatal?
Asterisk Users 1 Comment

Hi.

I have an Asterisk 13.14.1 setup which uses ODBC to write CEL and CDR records.

The connection to my database server depends on a VPN tunnel being up, and if Asterisk starts before that tunnel is functional, I get messages such as the following in the Asterisk log file:

[2020-06-23 10:40:22.384335] delta WARNING[1697]: res_odbc.c:958 in odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=1045 [unixODBC]
[ma-3.0.6]Access denied for user ‘Trimble’@’delta.example.net’ (using password: YES)

The problem is that this is not a fatal error as far as Asterisk is concerned, so it continues to start up to the point where I get:

[2020-06-23 10:40:26.076377] delta VERBOSE[1697]: asterisk.c:4791 in asterisk_daemon: Asterisk Ready.

and the system then processes calls without creating any CEL or CDR entries.

Is there any way I can tell Asterisk that an ODBC connection problem is a fatal error, so please shut down and don’t process any calls (I have an HA
setup so another machine will handle any calls which needs processing; I just don’t want to process calls without generating CDRs)?

Thanks,

Antony.


“Can you keep a secret?”
“Well, I shouldn’t really tell you this, but… no.”

Please reply to the list;
please *don’t* CC me.

One thought on - ODBC Connection Failure – Can It Be Fatal?

  • Your be best bet would be to do that check in the script that starts up Asterisk and maybe a CRON job that periodically tests connectivity.

    Doug