[SR-Users] [REGISTRAR] Registered. How to match $sut to usrloc received ?

Henning Westerholt hw at gilawa.com
Thu Jul 28 17:14:17 CEST 2022

Hi Richard,

I might not get the full complexity of your setup.

But if the documentation is correct it should work like this (note the use of $su instead of $sut):

$xavp(reg=>match_received) = $su;
if (registered("location ", "$fu", 2)) {...}

It looks that you just need to specify a valid URI, it should ignore it then by the xavp set.



Henning Westerholt - https://skalatan.de/blog/
Kamailio services - https://gilawa.com

-----Original Message-----
From: sr-users <sr-users-bounces at lists.kamailio.org> On Behalf Of Richard Edmands
Sent: Thursday, July 28, 2022 10:05 AM
To: Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>
Subject: Re: [SR-Users] [REGISTRAR] Registered. How to match $sut to usrloc received ?

Made some progress. Always good to step away for a bit.
modparam("registrar", "xavp_cfg", "reg") has been added.

                $xavp(reg=>match_received) = $sut;
                if (registered("location", "$sut", 2, 1)) {
                        $var(avariable) = $(xavp(ulrcd[0]=>contact){uri.user});

But still not matching. Where I think I'm getting stuck is while the url field is "optional", I'm not sure what the right syntax is for it to acknowledge the optional url isn't there and to not process the match_option section as the url instead.

If I go with
                $xavp(reg=>match_received) = $sut;
                if (registered("location", 2, 1)) {
                        $var(nico) = $(xavp(ulrcd[0]=>contact){uri.user});

Jul 28 18:04:41 ski-archive kamailio[231679]:  3(231679) DEBUG: {1 udp
1 INVITE 58E1A668952D365BD05BC835F88B019232758715} <core>
[core/parser/parse_uri.c:1293]: parse_uri(): uri too short: <2> (1)

On Wed, 27 Jul 2022 at 23:03, Richard Edmands <thesirdmz at gmail.com> wrote:
> Hey Kamailio Users,
> So the scenario is we get the registers. Load them, slightly oddly as 
> we also fill in the received section, not something I usually do.
> Then when they send an invite, the To and From headers are real phone 
> numbers and for some reason the contact header isn't their username.
> So to compensate for that I'm trying to match their connection ($sut) 
> using registered, but after a couple of hours I haven't been able to 
> get it to match up. Not sure what I'm missing.
> ul.dump gets me
> Received: sip:sipclientpublicip:2353;transport=udp
> so we know that part is loading $sut correctly into the user location data.
> modparam("usrloc", "matching_mode", 2) modparam("registrar", 
> "xavp_rcd", "ulrcd") modparam("registrar", "received_avp", 
> "$avp(i:42)")
>                 $xavp(regcfg=>match_received) = $sut;
>                 if (registered("location","$sut", 2, 1)) {
> After that block of code $sut is sip:
> sipclientpublicip:2353;transport=udp which is what's in usrloc for 
> received, but it's not match.
> There's probably a much smarter way of doing this that I've completely 
> missed, if so then that'd be excellent. But if I'm on the right path 
> somewhat then it would be great to get this working.

Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users at lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

More information about the sr-users mailing list