[SR-Users] How to access additional xavp's

Daniel-Constantin Mierla miconda at gmail.com
Fri Dec 24 11:30:24 CET 2010


Hello,

On 12/21/10 2:44 PM, Alex Hermann wrote:
> Hello,
>
> 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.

Cheers,
Daniel

> 	
> 	xlog("$xavp(test[0]=>a)");
> 	xlog("$xavp(test[0]=>b)");
> 	xlog("$xavp(test[1]=>a)");
> 	xlog("$xavp(test[1]=>b)");
>
> 	pv_xavp_print();
>
> Which gives the following result:
>
> Dec 21 14:30:35 veyron wsproxy1[10398]: ERROR:<script>: 2A
> Dec 21 14:30:35 veyron wsproxy1[10398]: ERROR:<script>: 2B
> Dec 21 14:30:35 veyron wsproxy1[10398]: ERROR:<script>:<null>
> Dec 21 14:30:35 veyron wsproxy1[10398]: ERROR:<script>:<null>
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:470]: +++++ XAVP list: 0xb3a38770
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:473]:      *** XAVP name: test
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:474]:      XAVP id: 2063405720
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:475]:      XAVP value type: 6
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:496]:      XAVP value:<xavp:0xb3a387c4>
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:470]: +++++ XAVP list: 0xb3a387c4
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:473]:      *** XAVP name: b
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:474]:      XAVP id: 110
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:475]:      XAVP value type: 2
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:484]:      XAVP value: 2B
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:473]:      *** XAVP name: a
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:474]:      XAVP id: 109
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:475]:      XAVP value type: 2
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:484]:      XAVP value: 2A
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:505]: ----- XAVP list
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:473]:      *** XAVP name: test
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:474]:      XAVP id: 2063405720
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:475]:      XAVP value type: 6
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:496]:      XAVP value:<xavp:0xb3a386c8>
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:470]: +++++ XAVP list: 0xb3a386c8
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:473]:      *** XAVP name: b
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:474]:      XAVP id: 110
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:475]:      XAVP value type: 2
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:484]:      XAVP value: 1B
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:473]:      *** XAVP name: a
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:474]:      XAVP id: 109
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:475]:      XAVP value type: 2
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:484]:      XAVP value: 1A
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:505]: ----- XAVP list
> Dec 21 14:30:35 veyron wsproxy1[10398]: INFO:<core>  [xavp.c:505]: ----- XAVP list
>

-- 
Daniel-Constantin Mierla
Kamailio (OpenSER) Advanced Training
Jan 24-26, 2011, Irvine, CA, USA
http://www.asipto.com




More information about the sr-users mailing list