Module: sip-router Branch: master Commit: 8bddb971122d9f7ae20bd4ed123771e5a6d0c800 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8bddb971...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Mon Jan 31 01:58:00 2011 +0100
dispatcher(k): enhanced the cfg example in docs
---
modules_k/dispatcher/README | 51 ++++++++++++++++++++++------ modules_k/dispatcher/doc/dispatcher.cfg | 55 +++++++++++++++++++++++------- 2 files changed, 82 insertions(+), 24 deletions(-)
diff --git a/modules_k/dispatcher/README b/modules_k/dispatcher/README index ea38560..0261325 100644 --- a/modules_k/dispatcher/README +++ b/modules_k/dispatcher/README @@ -953,26 +953,55 @@ mpath="/usr/local/lib/kamailio/modules/" loadmodule "maxfwd.so" loadmodule "sl.so" loadmodule "dispatcher.so" - -# loadmodule "modules/tm/tm.so" +loadmodule "tm.so"
# ----------------- setting module-specific parameters --------------- -# -- dispatcher params --
-modparam("dispatcher", "list_file", "../etc/dispatcher.list") -# modparam("dispatcher", "force_dst", 1) +# -- dispatcher params -- +modparam("dispatcher", "list_file", "/usr/local/etc/kamailio/dispatcher.list") +modparam("dispatcher", "flags", 2) +modparam("dispatcher", "dst_avp", "$avp(AVP_DST)") +modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)") +modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")
-route{ +# main request routing block +route { if ( !mf_process_maxfwd_header("10") ) { sl_send_reply("483","To Many Hops"); - drop(); - }; + exit; + }
- ds_select_dst("2", "0"); + # select from first dst group by round-robin + if(!ds_select_dst("1", "4")) + { + sl_send_reply("500", "No destination available"); + exit; + }
- forward(); - # t_relay(); + t_on_failure("RTF_DISPATCH"); + if(!t_relay()) + { + sl_reply_error(); + exit; + } +} + +# dispatcher failure routing block +failure_route[RTF_DISPATCH] { + if (t_is_canceled()) { + exit; + } + # select next destination only for local timeout + if (t_branch_timeout() && !t_branch_replied()) + { + if(ds_next_dst()) + { + t_on_failure("RTF_DISPATCH"); + t_relay(); + exit; + } + } }
... diff --git a/modules_k/dispatcher/doc/dispatcher.cfg b/modules_k/dispatcher/doc/dispatcher.cfg index 84087a2..a7258f4 100644 --- a/modules_k/dispatcher/doc/dispatcher.cfg +++ b/modules_k/dispatcher/doc/dispatcher.cfg @@ -19,24 +19,53 @@ mpath="/usr/local/lib/kamailio/modules/" loadmodule "maxfwd.so" loadmodule "sl.so" loadmodule "dispatcher.so" - -# loadmodule "modules/tm/tm.so" +loadmodule "tm.so"
# ----------------- setting module-specific parameters --------------- -# -- dispatcher params --
-modparam("dispatcher", "list_file", "../etc/dispatcher.list") -# modparam("dispatcher", "force_dst", 1) +# -- dispatcher params -- +modparam("dispatcher", "list_file", "/usr/local/etc/kamailio/dispatcher.list") +modparam("dispatcher", "flags", 2) +modparam("dispatcher", "dst_avp", "$avp(AVP_DST)") +modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)") +modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")
-route{ +# main request routing block +route { if ( !mf_process_maxfwd_header("10") ) { sl_send_reply("483","To Many Hops"); - drop(); - }; - - ds_select_dst("2", "0"); - - forward(); - # t_relay(); + exit; + } + + # select from first dst group by round-robin + if(!ds_select_dst("1", "4")) + { + sl_send_reply("500", "No destination available"); + exit; + } + + t_on_failure("RTF_DISPATCH"); + if(!t_relay()) + { + sl_reply_error(); + exit; + } +} + +# dispatcher failure routing block +failure_route[RTF_DISPATCH] { + if (t_is_canceled()) { + exit; + } + # select next destination only for local timeout + if (t_branch_timeout() && !t_branch_replied()) + { + if(ds_next_dst()) + { + t_on_failure("RTF_DISPATCH"); + t_relay(); + exit; + } + } }