On Thursday 07 November 2013 05:31:58 Allen Zhang wrote: > 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 200 back.
Somewhere in the request_route just do a query with a known response and is the response matches the expected value return a 200 else something else (or nothing at all like below). if(is_method("OPTIONS")) { sql_xquery("ca", "select unix_timestamp(now()) as t", "ra"); $var(ca)=$xavp(ra=>t); sql_result_free("ra"); if($(var(ca))>1) { sl_send_reply("200","Up and running"); } exit; } -- POCOS B.V. - Croy 9c - 5653 LC Eindhoven Telefoon: 040 293 8661 - Fax: 040 293 8658 http://www.pocos.nl/ - http://www.sipo.nl/ K.v.K. Eindhoven 17097024 _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users