<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Ah, ok. thanks. This explains the behaviour. But it isn't explicit
    mentioned in the documentation what /g stands for. <br>
    <br>
    But next time, i will also have a further look at the sources. <br>
    <br>
    Bye Sven<br>
    <pre class="moz-signature" cols="72">
</pre>
    <br>
    Am 22.02.2012 09:26, schrieb Marius Zbihlei:
    <blockquote cite="mid:4F44A6CE.7090802@1and1.ro" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      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"> </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 moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a moz-do-not-send="true" 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 moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:marius.zbihlei@1and1.ro">marius.zbihlei@1and1.ro</a>
71295, Romania
</pre>
    </blockquote>
  </body>
</html>