Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

2 Answers 2

up vote 0 down vote accepted

You may consider connecting all operator sessions under one account and different resources. Ex. help@example.com/Operator1 help@example.com/Operator2 help@example.com/Operator3 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 'help@example.com'. 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 - help@example.com

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
add comment

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
add comment

Your Answer

 
discard

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.