Hi Alex,
it took me quite a while due to traveling, but now the issue should be
fixed on git. Indeed there was an issue with the indexes when accessing
the xavp as PV.
Thanks,
Daniel
On 12/24/10 12:27 PM, Alex Hermann wrote:
On Friday 24 December 2010, Daniel-Constantin Mierla
wrote:
On 12/21/10 2:44 PM, Alex Hermann wrote:
I'm currently toying with xavp's and have
some trouble accessing the
values. I want to have access to the xavp that isn't the last added
one. From the wiki page on
http://sip-router.org/wiki/devel/xavp I got
the impression that indices are supported, but that doesn't seem to
work.
In the following fragment i want access to the values 1A& 1B, how to
do that?
$xavp(test=>a) = "1A";
$xavp(test[0]=>b) = "1B";
$xavp(test=>a) = "2A";
$xavp(test[0]=>b) = "2B";
Yes, indexes are supported, functionality
should be: when you do not use
an index, then you just stack a new value. When you use indexes, you
overwrite.
In this case you have to use indexes after a and be, like
$xavp(test=>a[0]) a.s.o.
This also doesn't work, see below and the wiki
page says the index should be on the avpname... Can you explain what the index on the
avpname does and
what the index on the subfield does, because i thought i understood, but it doesn't
seem to work.
What i want to accomplish is to set an xavp (test) multiple times with multiple subfields
(a& b) so that when i do an pv_unset($xavp(test)) i get the
next set of subfields (to be used for a serial forking scenario later on). This already
works. Now i want to have random access to the xavp, using an
index to get to the right set of subfields. ie if i query $xavp(test[0]=>a) i get 2A,
$xavp(test[1]=>b) should give 1B.
If i get this working i'll post an interesting patch to sqlops soon :)
I did some more testing and think there is a off-by-one bug somewhere:
$xavp(test=>a) = "1A";
$xavp(test[0]=>b) = "1B";
$xavp(test=>a) = "2A";
$xavp(test[0]=>b) = "2B";
$xavp(test[1]=>a) = "3A";
$xavp(test[1]=>b) = "3B";
xlog("Index on subavp");
xlog("0: $xavp(test)");
xlog("0a: $xavp(test=>a[0])");
xlog("0b: $xavp(test=>b[0])");
xlog("1: $xavp(test)");
xlog("1a: $xavp(test=>a[1])");
xlog("1b: $xavp(test=>b[1])");
xlog("2: $xavp(test)");
xlog("2a: $xavp(test=>a[2])");
xlog("2b: $xavp(test=>b[2])");
xlog("Index on avpname");
xlog("0: $xavp(test[0])");
xlog("0a: $xavp(test[0]=>a)");
xlog("0b: $xavp(test[0]=>b)");
xlog("1: $xavp(test[1])");
xlog("1a: $xavp(test[1]=>a)");
xlog("1b: $xavp(test[1]=>b)");
xlog("2: $xavp(test[2])");
xlog("2a: $xavp(test[2]=>a)");
xlog("2b: $xavp(test[2]=>b)");
Results in:
Dec 24 12:07:40 veyron wsproxy1[13032]: ERROR:<script>: Index on subavp
Dec 24 12:07:40 veyron wsproxy1[13032]: ERROR:<script>:
0:<<xavp:0xb3a627c4>>
Dec 24 12:07:40 veyron wsproxy1[13032]: ERROR:<script>: 0a: 2A
Dec 24 12:07:40 veyron wsproxy1[13032]: ERROR:<script>: 0b: 2B
Dec 24 12:07:40 veyron wsproxy1[13032]: ERROR:<script>:
1:<<xavp:0xb3a627c4>>
Dec 24 12:07:40 veyron wsproxy1[13032]: ERROR:<script>: 1a:<null>
Dec 24 12:07:40 veyron wsproxy1[13032]: ERROR:<script>: 1b:<null>
Dec 24 12:07:40 veyron wsproxy1[13032]: ERROR:<script>:
2:<<xavp:0xb3a627c4>>
Dec 24 12:07:40 veyron wsproxy1[13032]: ERROR:<script>: 2a:<null>
Dec 24 12:07:40 veyron wsproxy1[13032]: ERROR:<script>: 2b:<null>
Dec 24 12:07:40 veyron wsproxy1[13032]: ERROR:<script>: Index on avpname
Dec 24 12:07:40 veyron wsproxy1[13032]: ERROR:<script>:
0:<<xavp:0xb3a627c4>>
Dec 24 12:07:40 veyron wsproxy1[13032]: ERROR:<script>: 0a: 2A
Dec 24 12:07:40 veyron wsproxy1[13032]: ERROR:<script>: 0b: 2B
Dec 24 12:07:40 veyron wsproxy1[13032]: ERROR:<script>:
1:<<xavp:0xb3a6286c>>
Dec 24 12:07:40 veyron wsproxy1[13032]: ERROR:<script>: 1a: 1A
Dec 24 12:07:40 veyron wsproxy1[13032]: ERROR:<script>: 1b: 1B
Dec 24 12:07:40 veyron wsproxy1[13032]: ERROR:<script>: 2:<null>
Dec 24 12:07:40 veyron wsproxy1[13032]: ERROR:<script>: 2a:<null>
Dec 24 12:07:40 veyron wsproxy1[13032]: ERROR:<script>: 2b:<null>
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:470]: +++++ XAVP list:
0xb3a62770
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:473]: *** XAVP
name: test
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:474]: XAVP id:
2063405720
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:475]: XAVP value
type: 6
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:496]: XAVP
value:<xavp:0xb3a627c4>
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:470]: +++++ XAVP list:
0xb3a627c4
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:473]: *** XAVP
name: b
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:474]: XAVP id:
110
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:475]: XAVP value
type: 2
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:484]: XAVP value:
2B
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:473]: *** XAVP
name: a
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:474]: XAVP id:
109
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:475]: XAVP value
type: 2
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:484]: XAVP value:
2A
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:505]: ----- XAVP list
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:473]: *** XAVP
name: test
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:474]: XAVP id:
2063405720
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:475]: XAVP value
type: 6
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:496]: XAVP
value:<xavp:0xb3a6286c>
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:470]: +++++ XAVP list:
0xb3a6286c
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:473]: *** XAVP
name: b
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:474]: XAVP id:
110
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:475]: XAVP value
type: 2
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:484]: XAVP value:
3B
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:473]: *** XAVP
name: a
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:474]: XAVP id:
109
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:475]: XAVP value
type: 2
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:484]: XAVP value:
3A
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:473]: *** XAVP
name: b
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:474]: XAVP id:
110
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:475]: XAVP value
type: 2
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:484]: XAVP value:
1B
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:473]: *** XAVP
name: a
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:474]: XAVP id:
109
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:475]: XAVP value
type: 2
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:484]: XAVP value:
1A
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:505]: ----- XAVP list
Dec 24 12:07:40 veyron wsproxy1[13032]: INFO:<core> [xavp.c:505]: ----- XAVP list
Notice that the index on the subfield doesn't return the proper values, but that the
index on the avpname now returns 1A, 1B, 2A& 2B (still missing 3
thugh).
If i remove the setting of test[1]:
$xavp(test=>a) = "1A";
$xavp(test[0]=>b) = "1B";
$xavp(test=>a) = "2A";
$xavp(test[0]=>b) = "2B";
I get
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>: Index on subavp
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>:
0:<<xavp:0xb3aa77c4>>
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>: 0a: 2A
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>: 0b: 2B
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>:
1:<<xavp:0xb3aa77c4>>
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>: 1a:<null>
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>: 1b:<null>
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>:
2:<<xavp:0xb3aa77c4>>
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>: 2a:<null>
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>: 2b:<null>
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>: Index on avpname
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>:
0:<<xavp:0xb3aa77c4>>
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>: 0a: 2A
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>: 0b: 2B
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>:
1:<<xavp:0xb3aa76c8>>
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>: 1a:<null>
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>: 1b:<null>
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>: 2:<null>
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>: 2a:<null>
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>: 2b:<null>
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:470]: +++++ XAVP list:
0xb3aa7770
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:473]: *** XAVP
name: test
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:474]: XAVP id:
2063405720
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:475]: XAVP value
type: 6
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:496]: XAVP
value:<xavp:0xb3aa77c4>
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:470]: +++++ XAVP list:
0xb3aa77c4
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:473]: *** XAVP
name: b
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:474]: XAVP id:
110
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:475]: XAVP value
type: 2
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:484]: XAVP value:
2B
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:473]: *** XAVP
name: a
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:474]: XAVP id:
109
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:475]: XAVP value
type: 2
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:484]: XAVP value:
2A
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:505]: ----- XAVP list
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:473]: *** XAVP
name: test
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:474]: XAVP id:
2063405720
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:475]: XAVP value
type: 6
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:496]: XAVP
value:<xavp:0xb3aa76c8>
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:470]: +++++ XAVP list:
0xb3aa76c8
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:473]: *** XAVP
name: b
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:474]: XAVP id:
110
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:475]: XAVP value
type: 2
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:484]: XAVP value:
1B
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:473]: *** XAVP
name: a
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:474]: XAVP id:
109
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:475]: XAVP value
type: 2
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:484]: XAVP value:
1A
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:505]: ----- XAVP list
Dec 24 12:08:43 veyron wsproxy1[13835]: INFO:<core> [xavp.c:505]: ----- XAVP list
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>: Authorization processing.
Dec 24 12:08:43 veyron wsproxy1[13835]: ERROR:<script>: Unauthorized (-5) - No
credentials. (UA: Twinkle/1.4.2)
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>: Ts:1293188923
TS:1293188923 request
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>: [87.208.184.242:5066]
Request. INVITE<sip:31887732510@speakup.nl> =>
<sip:4671900000@speakup.nl> cid:<jiqumpgknwbpxsn@waxy.wenlex.nl>
len:1130
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>: Index on subavp
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>:
0:<<xavp:0xb3aa75cc>>
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>: 0a: 2A
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>: 0b: 2B
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>:
1:<<xavp:0xb3aa75cc>>
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>: 1a:<null>
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>: 1b:<null>
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>:
2:<<xavp:0xb3aa75cc>>
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>: 2a:<null>
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>: 2b:<null>
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>: Index on avpname
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>:
0:<<xavp:0xb3aa75cc>>
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>: 0a: 2A
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>: 0b: 2B
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>:
1:<<xavp:0xb3aa7770>>
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>: 1a:<null>
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>: 1b:<null>
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>: 2:<null>
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>: 2a:<null>
Dec 24 12:08:43 veyron wsproxy1[13839]: ERROR:<script>: 2b:<null>
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:470]: +++++ XAVP list:
0xb3aa77c4
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:473]: *** XAVP
name: test
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:474]: XAVP id:
2063405720
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:475]: XAVP value
type: 6
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:496]: XAVP
value:<xavp:0xb3aa75cc>
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:470]: +++++ XAVP list:
0xb3aa75cc
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:473]: *** XAVP
name: b
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:474]: XAVP id:
110
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:475]: XAVP value
type: 2
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:484]: XAVP value:
2B
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:473]: *** XAVP
name: a
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:474]: XAVP id:
109
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:475]: XAVP value
type: 2
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:484]: XAVP value:
2A
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:505]: ----- XAVP list
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:473]: *** XAVP
name: test
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:474]: XAVP id:
2063405720
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:475]: XAVP value
type: 6
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:496]: XAVP
value:<xavp:0xb3aa7770>
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:470]: +++++ XAVP list:
0xb3aa7770
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:473]: *** XAVP
name: b
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:474]: XAVP id:
110
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:475]: XAVP value
type: 2
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:484]: XAVP value:
1B
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:473]: *** XAVP
name: a
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:474]: XAVP id:
109
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:475]: XAVP value
type: 2
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:484]: XAVP value:
1A
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:505]: ----- XAVP list
Dec 24 12:08:43 veyron wsproxy1[13839]: INFO:<core> [xavp.c:505]: ----- XAVP list
Where have 1A and 1B gone?