Hello,<br><br><div class="gmail_quote">On Thu, Mar 10, 2011 at 10:33 AM, Klaus Darilion <span dir="ltr">&lt;<a href="mailto:klaus.mailinglists@pernau.at">klaus.mailinglists@pernau.at</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Aha, so using an AVP as loop counter (I need the counter for the whole<br>
transcation lifetime) like:<br>
<br>
$avp(count) = $avp(count) + 1;<br>
<br>
would work (it does), but creates a new array element every calculation?<br></blockquote><div><br>yes.<br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<br>
I guess the workaround to not create an array is to use always an index,<br>
at least on the left side, eg:<br>
<br>
$(avp(count)[0]) = $avp(count) + 1;<br></blockquote><div><br>The right would be:<br>$(avp(count)[*]) = $avp(count) + 1;<br><br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<br>
btw: Is there a function to dump all currently defined AVPs, XAVPs and<br>
variables?<br></blockquote><div><br>For avps:<br><br><a href="http://kamailio.org/docs/modules/stable/modules/avpops.html#id2867544">http://kamailio.org/docs/modules/stable/modules/avpops.html#id2867544</a><br><br>Not sure now the one for xavps was exported to config, but it is available internally.<br>
<br>Cheers,<br>Daniel<br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
regards<br>
Klaus<br>
<br>
Am 10.03.2011 09:49, schrieb Daniel-Constantin Mierla:<br>
<div class="im">&gt; Hello,<br>
&gt;<br>
&gt; AVPs are multi-value variables, so:<br>
&gt;<br>
&gt; $avp(x) = 1;<br>
&gt; $avp(x) = 2;<br>
&gt;<br>
&gt; Create a list with two values, the last added is first retrieved. You<br>
&gt; can use indexes to access them.<br>
&gt;<br>
&gt; For example:<br>
&gt; - $avp(x) will return now 2 (same as $(avp(x)[0]) )<br>
&gt; - $(avp(x)[1]) will return 1<br>
&gt;<br>
&gt; You can use variable as index:<br>
&gt;<br>
&gt; $var(i) = 0;<br>
&gt;<br>
&gt; then: $(avp(x)[$var(i)]))<br>
&gt;<br>
&gt; To go through the list, you can use while(...) { ... } statement with an<br>
&gt; variable for index that increments in each step.<br>
&gt;<br>
&gt; When there is no value for avp at that index, then the returned value is<br>
&gt; $null, e.g.,<br>
&gt;<br>
&gt; while($(avp(x)[$var(i)]) != $null) {<br>
&gt;    ...<br>
&gt;    $var(i) = $var(i) + 1;<br>
&gt; }<br>
&gt;<br>
&gt; Cheers,<br>
&gt; Daniel<br>
&gt;<br>
&gt; On Wed, Mar 9, 2011 at 2:07 PM, Geoffrey Mina &lt;<a href="mailto:geoffreymina@gmail.com">geoffreymina@gmail.com</a><br>
</div><div class="im">&gt; &lt;mailto:<a href="mailto:geoffreymina@gmail.com">geoffreymina@gmail.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;     There is nothing wrong with the carriers, so I wouldn&#39;t want to mark<br>
&gt;     them.  Just no route to destination type scenario.<br>
&gt;<br>
&gt;     I like daniels option with the drop on_branch.  Only challenge I<br>
&gt;     have is keeping a list of all the flags I have already tried.  Say I<br>
&gt;     have five carrier groups and I set the flags in gw to 1 2 3 4 or 5<br>
&gt;     respectivley.  How could I use an AVP to efficiently keep a running<br>
&gt;     list and then check against that list?<br>
&gt;<br>
&gt;     Thanks!<br>
&gt;<br>
&gt;     On Mar 8, 2011 9:02 PM, &quot;Juha Heinanen&quot; &lt;<a href="mailto:jh@tutpro.com">jh@tutpro.com</a><br>
</div><div class="im">&gt;     &lt;mailto:<a href="mailto:jh@tutpro.com">jh@tutpro.com</a>&gt;&gt; wrote:<br>
&gt;     &gt; Daniel-Constantin Mierla writes:<br>
&gt;     &gt;<br>
&gt;     &gt;&gt; &gt; The issue I am running into is that in a scenario where<br>
&gt;     &gt;&gt; &gt; both my carriers respond with a 5XX, I end up presenting the<br>
&gt;     same call to<br>
&gt;     &gt;&gt; &gt; all 4 gateways. I would like to present the call to one gateway<br>
&gt;     on each<br>
&gt;     &gt;&gt; &gt; carrier and not try the same carriers second gateway for the same<br>
&gt;     &gt;&gt; &gt; call.<br>
&gt;     &gt;<br>
&gt;     &gt; currently only lcr rule can be a stopper rule, i.e., if it matches,<br>
&gt;     &gt; other matching rules are not tried.<br>
&gt;     &gt;<br>
&gt;     &gt; you can disable a failing gateway for some number of seconds, which<br>
&gt;     &gt; should reduce unsuccessful attempts.<br>
&gt;     &gt;<br>
&gt;     &gt; -- juha<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Daniel-Constantin Mierla<br>
&gt;   <a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
</div><div><div></div><div class="h5">&gt; _______________________________________________<br>
&gt; SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
&gt; <a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
&gt; <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Daniel-Constantin Mierla<br>  <a href="http://www.asipto.com">http://www.asipto.com</a><br>