Continuous presence in the XMPP meeting room

I have an XMPP server (openfire) with a bunch of clients (spark), divided into several groups (departments). I am looking for the opportunity to keep them in conference rooms. I mean the similar functionality that skype has; when the user closes the group conversation window, his client monitors activity in the room and when a new message appears, the user automatically joins this conference again. I have already found that spark + openfire does not have such features, although there is a good “Bookmarks in group chat” function with automatic joining, however this does not prevent the user from simply leaving the room and not being able to find out about further events. I would like to ask if there is any XMPP client that has implemented this feature. I realized that I can configure my bot with administrative privileges to sit in each room and, possibly, force it to force removal / reconnection (for example, via openfire control via the HTTP function) when the user leaves the conference and he does not end the session, therefore, auto-join on the connector will return it. However, I think it would be easier and more pleasant to just change the client application, if there is an alternative.

UPDATE: I just found “auto-accept group chat invitations” in spark mode, so if I reconfigure all clients without their knowledge and configure this bot, just send an invitation if a person leaves the channel, he should do the trick. Any other ideas?

UPDATE2:

Ok guys, I successfully tested the option "Spark-> Preferences-> Group chat-> Automatically accept groupchat invites", it works; my spark joins every conference that I am automatically invited to. Therefore, I implemented the conference monitoring function → auto reinvite in baht based on JAXL 3.0. The only problem is that the jaxl-sent prompt doesn't work for me. Here is the source code:

<?php ### JAXL message bot composed by ewilded require 'JAXL-3.x/jaxl.php'; $jabber_conf=array('jid' => ' messagebot@localhost ','host'=>'openfire','user'=>'messagebot','domain'=>'localhost','logLevel'=>4, 'strict'=>true, 'port'=>5222, 'pass'=>'somepass','log_level' => JAXL_INFO); error_reporting(E_ALL); $conference_rooms=array(' tech@conference.localhost '); $client=null; ## Creating the object $client = new JAXL($jabber_conf); $client->require_xep(array( '0045', // MUC '0203', // Delayed Delivery '0199', // XMPP Ping '0249' // direct invite )); ## connect up callbacks $client->add_cb('on_auth_success', function() use($client,$conference_rooms,$cron_interval) { echo "Auth success.\n"; echo "My full jid: ".$client->full_jid->to_string()."\n"; $client->set_status("Mesasge bot - available!"); // set your status $client->get_vcard(); // fetch your vcard $client->get_roster(); // fetch your roster list foreach($conference_rooms as $conference) { echo "Joining conference $conference.\n"; $room_full_jid=new XMPPJid("$conference/messagebot"); $client->xeps['0045']->join_room($room_full_jid); } }); $client->add_cb('on_chat_message', function($msg) use($client) { $to=$msg->from; echo "Sending answer to: ".$to."\n"; $client->send_chat_msg($to,"I am just simple bot written in PHP with JAXL XMPP library."); }); $client->add_cb('on_connect_error',function(){echo "Connection error :(\n";}); $client->add_cb('on_disconnect', function() { echo "Got disconnected.\n"; _debug("got on_disconnect cb"); }); $client->add_cb('on_error_stanza',function($msg) { echo "Error stanza."; #print_r($msg); }); $client->add_cb('on_presence_stanza',function($msg) use($client) { echo "Presence stanza.\n"; ### joins and lefts are shown here, so here we simply send reinvite if we see that someone left if(isset($msg->attrs['type'])&&$msg->attrs['type']=='unavailable') { if(isset($msg->childrens[0])&&isset($msg->childrens[0]->childrens[0])&&isset($msg->childrens[0]->childrens[0]->attrs['jid'])) { echo "Sending invite.\n"; $jid=$msg->childrens[0]->childrens[0]->attrs['jid']; $bare_jid=explode("/",$jid); $from_room=$msg->attrs['from']; $bare_from_room=explode("/",$from_room); echo $bare_jid[0]."\n"; echo $bare_from_room[0]."\n"; $client->xeps['0249']->invite($jid,$from_room); ### for some reason it does not work :( echo "Invite ($jid to $from_room) sent.\n"; } else { echo "Ignoring.\n"; } } echo "After presence stanza.\n"; }); $client->add_cb('on_normal_stanza',function() { echo "Normal stanza.\n"; }); $client->add_cb('on_groupchat_message',function($msg) use ($client) { echo "Groupchat event received.\n"; }); echo "Start called.\n"; $client->start(); ?> 

In the conference room, the option "Allow the possibility of occupation by others" is enabled, both accounts (the one that my friend used to send the invitation when he worked, and the one used by messagebot) are members of the Tech group, none of them have administrative rights, therefore, I am sure that this is not a problem with settings and permissions.

Now, when I leave the conference room, the bot detects it and sends me an invitation, this is what it looks like in its release: ... The presence of a stanza. Sending an invitation. ewilded @ local tech@conference.localhost An invitation (ewilded @ localhost / Spark 2.6.3 to tech@conference.localhost / Ewil Ded) has been sent. After the presence of the stanza. ... Unfortunately, this invitation does not enter into force. I believe that I am doing something wrong with this xep call, more precisely with its parameters: $ Client-> xeps ['0249'] → invite ($ JID, $ from_room);

If someone has received invitations to Jaxl, PLEASE help, this is the only thing you need to do for this.

+6
source share
1 answer

Do you see the invitation packet being sent in the logs?

For the next debugging level, you can directly call $invite_pkt = $client->xeps['0249']->get_invite_pkt($to_bare_jid, $room_jid) . Both $to_bare_jid and $room_jid should be passed as a string. get_invite_pkt will return the necessary stanza to you, which must be sent in accordance with the direct extension of the MCC xmpp invitation . If you see that everything is fine with the returned stanza, just send it by calling $client->send($invite_pkt) .

Hope this helps you better debug and solve problems.

+2
source

All Articles