route(RELAY);
}For online users this will work as you require but may cause an infinite loop between the servers if you try dialling a user which is offline.
Try adding SIP Headers and make sure you don't get into infinite loop condition.
Server1:
if(!lookup("location") {
xlog("Failed to Find user online in this server, maybe try Second server\n")
if(!is_present_hf("X-FROM-SERVER")) {
append_hf("X-FROM-SERVER: 192.168.10.57\r\n");
$ru = "sip:" + $rU + "@192.168.15.30";
route(RELAY);
}
}Server2:if(!lookup("location") {
xlog("Failed to Find user online in this server, maybe try First server\n")
if(!is_present_hf("X-FROM-SERVER")) {
append_hf("X-FROM-SERVER: 192.168.15.30\r\n");
$ru = "sip:" + $rU + "@192.168.10.57";
route(RELAY);
}
}