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

Richard Edmands thesirdmz at gmail.com
Thu Jul 28 10:05:29 CEST 2022

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.

More information about the sr-users mailing list