It is hard to try to read your MySQL database tables except
lcr_rule_target. Try to minimize the failing case and then add log
message to your kamailio.cfg that displays the arguments of load_gws()
call followed by logging the result of next_gw() call.
-- Juha