[OpenSIPS-Devel] [ opensips-Bugs-2868064 ] Assign to indexed AVP fails.

SourceForge.net noreply at sourceforge.net
Tue Sep 29 13:55:29 CEST 2009


Bugs item #2868064, was opened at 2009-09-27 15:27
Message generated for change (Comment added) made by anca_vamanu
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=2868064&group_id=232389

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: core
Group: trunk
Status: Open
Resolution: Invalid
Priority: 5
Private: No
Submitted By: Sergey Okhapkin (sokhapkin)
Assigned to: Anca Vamanu (anca_vamanu)
Summary: Assign to indexed AVP fails.

Initial Comment:
The construction mentioned at http://www.opensips.org/Main/News0041 to assign a value to indexed variable

$avp(i:1)[0]="value";

yelds an error message from cfg parser. The following operator

$(avp(tp_trunkprefix)[$avp(index)])="";

is parsed OK, but doesn't update AVP value, the value remains old after operator execution, no errors/warnings in opensips log.

----------------------------------------------------------------------

>Comment By: Anca Vamanu (anca_vamanu)
Date: 2009-09-29 14:55

Message:
Hi,

Sorry, I was mistaken, It does not delete the value, but it replaces it
with an empty string. I have tested now more closely
Also I have fixed the errors in the documentation that you reported.

Regards,
Anca

----------------------------------------------------------------------

Comment By: Sergey Okhapkin (sokhapkin)
Date: 2009-09-29 14:42

Message:
Well, I need to set AVP value at certain index to an empty string, but
still have an access to [index+1] value. How can I do that? I don't like
the whole idea across opensips to remove variables instead of allowing
empty strings.

Regarding first construct see examples at
http://www.opensips.org/Resources/DocsCoreVar :

# delete the value located at a certain index 
$avp(i:17)[1] = NULL;

#overwrite the value at a certain index
$avp(i:17)[0] = "zero";


----------------------------------------------------------------------

Comment By: Anca Vamanu (anca_vamanu)
Date: 2009-09-29 14:30

Message:
Hi Sergey,

The first example that you typed in your post is indeed wrong because it
does not respect the avp syntax with name and index. The  example that was
written there was to show that it is about setting the value at a certain
index pvar[_index_]=NULL. The correct syntax for pseudovariables is here:
http://www.opensips.org/Resources/DocsCoreVar.
As for the second excerpt, attributing a 0 length string to an avp value
at a certain index has the result of deleting that value, I have tested
myself now and it works, To check it out I suggest to print all the values
in the avp before the operation and after. xlog("all values
$(avp(tp_trunkprefix[*])\n)");

Regards,
Anca


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=2868064&group_id=232389



More information about the Devel mailing list