<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<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]-->
</head>
<body bgcolor="white" lang="NL" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Hi Răzvan,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">Thank you for your answer!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">The table was just for illustrating the problem as simple as possible…<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">What I want to achieve is this: 3 servers for everyday use and 2 servers for fallback, so simple RURI rewriting won’t do the trick :-(<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">Can you tell me what the problem is with resetting the AVPs?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">It is good to hear it is not a bug, but this makes me thinking… in this example the resources in all groups are “all”. If I change the one from group 2 to “foobar” and then call load_balance in the
failure_route like “load_balance("2","foobar")”, I get a line telling me resource “foobar” is not found in group 1???<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">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 lang="EN-US" style="color:#1F497D"><o:p> </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> </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 lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:NL">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:NL">
users-bounces@lists.opensips.org [mailto:users-bounces@lists.opensips.org] <b>On Behalf Of
</b>Razvan Crainea<br>
<b>Sent:</b> dinsdag 3 januari 2012 14:36<br>
<b>To:</b> users@lists.opensips.org<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> </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ă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 lang="EN-US" style="color:#1F497D">I really want to know if I'm doing something wrong here…</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">Steven</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"> </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 lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:NL">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";mso-fareast-language:NL">
<a href="mailto:users-bounces@lists.opensips.org">users-bounces@lists.opensips.org</a> [<a 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 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"> <o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Courier New","serif"">Hi all,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Courier New","serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">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 “old” group.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">For example:</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">The table looks like this:</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">+----+----------+------------------+-----------+</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">| id | group_id | dst_uri | resources |</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">+----+----------+------------------+-----------+</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">| 1 | 1 |
<a href="sip:192.168.9.22">sip:192.168.9.22</a> | all=10 |</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">| 2 | 1 |
<a href="sip:192.168.9.27">sip:192.168.9.27</a> | all=20 |</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">| 3 | 2 |
<a href="sip:192.168.9.18">sip:192.168.9.18</a> | all=10 |</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">+----+----------+------------------+-----------+</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">Script looks like this:</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">...</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">if ( load_balance("1","all") ) {</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif""> xlog("==================> Destination is $du\n");</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif""> t_on_failure("1");</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif""> t_relay();</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif""> exit;</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">}</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">...</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">failure_route[1] {</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif""> lb_disable();</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif""> if ( load_balance("2","all") ) {</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif""> t_on_failure("1");</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif""> xlog("==================> New destination is $du\n");</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif""> t_relay();</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif""> } else {</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif""> t_reply("500","Error");</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif""> }</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">}</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">This will result in routing a INVITE to
<a href="sip:192.168.9.27">sip:192.168.9.27</a>, when this fails the INVITE will be routed to
<a 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 lang="EN-US" style="font-family:"Courier New","serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">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 lang="EN-US" style="font-family:"Courier New","serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">Hope someone can give me some advice on this.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New","serif"">Steven</span><o:p></o:p></p>
</div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif";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 href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><o:p></o:p></pre>
<pre><a 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>
</body>
</html>