ejabberd can not set nickname when add roster sometimes - xmpp

I am using iOS xmppframework and ejabberd as the xmpp server.When I add rosters with nickname, sometimes I can set the nick, sometimes I can not set nick. The packets I sent to the server are:
2015-07-03 10:19:24:144 pigai[36644:3a0b] The nick is songxiao
2015-07-03 10:19:24:144 pigai[36644:3a0b] SEND: <iq type="set" xmlns="jabber:client" id="roster-remotely-managed"><query xmlns="jabber:iq:roster"><item jid="xh1#192.168.1.67" name="songxiao"/></query></iq>
2015-07-03 10:19:24:144 pigai[36644:800b] SEND: <presence type="subscribe" to="xh1#192.168.1.67"><x xmlns="vcard-temp:x:update"><photo>c769b958f910fb6bfde4e8131385cc5ad2d95e0b</photo></x></presence>
2015-07-03 10:19:24:576 pigai[36644:3a0b] RECV: <iq xmlns="jabber:client" from="test3#192.168.1.67" to="test3#192.168.1.67/iPhone" id="push2270407375" type="set"><query xmlns="jabber:iq:roster" ver="6e3b72a923e4574fac87e8e89f08eee251cf73c8"><item subscription="none" name="songxiao" jid="xh1#192.168.1.67"/></query></iq>
2015-07-03 10:19:24:576 pigai[36644:3a0b] RECV: <r xmlns="urn:xmpp:sm:3"/>
2015-07-03 10:19:24:576 pigai[36644:3a0b] RECV: <iq xmlns="jabber:client" from="test3#192.168.1.67" to="test3#192.168.1.67/iPhone" id="roster-remotely-managed" type="result"/>
2015-07-03 10:19:24:577 pigai[36644:3a0b] RECV: <r xmlns="urn:xmpp:sm:3"/>
2015-07-03 10:19:24:577 pigai[36644:3a0b] RECV: <iq xmlns="jabber:client" from="test3#192.168.1.67" to="test3#192.168.1.67/iPhone" id="push2639732641" type="set"><query xmlns="jabber:iq:roster" ver="b16ad5f42baf7c0fe11925ed879ac7ecb0bcfb85"><item ask="subscribe" subscription="none" jid="xh1#192.168.1.67"/></query></iq>
2015-07-03 10:19:26:602 pigai[36644:433] RECV: <r xmlns="urn:xmpp:sm:3"/>
2015-07-03 10:19:26:602 pigai[36644:433] SEND: <a xmlns="urn:xmpp:sm:3" h="15"/>
2015-07-03 10:19:26:808 pigai[36644:4b17] SEND: <a xmlns="urn:xmpp:sm:3" h="15"/>
The nick was not set. From the client side, the nick is null. From the server side, the nick is not stored in the database.

Here is a sequence that should work fine:
Send the presence subscribe.
Wait for reply.
Set the name on roster item.
We will have a look to see if we can improve to handle this case better as well.

Related

XEP-0430 Inbox query is not working in openfire

I am using openfire 4.6.0 using which I am querying for Inbox( XEP-0430: Inbox) messages but I am getting the following error. Whether the feature XEP-0430 is available in openfire?
IQ Query:
<iq id="7025d773-fb53-4afa-89de-3be4d7167277" type="get" xmlns="jabber:client">
<inbox xmlns="urn:xmpp:inbox:1"/>
</iq>
Response:
<inbox xmlns="urn:xmpp:inbox:1"/>
<error xmlns="jabber:client" code="503" type="cancel">
<service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
The list of supported protocol extensions of Openfire is published at https://download.igniterealtime.org/openfire/docs/latest/documentation/protocol-support.html. The extension that you are looking for, XEP-0430 'Inbox', is not listed there.

Openfire server pep based avatars , Android client

I have setup openfire server and my android clients works well with it except that I am unable to publish avatars , the problem is that the server simply ignores the publish avatar iq packet , no errors , nothing in the log files. I am using standard XMPP pep avatar stanza , please hep
Thankyou for your replies everyone, I found that the issue is with openfire server 3.10 which does not parse the standard XEP 0084 stanza well, infact I found the logs and server was crashing so i modified the IQ as , for example this should be the standard IQ for publishing avatar
<iq type='set' from='juliet#capulet.lit/chamber' id='publish1'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<publish node='urn:xmpp:avatar:data'>
<item id='111f4b3c50d7b0df729d299bc6f8e9ef9066971f'>
<data xmlns='urn:xmpp:avatar:data'>
qANQR1DBwU4DX7jmYZnncm...
</data>
</item>
</publish>
</pubsub>
</iq>
but as you can see there is no "to" address in the standard IQ , openfire server would create the pubsub node in DB and crash and would not reply with result asking the user to now publish metadata ,so what i had to do is send this packet and then the standard metadata packet , but then send meta data packet again with a "to" address which would be replied by the server as result that the metadata notification succeded as
standard meta data to be sent to server for the first time ,
<iq type='set' from='juliet#capulet.lit/chamber' id='publish2'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<publish node='urn:xmpp:avatar:metadata'>
<item id='111f4b3c50d7b0df729d299bc6f8e9ef9066971f'>
<metadata xmlns='urn:xmpp:avatar:metadata'>
<info bytes='12345'
id='111f4b3c50d7b0df729d299bc6f8e9ef9066971f'
height='64'
type='image/png'
width='64'/>
</metadata>
</item>
</publish>
</pubsub>
</iq>
and then again like this with addition of "to" address
<iq type='set' from='juliet#capulet.lit/chamber' to="mydomain.com" id='publish2'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<publish node='urn:xmpp:avatar:metadata'>
<item id='111f4b3c50d7b0df729d299bc6f8e9ef9066971f'>
<metadata xmlns='urn:xmpp:avatar:metadata'>
<info bytes='12345'
id='111f4b3c50d7b0df729d299bc6f8e9ef9066971f'
height='64'
type='image/png'
width='64'/>
</metadata>
</item>
</publish>
</pubsub>
</iq>
in the above way avatar publishing is working and Im successfully issuing a notification to other users also
and here is the server crash log incase
2016.03.02 10:41:02 ERROR [socket_c2s-thread-3]: org.jivesoftware.openfire.handler.IQHandler - Internal server error
java.lang.NullPointerException
at org.jivesoftware.openfire.pubsub.PubSubEngine.createNodeHelper(PubSubEngine.java:1165)
at org.jivesoftware.openfire.pubsub.PubSubEngine.publishItemsToNode(PubSubEngine.java:340)
at org.jivesoftware.openfire.pubsub.PubSubEngine.process(PubSubEngine.java:98)
at org.jivesoftware.openfire.pep.PEPServiceManager.process(PEPServiceManager.java:215)
at org.jivesoftware.openfire.pep.IQPEPHandler.handleIQ(IQPEPHandler.java:423)
at org.jivesoftware.openfire.handler.IQHandler.process(IQHandler.java:66)
at org.jivesoftware.openfire.IQRouter.handle(IQRouter.java:372)
at org.jivesoftware.openfire.IQRouter.route(IQRouter.java:115)
at org.jivesoftware.openfire.spi.PacketRouterImpl.route(PacketRouterImpl.java:78)
at org.jivesoftware.openfire.net.StanzaHandler.processIQ(StanzaHandler.java:342)
at org.jivesoftware.openfire.net.ClientStanzaHandler.processIQ(ClientStanzaHandler.java:99)
at org.jivesoftware.openfire.net.StanzaHandler.process(StanzaHandler.java:307)
at org.jivesoftware.openfire.net.StanzaHandler.process(StanzaHandler.java:199)
at org.jivesoftware.openfire.nio.ConnectionHandler.messageReceived(ConnectionHandler.java:181)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:690)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:417)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:47)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:765)
at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:109)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:417)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:47)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:765)
at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:407)
at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:236)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:417)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:47)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:765)
at org.apache.mina.core.filterchain.IoFilterEvent.fire(IoFilterEvent.java:74)
at org.apache.mina.core.session.IoEvent.run(IoEvent.java:63)
at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.runTask(OrderedThreadPoolExecutor.java:769)
at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.runTasks(OrderedThreadPoolExecutor.java:761)
at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.run(OrderedThreadPoolExecutor.java:703)
at java.lang.Thread.run(Unknown Source)

PubSub module returning error

I'm working on getting Jappix running. I'm using ejabberd as my XMPP server and I've got everything working except comments and viewing attachments - group chat, single chat, external authentication, private messages, friend lists, presence and other works as intended.
My configuration is the same as the one the Jappix project provides on their jappix/jappix-tools github repository. I have no errors in my ejabberd log, the only thing I got while debugging and digging everything up is that this is an example stanza sent to the server:
<iq xmlns="jabber:client" type="get" id="get_31-30" to="pubsub.mydomain.com" xml:lang="en">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<items node="urn:xmpp:microblog:0:comments/3aca5f972fe7198805bdd1a20f502f35"/>
</pubsub>
</iq>
And this is the response I get from the server:
<iq xmlns="jabber:client" from="pubsub.mydomain.com" to="arqu#mydomain.com/jappix (1378149270017)" type="error" id="get_31-30" xml:lang="en" xmlns:xml="http://www.w3.org/XML/1998/namespace">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<items node="urn:xmpp:microblog:0:comments/3aca5f972fe7198805bdd1a20f502f35"/>
</pubsub>
<error code="503" type="cancel">
<service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>
And in Jappix I just get the usual "Service Unavailable" error message.
Additional info:
My BOSH is the internal one of ejabberd and works fine as far as i know, I've setup the reverse proxy and everything else to make it work. Still could be something related to this and not reaching the service on some other port maybe?
It looks like you do not have pubsub enabled/installed on your server.
Have you tried any other pubsub request?

Enabling mod_proxy65 on ejabberd server installed on ec2 ubuntu instance

I am working on a iOS chat application, so for media transfer to work i need to enable mod_proxy65, and i have enabled the same in ejabberd.cfg file with their default setting: {mod_proxy65[]}. on client side i am using the https://github.com/robbiehanson/XMPPFramework xmpp framework for iOS.
in TURNSocket.m i have used proxy candidate as dev.myserver.com in place of default jabber.org . now when I try to open the TURN connection, the series of iq received and sent are as follows:
SEND: <iq type="get" to="dev.myserver.com" id="A9876DD0-B13C-4DC7-B812-2A6E653288BC"><query xmlns="http://jabber.org/protocol/disco#items"/></iq>
RECV: <iq xmlns="jabber:client" from="dev.gungroo.com" to="smita#dev.myserver.com/24983171131368877324197828" id="A9876DD0-B13C-4DC7-B812-2A6E653288BC" type="result"><query xmlns="http://jabber.org/protocol/disco#items"><item jid="conference.dev.myserver.com"/><item jid="irc.dev.myserver.com"/><item jid="proxy.dev.myserver.com"/><item jid="pubsub.dev.myserver.com"/><item jid="vjud.dev.myserver.com"/></query></iq>
SEND: <iq type="get" to="proxy.dev.myserver.com" id="26D694FB-C679-478C-A3D1-A84B9A583534"><query xmlns="http://jabber.org/protocol/disco#info"/></iq>
RECV: <iq xmlns="jabber:client" from="proxy.dev.myserver.com" to="smita#dev.myserver.com/24983171131368877324197828" id="26D694FB-C679-478C-A3D1-A84B9A583534" type="result"><query xmlns="http://jabber.org/protocol/disco#info"><identity category="proxy" type="bytestreams" name="SOCKS5 Bytestreams"/><feature var="http://jabber.org/protocol/disco#info"/><feature var="vcard-temp"/><feature var="http://jabber.org/protocol/bytestreams"/><x xmlns="jabber:x:data" type="result"><field var="FORM_TYPE" type="hidden"><value>http://jabber.org/network/serverinfo</value></field></x></query></iq>
SEND: <iq type="get" to="proxy.dev.myserver.com" id="C60068A2-985C-4C5C-87B3-C9FFFB41FDF0"><query xmlns="http://jabber.org/protocol/bytestreams"/></iq>
RECV: <iq xmlns="jabber:client" from="proxy.dev.gungroo.com" to="smita#dev.myserver.com/24983171131368877324197828" id="C60068A2-985C-4C5C-87B3-C9FFFB41FDF0" type="result"><query xmlns="http://jabber.org/protocol/bytestreams"><streamhost jid="proxy.dev.myserver.com" host="10.212.103.159" port="7777"/></query></iq>
here is the problem, its returning me the internal ip address(10.212.103.159) of server dev.myserver.com, resulting in failure of making the TURN connection. why doesn't it return external ip address of proxy.dev.myserver.com ?
to be on the same page: proxy.dev.myserver.com and dev.myserver.com both points to same external ip. and the port 7777 is open at my server dev.myserver.com . anybody who have worked with the same, please help??
here is the last iq(sent and received) which shows the error message:
SEND
<iq type="set" to="smita1#dev.myserver.com/38303823331368691199448799" id="2D376DBF-D437-48C8-B0FF-B10A5CD73240">
<query xmlns="http://jabber.org/protocol/bytestreams" sid="2D376DBF-D437-48C8-B0FF-B10A5CD73240" mode="tcp">
<streamhost xmlns="http://jabber.org/protocol/bytestreams" jid="proxy.dev.myserver.com" host="10.212.103.159" port="7777"/>
</query>
</iq>
RECV
<iq xmlns="jabber:client" from="smita1#dev.myserver.com/38303823331368691199448799" to="smita#dev.myserver.com/278621573136869119737843" type="error" id="2D376DBF-D437-48C8-B0FF-B10A5CD73240">
<query xmlns="http://jabber.org/protocol/bytestreams" sid="2D376DBF-D437-48C8-B0FF-B10A5CD73240" mode="tcp">
<streamhost xmlns="http://jabber.org/protocol/bytestreams" jid="proxy.dev.myserver.com" host="10.212.103.159" port="7777"/>
</query>
<error type="cancel" code="501">
<feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>
it would be really great if someone can point me to the problem. Thanks!
This helped me to resolve the issue. xx.xx.xx.xx is my external ip:
{mod_proxy65, [{hostname, ["xx.xx.xx.xx"]}]},
Visit this ,I can give an idea [XMPPFramework - TURNSocket can't receive the data that sent by myself? ]
Also [http://xmpp.org/extensions/xep-0096.html],[ XMPP Sending/Receving file in iphone sdk ...? ]

XMPP Component indicating presence

I have an XEP-0114 based XMPP component that works fine with the Openfire server. Ejabberd however complains about it.
First thing it does (after having authenticated) is to indicate presence. It does so by sending this:
<presence from="tictactoe.komogvind.dk"/>
I get this reply
<presence type="error" to="tictactoe.komogvind.dk" xmlns:stream="http://etherx.jabber.org/streams">
<error code="400" type="modify">
<bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</presence>
What am I missing?