<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div>
<div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
No, that is wrong.</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div style="widows: 1;"><font face="Calibri,sans-serif">&quot;</font><span style="widows: 1; background-color: rgb(255, 255, 255);"><font color="#666666" face="Trebuchet MS,sans-serif,Verdana,Arial"><span style="font-size: 13.0080003738403px; line-height: 21.5932807922363px;">If
 no index is given, the first value will be returned.</span><span style="font-size: 13px; line-height: 21.593280792236328px;">”</span><span style="font-size: 13.0080003738403px; line-height: 21.5932807922363px;">&nbsp;[1]</span></font></span></div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
&nbsp;[1]&nbsp;<a href="http://www.opensips.org/Documentation/Script-CoreVar-1-11#toc2">http://www.opensips.org/Documentation/Script-CoreVar-1-11#toc2</a></div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<div id="">
<div><br>
</div>
<div>Ben Newlin</div>
</div>
</div>
</div>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<span id="OLK_SRC_BODY_SECTION" style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<div style="font-family:Calibri; font-size:12pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>&lt;Podrigal&gt;, Aron<br>
<span style="font-weight:bold">Reply-To: </span>OpenSIPS users mailling list<br>
<span style="font-weight:bold">Date: </span>Wednesday, July 1, 2015 at 1:29 PM<br>
<span style="font-weight:bold">To: </span>OpenSIPS users mailling list<br>
<span style="font-weight:bold">Subject: </span>Re: [OpenSIPS-Users] Route_to_gw not pushing gw_id to the first index of avp<br>
</div>
<div><br>
</div>
<div>
<div>
<div dir="ltr">When accessing an avp without explicit index isn't it returning the last index?&nbsp;
<div><br>
</div>
<div># first time svp_gw_id is set</div>
<div>is_from_gw(, i); &nbsp; # &nbsp;avp now has (1)</div>
<div><br>
</div>
<div>route_to_gw(&quot;gw2,gw3,gw4&quot;);</div>
<div># avp now has (gw1, gw2);</div>
<div><br>
</div>
<div>if we now access the avp, we can either get explicitly the specific index, or we get the last index which is `gw2`.</div>
<div>So if I'm not mistaken, then I don't understand what the problem is here?</div>
<div><br>
</div>
<div><br>
</div>
<div>Correct me if this is wrong.</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Jul 1, 2015 at 11:46 AM, Newlin, Ben <span dir="ltr">
&lt;<a href="mailto:Ben.Newlin@inin.com" target="_blank">Ben.Newlin@inin.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<div>
<div>
<div>I found similar behavior in my implementation, except that I use dr_routing() instead of route_to_gw(). When the AVP is already populated, these functions simply push on the end. This may be an implementation decision, but it is certainly not intuitive
 or what I expected.</div>
<div><br>
</div>
<div>I am currently using the same workaround of clearing out the AVPs prior to each DROUTING module call that populates them.</div>
<div>
<div>
<div><br>
</div>
<div>Ben Newlin</div>
</div>
</div>
</div>
</div>
<div><br>
</div>
<span>
<div style="font-family:Calibri;font-size:12pt;text-align:left;color:black;BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;PADDING-BOTTOM:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;BORDER-TOP:#b5c4df 1pt solid;BORDER-RIGHT:medium none;PADDING-TOP:3pt">
<span style="font-weight:bold">From: </span>Patrick Wakano<br>
<span style="font-weight:bold">Reply-To: </span>OpenSIPS users mailling list<br>
<span style="font-weight:bold">Date: </span>Wednesday, July 1, 2015 at 11:41 AM<br>
<span style="font-weight:bold">To: </span>OpenSIPS users mailling list<br>
<span style="font-weight:bold">Subject: </span>Re: [OpenSIPS-Users] Route_to_gw not pushing gw_id to the first index of avp<br>
</div>
<div>
<div class="h5">
<div><br>
</div>
<div>
<div>
<div dir="ltr">Hello Aron,
<div>After calling is_from_gw(&quot;-1&quot;,&quot;i&quot;) I don't need to use the index, because it is the only value hold by the avp, but later in my script, if I call route_to_gw() and use $avp(dr_gw_id), it still has the value previously pushed by is_from_gw(). Then to get
 the gw id pushed by route_to_gw() I have either to use the avp index (e.g. $avp(dr_gw_id)[1]) or I set&nbsp;$avp(dr_gw_id)&nbsp;to null before calling route_to_gw() (which is what I am doing now).
<div><br>
</div>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Jul 1, 2015 at 9:50 AM, Podrigal, Aron <span dir="ltr">
&lt;<a href="mailto:aronp@guaranteedplus.com" target="_blank">aronp@guaranteedplus.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<p dir="ltr">I guess&nbsp; pushing to the last index of the avp is what's expected. </p>
<p dir="ltr">But how did you retrieve the gw_id from is_from_gw, did you use an explicit index?
</p>
<div class="gmail_quote">
<div>
<div>On Jul 1, 2015 8:16 AM, &quot;Patrick Wakano&quot; &lt;<a href="mailto:pwakano@gmail.com" target="_blank">pwakano@gmail.com</a>&gt; wrote:<br type="attribution">
</div>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div>
<div dir="ltr">Hello Opensips list,
<div><br>
</div>
<div>When using the route_to_gw() function, I noticed that the gw_id that is pushed back to the avp wasn't matching the address actually selected by the drouting engine.</div>
<div>After some investigation I noticed that earlier in my script I was calling the is_from_gw() function with the 'i' flag which also pushes the gw_id to the avp and this was the value I was seeing in my avp after calling the route_to_gw().</div>
<div>By debuging with the avp_print() function I could see that the route_to_gw() does not pushes the gw_id to first index of the avp, but to the end of it. Any reason for that or is it a bug?</div>
<div><br>
</div>
<div>Regards,</div>
<div><br>
</div>
<div>Patrick</div>
</div>
<br>
</div>
</div>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br>
</blockquote>
</div>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</span></div>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="gmail_signature">
<div dir="ltr">Aron Podrigal
<div>-</div>
<div>//Be happy :-)</div>
</div>
</div>
</div>
</div>
</div>
</span>
</body>
</html>