I'm pretty new to XMPP and ejabberd. I'd like to build a chat app using strophe.js as web interface and ejabberd as XMPP server.
The scenario I have is when user anonymously login, and sends out a presense, and there is a process (logic) to determine which one he can talk with.
How can I accomplish this? Should I write a BOT, and use this BOT as a dispatcher? So, user first talk with the BOT, and BOT does some logic and forward the chat to the right one. Then, user can chat with the chosen one to talk with.
Any idea?
Thanks in advance.
fei wrote: Should I write a
Should I write a BOT, and use this BOT as a dispatcher? So, user first talk with the BOT, and BOT does some logic and forward the chat to the right one. Then, user can chat with the chosen one to talk with.
Yes, this looks a good idea. Some proposals:
1. You can use mod_shared_roster to ensure anon users get the dispatcher as a contact. See example 3: http://www.ejabberd.im/shared-roster-all#example-3
2. Example: user1 talks to bot, bot decides that worker5 will handle the conversation, bot sends a special Message XMPP stanza to client, that contains this: <forward-to>worker5@example.org</forward-to>. You implement in your Strophe.js user client that when a stanza with forward-to is received, the client sends a new message to that worker JID.
badlop, Thanks for your
badlop,
Thanks for your reply, and I greatly appreciated.
badlop, I have a follow up
badlop,
I have a follow up question. If worker5 handles the conversation, then later transfers to worker6. How to enable worker6 to see all the history conversation between the client and worker5?
Thanks
Clients send the history, or use MUC
If worker5 handles the conversation, then later transfers to worker6. How to enable worker6 to see all the history conversation between the client and worker5?
ejabberd doesn't store history of private chats. Two ideas:
A) Your worker5 client, or the asking client, stores all the conversation and sends it to worker6.
B) Or, instead of private conversations, use MUC roomsin some way: ejabberd stores the last 20 messages of a room (you can configure that to 9999...), and sends that history to clients that join the room.