I'm trying to use the LCR module to do a failover between two gateways.
For testing purposes, I have a gateway record pointed at an IP that
isn't used. The problem is, I can't seem to get OpenSER to fail over to
the other gateway. I want to use TCP (with TLS when I'm done), but I get
this:
Jul 20 15:36:57 asiago /usr/sbin/openser[11896]: route[6]: routing to
INVITE sip:MYDID@MYIPADDRESS:5060;transport=tcp
Jul 20 15:37:17 asiago /usr/sbin/openser[11896]: ERROR:
tcp_blocking_connect: timeout (10)
Jul 20 15:37:17 asiago /usr/sbin/openser[11896]: ERROR: tcpconn_connect:
tcp_blocking_connect failed
Jul 20 15:37:17 asiago /usr/sbin/openser[11896]: ERROR: tcp_send:
connect failed
Jul 20 15:37:17 asiago /usr/sbin/openser[11896]: msg_send: ERROR:
tcp_send failed
Jul 20 15:37:17 asiago /usr/sbin/openser[11896]:
ERROR:tm:t_forward_nonack: sending request failed
(IP and username censored.)
OpenSER sends this to the caller:
SIP/2.0 477 Unfortunately error on sending to next hop occurred (477/TM)
Why can't I catch this with either the return code from t_relay or the
failure route?
It will go to the failure route if I get a reply back from the next hop.
But I need to fail to the other gateway.
The relevent parts of the configs are shown below. (Addresses censored.)
Any help would greatly appreciated.
Thanks,
---Nathan
Config snippet:
# ok, so maybe try a gateway...
if( load_gws() ) {
xlog("L_INFO","route[3]: gateway routing $rm $ru");
t_on_failure("1");
route(6);
return;
}
}
route[6] {
xlog("L_INFO","route[6]: $rm $ru");
t_on_failure("1");
t_on_reply("1");
if (!next_gw()) {
xlog("L_INFO","route[6]: no more gateways for $ru");
exit;
}
xlog("L_INFO","route[6]: routing to $rm $ru");
if(!t_relay()) {
xlog("L_INFO","route[6]: t_relay returned $rc");
sl_reply_error();
}
return;
}
failure_route[1] {
xlog("L_INFO","failure_route[1]: $rm $ru");
t_on_failure("1");
if(t_check_status("404")) {
xlog("L_INFO","failure_route[1]: failing call with 404 for
$ru");
return;
}
if (!next_gw()) {
xlog("L_INFO","route[6]: no more gateways for $ru");
exit;
}
append_branch();
xlog("L_INFO","failure_route[1]: sending $rm $ru");
if(!t_relay()) {
xlog("L_INFO","route[6]: t_relay returned $rc");
}
return;
}
Gateways:
mysql> select * from gw where grp_id=4;
+---------+--------+-----------+------+------------+-----------+--------+
| gw_name | grp_id | ip_addr | port | uri_scheme | transport | prefix |
+---------+--------+-----------+------+------------+-----------+--------+
| ithaka | 4 | CENSORED | 5060 | NULL | 2 | NULL |
| larink | 4 | BAD_ADDRESS | 5060 | NULL | 2 | NULL |
+---------+--------+-----------+------+------------+-----------+--------+
2 rows in set (0.00 sec)
ithaka is a working OpenSER proxy. larink is an empty IP address. (There
used to be a server named larink.)