<div dir="ltr">
<pre>Hey Thanks for that one Alex,<br><br></pre><pre>If only I hadn't stopped reading at "will send 200 OK"...<br></pre><pre>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.<br></pre><pre>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.<br></pre><pre>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.<br></pre><pre>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.<br>modparam("registrar", "method_filtering", 0)<br>modparam("registrar", "gruu_enabled", 0)<br>#modparam("usrloc", "nat_bflag", 0)<br>modparam("usrloc", "matching_mode", 0)<br><br><br><br># LetsCaptureAnyRegister...<br>      if (src_ip!=PBXIP) {<br>          if (is_method("REGISTER")) {<br>                        xlog("L_INFO", "[MAIN] REGISTERRESPONSE\n");<br>                      save("location", "0x02");<br>         }                <br>     }<br><br><br><br># Then lets verify it...<br>     if ($src_ip!="PBXIP") {<br>             if (!is_method("REGISTER")) {<br>                       if(!lookup("location")) {    #Try looking up location<br><br>                   switch($rc) {<br>                 case -1:<br>                              xlog("L_INFO", "[MAIN] case -1\n");<br>                       case -2:<br>                              xlog("L_INFO", "[MAIN] case -2\n");<br>                       case -3:<br>                              xlog("L_INFO", "[MAIN] case -3\n");<br><br>                     }<br><br><br><br>                           sl_reply("404", "User not Registered");     #If looking up location fails reply with 404<br>                                  exit;                                       #And exit<br>                        } else {<br>                              xlog("L_INFO", "[MAIN] PASSEDREGISTERVALIDATION\n");<br>                      }<br>             }<br>     }<br><br><br></pre><pre>I had email digest emailed... I'm guessing this response isn't going to align correctly on the maillist.<br></pre><pre><br><br><br>
<b>Alex Balashov</b> 
    <a href="mailto: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" title="[SR-Users] Catching Register 200 OK, then using it to validate other packets.">abalashov at evaristesys.com
</a>    <i>Tue Jan  4 06:55:52 CET 2022</i>

<br>Hi Richard,

If I’ve understood your query correctly, flag 0x02 to save() should accomplish what you want:

<a href="https://kamailio.org/docs/modules/5.5.x/modules/registrar.html#registrar.f.save">https://kamailio.org/docs/modules/5.5.x/modules/registrar.html#registrar.f.save</a>

— Alex</pre>

<br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">---------- Forwarded message ---------<br>From: <b class="gmail_sendername" dir="auto">Richard Edmands</b> <span dir="auto"><<a href="mailto:thesirdmz@gmail.com">thesirdmz@gmail.com</a>></span><br>Date: Tue, 4 Jan 2022 at 15:53<br>Subject: Catching Register 200 OK, then using it to validate other packets.<br>To:  <<a href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>><br></div><br><br><div dir="ltr"><div>Hey Kamailio Users,</div><div><br></div><div>I've written a TLS-UDP gateway. It works well, but I want to reduce the internet noise it pushes through.</div><div><br></div><div>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?</div><div>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.</div><div><br></div><div>Anyone done something similar and got some working example code? Is this a bad idea for some reason?<br></div></div>
</div></div>