[prev in list] [next in list] [prev in thread] [next in thread] 

List:       serusers
Subject:    [SR-Users] lookup() and database
From:       Jawaid Bazyar via sr-users <sr-users () lists ! kamailio ! org>
Date:       2023-10-19 23:56:34
Message-ID: 7A03FBA2-8373-437B-9135-609D55812128 () gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi,

 

I have an application as follows:

 

Multiple Kamailio Nodes

Shared Postgres database

 

Auth information will be stored in DB and accessed with Authdb.

 

Here is the behavior I seek:

 

I would like all the Kamailo nodes to cooperate in updating the database, each \
updating data as appropriate:

 
When a registration comes in to any Node, and it authenticated, create or update a \
database record in location table. When a registration expires on that Node, delete \
database record in location table. When INVITE comes in on any Node, ignore local \
cache and always lookup() record from database.  

#1 and #2 are used so that a third SIP system can query the database and look up the \
Node a NAT'd subscriber is ‘connected' to.

#3 is to let NON-NAT'd subscribers be contacted from any Node.

 

Now I have something close to this now – using following settings:

 

modparam("usrloc", "db_mode", 1)               # immediately write registrations to \
the database.

modparam("usrloc", "db_timer_clean", 0) # do not expire DB records separately

modparam("usrloc", "db_check_update", 1)

 

This takes care of #1 and #2 above. However, #3 seems to still be relying purely on \
local cache and does not hit the database.

 

Is there a way to do #3? I can set db_mode to 3 but that would seem to have other \
effects besides merely making lookup() read from database.

 

Thanks in advance,

 

Jawaid

 

 


[Attachment #5 (text/html)]

<html xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type \
content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 \
(filtered medium)"><style><!-- /* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Menlo;
	panose-1:2 11 6 9 3 8 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;
	mso-ligatures:standardcontextual;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
	{mso-style-priority:34;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.5in;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;
	mso-ligatures:standardcontextual;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri",sans-serif;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
/* List Definitions */
@list l0
	{mso-list-id:2070688458;
	mso-list-type:hybrid;
	mso-list-template-ids:1334495136 67698703 67698713 67698715 67698703 67698713 \
67698715 67698703 67698713 67698715;} @list l0:level1
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level2
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level3
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l0:level4
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level5
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level6
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l0:level7
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level8
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level9
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
--></style></head><body lang=EN-US link="#0563C1" vlink="#954F72" \
style='word-wrap:break-word'><div class=WordSection1><p \
class=MsoNormal>Hi,<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p \
class=MsoNormal>I have an application as follows:<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Multiple Kamailio \
Nodes<o:p></o:p></p><p class=MsoNormal>Shared Postgres database<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Auth information will be \
stored in DB and accessed with Authdb.<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Here is the behavior I \
seek:<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>I \
would like all the Kamailo nodes to cooperate in updating the database, each updating \
data as appropriate:<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><ol \
style='margin-top:0in' start=1 type=1><li class=MsoListParagraph \
style='margin-left:0in;mso-list:l0 level1 lfo1'>When a registration comes in to any \
Node, and it authenticated, create or update a database record in location \
table.<o:p></o:p></li><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 \
level1 lfo1'>When a registration expires on that Node, delete database record in \
location table.<o:p></o:p></li><li class=MsoListParagraph \
style='margin-left:0in;mso-list:l0 level1 lfo1'>When INVITE comes in on any Node, \
ignore local cache and always lookup() record from database.<o:p></o:p></li></ol><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>#1 and #2 are used so that a \
third SIP system can query the database and look up the Node a NAT'd subscriber is \
‘connected' to.<o:p></o:p></p><p class=MsoNormal>#3 is to let NON-NAT'd subscribers \
be contacted from any Node.<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p \
class=MsoNormal>Now I have something close to this now – using following \
settings:<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal \
style='line-height:13.5pt;background:white'><span \
style='font-size:9.0pt;font-family:Menlo;color:black;mso-ligatures:none'>modparam(</span><span \
style='font-size:9.0pt;font-family:Menlo;color:#E21F1F;mso-ligatures:none'>&quot;</span><span \
style='font-size:9.0pt;font-family:Menlo;color:#A31515;mso-ligatures:none'>usrloc</span><span \
style='font-size:9.0pt;font-family:Menlo;color:#E21F1F;mso-ligatures:none'>&quot;</span><span \
style='font-size:9.0pt;font-family:Menlo;color:black;mso-ligatures:none'>, \
</span><span style='font-size:9.0pt;font-family:Menlo;color:#E21F1F;mso-ligatures:none'>&quot;</span><span \
style='font-size:9.0pt;font-family:Menlo;color:#A31515;mso-ligatures:none'>db_mode</span><span \
style='font-size:9.0pt;font-family:Menlo;color:#E21F1F;mso-ligatures:none'>&quot;</span><span \
style='font-size:9.0pt;font-family:Menlo;color:black;mso-ligatures:none'>, 1)         \
</span><span style='font-size:9.0pt;font-family:Menlo;color:green;mso-ligatures:none'># \
immediately write registrations to the database.</span><span \
style='font-size:9.0pt;font-family:Menlo;color:black;mso-ligatures:none'><o:p></o:p></span></p><p \
class=MsoNormal style='line-height:13.5pt;background:white'><span \
style='font-size:9.0pt;font-family:Menlo;color:black;mso-ligatures:none'>modparam(</span><span \
style='font-size:9.0pt;font-family:Menlo;color:#E21F1F;mso-ligatures:none'>&quot;</span><span \
style='font-size:9.0pt;font-family:Menlo;color:#A31515;mso-ligatures:none'>usrloc</span><span \
style='font-size:9.0pt;font-family:Menlo;color:#E21F1F;mso-ligatures:none'>&quot;</span><span \
style='font-size:9.0pt;font-family:Menlo;color:black;mso-ligatures:none'>, \
</span><span style='font-size:9.0pt;font-family:Menlo;color:#E21F1F;mso-ligatures:none'>&quot;</span><span \
style='font-size:9.0pt;font-family:Menlo;color:#A31515;mso-ligatures:none'>db_timer_clean</span><span \
style='font-size:9.0pt;font-family:Menlo;color:#E21F1F;mso-ligatures:none'>&quot;</span><span \
style='font-size:9.0pt;font-family:Menlo;color:black;mso-ligatures:none'>, 0) \
</span><span style='font-size:9.0pt;font-family:Menlo;color:green;mso-ligatures:none'># \
do not expire DB records separately</span><span \
style='font-size:9.0pt;font-family:Menlo;color:black;mso-ligatures:none'><o:p></o:p></span></p><p \
class=MsoNormal style='line-height:13.5pt;background:white'><span \
style='font-size:9.0pt;font-family:Menlo;color:black;mso-ligatures:none'>modparam(</span><span \
style='font-size:9.0pt;font-family:Menlo;color:#E21F1F;mso-ligatures:none'>&quot;</span><span \
style='font-size:9.0pt;font-family:Menlo;color:#A31515;mso-ligatures:none'>usrloc</span><span \
style='font-size:9.0pt;font-family:Menlo;color:#E21F1F;mso-ligatures:none'>&quot;</span><span \
style='font-size:9.0pt;font-family:Menlo;color:black;mso-ligatures:none'>, \
</span><span style='font-size:9.0pt;font-family:Menlo;color:#E21F1F;mso-ligatures:none'>&quot;</span><span \
style='font-size:9.0pt;font-family:Menlo;color:#A31515;mso-ligatures:none'>db_check_update</span><span \
style='font-size:9.0pt;font-family:Menlo;color:#E21F1F;mso-ligatures:none'>&quot;</span><span \
style='font-size:9.0pt;font-family:Menlo;color:black;mso-ligatures:none'>, \
1)<o:p></o:p></span></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p \
class=MsoNormal>This takes care of #1 and #2 above. However, #3 seems to still be \
relying purely on local cache and does not hit the database.<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Is there a way to do #3? I \
can set db_mode to 3 but that would seem to have other effects besides merely making \
lookup() read from database.<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p \
class=MsoNormal>Thanks in advance,<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Jawaid<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p></div></body></html>



__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-leave@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic