Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i've set up a live chat using ejabberd. It's working pretty well but I'd like to be able to round-robin chat sessions to different operators depending on who is already in a chat and who is free to talk. To implement this I need some way to update a users presence based on wether they are currently in a private chat. I'm currently using mod_shared_roster to advertise presence but it only reports wether a user is available.

This really needs to be done server side because I will need to rely on different IM clients depending on the operators' system.

share|improve this question
up vote 0 down vote accepted

You may consider connecting all operator sessions under one account and different resources. Ex. All with priority 1.

When an operator is in chat with user, send presence with priority -1. This removes the resource from a resource pool to contact when user sends message to ''. When operator finishes chatting with user - send presence with priority 1.

An added feature of this model is that you have only one Jabber ID to communiate to your users -

share|improve this answer
this isn't the solution i went with but it's worth a tick anyway. – SpliFF Aug 26 '09 at 5:57

I've found a workaround. Since the livechat system uses jsjac (javascript interface to xmpp) I can craft my own presence packets. When a client connects to an operator I set the clients' presence to 'chat' and status to 'talking to <operator jid>'.

When a new client connects I can query the status of all other clients to see who they are chatting to and choose the operator with the least active chats.

If anyone knows a better/easier way I'm happy to hear it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.