Hi,
OPENFIRE 4.1.1
Smack API 4.2.0
I’m trying to connecto to an Openfire Fastpath workgroup and chat with an agent from Java, i could reach an Agent and he will accept the conversation, then he answers me, but i dont’ receive any response so i cant’ chat with him,
This is my code,
SERVIDOR = “10.1.0.189”
// this is a listener that will answer the message received
org.jivesoftware.smack.chat2.ChatManager chatManager = org.jivesoftware.smack.chat2.ChatManager.getInstanceFor(connection);
chatManager.setXhmtlImEnabled(true);
chatManager.addIncomingListener(new IncomingChatMessageListener() {
public void newIncomingMessage(EntityBareJid from, Message message, org.jivesoftware.smack.chat2.Chat chat) {
System.out.println("New message from " + from + ": " + message.getBody());
System.out.println("Escriba mensaje de respuesta: ");
Scanner s = new Scanner(System.in);
String mensaje;
mensaje = s.nextLine();
try {
chat.send(mensaje + " , hora del mensaje: " + new Date());
} catch (NotConnectedException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
s.close();
}
}
});
EntityBareJid jidp = JidCreate.entityBareFrom("soporte@workgroup." + SERVIDOR );
presence = new Presence(Presence.Type.available);
jidp = JidCreate.entityBareFrom( “soporte@workgroup.” + SERVIDOR );
presence.setTo(jidp);
presence.setStatus(“Disponible”);
connection.sendStanza(presence);
String tecla = "soporte@workgroup." + SERVIDOR ;
EntityBareJid jid2 = JidCreate.entityBareFrom(tecla);
org.jivesoftware.smack.chat2.Chat chat2 = chatManager.chatWith(jid2);
chat2.send("join");
chat2.send("yes");
chat2.send("pedro");
chat2.send("pregunta desde java");
// At this point the Agent recevies a chat request, with user “pedro” and question “pregunta desde java”.
// then i would expect the agent write something and the chatlistener with receive the message, but it won’t happen.
Thanks in advance
Horacio