Summary: | ASTERISK-16925: [patch] distributed device state does not work | ||
Reporter: | klaus3000 (klaus3000) | Labels: | |
Date Opened: | 2010-11-07 14:00:28.000-0600 | Date Closed: | 2010-11-26 12:31:50.000-0600 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Resources/res_jabber |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) res_jabber_fix_pubsubflags_and_CLI-patch.txt | |
Description: | from res_jabber.c: /*! \brief Global flags, initialized to default values */ static struct ast_flags globalflags = { AJI_AUTOREGISTER | AJI_AUTOACCEPT }; /*! \brief PubSub flags, initialized to default values */ static struct ast_flags pubsubflags = { AJI_AUTOREGISTER }; As you see, pubsubflags is initialized to AJI_AUTOREGISTER - but AJI_AUTOREGISTER is meant for global flags. from jabber.h: enum { AJI_AUTOPRUNE = (1 << 0), AJI_AUTOREGISTER = (1 << 1), AJI_AUTOACCEPT = (1 << 2), }; enum { AJI_XEP0248 = (1 << 0), AJI_PUBSUB = (1 << 1), AJI_PUBSUB_AUTOCREATE = (1 << 2), }; As you see AJI_AUTOREGISTER==AJI_PUBSUB. Thus, res_jabber always thinks that there is already a connection with pubsub enabled and thus does not allow any other connection to enable pubsub. ****** ADDITIONAL INFORMATION ****** Attached patch removes the default value and now Asterisk subscribes and publishes device state. The patch also: - renames CLI command "jabber show connected" to "jabber show connections" which is IMO more correct - as it also shows unconnected clients - some CLI commands assume a default value for the connection of "asterisk". This is IMO bad: - it prevents to show the usage instructions - it is dangerous, especially with "purge" or "delete" commands as it "or do you want your "rm" command to have a default value?) - 1 indention fix - fixed CLI usage to display all mandatory parameters within <> and optional parameters within [] Testing: pubsub works now, previously it did not work. Tested with ejabberd 2.1 (lenny-backports), ejabberd 2.0 (lenny) does not work (different node creation behavior). Patch works for trunk and 1.8.0. | ||
Comments: | By: klaus3000 (klaus3000) 2010-11-08 08:28:24.000-0600 btw: was this ever tested? AFAIS without my patch PubSub is never activated.... By: Bradley Watkins (marquis) 2010-11-08 14:58:31.000-0600 You are exactly correct. This is really my fault for not committing this before it was merged. It's in my backport to 1.6.2 that I'm running in production, so I don't know why it wasn't already there. The CLI cleanups look sound, too, though I haven't tried them at all. By: Leif Madsen (lmadsen) 2010-11-18 14:10:48.000-0600 Marquis: Do you have commit access? Perhaps you could just commit this if you think it is right? By: Digium Subversion (svnbot) 2010-11-26 12:31:19.000-0600 Repository: asterisk Revision: 296354 U branches/1.8/res/res_jabber.c ------------------------------------------------------------------------ r296354 | marquis | 2010-11-26 12:31:18 -0600 (Fri, 26 Nov 2010) | 12 lines Fix XMPP PubSub-based distributed device state. Initialize pubsubflags to 0 so res_jabber doesn't think there is already an XMPP connection sending device state. Also clean up CLI commands a bit. (closes issue ASTERISK-16925) Reported by: klaus3000 Patches: res_jabber_fix_pubsubflags_and_CLI-patch.txt uploaded by klaus3000 (license 65) Tested by: klaus3000, Marquis Review: https://reviewboard.asterisk.org/r/1030/ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=296354 By: Digium Subversion (svnbot) 2010-11-26 12:31:49.000-0600 Repository: asterisk Revision: 296355 _U trunk/ U trunk/res/res_jabber.c ------------------------------------------------------------------------ r296355 | marquis | 2010-11-26 12:31:48 -0600 (Fri, 26 Nov 2010) | 19 lines Merged revisions 296354 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r296354 | marquis | 2010-11-26 13:31:17 -0500 (Fri, 26 Nov 2010) | 12 lines Fix XMPP PubSub-based distributed device state. Initialize pubsubflags to 0 so res_jabber doesn't think there is already an XMPP connection sending device state. Also clean up CLI commands a bit. (closes issue ASTERISK-16925) Reported by: klaus3000 Patches: res_jabber_fix_pubsubflags_and_CLI-patch.txt uploaded by klaus3000 (license 65) Tested by: klaus3000, Marquis Review: https://reviewboard.asterisk.org/r/1030/ ........ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=296355 |