Tips for External Presence Management

Our company is currently using Wildfire for interoffice communications and we also use a custom CRM that runs on the traditional LAMP stack. Recently we’‘ve been asked if it would be possible to “integrate” to the two in so much that the CRM could set the user’‘s Wildfire presence. They’‘ve imagined this to work so that when the user logs out of the CRM, they’‘re set to Away in Wildfire. I’‘m sure if we can get the functionality working, they’'ll find more uses for it.

I’'ve pondered a couple different options so far.

1- Having PHP connect to the admin console via HTTPS and disconnecting the user. While this works, it doesn’‘t allow us to change the user’'s presence, just disconnect them.

2- I’'ve looked at the existing plugins and while there is a user management one, it is oriented towards usernames, passwords, etc.

3- I considered having the CRM log into Wildfire as a Jabber client and changing the presence that way. The problems I see with this are 1) The user passwords are stored in MD5 and 2) I believe it would only change their presence for that session, not their existing session.

With all of that in mind, I think I’'m going to have to write a plugin to accomplish this task. I wanted to post here so that before I dive in, I can see if anyone has any tips or alternate methods. I know the Asterisk-IM plugin can change presence, so if I get to the point of writing one, I can atleast reference that one.

Any advice is appreciated in advance!

I think you should create a plugin that monitors their state in your CRM rather than trying to ‘‘push’’ the info from the CRM to openfire. You’'re correct that their status would be set for a different connection if you tried to have the CRM login as them to change their status.

Before I can provide an adequate answer to your question I would have to ask, what is the purpose of the interaction. In other words, what are you hoping to accomplish?


The issue originally came up because a number of people either are not or do not want to use the Idle Timeout features built in to Spark, so they always look like they are online and available, even when they’'ve been out of the office for several hours. Since we have a CRM that already automatically logs users out after X number of minutes, it was suggested that their presence be directly tied to whether or not they were logged in to the CRM.

However, once the abilities exists for the CRM to alter the user’‘s presence in some way, I’'m sure there will be more feature requests. Something along the line of “If the user is on a page that involves processing payments or something equally detailed-oriented and important, set their presence to Do Not Disturb”

I would recommend checking out what Asterisk IM does as it has a very similar use case. Basically, when users are on the phone through Asterisk IM their presence is changed on all logged in resources to be “On the Phone”. So, essentially the same thing.



Asterisk IM uses a concept of “layered presence”:

Once we detect a call for a given user we add an “on the phone” layer.

When the user receives or places another call before the first call has been finished (e.g. put the call on hold) we create a second layer for the new call.

When the user changes presence while “on the phone” we update the original presence that is hidden by the “on the phone” layers.

When a call has been finished we remove the corresponding “on the phone” layer.

When now overriding presence layers remain we restore the original presence.

It seems this problem could be more easily solved in educating your users. Coupling presence to the CRM system just forces them to use a server side idle detection feature…