Hello , I am using the usrloc module to store registrations. I could not find any way to remove stale registrations before expires time. Most of the registrations are mobile app so they wont run in background to save battery of phone hence we end up having lots of registrations in usrloc which were not removed because app was killed in background by OS without letting it send unregister request.
Is there any way to remove stale registrations before expires time from usrloc ?
sagar malam writes:
I am using the usrloc module to store registrations. I could not find any way to remove stale registrations before expires time. Most of the registrations are mobile app so they wont run in background to save battery of phone hence we end up having lots of registrations in usrloc which were not removed because app was killed in background by OS without letting it send unregister request.
There are apps (e.g. baresip) that run as foreground service to avoid being killed and that don't consume lots of battery.
Is there any way to remove stale registrations before expires time from usrloc ?
There is ul.rm_contact rpc command.
-- Juha
Hello Juha,
baresip app is interesting. I will look at it.
I have tried ul_rm_contact but it is not working : curl POST --data '{"jsonrpc":"2.0","method":"ul.rm_contact","params":{"0":"location","1":" 30001@XXXXX.com 30001@jeff.sip.teledge.com","2":"sip:30001@X.X.X.X:43108;x-nat=yes;pv-ip=10.212.134.167;pb-ip=X.X.X.X;pb-pt=43108;transport=tcp"}}' -H "Content-Type: application/json" -X POST 10.50.7.14:5060/RPC2
It is throwing error : { "jsonrpc": "2.0", "error": { "code": 404, "message": "Contact not found" }
On Fri, Sep 11, 2020 at 8:03 PM Juha Heinanen jh@tutpro.com wrote:
sagar malam writes:
I am using the usrloc module to store registrations. I could not find any way to remove stale registrations before expires time. Most of the registrations are mobile app so they wont run in background to save
battery
of phone hence we end up having lots of registrations in usrloc which
were
not removed because app was killed in background by OS without letting it send unregister request.
There are apps (e.g. baresip) that run as foreground service to avoid being killed and that don't consume lots of battery.
Is there any way to remove stale registrations before expires time from usrloc ?
There is ul.rm_contact rpc command.
-- Juha
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Why not just expire them quickly?
On Fri, 11 Sep 2020 at 17:25, sagar malam sagarmalam@gmail.com wrote:
Hello Juha,
baresip app is interesting. I will look at it.
I have tried ul_rm_contact but it is not working : curl POST --data '{"jsonrpc":"2.0","method":"ul.rm_contact","params":{"0":"location","1":" 30001@XXXXX.com 30001@jeff.sip.teledge.com","2":"sip:30001@X.X.X.X:43108;x-nat=yes;pv-ip=10.212.134.167;pb-ip=X.X.X.X;pb-pt=43108;transport=tcp"}}' -H "Content-Type: application/json" -X POST 10.50.7.14:5060/RPC2
It is throwing error : { "jsonrpc": "2.0", "error": { "code": 404, "message": "Contact not found" }
On Fri, Sep 11, 2020 at 8:03 PM Juha Heinanen jh@tutpro.com wrote:
sagar malam writes:
I am using the usrloc module to store registrations. I could not find
any
way to remove stale registrations before expires time. Most of the
registrations are mobile app so they wont run in background to save
battery
of phone hence we end up having lots of registrations in usrloc which
were
not removed because app was killed in background by OS without letting
it
send unregister request.
There are apps (e.g. baresip) that run as foreground service to avoid
being killed and that don't consume lots of battery.
Is there any way to remove stale registrations before expires time from
usrloc ?
There is ul.rm_contact rpc command.
-- Juha
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Thanks,
Sagar
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Fri, Sep 11, 2020 at 11:06 PM David Villasmil < david.villasmil.work@gmail.com> wrote:
Why not just expire them quickly?
This may work but it will increase rate of registrations and put load on server.
On Fri, 11 Sep 2020 at 17:25, sagar malam sagarmalam@gmail.com wrote:
Hello Juha,
baresip app is interesting. I will look at it.
I have tried ul_rm_contact but it is not working : curl POST --data '{"jsonrpc":"2.0","method":"ul.rm_contact","params":{"0":"location","1":" 30001@XXXXX.com 30001@jeff.sip.teledge.com","2":"sip:30001@X.X.X.X:43108;x-nat=yes;pv-ip=10.212.134.167;pb-ip=X.X.X.X;pb-pt=43108;transport=tcp"}}' -H "Content-Type: application/json" -X POST 10.50.7.14:5060/RPC2
It is throwing error : { "jsonrpc": "2.0", "error": { "code": 404, "message": "Contact not found" }
On Fri, Sep 11, 2020 at 8:03 PM Juha Heinanen jh@tutpro.com wrote:
sagar malam writes:
I am using the usrloc module to store registrations. I could not find
any
way to remove stale registrations before expires time. Most of the
registrations are mobile app so they wont run in background to save
battery
of phone hence we end up having lots of registrations in usrloc which
were
not removed because app was killed in background by OS without letting
it
send unregister request.
There are apps (e.g. baresip) that run as foreground service to avoid
being killed and that don't consume lots of battery.
Is there any way to remove stale registrations before expires time from
usrloc ?
There is ul.rm_contact rpc command.
-- Juha
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Thanks,
Sagar
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337 _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
sagar malam writes:
I have tried ul_rm_contact but it is not working : curl POST --data '{"jsonrpc":"2.0","method":"ul.rm_contact","params":{"0":"location","1":" 30001@XXXXX.com 30001@jeff.sip.teledge.com","2":"sip:30001@X.X.X.X:43108;x-nat=yes;pv-ip=10.212.134.167;pb-ip=X.X.X.X;pb-pt=43108;transport=tcp"}}' -H "Content-Type: application/json" -X POST 10.50.7.14:5060/RPC2
Second param is AOR (username@domain). Yours does not look like it. Use ul.dump to check.
-- Juha
There was mistake in Json syntax but it does not work with kamcmd as well : [root@SBC-4-2 kamailio]# kamcmd ul.rm_contact location 30001@jeff.sip.teledge.com "sip:30001@43.228.229.106:38048 ;x-nat=yes;pv-ip=10.212.134.171;pb-ip=43.228.229.106;pb-pt=38048;transport=tcp"
error: 404 - Contact not found
*ul.dump : *
Info: { AoR: 30001@jeff.sip.teledge.com HashID: 286668796 Contacts: { Contact: { Address: sip:30001@43.228.229.106:38048 ;x-nat=yes;pv-ip=10.212.134.171;pb-ip=43.228.229.106;pb -pt=38048;transport=tcp Expires: 445 Q: -1.000000 Call-ID: Yzk0NWUzOWIzMWI2MzQzM2JhMzE2NzAyOWQyNDM1ODI. CSeq: 5 User-Agent: FreeSWITCH-mod_sofia/1.10.3-release~64bit Received: [not set] Path: [not set] State: CS_SYNC Flags: 0 CFlags: 0 Socket: udp: 10.50.8.11:5060 Methods: 15359 Ruid: uloc-5f5c7a22-afe4-2 Instance: [not set] Reg-Id: 0 Server-Id: 0 Tcpconn-Id: -1 Keepalive: 0 Last-Keepalive: 1599896245 KA-Roundtrip: 0 Last-Modified: 1599896245 } Contact: { Address: sip:30001@43.228.229.106:38048 ;x-nat=yes;pv-ip=10.212.134.171;pb-ip=43.228.229.106;pb -pt=38048;transport=tcp Expires: 716 Q: -1.000000 Call-ID: MzAwN2Y0NTc1YmVkY2RlYWRmMTI2Zjg1MDk5YzRlODE. CSeq: 5 User-Agent: FreeSWITCH-mod_sofia/1.10.3-release~64bit Received: [not set] Path: [not set] State: CS_SYNC Flags: 0 CFlags: 0 Socket: udp: 10.50.8.11:5060 Methods: 15359 Ruid: uloc-5f5c7a22-afdf-8 Instance: [not set] Reg-Id: 0 Server-Id: 0 Tcpconn-Id: -1 Keepalive: 0 Last-Keepalive: 1599896384 KA-Roundtrip: 0 Last-Modified: 1599896384 }
I found ka_timeout parameter which is exactly what i was looking for but it is not yet available in stable version : https://www.kamailio.org/docs/modules/devel/modules/usrloc.html#usrloc.p.ka_...
On Sat, Sep 12, 2020 at 12:06 AM Juha Heinanen jh@tutpro.com wrote:
sagar malam writes:
I have tried ul_rm_contact but it is not working : curl POST --data '{"jsonrpc":"2.0","method":"ul.rm_contact","params":{"0":"location","1":" 30001@XXXXX.com 30001@jeff.sip.teledge.com","2":"sip:30001@X.X.X.X
:43108;x-nat=yes;pv-ip=10.212.134.167;pb-ip=X.X.X.X;pb-pt=43108;transport=tcp"}}'
-H "Content-Type: application/json" -X POST 10.50.7.14:5060/RPC2
Second param is AOR (username@domain). Yours does not look like it. Use ul.dump to check.
-- Juha
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hi,
On 2020-09-11 08:19, sagar malam wrote:
Hello , I am using the usrloc module to store registrations. I could not find any way to remove stale registrations before expires time. Most of the registrations are mobile app so they wont run in background to save battery of phone hence we end up having lots of registrations in usrloc which were not removed because app was killed in background by OS without letting it send unregister request.
Are you sure that removing such registrations is the best thing to do?
You don't know what the user is going to do; maybe they will be using it continuously, or maybe it'll be backgrounded. It's impossible to determine, so you can't assume any given registration is stale, and it is reasonable to attempt to contact the registrant for any given inbound call, even if the attempt is futile because it has gone unreachable.
Meanwhile, the moment the endpoint is "woken up"[1] via a push notification, it will re-register and overwrite the stale contact binding instead of adding an additional one, provided that the match mode[2] is set correctly.
-- Alex
[1] https://www.kamailio.org/events/2015-KamailioWorld/Day2/20-Federico.Cabiddu-...
[2] https://kamailio.org/docs/modules/5.4.x/modules/usrloc.html#usrloc.o.contact...
Hello ,
On Mon, Sep 14, 2020 at 4:16 AM Alex Balashov abalashov@evaristesys.com wrote:
Hi,
On 2020-09-11 08:19, sagar malam wrote:
Hello , I am using the usrloc module to store registrations. I could not find any way to remove stale registrations before expires time. Most of the registrations are mobile app so they wont run in background to save battery of phone hence we end up having lots of registrations in usrloc which were not removed because app was killed in background by OS without letting it send unregister request.
Are you sure that removing such registrations is the best thing to do?
You don't know what the user is going to do; maybe they will be using it continuously, or maybe it'll be backgrounded. It's impossible to determine, so you can't assume any given registration is stale, and it is reasonable to attempt to contact the registrant for any given inbound call, even if the attempt is futile because it has gone unreachable.
I am using the Keepalive to identify if any registration is stale. If KA OPTION does not get a reply then that registration is considered as stale. There is no point of keeping unreachable registration in usrloc irrespective of whether the app is in background or foreground because it will only add overhead to generate an invite which will ultimately timeout without any response.
Meanwhile, the moment the endpoint is "woken up"[1] via a push notification, it will re-register and overwrite the stale contact binding instead of adding an additional one, provided that the match mode[2] is set correctly.
This is true for hard phones or any endpoint which has a stable internet. Here I am dealing with cellular networks so we cannot be sure if the app will be provided the same public IP and port(IP is same most of the time but not port) each time it will register with the server. So the same APP can register with the same call ID but different contact address which will create duplicate registration entries for the same APP.
-- Alex
[1]
https://www.kamailio.org/events/2015-KamailioWorld/Day2/20-Federico.Cabiddu-...
[2]
https://kamailio.org/docs/modules/5.4.x/modules/usrloc.html#usrloc.o.contact...
-- Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users