Hey Thanks for that one Alex,
If only I hadn't stopped reading at "will send 200 OK"...
I've been doing some more poking at this one, I was having issues with
it so I simplified it down to the basics with both of these code
blocks next to each other.
I can see the contact appear in kamcmd ul.dump as well as the [MAIN]
REGISTERRESPONSE in the log file. The log file also creates the lines
for all three case statements and the phone gets the 404 not
registered.
Not sure why it's not matching in this simplified configuration as the
steps are right after eachother the contact fields should be lining up
without issue.
I've also been playing with these modparams in case they were related,
but I haven't found the right combo if they are the issue.
modparam("registrar", "method_filtering", 0)
modparam("registrar", "gruu_enabled", 0)
#modparam("usrloc", "nat_bflag", 0)
modparam("usrloc", "matching_mode", 0)
# LetsCaptureAnyRegister...
if (src_ip!=PBXIP) {
if (is_method("REGISTER")) {
xlog("L_INFO", "[MAIN] REGISTERRESPONSE\n");
save("location", "0x02");
}
}
# Then lets verify it...
if ($src_ip!="PBXIP") {
if (!is_method("REGISTER")) {
if(!lookup("location")) { #Try looking up location
switch($rc) {
case -1:
xlog("L_INFO", "[MAIN] case -1\n");
case -2:
xlog("L_INFO", "[MAIN] case -2\n");
case -3:
xlog("L_INFO", "[MAIN] case -3\n");
}
sl_reply("404", "User not Registered");
#If looking up location fails reply with 404
exit;
#And exit
} else {
xlog("L_INFO", "[MAIN] PASSEDREGISTERVALIDATION\n");
}
}
}
I had email digest emailed... I'm guessing this response isn't going
to align correctly on the maillist.
*Alex Balashov*
abalashov at
evaristesys.com
<sr-users%40lists.kamailio.org?Subject=Re%3A%20%5BSR-Users%5D%20Catching%20Register%20200%20OK%2C%0A%20then%20using%20it%20to%20validate%20other%20packets.&In-Reply-To=%3CB696D90F-41BA-43B5-A91F-EBF3B1FF3AF2%40evaristesys.com%3E>
*Tue Jan 4 06:55:52 CET 2022*
Hi Richard,
If I’ve understood your query correctly, flag 0x02 to save() should
accomplish what you want:
https://kamailio.org/docs/modules/5.5.x/modules/registrar.html#registrar.f.…
— Alex
---------- Forwarded message ---------
From: Richard Edmands <thesirdmz(a)gmail.com>
Date: Tue, 4 Jan 2022 at 15:53
Subject: Catching Register 200 OK, then using it to validate other packets.
To: <sr-users(a)lists.kamailio.org>
Hey Kamailio Users,
I've written a TLS-UDP gateway. It works well, but I want to reduce the
internet noise it pushes through.
I have an idea on what I'd like to try. Wondering if it would be possible
to catch the Register 200 OK, store it and then when receiving packets it
future to then validate them against the data?
I've managed to capture a 200 OK, but the save("location") function says it
will return it's own 200 OK which isn't the plan since we just want to
capture the location.
Anyone done something similar and got some working example code? Is this a
bad idea for some reason?