[SR-Users] Function to test DB connection in the cfg file?

Allen Zhang Allen.Zhang at imgtec.com
Tue Nov 12 22:33:31 CET 2013


Thanks for the replies everyone.

I couldn't find my own post from google search...... It's odd......

I have solved the problem. For anyone who are interested:

Store ruri in a avp.
Set ruir to some known value.
Call alias_db_lookup(table_name). This function returns false if db connection is down.
                Do handling
Set ruri back to original value before sending reply.



From: sr-users-bounces at lists.sip-router.org [mailto:sr-users-bounces at lists.sip-router.org] On Behalf Of Olle E. Johansson
Sent: Tuesday, 12 November 2013 8:54 a.m.
To: Kamailio (SER) - Users Mailing List
Subject: Re: [SR-Users] Function to test DB connection in the cfg file?

10 nov 2013 kl. 21:33 skrev Allen Zhang <Allen.Zhang at imgtec.com<mailto:Allen.Zhang at imgtec.com>>:

Hi all,

This is a re-post. My email didn't seem to get on the list last time.

Is there a function I can use to test database connection from the routing script in the cfg file?
My dispatcher uses OPTIONS probing. When the destination receives the OPTIONS request, I'd like to detect the health status of the database connection before sending a reply back.
Note the OPTIONS request doesn't have a user part in the RURI. Hence, is_subscriber() and alias_db_lookup() don't work.

Any suggestion?

I wrote such a function as an extension to the db API at some point. Your mail reminds me that I should find that code and commit it to trunk.
It was implemented in the generic API and in the MySQL driver.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20131112/3e46664d/attachment-0001.html>

More information about the sr-users mailing list