Hi,
on 18. 12. 2005 Daniel-Constantin Mierla accounted on this list that the dispatcher module now has a kind of failover support. I was really curious for this feature, since I had to config openser to support both load-balancing and failover.
Failover works fine: if one PSTNGW is not available, the next one is tried, until one works.
But unfortunately, for negative status reports (like 'busy'), the failure_route is also entered and thereby also the failover mechanism is triggered, with the result that a 'busy' is signalled to the A-side as 'no more gws'.
(I've tried different mechanisms for ds_select_domain, also I tried with and without the append_branch in the failure_route block.)
Any hints for me?
Thank you very much! Wolfgang
debug=3 fork=yes log_stderror=yes # (cmd line: -E)
check_via=no # (cmd. line: -v) dns=no # (cmd. line: -r) rev_dns=no # (cmd. line: -R) port=5060 children=4 fifo="/tmp/openser_fifo"
# ------------------ module loading ---------------------------------- loadmodule "/opt/openser/lib/openser/modules/sl.so" loadmodule "/opt/openser/lib/openser/modules/tm.so" loadmodule "/opt/openser/lib/openser/modules/rr.so" loadmodule "/opt/openser/lib/openser/modules/maxfwd.so" loadmodule "/opt/openser/lib/openser/modules/usrloc.so" loadmodule "/opt/openser/lib/openser/modules/registrar.so" loadmodule "/opt/openser/lib/openser/modules/textops.so" loadmodule "/opt/openser/lib/openser/modules/xlog.so" loadmodule "/opt/openser/lib/openser/modules/dispatcher.so"
# ----------------- setting module-specific parameters --------------- modparam("rr", "enable_full_lr", 1) modparam("xlog", "buf_size", 8192) modparam("dispatcher", "list_file", "/opt/openser/etc/openser/dispatcher.list") modparam("dispatcher", "force_dst", 1) modparam("dispatcher", "flags", 3) modparam("tm", "fr_timer", 5)
# ------------------------- request routing logic -------------------
# main routing logic
route[0] { xlog("L_NOTICE", "----> before route 1 <----\n"); route(1); xlog("L_NOTICE", "----> after route 1 <----\n"); }
route[1] { if (loose_route()) { xlog("L_NOTICE", "*** loose routing enforced: $rm, $ru, $si, $du\n"); t_relay(); return; }
record_route(); xlog("L_NOTICE", "REQUEST: $rm, $ru, $si, $du\n");
if (method=="REGISTER") { xlog("L_NOTICE", "*** register request from $si\n"); sl_send_reply("503", "No registrar service here"); return; }
if (method=="INVITE" && ! uri=~"^sip:+[1-9][0-9]+@") { xlog("L_NOTICE", "*** illegal sip uri: $ru\n"); sl_send_reply("484", "International number required"); return; }
# --- customer specific part ---------------------------------------
if ( src_ip==62.191.185.122 ) { xlog("L_NOTICE", "*** $rm from laptop-who, $si\n");
append_hf("P-Hint: from laptop-who\n"); append_hf("Remote-Party-ID: sip:+492319721231@62.191.185.47;party=calling;screen=yes;privacy=off\n");
if (method=="INVITE") { strip(1); prefix("+0000666666"); }
ds_select_domain("00", "4"); if (method=="INVITE") { t_on_failure("2"); }
xlog("L_NOTICE", "----> before t_relay <----\n"); t_relay(); xlog("L_NOTICE", "----> after t_relay <----\n");
return; }
if ( src_ip==62.191.185.29 ) { xlog("L_NOTICE", "*** $rm from laptop-aholt, $si\n");
append_hf("P-Hint: from laptop-aholt\n"); append_hf("Remote-Party-ID: sip:+492319721231@62.191.185.47;party=calling;screen=yes;privacy=off\n");
if (method=="INVITE") { strip(1); prefix("+0100555555"); }
ds_select_domain("01", "4"); if (method=="INVITE") { t_on_failure("2"); }
xlog("L_NOTICE", "----> before t_relay <----\n"); t_relay(); xlog("L_NOTICE", "----> after t_relay <----\n");
return; }
if ( src_ip==62.191.185.53 ) { xlog("L_NOTICE", "*** $rm from ipphone-who, $si\n");
append_hf("P-Hint: from ipphone-who\n"); append_hf("Remote-Party-ID: sip:+492319721231@62.191.185.47;party=calling;screen=yes;privacy=off\n");
if (method=="INVITE") { strip(1); prefix("+0100555555"); }
ds_select_domain("01", "4"); if (method=="INVITE") { t_on_failure("2"); }
xlog("L_NOTICE", "----> before t_relay <----\n"); t_relay(); xlog("L_NOTICE", "----> after t_relay <----\n");
return; }
if ( src_ip==127.0.2.1 || src_ip==127.0.2.2 ) { xlog("L_NOTICE", "*** $rm from cust3, $si\n");
append_hf("P-Hint: from cust3\n"); append_hf("Remote-Party-ID: sip:+492319721231@62.191.185.47;party=calling;screen=yes;privacy=off\n");
if (method=="INVITE") { strip(1); prefix("+0200000003"); }
ds_select_domain("02", "4"); if (method=="INVITE") { t_on_failure("2"); }
xlog("L_NOTICE", "----> before t_relay <----\n"); t_relay(); xlog("L_NOTICE", "----> after t_relay <----\n");
return; }
# ------------------------------------------------------------------
if (method=="INVITE") { xlog("L_NOTICE", "*** reject invite from $si\n"); t_reply("403", "Forbidden"); return; }
xlog("L_NOTICE", "*** $rm from $si\n"); t_relay(); }
failure_route[2] { xlog("L_NOTICE", "*** in failure_route 1: rc: $rc, rr: $rr, rs: $rs\n"); if (! ds_next_domain()) { t_reply("503", "Service unavailable: no more gws"); return; } else { append_branch(); t_on_failure("2"); t_relay(); return; } }
# $Id: main.m4,v 1.3 2006/01/12 15:27:42 whottgen.uu.net Exp $
debug=3 fork=yes log_stderror=yes # (cmd line: -E)
check_via=no # (cmd. line: -v) dns=no # (cmd. line: -r) rev_dns=no # (cmd. line: -R) port=5060 children=4 fifo="/tmp/openser_fifo"
# ------------------ module loading ---------------------------------- loadmodule "/opt/openser/lib/openser/modules/sl.so" loadmodule "/opt/openser/lib/openser/modules/tm.so" loadmodule "/opt/openser/lib/openser/modules/rr.so" loadmodule "/opt/openser/lib/openser/modules/maxfwd.so" loadmodule "/opt/openser/lib/openser/modules/usrloc.so" loadmodule "/opt/openser/lib/openser/modules/registrar.so" loadmodule "/opt/openser/lib/openser/modules/textops.so" loadmodule "/opt/openser/lib/openser/modules/xlog.so" loadmodule "/opt/openser/lib/openser/modules/dispatcher.so"
# ----------------- setting module-specific parameters --------------- modparam("rr", "enable_full_lr", 1) modparam("xlog", "buf_size", 8192) modparam("dispatcher", "list_file", "/opt/openser/etc/openser/dispatcher.list") modparam("dispatcher", "force_dst", 1) modparam("dispatcher", "flags", 3) modparam("tm", "fr_timer", 5)
# ------------------------- request routing logic -------------------
# main routing logic
route[0] { xlog("L_NOTICE", "----> before route 1 <----\n"); route(1); xlog("L_NOTICE", "----> after route 1 <----\n"); }
route[1] { if (loose_route()) { xlog("L_NOTICE", "*** loose routing enforced: $rm, $ru, $si, $du\n"); t_relay(); return; }
record_route(); xlog("L_NOTICE", "REQUEST: $rm, $ru, $si, $du\n");
if (method=="REGISTER") { xlog("L_NOTICE", "*** register request from $si\n"); sl_send_reply("503", "No registrar service here"); return; }
if (method=="INVITE" && ! uri=~"^sip:+[1-9][0-9]+@") { xlog("L_NOTICE", "*** illegal sip uri: $ru\n"); sl_send_reply("484", "International number required"); return; }
# --- customer specific part ---------------------------------------
if ( src_ip==62.191.185.122 ) { xlog("L_NOTICE", "*** $rm from laptop-who, $si\n");
append_hf("P-Hint: from laptop-who\n"); append_hf("Remote-Party-ID: sip:+492319721231@62.191.185.47;party=calling;screen=yes;privacy=off\n");
if (method=="INVITE") { strip(1); prefix("+0000666666"); }
ds_select_domain("00", "4"); if (method=="INVITE") { t_on_failure("2"); }
xlog("L_NOTICE", "----> before t_relay <----\n"); t_relay(); xlog("L_NOTICE", "----> after t_relay <----\n");
return; }
if ( src_ip==62.191.185.29 ) { xlog("L_NOTICE", "*** $rm from laptop-aholt, $si\n");
append_hf("P-Hint: from laptop-aholt\n"); append_hf("Remote-Party-ID: sip:+492319721231@62.191.185.47;party=calling;screen=yes;privacy=off\n");
if (method=="INVITE") { strip(1); prefix("+0100555555"); }
ds_select_domain("01", "4"); if (method=="INVITE") { t_on_failure("2"); }
xlog("L_NOTICE", "----> before t_relay <----\n"); t_relay(); xlog("L_NOTICE", "----> after t_relay <----\n");
return; }
if ( src_ip==62.191.185.53 ) { xlog("L_NOTICE", "*** $rm from ipphone-who, $si\n");
append_hf("P-Hint: from ipphone-who\n"); append_hf("Remote-Party-ID: sip:+492319721231@62.191.185.47;party=calling;screen=yes;privacy=off\n");
if (method=="INVITE") { strip(1); prefix("+0100555555"); }
ds_select_domain("01", "4"); if (method=="INVITE") { t_on_failure("2"); }
xlog("L_NOTICE", "----> before t_relay <----\n"); t_relay(); xlog("L_NOTICE", "----> after t_relay <----\n");
return; }
if ( src_ip==127.0.2.1 || src_ip==127.0.2.2 ) { xlog("L_NOTICE", "*** $rm from cust3, $si\n");
append_hf("P-Hint: from cust3\n"); append_hf("Remote-Party-ID: sip:+492319721231@62.191.185.47;party=calling;screen=yes;privacy=off\n");
if (method=="INVITE") { strip(1); prefix("+0200000003"); }
ds_select_domain("02", "4"); if (method=="INVITE") { t_on_failure("2"); }
xlog("L_NOTICE", "----> before t_relay <----\n"); t_relay(); xlog("L_NOTICE", "----> after t_relay <----\n");
return; }
# ------------------------------------------------------------------
if (method=="INVITE") { xlog("L_NOTICE", "*** reject invite from $si\n"); t_reply("403", "Forbidden"); return; }
xlog("L_NOTICE", "*** $rm from $si\n"); t_relay(); }
failure_route[2] { xlog("L_NOTICE", "*** in failure_route 1: rc: $rc, rr: $rr, rs: $rs\n"); if (! ds_next_domain()) { t_reply("503", "Service unavailable: no more gws"); return; } else { append_branch(); t_on_failure("2"); t_relay(); return; } }
main.cfg: main.mc m4/main.m4 m4/subs.m4 m4 -I ./m4 $< > $@
00 sip:139.4.200.6:5060 01 sip:139.4.200.6:5060
include(`subs.m4')
define(`_PKG_PATH_', `/opt/openser') define(`_INST_NAME_', `MAIN') define(`_DEBUG_LEVEL_', `3')
CUST_BLOCK(`62.191.185.122', `laptop-who', `00', `0', `0666666') CUST_BLOCK(`62.191.185.29', `laptop-aholt', `01', `0', `0555555') CUST_BLOCK(`62.191.185.53', `ipphone-who', `01', `0', `0555555') CUST_BLOCK(`127.0.2.1,127.0.2.2', `cust3', `02', `0', `0000003')
include(`main.m4')
dnl dnl Main part of the SER configuration file dnl dnl dnl
# $Id: main.m4,v 1.4 2006/01/13 14:29:06 whottgen.uu.net Exp $
divert(-1) ifdef(`_PKG_PATH_', `', ` errprint(`*** Package path not defined *** ')m4exit(1)') ifdef(`_INST_NAME_', `', ` errprint(`*** Instance name not defined *** ')m4exit(1)') define(`_MODULE_PATH_', _PKG_PATH_`/lib/openser/modules') ifdef(`_DEBUG_LEVEL_', `', ` define(_DEBUG_LEVEL_, `9')') divert
debug=_DEBUG_LEVEL_ fork=yes log_stderror=yes # (cmd line: -E)
check_via=no # (cmd. line: -v) dns=no # (cmd. line: -r) rev_dns=no # (cmd. line: -R) port=5060 children=4 fifo="/tmp/openser_fifo"
# ------------------ module loading ---------------------------------- loadmodule "_MODULE_PATH_/sl.so" loadmodule "_MODULE_PATH_/tm.so" loadmodule "_MODULE_PATH_/rr.so" loadmodule "_MODULE_PATH_/maxfwd.so" loadmodule "_MODULE_PATH_/usrloc.so" loadmodule "_MODULE_PATH_/registrar.so" loadmodule "_MODULE_PATH_/textops.so" loadmodule "_MODULE_PATH_/xlog.so" loadmodule "_MODULE_PATH_/dispatcher.so"
# ----------------- setting module-specific parameters --------------- modparam("rr", "enable_full_lr", 1) modparam("xlog", "buf_size", 8192) modparam("dispatcher", "list_file", "/opt/openser/etc/openser/dispatcher.list") modparam("dispatcher", "force_dst", 1) modparam("dispatcher", "flags", 3) modparam("tm", "fr_timer", 5)
# ------------------------- request routing logic -------------------
# main routing logic
route[0] { xlog("L_NOTICE", "----> before route 1 <----\n"); route(1); xlog("L_NOTICE", "----> after route 1 <----\n"); }
route[1] { if (loose_route()) { xlog("L_NOTICE", "*** loose routing enforced: $rm, $ru, $si, $du\n"); t_relay(); return; }
record_route(); xlog("L_NOTICE", "REQUEST: $rm, $ru, $si, $du\n");
if (method=="REGISTER") { xlog("L_NOTICE", "*** register request from $si\n"); sl_send_reply("503", "No registrar service here"); return; }
if (method=="INVITE" && ! uri=~"^sip:+[1-9][0-9]+@") { xlog("L_NOTICE", "*** illegal sip uri: $ru\n"); sl_send_reply("484", "International number format required"); return; }
# --- customer specific part ---------------------------------------
undivert(2)
# ------------------------------------------------------------------
if (method=="INVITE") { xlog("L_NOTICE", "*** reject invite from $si\n"); t_reply("403", "Forbidden"); return; }
xlog("L_NOTICE", "*** $rm from $si\n"); t_relay(); }
failure_route[2] { xlog("L_NOTICE", "*** in failure_route 1: rc: $rc, rr: $rr, rs: $rs\n"); if (! ds_next_domain()) { t_reply("503", "Service unavailable: no more gws"); return; } else { append_branch(); t_on_failure("2"); t_relay(); return; } }
divert(-1) define(`CUST_IP_PRINT', `src_ip=='$1) define(`CUST_IP_FOREACH', `dnl ifelse($#, 0, `',dnl $#, 1, `CUST_IP_PRINT($1)',dnl `CUST_IP_PRINT($1) || CUST_IP_FOREACH(shift($@))')')
define(`CUST_BLOCK', ` divert(2) if ( CUST_IP_FOREACH($1) ) { xlog("L_NOTICE", "*** $rm from '$2`, $si\n");
append_hf("P-Hint: from '$2`\n"); append_hf("Remote-Party-ID: sip:+492319721231@62.191.185.47;party=calling;screen=yes;privacy=off\n");
if (method=="INVITE") { strip(1); prefix("+'$3$4$5`"); }
ds_select_domain("'$3`", "4"); if (method=="INVITE") { t_on_failure("2"); }
xlog("L_NOTICE", "----> before t_relay <----\n"); t_relay(); xlog("L_NOTICE", "----> after t_relay <----\n");
return; } divert ') divert
Hello,
in the failure_route[] you can make a selection of the returned reply code from the gateways/destinations.
if(t_check_status("486" /*busy here*/)) { /* do nothing in script ==> forward the reply to the user */ exit; } else { /* select next gateway ...*/ if (! ds_next_domain()) { .... } else { .... } }
Cheers, Daniel
On 01/13/06 16:44, Wolfgang Hottgenroth wrote:
Hi,
on 18. 12. 2005 Daniel-Constantin Mierla accounted on this list that the dispatcher module now has a kind of failover support. I was really curious for this feature, since I had to config openser to support both load-balancing and failover.
Failover works fine: if one PSTNGW is not available, the next one is tried, until one works.
But unfortunately, for negative status reports (like 'busy'), the failure_route is also entered and thereby also the failover mechanism is triggered, with the result that a 'busy' is signalled to the A-side as 'no more gws'.
(I've tried different mechanisms for ds_select_domain, also I tried with and without the append_branch in the failure_route block.)
Any hints for me?
Thank you very much! Wolfgang
[...]
Thanks for that answer. I was not aware, that the timeout is also signalled tru a SIP status internally.
I did
failure_route[2] { if (t_check_status("408")) { if (! ds_next_domain()) { ... } else { ... } } else { return; } }
Everything but timeout will be forwarded to the user, timeout is handled by selecting alternative gateway.
Thanks again, Wolfgang
Daniel-Constantin Mierla wrote:
Hello,
in the failure_route[] you can make a selection of the returned reply code from the gateways/destinations.
if(t_check_status("486" /*busy here*/)) { /* do nothing in script ==> forward the reply to the user */ exit; } else { /* select next gateway ...*/ if (! ds_next_domain()) { .... } else { .... } }
Cheers, Daniel
On 01/13/06 16:44, Wolfgang Hottgenroth wrote:
Hi,
on 18. 12. 2005 Daniel-Constantin Mierla accounted on this list that the dispatcher module now has a kind of failover support. I was really curious for this feature, since I had to config openser to support both load-balancing and failover.
Failover works fine: if one PSTNGW is not available, the next one is tried, until one works.
But unfortunately, for negative status reports (like 'busy'), the failure_route is also entered and thereby also the failover mechanism is triggered, with the result that a 'busy' is signalled to the A-side as 'no more gws'.
(I've tried different mechanisms for ds_select_domain, also I tried with and without the append_branch in the failure_route block.)
Any hints for me?
Thank you very much! Wolfgang
[...]