[SR-Users] Multiple Registrations - Overwrite oldest contact

Olle E. Johansson oej at edvina.net
Fri Apr 1 22:31:17 CEST 2016


That requires a bit more of reading the same doc page, but I still think you can do it.

Run reg_fetch_contacts and check how many you have. Loop through them and unregister by the ruri (id) of the one that expires first
if you have too many.

We’ve made this function to make the location database handling very transparent to the script writer that wants to go beyond 
the ordinary and do some fun scripting :-)

http://kamailio.org/docs/modules/devel/modules/registrar.html#registrar.f.reg_fetch_contacts
http://kamailio.org/docs/modules/devel/modules/registrar.html#registrar.f.unregister

Kamailio is cool, isn’t it? :-)

/O

> On 01 Apr 2016, at 22:18, Bruno Emer <brunoemer at gmail.com> wrote:
> 
> This is my problem... I want to have 2 contacts for AOR, and not only one. 
> 
> When the 3rd arrives, it must remove the oldest and continue with 2...
> 
> If I am using the 0x04 parameter, it will save just one contact, and the user will not be able to get the Invite both, in the mobile device and web interface.
> 
> Bruno Emer
> 
> Mobile: +55 11 96540-0044 <tel:%2B55%2011%2096540-0044> 
> email: brunoemer at gmail.com <mailto:brunoemer at gmail.com>
>  <https://www.facebook.com/bruno.emer.5>  <https://www.linkedin.com/profile/view?id=86461237&trk=spm_pic>  <https://twitter.com/brunoemer_>  <https://www.flickr.com/photos/122070309@N03/>  <http://google.com/+BrunoEmer>  <http://instagram.com/brunoemer_>
> 2016-04-01 17:07 GMT-03:00 Bruno Emer <brunoemer at gmail.com <mailto:brunoemer at gmail.com>>:
> Hello, Olle!
> 
> Thanks for your help in this case, and don't worry about the time (actually I wasn't even expecting to get an answer today).
> 
> I know the max_contacts parameter. But the problem is that if I set the max_contacts to 2, when the user tries to register again, he gets an error message 503. The point is that I want to get the user registered, and replace the oldest location entry for the newest one.
> 
> 
> 
> Bruno Emer
> 
> Mobile: +55 11 96540-0044 <tel:%2B55%2011%2096540-0044> 
> email: brunoemer at gmail.com <mailto:brunoemer at gmail.com>
> 
> 2016-04-01 16:31 GMT-03:00 Bruno Emer <brunoemer at gmail.com <mailto:brunoemer at gmail.com>>:
> Hello all.
> 
> I have problem here and I tried to find a solution and search over internet, but without success.
> 
> My scenario is the following: I have an application that must be registered in Kamailio when a user logs in the web interface, so he can get calls (something like a web softphone using webrtc). At this point, we are OK, and everything is working fine.
> 
> To get these register functions I am using the parameter "save("location", "0x04")" as described in the REGISTRAR module documentation, so if a user logs in another web browser or computer, only the last one will continue registered and all calls will be forwarded to him.
> 
> The point is that now we are creating a phone app that will do almost the same thing as the web interface, allowing users to receive calls using the mobile device, and here is my problem: I want to allow my users to be registered on two devices at the same time, but if a user logs into another device, I don't want to reply with a 503. I want to allow the user to register again, deregistering the oldest contact.
> 
> I saw that there is a module named "ims_usrloc_scscf" and on its description it says "implemented overwrite oldest contact behaviour", but I couldn't find any documentation about it.
> 
> So, is there a way to get this working today?
> 
> 
> Bruno Emer
> 
> Mobile: +55 11 96540-0044 <tel:%2B55%2011%2096540-0044> 
> email: brunoemer at gmail.com <mailto:brunoemer at gmail.com>
> 
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20160401/0f0d3551/attachment.html>


More information about the sr-users mailing list