Hi Giacomo,

I patched few days ago to make pua_usrloc sending the PUBLISH also for location record expiration.

http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=bdbacf559134022856f5723a91fe7e130ceada29
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=266fa4e2cd62f58ee1f2eec2a5a83bc3028d194a

The idea is to set a branch flag for marking the contact for publishing -- pua_set_publish() can be still used actually, it sets also the branch flag internally, if the module parameter specifying the flag is set -- alternative is to use directly setbflag(index).

I was out of office and couldn't try it yet, maybe you can test and report if it is working fine.

You have to install devel version, either from git or from nightly debs:

http://www.kamailio.org/wiki/packages/debs#kamailio_development_-_nightly_builds

Cheers,
Daniel

On 1/20/12 12:56 PM, Giacomo Vacca wrote:

Thanks Daniel.

What I’d like to achieve is this: given a cluster of kamailio-based proxy/registrar, notify a separate entity whenever a contact is inserted or removed (either by deletion or expiration).

 

I’d like this separate entity to be stateless (i.e. don’t manage expiry time), avoid using a DB as shared information and have asynchronous notifications.

 

This is why I thought pua_usrloc could help me, without the need of a full presence server in the architecture to manage expiry times for presentities.

 

What do you think could be used to achieve this?

 

From my point of view the ideal solution is implementing reg-info events (RFC 3680), where the separate entity mentioned above acts as watcher for reg-info events on all kamailio instances.

But I’m really looking at a simpler, lighter solution.

 

Regards,

Giacomo

 

 

From: Daniel-Constantin Mierla [mailto:miconda@gmail.com]
Sent: 20 January 2012 10:58
To: SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing List
Cc: Giacomo Vacca
Subject: Re: [SR-Users] pua_usrloc, PUBLISH not send when contact is deleted or expires

 

Hi Giacomo,

On 1/19/12 11:49 AM, Giacomo Vacca wrote:

Ah thanks Daniel,

So I had a wrong expectation on the behaviour of pua_usrloc.

It does make sense that the PUBLISH already carries its expiry and so the expiration moment is implicit and should/can be handled elsewhere.

 

I think what confused me were two things: the pua_usrloc documentation and the fact that pua_usrloc does register for EXPIRE callbacks with usrloc.

 

I’m referring to:

The pua_usrloc module is the connector between the usrloc and pua modules. It creates the environment to send PUBLISH requests for user location records, on specific events (e.g., when new record is added in usrloc, a PUBLISH with status open (online) is issued; when expires, it sends closed (offline)).”


perhaps the documentation is misleading a bit with its phrasing. It send offline (closed) when it is an un-register, before the expiration. I haven't looked in the code, but based on log messages and correlated with the expired carried by PUBLISH, the behavior is correct over all.

There is another aspect, usrloc cleans up expired records on timer, so usrloc callback can be executed later than actual expiration. A publish at that time could be late. Of course, presence does cleanup on timer as well, but it may be more accurate to handle expiration there. It is like when an UA with presence support disappears from networks, without sending any PUBLISH updates.

Cheers,
DAniel




From: Daniel-Constantin Mierla [mailto:miconda@gmail.com]
Sent: 19 January 2012 10:37
To: SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing List
Cc: Giacomo Vacca
Subject: Re: [SR-Users] pua_usrloc, PUBLISH not send when contact is deleted or expires

 

Hello,

On 1/19/12 11:22 AM, Giacomo Vacca wrote:

Hi Daniel,

Thanks for your feedback. Yes, using mysql and enabling presence made it work for un-registrations too.

Just for the purpose of this scenario I’m sending the PUBLISH back to the same entity, and it’s being handled as a presentity.

 

I still have a missing piece though (which is in fact the reason for this configuration): having PUBLISH requests triggered by the expiration of a contact.

 

When a contact expires, pua_usrloc is now logging:

 

Jan 19 10:12:03 debian6 /usr/sbin/kamailio[4359]: INFO: pua_usrloc [ul_publish.c:211]: should not send ul publish

 

(please see below for traces and details).

 

Since I’m marking a registration with pua_set_publish(), why is that flag not seen as true when usrloc fires an EXPIRE callback?

 

I’ve tried marking every REGISTER request with pua_set_publish(), and not just the first one, before calling save(“location”) but the result was the same.


the PUBLISH for registration expiration does not make sense, as PUBLISH has also an expire interval, so the record in the presence server should expire at the same time. A publish with update state to close will eventually hit the presence server when there is no record for it. Presence server will send notifications when the record in its table expires.

Cheers,
Daniel





-- 
Daniel-Constantin Mierla -- http://www.asipto.com
http://linkedin.com/in/miconda -- http://twitter.com/miconda

Truphone Limited is a limited liability company registered in England & Wales, registered office: 5 New Street Square, London EC4A 3TW. Registered No. 04187081. VAT No. GB 851 5278 19.

Tru is a brand name of Truphone and is a Truphone Communications Service. Truphone is a trading name for a number of distinct legal entities that operate in combination. www.truphone.com.


This e-mail, and any attachment(s), may contain information which is confidential and/or privileged, and is intended for the addressee only. If you are not the intended recipient, you may not use, disclose, copy or distribute this information in any manner whatsoever. If you have received this e-mail in error, please contact the sender immediately and delete it.


_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- http://www.asipto.com
http://linkedin.com/in/miconda -- http://twitter.com/miconda