[Serusers] Multiple Registrations
Jan Janak
jan at iptel.org
Wed Mar 19 21:59:09 CET 2003
Hello Ricardo,
enclosed find a patch that modifies the registrar so it will be possible
to use just one contact. You will have to use
modparam("registrar", "append_branches", 0) in your script and after
that only the most recently updated/created contact will be used (even if
there are many of them).
Note: if you don't use the modparam, the registrar will still use all
registered contacts.
This should do exactly what you are asking for.
Put the patch in parent directory of ser-0.8.10 and apply it using
patch -p0 < reg-ordering.patch
regards, Jan.
On 19-03 15:40, Ricardo Villa wrote:
> Hi Jan,
>
> Regarding the "q" parameter, thank you for the explanation.
>
> Regarding my "potential" problem, I was thinking that if I could use the
> "serctl ul rm" command:
> serctl ul rm <username> ................... delete user's UsrLoc entries
>
> to delete the oldest duplicate contact, it would be great since I could
> write a Perl script for it. But the "serctl ul rm" command does not do
> anything if we append the ipaddress to the username.
>
> [root at maui sip]# serctl ul show pperez
> <sip:pperez at 192.168.0.111:5060;transport=udp>;q=0.00;expires=2335
> [root at maui sip]# serctl ul rm pperez at 192.168.0.111
> 200 user (location, pperez at 192.168.0.111) deleted
> [root at maui sip]# serctl ul show pperez
> <sip:pperez at 192.168.0.111:5060;transport=udp>;q=0.00;expires=2322
> [root at maui sip]#
>
> I think this would be better than modifying the registrar and affect all
> other SER users.
>
> Thanks,
> Ricardo
>
> ----- Original Message -----
> From: "Jan Janak" <jan at iptel.org>
> To: "Juha Heinanen" <jh at lohi.eng.song.fi>
> Cc: "Ricardo Villa" <ricvil at epm.net.co>; <serusers at lists.iptel.org>
> Sent: Wednesday, March 19, 2003 3:01 PM
> Subject: Re: [Serusers] Multiple Registrations
>
>
-------------- next part --------------
diff -Naur ser-0.8.10/modules/registrar/save.c ser-0.8.10.new/modules/registrar/save.c
--- ser-0.8.10/modules/registrar/save.c 2002-11-12 00:11:52.000000000 +0100
+++ ser-0.8.10.new/modules/registrar/save.c 2003-03-11 11:22:54.000000000 +0100
@@ -43,6 +43,40 @@
#include "regtime.h"
+void remove_cont(urecord_t* _r, ucontact_t* _c)
+{
+ if (_c->prev) {
+ _c->prev->next = _c->next;
+ if (_c->next) {
+ _c->next->prev = _c->prev;
+ }
+ } else {
+ _r->contacts = _c->next;
+ if (_c->next) {
+ _c->next->prev = 0;
+ }
+ }
+}
+
+
+void move_on_top(urecord_t* _r, ucontact_t* _c)
+{
+ ucontact_t* prev;
+
+ if (!_r->contacts) return;
+ if (_c->prev == 0) return;
+
+ prev = _c->prev;
+
+ remove_cont(_r, _c);
+
+ _c->next = _r->contacts;
+ _c->prev = 0;
+
+ _r->contacts->prev = _c;
+ _r->contacts = _c;
+}
+
/*
* Process request that contained a star, in that case,
* we will remove all bindings with the given username
@@ -261,6 +295,9 @@
LOG(L_ERR, "update(): Error while updating contact\n");
return -8;
}
+
+ move_on_top(_r, c);
+
}
}
_c = get_next_contact(_c);
diff -Naur ser-0.8.10/modules/usrloc/urecord.c ser-0.8.10.new/modules/usrloc/urecord.c
--- ser-0.8.10/modules/usrloc/urecord.c 2002-09-19 14:23:55.000000000 +0200
+++ ser-0.8.10.new/modules/usrloc/urecord.c 2003-03-11 11:20:28.000000000 +0100
@@ -125,11 +125,13 @@
ptr = _r->contacts;
+ /*
while(ptr) {
if (ptr->q < _q) break;
prev = ptr;
ptr = ptr->next;
}
+ */
if (ptr) {
if (!ptr->prev) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20030319/a9287789/attachment.pgp>
More information about the sr-users
mailing list