<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 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>
    <pre class="moz-signature" cols="72">--
R&#259;zvan Crainea
OpenSIPS Developer</pre>
    <br>
    On 01/03/2012 02:34 PM, Steven Lam, KeenSystems B.V. wrote:
    <blockquote
cite="mid:2AB1E3C03738764094BDD615FEE595ADF9269D@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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        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;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.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">Is nobody using
            this? :-(<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">I
            really want to know if I'm doing something wrong here&#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">Steven<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><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;;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 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>Steven Lam, KeenSystems B.V.<br>
                  <b>Sent:</b> donderdag 29 december 2011 14:48<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> [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"><span style="font-family:&quot;Courier
              New&quot;">Hi all,<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;"><o:p>&nbsp;</o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&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.<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">For example:<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">The table looks like this:<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">+----+----------+------------------+-----------+<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">| id | group_id | dst_uri&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
              | resources |<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">+----+----------+------------------+-----------+<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&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; |<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&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; |<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&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; |<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">+----+----------+------------------+-----------+<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">Script looks like this:<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">...<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">if ( load_balance("1","all") ) {<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp; xlog("==================&gt;
              Destination is $du\n");<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp; t_on_failure("1");<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp; t_relay();<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp; exit;<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">}<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">...<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">failure_route[1] {<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">&nbsp;lb_disable();<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">&nbsp; if ( load_balance("2","all") ) {<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">&nbsp;&nbsp;&nbsp; t_on_failure("1");<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">&nbsp;&nbsp;&nbsp; xlog("==================&gt;
              New destination is $du\n");<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">&nbsp;&nbsp;&nbsp; t_relay();<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">&nbsp; } else {<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">&nbsp;&nbsp;&nbsp; t_reply("500","Error");<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">&nbsp; }<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">}<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&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.<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&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?<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">Hope someone can give me some
              advice on this.<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>
          <p class="MsoNormal"><span style="font-family:&quot;Courier
              New&quot;" lang="EN-US">Steven<o:p></o:p></span></p>
        </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>