<div dir="ltr">I figured this finally out and all works for me very well. <br>In usrloc dbmode i set value of 3 (its saving immediately changes into DB).<div><br></div><div>In request route for REGISTER method i set t_on_reply("MANAGE_REPLY_REGISTER" and for REGISTER with expires set to 0 i set t_on_reply("MANAGE_REPLY_UNREGISTER") (used pseudovariable $expires(max)). <br>I stored Contact header in $avp(contact) for unREGISTER request for further use when calling unregister().<br><br>Then in onreply_route for MANAGE_REPLY_REGISTER i call save lcoation and in MANAGE_REPLY_UNREGISTER for reply code 200 i call unregister function with the stored contact (i had to remove < > and display name using re.subst).<br><br>So far it looks to work perfect. </div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">pon., 18 lis 2019 o 13:38 Voip support <<a href="mailto:voipexpert0@gmail.com">voipexpert0@gmail.com</a>> napisał(a):<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div>Thanks again for all replies... I need to try it out - did not have time for it yet.<br><br>I think i will go for the onreply_route answer and try to save location in this place.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">pon., 18 lis 2019 o 06:23 Joel Serrano <<a href="mailto:joel@textplus.com" target="_blank">joel@textplus.com</a>> napisał(a):<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Yes sir! Works perfectly!<br></div><div><br></div><div>To give you a quick example:</div><div><br></div><div>1) Add in the appropriate place for the REGISTER request:   t_on_reply("MANAGE_REG_REPLY");</div><div>2) Create a new onreply route: </div><div><br></div><div># Manage registration incoming replies<br>onreply_route[MANAGE_REG_REPLY] {<br>    if(status=~"2[0-9][0-9]") {<br>        if (save("location", "0x04")) {<br>            xlog("L_NOTICE", "[usrloc] saved user location\n");<br>        }<br>    }<br>}<br></div><div><br></div><div><br></div><div>Note1: In my setup, I needed to strictly simulate asterisk (chan_sip) registrations, so only one AoR was allowed, thus the flags 0x04, if you are using PJSIP you might not need it.</div><div>Note2: With this example code, a "unregister" (REGISTER with expires=0) will not remove the AoR from Kamailio, to achieve that I check independently if the header Expires exists and is 0, or if the contact param Expires exists and is 0, and in that case I use the unregister() function instead of the save().</div><div><br></div><div>Hope it helps!</div><div>Joel.</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Nov 17, 2019 at 5:42 PM Ovidiu Sas <<a href="mailto:osas@voipembedded.com" target="_blank">osas@voipembedded.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Did it work calling save() on the reply route?<br>
<br>
-ovidiu<br>
<br>
On Thu, Nov 14, 2019 at 6:20 PM Voip support <<a href="mailto:voipexpert0@gmail.com" target="_blank">voipexpert0@gmail.com</a>> wrote:<br>
><br>
>   I am using kamailio 5.3.<br>
><br>
> Ovidiu Sas, i will try this tomorrow today is bit late. Maybe it could work.<br>
><br>
> David Villasmil , i know i can use SQLOPS but i was thinking of easier method of doing this.<br>
> By successful REGISTER i mean save only REGISTER attempt that authenticated correctly at SIP server and in 200 OK a binding was returned.<br>
> Same if the binding is later removed i would like remove it from database. I need this because when i run REGISTER over kamailio to destination SIP server i see all register from same IP.<br>
> I need to be able to check what was the real source IP of client REGISTER.<br>
><br>
> Regards,<br>
> Tomasz<br>
><br>
><br>
><br>
> pt., 15 lis 2019 o 00:16 Mike from ApoloCore <<a href="mailto:mike@apolocore.com" target="_blank">mike@apolocore.com</a>> napisał(a):<br>
>><br>
>> I am using kamailio 5.3.<br>
>><br>
>> Ovidiu Sas, i will try this tomorrow today is bit late. Maybe it could work.<br>
>><br>
>> David Villasmil , i know i can use SQLOPS but i was thinking of easier method of doing this.<br>
>> By successful REGISTER i mean save only REGISTER attempt that authenticated correctly at SIP server and in 200 OK a binding was returned.<br>
>> Same if the binding is later removed i would like remove it from database. I need this because when i run REGISTER over kamailio to destination SIP server i see all register from same IP.<br>
>> I need to be able to check what was the real source IP of client REGISTER.<br>
>><br>
>> Regards,<br>
>> Tomasz<br>
>><br>
>><br>
>><br>
>><br>
>> czw., 14 lis 2019 o 23:33 Ovidiu Sas <<a href="mailto:osas@voipembedded.com" target="_blank">osas@voipembedded.com</a>> napisał(a):<br>
>>><br>
>>> Try to use save() when you process the 200 ok reply for REGISTER in<br>
>>> the reply route.<br>
>>><br>
>>> Regards,<br>
>>> Ovidiu Sas<br>
>>><br>
>>> On Thu, Nov 14, 2019 at 3:40 PM Voip support <<a href="mailto:voipexpert0@gmail.com" target="_blank">voipexpert0@gmail.com</a>> wrote:<br>
>>> ><br>
>>> > I setup kamailio to forward REGISTER packets using dispatcher to two servers main and backup.<br>
>>> ><br>
>>> > The routing logic is quite simple i use the dispatcher probing mechanism to detect if my main dispatcher set id (one server) is active or inactive once it detect a failure all packets are sent to secondary SIP server to achieve High Availability.<br>
>>> ><br>
>>> > I am looking for module or a way to save into kamailio database client information such as IP address, register username (from FROM header), digest username (authorization username), call-id for successful registration.<br>
>>> ><br>
>>> > I tried to use registrar module but once i used function save("location") the client was registered on kamailio and packets was not forwarded to main/secondary SIP server (like dispatcher stopped working, the destination did not override).<br>
>>> ><br>
>>> > REGISTER is sent to SIP URI of kamailio.<br>
>>> ><br>
>>> > Please let me know if you have any idea how to make this data update in database (insert an entry on fresh successfull REGISTER, delete on expired or removed binding).<br>
>>> ><br>
>>> > Best regards,<br>
>>> > Tomasz<br>
>>> ><br>
>>> > _______________________________________________<br>
>>> > Kamailio (SER) - Users Mailing List<br>
>>> > <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
>>> > <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
>>><br>
>>><br>
>>><br>
>>> --<br>
>>> VoIP Embedded, Inc.<br>
>>> <a href="http://www.voipembedded.com" rel="noreferrer" target="_blank">http://www.voipembedded.com</a><br>
>>><br>
>>> _______________________________________________<br>
>>> Kamailio (SER) - Users Mailing List<br>
>>> <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
>>> <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
><br>
> _______________________________________________<br>
> Kamailio (SER) - Users Mailing List<br>
> <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
> <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br>
<br>
<br>
-- <br>
VoIP Embedded, Inc.<br>
<a href="http://www.voipembedded.com" rel="noreferrer" target="_blank">http://www.voipembedded.com</a><br>
<br>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div>
</blockquote></div>
</blockquote></div>