[SR-Users] Problem Storing USRLOC Attributes, Part 2

Daniel-Constantin Mierla miconda at gmail.com
Thu Apr 2 21:12:38 CEST 2020


Hello,

this is because the chlidren value are not grouped inside the same root
xavp, but there are 3 root xavps, each with one child value. Try:

$xavp(ulattrs=>PubNetIP) = $si;
$xavp(ulattrs[0]=>PubNetPort) = $sp;
$xavp(ulattrs[0]=>Transport) = $proto;

Feel free to enhance the docs in the wiki, if you consider them not very
clear on what the operations with avps do:

  *
https://www.kamailio.org/wiki/cookbooks/5.3.x/pseudovariables#xavp_id_-_xavps

In short, if no index is provided, the xavps are added, both root and child.

Cheers,
Daniel

On 02.04.20 05:21, Sergiu Pojoga wrote:
> Hi there,
>
> I'm observing a similar behavior as reported a while ago in this
> case: https://github.com/kamailio/kamailio/issues/243
>
> It appears that only the *last *attribute before save() is stored in
> DB and later restored on lookup()
>
> kamcmd version
> kamailio 5.2.5 (x86_64/linux) e10d4f
>
> Script:
> $xavp(ulattrs=>PubNetIP) = $si;
> $xavp(ulattrs=>PubNetPort) = $sp;
> $xavp(ulattrs=>Transport) = $proto;
>
> pv_xavp_print();
>
> save("location", "");
>
> Mysql log:
> insert into `location_attrs`
> (`username`,`ruid`,`last_modified`,`aname`,`atype`,`avalue`,`domain` )
> values ('firstuser','uloc-5e855601-2529-1','2020-04-01
> 23:03:48','Transport',0,'udp','sip.mydomain.net
> <http://sip.mydomain.net>')
>
> MariaDB [(none)]> select * from kamailio.location_attrs;
> *************************** 1. row ***************************
>            id: 26
>          ruid: uloc-5e855601-2529-1
>      username: firstuser
>        domain: sip.mydomain.net <http://sip.mydomain.net>
>         aname: Transport
>         atype: 0
>        avalue: udp
> last_modified: 2020-04-01 23:12:48
>
> Kamailio xavp pring in logs:
> +++++ start XAVP list: 0x7f28ff1e9590 ((nil)) (level=0)
> *** (l:0 - 0x7f28ff1e9590) XAVP name: ulattrs
> XAVP id: 2085639187
> XAVP value type: 6
> XAVP value: <xavp:0x7f28ff1e94e0>
> +++++ start XAVP list: 0x7f28ff1e94e0 (0x7f28ff1e95b0) (level=1)
> *** (l:1 - 0x7f28ff1e94e0) XAVP name: Transport
> XAVP id: 3694982711
> XAVP value type: 2
> XAVP value (str): udp
> *** (l:1 - 0x7f28ff1e94e0) end
> ----- end XAVP list: 0x7f28ff1e94e0 (level=1)
> *** (l:0 - 0x7f28ff1e9590) end
> *** (l:0 - 0x7f28ff1e9438) XAVP name: ulattrs
> XAVP id: 2085639187
> XAVP value type: 6
> XAVP value: <xavp:0x7f28ff1e9388>
> +++++ start XAVP list: 0x7f28ff1e9388 (0x7f28ff1e9458) (level=1)
> *** (l:1 - 0x7f28ff1e9388) XAVP name: PubNetPort
> XAVP id: 3296056264
> XAVP value type: 1
> XAVP value (int): 58535
> *** (l:1 - 0x7f28ff1e9388) end
> ----- end XAVP list: 0x7f28ff1e9388 (level=1)
> *** (l:0 - 0x7f28ff1e9438) end
> *** (l:0 - 0x7f28ff1e92e0) XAVP name: ulattrs
> XAVP id: 2085639187
> XAVP value type: 6
> XAVP value: <xavp:0x7f28ff1e9228>
> +++++ start XAVP list: 0x7f28ff1e9228 (0x7f28ff1e9300) (level=1)
> *** (l:1 - 0x7f28ff1e9228) XAVP name: PubNetIP
> XAVP id: 3296017806
> XAVP value type: 2
> XAVP value (str): 173.246.28.83
> *** (l:1 - 0x7f28ff1e9228) end
> ----- end XAVP list: 0x7f28ff1e9228 (level=1)
> *** (l:0 - 0x7f28ff1e92e0) end
> ----- end XAVP list: 0x7f28ff1e9590 (level=0)
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200402/5cbeffd6/attachment.html>


More information about the sr-users mailing list