[Users] How to use the failover support in the dispatcher module?

Wolfgang Hottgenroth woho at hottis.de
Fri Jan 13 15:44:02 CET 2006


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 at 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 at 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 at 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 at 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;
  }
}

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: main.cfg
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20060113/1bac4ada/attachment.asc>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Makefile
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20060113/1bac4ada/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dispatcher.list
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20060113/1bac4ada/attachment-0001.asc>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: main.mc
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20060113/1bac4ada/attachment-0001.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: main.m4
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20060113/1bac4ada/attachment-0002.asc>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: subs.m4
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20060113/1bac4ada/attachment-0002.txt>


More information about the sr-users mailing list