1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
#
# $Id: serial_183.cfg,v 1.2 2005/07/25 16:27:33 miconda Exp $
#
# this example shows how to use forking on failure
#
log_stderror=1
fork=no
listen=192.168.2.16
debug=3
# ------------------ module loading ----------------------------------
# Uncomment this if you want to use SQL database
loadmodule "modules/tm/tm.so"
loadmodule "modules/sl/sl.so"
loadmodule "modules/maxfwd/maxfwd.so"
# ------------------------- request routing logic -------------------
# main routing logic
route{
# initial sanity checks -- messages with
# max_forwards==0, or excessively long requests
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
return;
};
if (len_gt( max_len )) {
sl_send_reply("513", "Message too big");
return;
};
/* skip register for testing purposes */
if (method=="REGISTER") { sl_send_reply("200", "ok"); return; };
if (!method=="ACK")
log(1, "forwarding now to primary destination\n");
if (method=="INVITE") {
rewriteuri("sip:xxx@192.168.2.16:5064");
# if transaction broken, try other an alternative
# route
t_on_failure("1");
# if a provisional came, stop alternating
t_on_reply("1");
};
t_relay();
}
failure_route[1] {
log(1, "trying at alternate destination\n");
append_branch("sip:yyy@192.168.2.16:5064");
t_relay();
}
onreply_route[1] {
log(1, "reply came in\n");
if (status=~"18[0-9]") {
log(1, "provisional -- resetting negative failure\n");
t_on_failure("0");
};
}
|