[SR-Users] avp_delete problem [kamailio 1.5]

Sven Knoblich sven.knoblich at 1und1.de
Wed Feb 22 10:26:29 CET 2012


Ah, ok. thanks. This explains the behaviour. But it isn't explicit 
mentioned in the documentation what /g stands for.

But next time, i will also have a further look at the sources.

Bye Sven


Am 22.02.2012 09:26, schrieb Marius Zbihlei:
> On 02/22/2012 09:45 AM, Sven Knoblich wrote:
>> 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?
> Hello Sven,
>
> After looking thru the code it seems that this is the wanted behaviour 
> (something like sed with /g switch) even in 3.x (master).
>
> From the fixup function of avp_delete :
> <code>
>                 case 'g':
>                 case 'G':
>                     ap->ops|=AVPOPS_FLAG_ALL;
> </code>
>
> This flag is sent as the /all /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)
>
> Cheers
> Marius
>> 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
>> sr-users at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>
>
> -- 
> Zbihlei Marius
>
> Head of
> Linux Development Services Romania
>
> 1&1 Internet Development srl    Tel KA: 754-9152
> Str Mircea Eliade 18            Tel RO: +40-31-223-9152
> Sect 1, Bucuresti               mailto:marius.zbihlei at 1and1.ro
> 71295, Romania
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20120222/8c099287/attachment.htm>


More information about the sr-users mailing list