Oh dear... it's failing because as far as t_relay() is concerned, the packet has been
delivered, and the transaction is complete, right? If that's the case, how can I also
send the REGISTRATION packet to another destination? Can I use forward() with
failure_route? Arrgh!.
-----Original Message-----
From: Douglas Garstang
Sent: Tuesday, December 13, 2005 6:01 PM
To: 'users(a)openser.org'
Subject: failure_route.... I could cry...
I am trying to have OpenSER forward registration requests to multiple Asterisk boxes with
failover. Each Asterisk box has two ip addresses. My logic tries to relay to the first IP
on the first Asterisk box (192.168.10.100). If that fails, it tries to relay to the second
IP on the first Asterisk box (192.168.10.17). It then goes on and repeats the process with
another Asterisk box who's IP's are 192.168.10.10.101 and 192.168.10.8.
Actually the first IP address on each Asterisk system is fake (100 and 101)... that's
how I am testing that it will fail to the second one.
The openser.cfg below is causing this to be logged to messages:
Dec 13 17:50:08 bil-pdev-3 openser[22318]: route10: Asterisk-1, NIC-1
Dec 13 17:50:08 bil-pdev-3 openser[22318]: route20: Asterisk-2, NIC-1
Dec 13 17:50:08 bil-pdev-3 openser[22318]: ERROR: t_newtran: transaction already in
process 0xb6126560 < --- Why?
Dec 13 17:50:08 bil-pdev-3 openser[22318]: route20: t_relay returned error
<--- Why?
Dec 13 17:50:09 bil-pdev-3 openser[22328]: failure21: Failed to register with Asterisk-2,
NIC-1
Dec 13 17:50:09 bil-pdev-3 openser[22328]: route22: Asterisk-2, NIC-2
Dec 13 17:50:09 bil-pdev-3 openser[22328]: route22: End of routine
Dec 13 17:50:10 bil-pdev-3 openser[22322]: User local found
Dec 13 17:50:10 bil-pdev-3 openser[22320]: User local found
Why am I getting the t_newtran and t_relay errors in there? What am I doing wrong?
I'm just calling rewritehostport(next-ip), followed by append_branch() and t_relay. In
fact something really weird happens. When I have the code there for route[20],
failure_route[21] and route[22], it causes the code for the first three routing blocks,
route[10], failure_route[11] and route[12] to act differently. It seems to make route20
fail to connect eventhough it comes AFTER it in the code.
I'd really appreciate some help! Am I doing something wrong with rewritehostport and
append_branch, because quite frankly the docs are terrible.
if ( method == REGISTER ) {
if ( !www_authorize("voip.com", "subscriber") ) {
www_challenge("voip.com", "0");
};
save("location");
route(10);
route(20);
#
# First Asterisk System.
#
# Try first IP on this system (fake - will fail)
route[10] {
xlog ("L_INFO","route10: Asterisk-1, NIC-1");
t_on_failure("11");
rewritehostport("192.168.10.100:5060");
append_branch();
if ( !t_relay() ) {
xlog ("L_INFO","route10: t_relay returned error");
}
}
failure_route[11] {
xlog ("L_INFO","failure11: Failed to register with Asterisk-1,
NIC-1");
route(12);
}
# Try second IP on this system (real - should work)
route[12] {
xlog ("L_INFO","route12: Asterisk-1, NIC-2");
t_on_failure("13");
rewritehostport("192.168.10.17:5060");
append_branch();
if ( !t_relay() ) {
xlog ("L_INFO","route12: t_relay returned error");
}
xlog ("L_INFO","route12: End of routine");
return;
}
#
# Second Asterisk System
#
# Try first IP on this system (fake - will fail)
route[20] {
xlog ("L_INFO","route20: Asterisk-2, NIC-1");
t_on_failure("21");
rewritehostport("192.168.10.101:5060");
append_branch();
if ( !t_relay() ) {
xlog ("L_INFO","route20: t_relay returned error");>
}
}
failure_route[21] {
xlog ("L_INFO","failure21: Failed to register with Asterisk-2,
NIC-1");
route(22);
}
# Try second IP on this system (real - should work)
route[22] {
xlog ("L_INFO","route22: Asterisk-2, NIC-2");
t_on_failure("23");
rewritehostport("192.168.10.8:5060");
append_branch();
if ( !t_relay() ) {
xlog ("L_INFO","route22: t_relay returned error");
}
xlog ("L_INFO","route22: End of routine");
return;
}
Doug