<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    On 02/22/2012 09:45 AM, Sven Knoblich wrote:
    <blockquote cite="mid:4F449D0B.9080504@1und1.de" type="cite">
      <pre wrap="">Hello all,
i am currently confused by using the avpops function avp_delete. When i 
run avp_delete without the flag-value \g only the last value will be 
unset (like an undo). Is this the wanted behaviour?
</pre>
    </blockquote>
    <blockquote cite="mid:4F449D0B.9080504@1und1.de" type="cite">
      <pre wrap="">
</pre>
    </blockquote>
    Hello Sven, <br>
    <br>
    After looking thru the code it seems that this is the wanted
    behaviour (something like sed with /g switch) even in 3.x (master).
    <br>
    <br>
    From the fixup function of avp_delete :<br>
    &lt;code&gt;<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case 'g':<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case 'G':<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ap-&gt;ops|=AVPOPS_FLAG_ALL;<br>
    &lt;/code&gt;<br>
    <br>
    This flag is sent as the <i>all </i>parameter in destroy_avps in
    usr_avp.c method. (The avp's are inserted in memory in reversed
    order so it's a Last In First Out type structure)<br>
    <br>
    Cheers<br>
    Marius<br>
    <blockquote cite="mid:4F449D0B.9080504@1und1.de" type="cite">
      <pre wrap="">
EXAMPLE:

$avp(test) = "test"
if( $avp(test)){xlog("L_NOTICE","result1:$avp(test)\n");}

$avp(test) = "nooo";
if( $avp(test)){xlog("L_NOTICE","result2:$avp(test)\n");}

avp_delete("$avp(test)");
if( $avp(test)){xlog("L_NOTICE","result3:$avp(test)\n");}


RESULT:

result1:test
result2:nooo
result3:test

Could anybody helps me to understand that?

thanks in advance,
Sven


_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>

</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Zbihlei Marius

Head of
Linux Development Services Romania

1&amp;1 Internet Development srl    Tel KA: 754-9152
Str Mircea Eliade 18            Tel RO: +40-31-223-9152
Sect 1, Bucuresti               mailto: <a class="moz-txt-link-abbreviated" href="mailto:marius.zbihlei@1and1.ro">marius.zbihlei@1and1.ro</a>
71295, Romania
</pre>
  </body>
</html>