if(!load_gws(1, $rU, $var(caller_uri))) {
xlog("Gateways no disponibles");
sl_send_reply("500", "Server Internal Error - No gateway");
exit;
} else {
xlog("GW Seleccionado '$avp(i:709)'\n");
xlog("Dominio de destino: $dd\n");
xlog("To URI: $tu\n");
}
if(!next_gw()) {
xlog("No hay GW de Backup");
sl_send_reply("503", "Service not available - No gateway");
exit;
} else {
xlog("Enviado por primer GW\n");
xlog("ruri_user_avp: '$avp(i:500)'\n");
xlog("To URI after next_gw: $tu\n");
xlog("Request URI: $rU\n");
t_on_failure("FAILBACK");
}
failure_route[FAILBACK] {
if (t_is_canceled()) {
exit;
}
if (t_check_status("408|50[34]")) {
route(LCR_OUT_OP2);
}
}
And using for OP2 same routing block with id=3...
This second providers use AUTH so using:
t_on_failure("TRUNKAUTH");
failure_route[TRUNKAUTH] {
if (t_is_canceled()) {
exit;
}
if(t_check_status("401|407")) {
if (to_gw("3")) {
xlog("Autenticación ");
$avp(auser) = "user";
$avp(apass) = "pass";
}
uac_auth();
t_relay();
exit;
}
But getting this error:
May 30 09:59:05 kamailio /usr/local/sbin/kamailio[21602]: ERROR: tm [t_fwd.c:1704]: t_forward_nonack(): ERROR: t_forward_nonack: no branches for forwarding
May 30 09:59:05 kamailio /usr/local/sbin/kamailio[21602]: ERROR: tm [tm.c:1466]: _w_t_relay_to(): ERROR: w_t_relay_to: t_relay_to failed
Any idea how to resolve that?