[SR-Users] 503 on DB Error

Daniel-Constantin Mierla miconda at gmail.com
Mon Dec 12 10:33:59 CET 2011


Hello,

On 12/10/11 11:36 AM, Olle E. Johansson wrote:
> 9 dec 2011 kl. 18:54 skrev Spencer Thomason:
>
>> Hello all,
>> Is it possible to configure Kamailio to reply to a request with a 503 if it cannot connect to a necessary database for the operation?
>>
>> I.e.  Kamailio cannot connect to the database, when a REGISTER comes in and userloc can't find the credentials (due to DB failure), respond with a 503.  The requesting endpoint can then fail over properly.  The same behaviour would be desired for other modules as well, i.e. aliasdb.
>>
>>
>> I noticed using 3.1.5 that it simply does not authorize the user.
>>
>>
> I have been thinking about this as well. We could implement a db_ping function so we could test in the routing script before
> calling functions that use the DB. It's harder with stuff that happens in the background, like ACC and SIPTRACE. I don't know
> what happens with them if the database fails.
one option would be to set a config env variable, like db_error, which 
is set by the db modules on error. Then can be checked in the config and 
act accordingly. This will require touching the db modules.

Alternative is to propagate some return codes up to config file, but 
this will require changes in all modules interacting with database, 
including the db modules.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla -- http://www.asipto.com
http://linkedin.com/in/miconda -- http://twitter.com/miconda




More information about the sr-users mailing list