Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Asterisk and a MySQL database connected via ODBC to store CDRs. When my MySQL database isn't available when Asterisk starts or has an outage while Asterisk is running, I would expect Asterisk to retry to connect to the database, but this doesn't happen! Anyone knows where I can enable some kidn of automatic reconnect to databases in Asterisk?

My res_odbc.conf looks like this:

enabled => yes
dsn => asterisk-connector
username => user
password => pass
pre-connect => yes
pooling => no
limit => 1
idlecheck => 1
negative_connection_cache => 1
share|improve this question

Usualy it do reconnect on next realtime request.

Try this set

idlecheck => 300; ( will check connection in pool every 5 minutes)
connect_timeout => 5; ( how long to wait on reconnect)
negative_connection_cache=>10 ;( how long wait before reconnect)
pre-connect = yes; will allow you check if connection ok by issue "realtime show odbc status"

Also i recomend set limit to more then 1.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.