[OpenSIPS-Devel] Presence API & Clustering

Bogdan-Andrei Iancu bogdan at opensips.org
Fri Sep 22 12:48:50 UTC 2023


Hi Carsten,

In terms of the finding, yes, you are right - it looks the 
`update_presentity` API function was "missed" during the latest events 
and clustering additions in the presence module :D....Actually, this is 
explained by the fact that that API function is used only by 
`presence_callinfo` module (not a very used one also).

Anyhow, I will take care a push a fix, thanks for the report.

Nevertheless, I do not agree with the shortcuting of t PUBLISH - keep in 
mind that in many cases the pua side (the publisher) is actually located 
on a different instance than the presence servers. This is way the 
communication between the PUA and PRESENCE is always done via PUBLISH, 
even if it loops.

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
   https://www.opensips-solutions.com
   https://www.siphub.com

On 9/20/23 1:56 PM, Carsten Bock via Devel wrote:
> Hi there,
> ´
> I have a quick question regarding presence & clustering:
> I am working on extensions for handling "reg"-Events based on Usrloc. 
> I came across the following:
>
> When OpenSIPS receives and handles a publish, it does the following:
>
> /* query the database and update or insert */
> if(update_presentity(msg, &presentity, &sent_reply) <0)
> {
>   LM_ERR("when updating presentity\n");
>   reply_code = 500;
>   reply_str = pu_500_rpl;
>   goto error;
> }
>
> /* send event E_PRESENCE_PUBLISH */
> presence_raise_event(presence_event_id, &presentity);
>
> /* see if this PUBLISH needs to be replicated via cluster */
> if (is_cluster_federation_enabled() &&
> is_event_clustered(event->evp->parsed))
>   replicate_publish_on_cluster(&presentity);
>
> The API, however, only exposes "update_presentity()". I want to avoid 
> having to send me a PUBLISH locally, so I tried to use 
> "update_presentity()".
> Do I understand this code correctly that the status set by my module 
> using "update_presentity()" is not replicated across the cluster and 
> would not raise any event?
> Is that intended, or is there missing some functionality?
> Should those functions be exposed so I can trigger a replication in 
> the cluster?
>
> I am happy to make a PR for the changes once I have tested this, but I 
> wanted to know if this is on purpose.
>
> Thanks,
> Carsten
> --
> Carsten Bock I Chief Technology Innovation Officer & Founder
>
> ng-voice GmbH
>
> Trostbrücke 1 I 20457 Hamburg I Germany
> T +49 1511 5942983 I www.ng-voice.com <http://www.ng-voice.com/>
>
> Registry Office at Local Court Hamburg, HRB 120189
> Managing Directors: Dr. David Bachmann, Carsten Bock, Quirin Maderspacher
>
>
> _______________________________________________
> Devel mailing list
> Devel at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20230922/ff634c90/attachment.html>


More information about the Devel mailing list