In case anyone is looking at this thread in 10 years time wondering
what solution I came across.
I ended up giving up on the concept of matching the invites and
passing them through for authentication on the other end. Instead I
decided to auth the invites at the Kamailio layer itself. In my use
case this is a very workable solution.
You could do something with htables, stash the $sut into a htable with
an expiry after a successful register then match the htable on inbound
invites. That would stop most of the shenanigans.
On Fri, 29 Jul 2022 at 01:14, Henning Westerholt <hw(a)gilawa.com> wrote:
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.
Cheers,
Henning
--
Henning Westerholt -
https://skalatan.de/blog/
Kamailio services -
https://gilawa.com
-----Original Message-----
From: sr-users <sr-users-bounces(a)lists.kamailio.org> On Behalf Of Richard Edmands
Sent: Thursday, July 28, 2022 10:05 AM
To: Kamailio (SER) - Users Mailing List <sr-users(a)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(a)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(a)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