AnsweredAssumed Answered

Perl NET::XMPP : Can't send message to groupchat

Question asked by PtitPopey on Jul 4, 2017

Hello,

 

I have upgrade my server from openfire 3.10.3 to 4.1.5. Before upgrade no problem ton send message to groupchat but now I can't. I can only send to user.

See below the debug :

 

XML::Stream: new: hostname = (mypc)

XML::Stream: SetCallBacks: tag(node) func(CODE(0x22f6738))

XMPP::Conn: xmppCallbackInit: start

XMPP::Conn: SetCallBacks: tag(message) func(CODE(0x27b4518))

XMPP::Conn: SetCallBacks: tag(presence) func(CODE(0x27b4458))

XMPP::Conn: SetCallBacks: tag(iq) func(CODE(0x27b4338))

XMPP::Conn: SetPresenceCallBacks: type(subscribe) func(CODE(0x27b4440))

XMPP::Conn: SetPresenceCallBacks: type(subscribed) func(CODE(0x27b47b8))

XMPP::Conn: SetPresenceCallBacks: type(unsubscribe) func(CODE(0x27b46f8))

XMPP::Conn: SetPresenceCallBacks: type(unsubscribed) func(CODE(0x27b4878))

XMPP::Conn: SetDirectXPathCallBacks: xpath(/[@xmlns="urn:ietf:params:xml:ns:xmpp-tls"]) func(CODE(0x27b47a0))

XMPP::Conn: SetDirectXPathCallBacks: xpath(/[@xmlns="urn:ietf:params:xml:ns:xmpp-sasl"]) func(CODE(0x27b4980))

XMPP::Conn: xmppCallbackInit: stop

XMPP::Conn: Connect: host(imserver:5222) namespace(jabber:client)

XMPP::Conn: Connect: timeout(10)

XML::Stream: Connect: type(tcpip)

XML::Stream: Connect: Got a connection

XML::Stream: Send: (<?xml version='1.0'?><stream:stream version='1.0' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' to='imserver' from='mypc' xml:lang='en' >)

XML::Stream: Read: buff(<?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="imserver" id="75d2lhy3ar" xml:lang="en" version="1.0">)

XML::Stream: Read: buff(<stream:features><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism></mechanis ms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression></stream:features>)

XMPP::Conn: Connect: connection made

XML::Stream: SetCallBacks: tag(node) func(CODE(0x27b4dd0))

XMPP::Conn: AuthSASL: shiney new auth

XML::Stream: Send: (<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>cGFAaW0ubnVtbG9nLnByaXYAcGEAaWVhZTY3YWU=</auth>)

XMPP::Conn: AuthSASL: haven't authed yet... let's wait.

XMPP::Conn: Process: timeout(1)

XML::Stream: Read: buff(<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>)

XMPP::Conn: AuthSASL: We authed!

XML::Stream: Send: (<?xml version='1.0'?><stream:stream version='1.0' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' to='imserver' from='mypc' xml:lang='en' >)

XML::Stream: Read: buff(<?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="imserver" id="75d2lhy3ar" xml:lang="en" version="1.0"><stream:features><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/><session xmlns="urn:ietf:params:xml:ns:xmpp-session"><optional/></session><sm xmlns='urn:xmpp:sm:2'/><sm xmlns='urn:xmpp:sm:3'/></stream:features>)

XMPP::Conn: AuthSASL: We got a new session. sid(75d2lhy3ar)

XMPP::Conn: AuthSASL: Binding to resource

XMPP::Conn: SendAndReceiveWithID: object(Net::XMPP::IQ=HASH(0x288a468))

XMPP::Conn: SendWithID: id(netjabber-0)

XMPP::Conn: SendWithID: in(<iq type='set'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/></iq>)

XMPP::Conn: RegisterID: tag(iq) id(netjabber-0)

XMPP::Conn: SendWithID: out(<iq id='netjabber-0' type='set'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/></iq>)

XMPP::Conn: SendXML: sent(<iq id='netjabber-0' type='set'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/></iq>)

XML::Stream: Send: (<iq id='netjabber-0' type='set'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/></iq>)

XMPP::Conn: SendAndReceiveWithID: sent with id(netjabber-0)

XMPP::Conn: WaitForID: id(netjabber-0)

XMPP::Conn: Receivroom1D: id(netjabber-0)

XMPP::Conn: Receivroom1D: nope...

XMPP::Conn: WaitForID: haven't gotten it yet... let's wait for more packets

XMPP::Conn: Process: timeout(1)

XML::Stream: Read: buff(<iq type="result" id="netjabber-0" to="imserver/75d2lhy3ar"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><jid>pa@imserver/75d2lhy3ar</jid></bin d></iq>)

XMPP::Conn: CallBack: sid(75d2lhy3ar) received(<iq id='netjabber-0' to='imserver/75d2lhy3ar' type='result'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>pa@imserver/75d2lhy3ar</jid></bin d></iq>)

XMPP::Conn: CallBack: tag(iq)

XMPP::Conn: CallBack: id(netjabber-0)

XMPP::Conn: CallBack: we either want it or were waiting for it.

XMPP::Conn: CallBack: check directxpath

XMPP::Conn: CallBack: check directxpath(/[@xmlns="urn:ietf:params:xml:ns:xmpp-sasl"])

XMPP::Conn: CallBack: check directxpath(/[@xmlns="urn:ietf:params:xml:ns:xmpp-tls"])

XMPP::Conn: BuildObject: tag(iq) package(Net::XMPP::IQ)

XMPP::Conn: CheckID: tag(iq) id(netjabber-0)

XMPP::Conn: CheckID: we have that here somewhere...

XMPP::Conn: CallBack: found registry entry: tag(iq) id(netjabber-0)

XMPP::Conn: DeregisterID: tag(iq) id(netjabber-0)

XMPP::Conn: CallBack: they still want it... we still got it...

XMPP::Conn: GotID: id(netjabber-0) xml(<iq id='netjabber-0' to='imserver/75d2lhy3ar' type='result'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>pa@imserver/75d2lhy3ar</jid></bin d></iq>)

XMPP::Conn: Receivroom1D: id(netjabber-0)

XMPP::Conn: Receivroom1D: id(netjabber-0)

XMPP::Conn: WaitForID: we got it!

XMPP::Conn: GetID: id(netjabber-0)

XMPP::Conn: Receivroom1D: id(netjabber-0)

XMPP::Conn: CleanID: id(netjabber-0)

XMPP::Conn: AuthSASL: Starting session

XMPP::Conn: SendAndReceiveWithID: object(Net::XMPP::IQ=HASH(0x204b340))

XMPP::Conn: SendWithID: id(netjabber-1)

XMPP::Conn: SendWithID: in(<iq type='set'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq>)

XMPP::Conn: RegisterID: tag(iq) id(netjabber-1)

XMPP::Conn: SendWithID: out(<iq id='netjabber-1' type='set'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq>)

XMPP::Conn: SendXML: sent(<iq id='netjabber-1' type='set'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq>)

XML::Stream: Send: (<iq id='netjabber-1' type='set'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq>)

XMPP::Conn: SendAndReceiveWithID: sent with id(netjabber-1)

XMPP::Conn: WaitForID: id(netjabber-1)

XMPP::Conn: Receivroom1D: id(netjabber-1)

XMPP::Conn: Receivroom1D: nope...

XMPP::Conn: WaitForID: haven't gotten it yet... let's wait for more packets

XMPP::Conn: Process: timeout(1)

XML::Stream: Read: buff(<iq type="result" id="netjabber-1" to="pa@imserver/75d2lhy3ar"/>)

XMPP::Conn: CallBack: sid(75d2lhy3ar) received(<iq id='netjabber-1' to='pa@imserver/75d2lhy3ar' type='result'/>)

XMPP::Conn: CallBack: tag(iq)

XMPP::Conn: CallBack: id(netjabber-1)

XMPP::Conn: CallBack: we either want it or were waiting for it.

XMPP::Conn: CallBack: check directxpath

XMPP::Conn: CallBack: check directxpath(/[@xmlns="urn:ietf:params:xml:ns:xmpp-sasl"])

XMPP::Conn: CallBack: check directxpath(/[@xmlns="urn:ietf:params:xml:ns:xmpp-tls"])

XMPP::Conn: BuildObject: tag(iq) package(Net::XMPP::IQ)

XMPP::Conn: CheckID: tag(iq) id(netjabber-1)

XMPP::Conn: CheckID: we have that here somewhere...

XMPP::Conn: CallBack: found registry entry: tag(iq) id(netjabber-1)

XMPP::Conn: DeregisterID: tag(iq) id(netjabber-1)

XMPP::Conn: CallBack: they still want it... we still got it...

XMPP::Conn: GotID: id(netjabber-1) xml(<iq id='netjabber-1' to='pa@imserver/75d2lhy3ar' type='result'/>)

XMPP::Conn: Receivroom1D: id(netjabber-1)

XMPP::Conn: Receivroom1D: id(netjabber-1)

XMPP::Conn: WaitForID: we got it!

XMPP::Conn: GetID: id(netjabber-1)

XMPP::Conn: Receivroom1D: id(netjabber-1)

XMPP::Conn: CleanID: id(netjabber-1)

XMPP::Conn: SendXML: sent(<message from='user1@imserver' to='room1@conf.imserver' type='groupchat'><body>coucou</body><subject>Notification</subject></message>)

XML::Stream: Send: (<message from='user1@imserver' to='room1@conf.imserver' type='groupchat'><body>coucou</body><subject>Notification</subject></message>)

 

 

Pearl Script :

#!/usr/bin/perl -w

 

use strict;

use Net::XMPP;

use Data::Dumper;

use Encode 'decode';

 

## Configuration

my $username = "user";

my $password = "mdp";

## End of configuration

 

 

my $len = scalar @ARGV;

if ($len lt 2) {

   die "Usage...\n $0 [jabberid] [message] [groupchat]\n";

}

my @field=split(/,/,$ARGV[0]);

#------------------------------------

 

# Google Talk & Jabber parameters :

 

my $hostname = 'imserver';

my $port = 5222;

my $componentname = 'imserver';

my $connectiontype = 'tcpip';

my $tls = 0;

 

#------------------------------------

 

my $Connection = Net::XMPP::Client->new( debuglevel=>1,);

 

my $status = $Connection->Connect(

       hostname => $hostname, port => $port,

       componentname => $componentname,

       connectiontype => $connectiontype, tls => $tls);

 

if (!(defined($status))) {

   print "ERROR:  XMPP connection failed.\n";

   print "        ($!)\n";

   exit(0);

}

 

# Authenticate

my @result = $Connection->AuthSend(

       username => $username,

       password => $password);

 

if ($result[0] ne "ok") {

   print "ERROR: Authorization failed: $result[0] - $result[1]\n";

   exit(0);

}

 

if ($len lt 3 || $ARGV[2] ne "groupchat") {

    # Send messages

    foreach ( @field ) {

    $Connection->MessageSend(

        to       => "$_\@$componentname",

        resource => $resource,

        subject  => "Notification",

        type     => "chat",

        body     => decode('UTF-8',$ARGV[1]));

    }

} else {

    # Send messages groupchat

    foreach ( @field ) {

    my @result = $Connection->MessageSend(

        from  => "user\@$componentname",

        to       => "$_\@conf.$componentname",

        resource => $resource,

        subject  => "Notification",

        type     => "groupchat",

        body     => decode('UTF-8',$ARGV[1]));

    }

}

print Dumper \@result;

 

Can you help me ?

Outcomes