[sr-dev] Possible PUA bug

Peter Dunkley peter.dunkley at crocodile-rcs.com
Thu Jun 9 09:18:53 CEST 2011

Hi Daniel,

I was thinking of adding a modparam to pua to simply not compare the remote_contact when checking for SUBSCRIBE dialogs.  When not set the current pua behaviour will remain.

The RLS back-end dialogs should be unique across pres_uri and pres_id.  The current check is on pres_uri, pres_id, watcher_uri, and remote_contact.  So, I don't think remote_contact really needs to be checked here at all.

This change shouldn't cause problems with anything else that uses pua because the same check should be OK for them too (they may even suffer from the same problem).  However, putting in the modparam so the old behaviour is still used by default seems safer for now.


On 9 Jun 2011, at 07:33, Daniel-Constantin Mierla <miconda at gmail.com> wrote:

> Hello,
> On 6/8/11 3:48 PM, Peter Dunkley wrote:
>> Hello,
>> I am working with Kamailio RLS which uses PUA as a library to send SUBSCRIBEs.
>> Whenever Kamailio receives an RLS subscription it calls rls_handle_subscribe().  rls_handle_subscribe() calls the function resource_subscriptions() which in turn calls send_resource_subs() (via process_list_and_exec()).  resource_subscriptions() and send_resource_subs() fill in a subs_info_t structure that is passed into the PUA module send_subscribe() function.
>> The key part is that send_resource_subs() sets the subs_info_t remote_target field to the pres_uri.  The PUA send_subscribe() function uses the remote_target as the remote_contact (in the ua_pres_t structure) that is used to lookup the dialog in the PUA hash table.  Unfortunately, this lookup always fails because the PUA module correctly updates the remote contact in the hash table when it gets a response back from the (Kamailio) presence server.
>> The effect that this has is that any re-SUBSCRIBE requests from the RLS module are treated as new initial SUBSCRIBEs.  This causes the pua and (presence) watchers tables in my Kamailio database to grow rapidly, and can result in multiple notifications on a presence status change.
>> I noticed this because I am currently adding a new API to RLS which will allow me to update my RLS subscriptions whenever my resource list documents change.  This is needed so that subscribers receive an immediate presence authorisation request when someone adds them to their contact list.  The client I am testing with tends to update the RLS documents frequently (often for superficial changes) and this combined with the PUA issue described above means with just two clients on the system (with only each other in the contact list) I can end up with many 10s of records in pua and watchers within a few minutes.
>> This issue will also have a lesser effect when RLS re-SUBSCRIBEs from clients occur.  There will be a window (until the original SUBSCRIBE expires) when there are multiple back-end SUBSCRIBE       dialogs for each contact.
>> Can anyone advise on this issue and suggest a solution?
> had no time to look into the code, you should have it fresh in mind -- is any other unique key that could be used to match the dialog in pua hash table? If not, then maybe adding a new field to keep the initial remote_contact is a solution, so if matching on remote contact does not return, lookup again on initial field.
> Cheers,
> Daniel
>> Regards,
>> Peter
>> -- 
>> Peter Dunkley
>> Technical Director
>> Crocodile RCS Ltd
>> _______________________________________________
>> sr-dev mailing list
>> sr-dev at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
> -- 
> Daniel-Constantin Mierla -- http://www.asipto.com
> http://linkedin.com/in/miconda -- http://twitter.com/miconda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20110609/993cc8f1/attachment-0001.htm>

More information about the sr-dev mailing list