<br clear="all">Hi Bogdan,<br><br>Will the following script work properly with probing mode 2 with two asterisk gateways, we want to introduce it in our production environment.<br><br>route{<br><br> if (!mf_process_maxfwd_header("10")) {<br>
sl_send_reply("483","Too Many Hops");<br> exit;<br> }<br><br> if (has_totag()) <br> {<br> if (loose_route()) <br> {<br> if (is_method("BYE")) <br>
{<br> setflag(1); <br> setflag(3);<br> } <br> else if (is_method("INVITE")) <br> {<br> record_route();<br> }<br>
route(1);<br> } <br> else <br> {<br> if ( is_method("ACK") ) <br> {<br> if ( t_check_trans() ) <br> {<br> exit;<br>
} <br> else <br> {<br> # ACK without matching transaction -><br> # ignore and discard<br> exit;<br> }<br>
}<br> sl_send_reply("404","Not here");<br> }<br> exit;<br> }<br><br> #initial requests<br><br> # CANCEL processing<br> if (is_method("CANCEL"))<br>
{<br> if (t_check_trans())<br> t_relay();<br> exit;<br> }<br><br> t_check_trans();<br> <br> if (loose_route()) <br> {<br> xlog("L_ERR","Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");<br>
if (!is_method("ACK"))<br> sl_send_reply("403","Preload Route denied");<br> exit;<br> }<br><br> # record routing<br> if (!is_method("REGISTER|MESSAGE"))<br>
record_route();<br><br> # account only INVITEs<br> if (is_method("INVITE")) <br> {<br> setflag(1); # do accounting<br> if(!load_balance("1","pstn"))<br> {<br>
sl_send_reply("500", "Service full");<br> exit;<br> }<br> }<br> <br> if (!uri==myself)<br> {<br> append_hf("P-hint: outbound\r\n"); <br> route(1);<br>
}<br><br> if (is_method("PUBLISH"))<br> {<br> sl_send_reply("503", "Service Unavailable");<br> exit;<br> }<br> <br><br> if (is_method("REGISTER"))<br>
{<br> if (!save("location"))<br> sl_reply_error();<br><br> exit;<br> }<br><br> if ($rU==NULL) {<br> # request with no Username in RURI<br> sl_send_reply("484","Address Incomplete");<br>
exit;<br> }<br> route(1);<br>}<br><br><br>route[1] <br>{<br> # for INVITEs enable some additional helper routes<br> if (is_method("INVITE")) <br> {<br> t_on_branch("2");<br>
t_on_reply("2");<br> t_on_failure("1");<br> }<br><br> if (!t_relay()) <br> {<br> sl_reply_error();<br> };<br> exit;<br>}<br><br>branch_route[2] <br>{<br> xlog("new branch at $ru\n");<br>
}<br><br><br>onreply_route[2] <br>{<br> xlog("incoming reply\n");<br>}<br><br><br>failure_route[1] <br>{<br> if (t_was_cancelled()) <br> {<br> exit;<br> }<br><br> # uncomment the following lines if you want to block client <br>
# redirect based on 3xx replies.<br> <br> if (t_check_status("3[0-9][0-9]"))<br> {<br> t_reply("404","Not found");<br> exit;<br> }<br><br> # uncomment the following lines if you want to redirect the failed <br>
# calls to a different new destination<br> ##if (t_check_status("486|408")) {<br> ## sethostport("<a href="http://192.168.2.100:5060">192.168.2.100:5060</a>");<br> ## # do not set the missed call flag again<br>
## t_relay();<br> ##}<br>}<br><br>-- <br>Rajib Deka<br>Software Engineer<br><br>Mobile No: + 91 80157 09130<br>