<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi, Steven!<br>
    <br>
    This is not strange, the usual scenario is to do failover within the
    gateways from the same group. My question is that if you have only
    one resource, why don't you use the dispatcher[1] module? I think it
    will meet better your requirements, as load balancer is usually used
    when you want to dispatch requests based on multiple resources.
    Also, there you can disable the automatic failover behavior.<br>
    <br>
    [1] <a class="moz-txt-link-freetext" href="http://www.opensips.org/html/docs/modules/1.7.x/dispatcher.html">http://www.opensips.org/html/docs/modules/1.7.x/dispatcher.html</a><br>
    <br>
    Regards,<br>
    <pre class="moz-signature" cols="72">--
R&#259;zvan Crainea
OpenSIPS Developer</pre>
    <br>
    On 01/03/2012 04:31 PM, Steven Lam, KeenSystems B.V. wrote:
    <blockquote
cite="mid:2AB1E3C03738764094BDD615FEE595ADF928C3@AMSPRD0402MB111.eurprd04.prod.outlook.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <meta name="Generator" content="Microsoft Word 14 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New","serif";
        color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:#1F497D">Hi R&#259;zvan,<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Thank
            you for your answer!<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">The
            table was just for illustrating the problem as simple as
            possible&#8230;<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">What
            I want to achieve is this: 3 servers for everyday use and 2
            servers for fallback, so simple RURI rewriting won&#8217;t do the
            trick :-(<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Can
            you tell me what the problem is with resetting the AVPs?<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">It
            is good to hear it is not a bug, but this makes me thinking&#8230;
            in this example the resources in all groups are &#8220;all&#8221;. If I
            change the one from group 2 to &#8220;foobar&#8221; and then call
            load_balance in the failure_route like
            &#8220;load_balance("2","foobar")&#8221;, I get a line telling me
            resource &#8220;foobar&#8221; is not found in group 1???<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">So
            in a failure_route load_balance does care about the resource
            and does NOT care about the group number, is this not
            strange?<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">Steven<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
        <div style="border:none;border-left:solid blue 1.5pt;padding:0cm
          0cm 0cm 4.0pt">
          <div>
            <div style="border:none;border-top:solid #B5C4DF
              1.0pt;padding:3.0pt 0cm 0cm 0cm">
              <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:windowtext;mso-fareast-language:NL"
                    lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:windowtext;mso-fareast-language:NL"
                  lang="EN-US"> <a class="moz-txt-link-abbreviated" href="mailto:users-bounces@lists.opensips.org">users-bounces@lists.opensips.org</a>
                  [<a class="moz-txt-link-freetext" href="mailto:users-bounces@lists.opensips.org">mailto:users-bounces@lists.opensips.org</a>] <b>On
                    Behalf Of
                  </b>Razvan Crainea<br>
                  <b>Sent:</b> dinsdag 3 januari 2012 14:36<br>
                  <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:users@lists.opensips.org">users@lists.opensips.org</a><br>
                  <b>Subject:</b> Re: [OpenSIPS-Users] load_balance not
                  using group id in failure route<o:p></o:p></span></p>
            </div>
          </div>
          <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
          <p class="MsoNormal">Hi, Steven!<br>
            <br>
            This is not wrong, this is the desired behaviour in order to
            use the failover features.<br>
            I see that you have only one destination in group 2. Will
            this be the final scenario? If yes, then you shouldn't use
            load balance, but a simple RURI rewriting.<br>
            However, if you want to use multiple gateways from failure
            route, there is a hack you can do, but I don't recommend it.
            You can reset the
            <b>lb_mask</b>, <b>lb_id</b> and <b>lb_grp</b> AVPs just
            before calling the load_balance function.<br>
            <br>
            Regards,<br>
            <br>
            <o:p></o:p></p>
          <pre>--<o:p></o:p></pre>
          <pre>R&#259;zvan Crainea<o:p></o:p></pre>
          <pre>OpenSIPS Developer<o:p></o:p></pre>
          <p class="MsoNormal"><br>
            On 01/03/2012 02:34 PM, Steven Lam, KeenSystems B.V. wrote:
            <o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">Is nobody
              using this? :-(</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">I
              really want to know if I'm doing something wrong here&#8230;</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">&nbsp;</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Steven</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">&nbsp;</span><o:p></o:p></p>
          <div style="border:none;border-left:solid blue
            1.5pt;padding:0cm 0cm 0cm 4.0pt">
            <div>
              <div style="border:none;border-top:solid #B5C4DF
                1.0pt;padding:3.0pt 0cm 0cm 0cm">
                <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;mso-fareast-language:NL"
                      lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;mso-fareast-language:NL"
                    lang="EN-US">
                    <a moz-do-not-send="true"
                      href="mailto:users-bounces@lists.opensips.org">users-bounces@lists.opensips.org</a>
                    [<a moz-do-not-send="true"
                      href="mailto:users-bounces@lists.opensips.org">mailto:users-bounces@lists.opensips.org</a>]
                    <b>On Behalf Of </b>Steven Lam, KeenSystems B.V.<br>
                    <b>Sent:</b> donderdag 29 december 2011 14:48<br>
                    <b>To:</b> <a moz-do-not-send="true"
                      href="mailto:users@lists.opensips.org">users@lists.opensips.org</a><br>
                    <b>Subject:</b> [OpenSIPS-Users] load_balance not
                    using group id in failure route</span><o:p></o:p></p>
              </div>
            </div>
            <p class="MsoNormal">&nbsp;<o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;">Hi all,</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;">&nbsp;</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">Using the load
                balancer on OpenSIPS 1.7.1 I found that when calling
                load_balance in a failure_route with a group other than
                the one on the initial call, the load_balance still uses
                the &#8220;old&#8221; group.</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">&nbsp;</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">For example:</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">&nbsp;</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">The table
                looks like this:</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">+----+----------+------------------+-----------+</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">| id |
                group_id | dst_uri&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | resources |</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">+----+----------+------------------+-----------+</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">|&nbsp; 1 |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                1 |
                <a moz-do-not-send="true" href="sip:192.168.9.22">sip:192.168.9.22</a>
                | all=10&nbsp;&nbsp;&nbsp; |</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">|&nbsp; 2 |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                1 |
                <a moz-do-not-send="true" href="sip:192.168.9.27">sip:192.168.9.27</a>
                | all=20&nbsp;&nbsp;&nbsp; |</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">|&nbsp; 3 |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                2 |
                <a moz-do-not-send="true" href="sip:192.168.9.18">sip:192.168.9.18</a>
                | all=10&nbsp;&nbsp;&nbsp; |</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">+----+----------+------------------+-----------+</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">&nbsp;</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">Script looks
                like this:</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">...</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">if (
                load_balance("1","all") ) {</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;
                xlog("==================&gt; Destination is $du\n");</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;
                t_on_failure("1");</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;
                t_relay();</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp; exit;</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">}</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">...</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">&nbsp;</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">failure_route[1]
                {</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">&nbsp;lb_disable();</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">&nbsp; if (
                load_balance("2","all") ) {</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">&nbsp;&nbsp;&nbsp;
                t_on_failure("1");</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">&nbsp;&nbsp;&nbsp;
                xlog("==================&gt; New destination is $du\n");</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">&nbsp;&nbsp;&nbsp; t_relay();</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">&nbsp; } else {</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">&nbsp;&nbsp;&nbsp;
                t_reply("500","Error");</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">&nbsp; }</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">}</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">&nbsp;</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">This will
                result in routing a INVITE to
                <a moz-do-not-send="true" href="sip:192.168.9.27">sip:192.168.9.27</a>,
                when this fails the INVITE will be routed to
                <a moz-do-not-send="true" href="sip:192.168.9.22">sip:192.168.9.22</a>
                _<i>NOT</i>_ 192.168.9.18. To me this looks wrong.</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">&nbsp;</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">Is this by
                design? If so how can I force load_balance to use a uri
                from group 2 after using one from group 1?</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">&nbsp;</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">Hope someone
                can give me some advice on this.</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">&nbsp;</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="font-family:&quot;Courier
                New&quot;,&quot;serif&quot;" lang="EN-US">Steven</span><o:p></o:p></p>
          </div>
          <p class="MsoNormal"><span
              style="font-size:12.0pt;font-family:&quot;Times New
              Roman&quot;,&quot;serif&quot;;mso-fareast-language:NL"><br>
              <br>
              <br>
              <o:p></o:p></span></p>
          <pre>_______________________________________________<o:p></o:p></pre>
          <pre>Users mailing list<o:p></o:p></pre>
          <pre><a moz-do-not-send="true" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><o:p></o:p></pre>
          <pre><a moz-do-not-send="true" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><o:p></o:p></pre>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
  </body>
</html>