1

I have a ios xmpp client and I would like to be able to get images which is sent from iMessage(ichat). I am implementing XEP-0137 to be able to get file from iChat.

When User1 send an image using iMessage to user2 which is logged in with my xmpp client, it gets (I have nothing to do with this part and I have absolutely no control over it since it it created by Apple standard chat app, I am simply trying to handle this message):

<message xmlns="jabber:client" from="user1@ejabberd.com/Sakj2019MacBookPro" to="user2@ejabberd.com"
type="chat" id="E399E1FF-8D8D-4220-83DD-B8615E6DF277">
    <x xmlns="http://www.apple.com/xmpp/message-attachments">
        <attachment id="1">
            <sipub xmlns="http://jabber.org/protocol/sipub" from="user1@ejabberd.com/Sakj2019MacBookPro"
            id="sipubid_7D0EF6A6" mime-type="binary/octet-stream" profile="http://jabber.org/protocol/si/profile/file-transfer">
                <file xmlns="http://jabber.org/protocol/si/profile/file-transfer" xmlns:ichat="apple:profile:transfer-extensions"
                name="small.png" size="1182" ichat:posixflags="000001A4" />
            </sipub>
        </attachment>
    </x>
    <body/>
    <html xmlns="http://jabber.org/protocol/xhtml-im">

    <body xmlns="http://www.w3.org/1999/xhtml"><img alt="small.png" src="message-attachments:1" width="144" height="144" />
    </body>

    </html>
    <x xmlns="jabber:x:event">
        <composing/>
    </x>
    <active xmlns="http://jabber.org/protocol/chatstates" />
</message>

After I get this message I process it and send an IQ to sender(user1) based on http://xmpp.org/extensions/xep-0137.html:

  <iq type='get'
      id='sipub-request-0'
      from='user2@ejabberd.com/sdafz23123sdf'
      to='user1@ejabberd.com/Sakj2019MacBookPro'>
    <start xmlns='http://jabber.org/protocol/sipub'
           id='sipubid_7D0EF6A6'/>
  </iq>

But I get this error: Sender denies because receiver is forbidden

  <iq type='error'
      id='sipub-set-1'
      from='user1@ejabberd.com/Sakj2019MacBookPro'
      to='user2@ejabberd.com/sdafz23123sdf'>
    <start xmlns='http://jabber.org/protocol/sipub'>sipubid_7D0EF6A6</start>
    <error code='403' type='auth'>
      <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
    </error>
  </iq>

I have tried different things but still no luck!

this is part of my ejabberd server log that shows I am getting the image:

2017-02-03 14:22:30.648 [debug] <0.23733.0>@ejabberd_receiver:process_data:284 Received XML on stream = <<"\r\n">>
2017-02-03 14:22:30.648 [debug] <0.23733.0>@shaper:update:120 State: {maxrate,1000,32.728263634574134,1486149717476774}, Size=2
M=1.0166363715950295, I=33171.384
2017-02-03 14:22:34.140 [debug] <0.23733.0>@ejabberd_receiver:process_data:284 Received XML on stream = <<60,109,101,115,115,97,103,101,32,116,111,61,34,98,101,115,97,116,45,108,100,110,64,101,106,97,98,98,101,114,100,45,100,101,118,46,109,111,114,103,105,105,106,46,99,111,109,34,32,116,121,112,101,61,34,99,104,97,116,34,32,105,100,61,34,69,51,57,57,69,49,70,70,45,56,68,56,68,45,52,50,50,48,45,56,51,68,68,45,66,56,54,49,53,69,54,68,70,50,55,55,34,62,60,120,32,120,109,108,110,115,61,34,104,116,116,112,58,47,47,119,119,119,46,97,112,112,108,101,46,99,111,109,47,120,109,112,112,47,109,101,115,115,97,103,101,45,97,116,116,97,99,104,109,101,110,116,115,34,62,60,97,116,116,97,99,104,109,101,110,116,32,105,100,61,34,49,34,62,60,115,105,112,117,98,32,120,109,108,110,115,61,34,104,116,116,112,58,47,47,106,97,98,98,101,114,46,111,114,103,47,112,114,111,116,111,99,111,108,47,115,105,112,117,98,34,32,102,114,111,109,61,34,116,109,103,97,100,109,105,110,64,101,106,97,98,98,101,114,100,45,100,101,118,46,109,111,114,103,105,105,106,46,99,111,109,47,66,101,115,97,116,226,128,153,115,32,77,97,99,66,111,111,107,32,80,114,111,34,32,105,100,61,34,115,105,112,117,98,105,100,95,55,68,48,69,70,54,65,54,34,32,109,105,109,101,45,116,121,112,101,61,34,98,105,110,97,114,121,47,111,99,116,101,116,45,115,116,114,101,97,109,34,32,112,114,111,102,105,108,101,61,34,104,116,116,112,58,47,47,106,97,98,98,101,114,46,111,114,103,47,112,114,111,116,111,99,111,108,47,115,105,47,112,114,111,102,105,108,101,47,102,105,108,101,45,116,114,97,110,115,102,101,114,34,62,60,102,105,108,101,32,120,109,108,110,115,61,34,104,116,116,112,58,47,47,106,97,98,98,101,114,46,111,114,103,47,112,114,111,116,111,99,111,108,47,115,105,47,112,114,111,102,105,108,101,47,102,105,108,101,45,116,114,97,110,115,102,101,114,34,32,120,109,108,110,115,58,105,99,104,97,116,61,34,97,112,112,108,101,58,112,114,111,102,105,108,101,58,116,114,97,110,115,102,101,114,45,101,120,116,101,110,115,105,111,110,115,34,32,110,97,109,101,61,34,115,109,97,108,108,46,112,110,103,34,32,115,105,122,101,61,34,49,49,56,50,34,32,105,99,104,97,116,58,112,111,115,105,120,102,108,97,103,115,61,34,48,48,48,48,48,49,65,52,34,47,62,60,47,115,105,112,117,98,62,10,60,47,97,116,116,97,99,104,109,101,110,116,62,10,60,47,120,62,10,60,98,111,100,121,62,60,47,98,111,100,121,62,10,60,104,116,109,108,32,120,109,108,110,115,61,34,104,116,116,112,58,47,47,106,97,98,98,101,114,46,111,114,103,47,112,114,111,116,111,99,111,108,47,120,104,116,109,108,45,105,109,34,62,60,98,111,100,121,32,120,109,108,110,115,61,34,104,116,116,112,58,47,47,119,119,119,46,119,51,46,111,114,103,47,49,57,57,57,47,120,104,116,109,108,34,32,62,60,105,109,103,32,97,108,116,61,34,115,109,97,108,108,46,112,110,103,34,32,115,114,99,61,34,109,101,115,115,97,103,101,45,97,116,116,97,99,104,109,101,110,116,115,58,49,34,32,119,105,100,116,104,61,34,49,52,52,34,32,104,101,105,103,104,116,61,34,49,52,52,34,32,47,62,60,47,98,111,100,121,62,60,47,104,116,109,108,62,60,120,32,120,109,108,110,115,61,34,106,97,98,98,101,114,58,120,58,101,118,101,110,116,34,62,60,99,111,109,112,111,115,105,110,103,47,62,60,47,120,62,10,60,97,99,116,105,118,101,32,120,109,108,110,115,61,34,104,116,116,112,58,47,47,106,97,98,98,101,114,46,111,114,103,47,112,114,111,116,111,99,111,108,47,99,104,97,116,115,116,97,116,101,115,34,47,62,60,47,109,101,115,115,97,103,101,62,10>>
2017-02-03 14:22:34.141 [debug] <0.23733.0>@shaper:update:120 State: {maxrate,1000,16.394278152421222,1486149750648302}, Size=913
M=460.2729211476611, I=3492.751

This is all the features I get for user1:

  <query xmlns="http://jabber.org/protocol/disco#info">
    <identity category="pubsub" type="pep"/>
    <identity category="server" type="im" name="ejabberd"/>
    <x xmlns="jabber:x:data" type="result">
      <field var="FORM_TYPE" type="hidden">
        <value>http://jabber.org/network/serverinfo</value>
      </field>
    </x>
    <feature var="http://jabber.org/protocol/commands"/>
    <feature var="http://jabber.org/protocol/disco#info"/>
    <feature var="http://jabber.org/protocol/disco#items"/>
    <feature var="http://jabber.org/protocol/offline"/>
    <feature var="http://jabber.org/protocol/pubsub"/>
    <feature var="http://jabber.org/protocol/pubsub#access-authorize"/>
    <feature var="http://jabber.org/protocol/pubsub#access-open"/>
    <feature var="http://jabber.org/protocol/pubsub#access-presence"/>
    <feature var="http://jabber.org/protocol/pubsub#access-whitelist"/>
    <feature var="http://jabber.org/protocol/pubsub#auto-create"/>
    <feature var="http://jabber.org/protocol/pubsub#auto-subscribe"/>
    <feature var="http://jabber.org/protocol/pubsub#collections"/>
    <feature var="http://jabber.org/protocol/pubsub#config-node"/>
    <feature var="http://jabber.org/protocol/pubsub#create-and-configure"/>
    <feature var="http://jabber.org/protocol/pubsub#create-nodes"/>
    <feature var="http://jabber.org/protocol/pubsub#delete-items"/>
    <feature var="http://jabber.org/protocol/pubsub#delete-nodes"/>
    <feature var="http://jabber.org/protocol/pubsub#filtered-notifications"/>
    <feature var="http://jabber.org/protocol/pubsub#get-pending"/>
    <feature var="http://jabber.org/protocol/pubsub#instant-nodes"/>
    <feature var="http://jabber.org/protocol/pubsub#item-ids"/>
    <feature var="http://jabber.org/protocol/pubsub#last-published"/>
    <feature var="http://jabber.org/protocol/pubsub#manage-subscriptions"/>
    <feature var="http://jabber.org/protocol/pubsub#member-affiliation"/>
    <feature var="http://jabber.org/protocol/pubsub#modify-affiliations"/>
    <feature var="http://jabber.org/protocol/pubsub#outcast-affiliation"/>
    <feature var="http://jabber.org/protocol/pubsub#persistent-items"/>
    <feature var="http://jabber.org/protocol/pubsub#presence-notifications"/>
    <feature var="http://jabber.org/protocol/pubsub#presence-subscribe"/>
    <feature var="http://jabber.org/protocol/pubsub#publish"/>
    <feature var="http://jabber.org/protocol/pubsub#publish-only-affiliation"/>
    <feature var="http://jabber.org/protocol/pubsub#publisher-affiliation"/>
    <feature var="http://jabber.org/protocol/pubsub#purge-nodes"/>
    <feature var="http://jabber.org/protocol/pubsub#retract-items"/>
    <feature var="http://jabber.org/protocol/pubsub#retrieve-affiliations"/>
    <feature var="http://jabber.org/protocol/pubsub#retrieve-default"/>
    <feature var="http://jabber.org/protocol/pubsub#retrieve-items"/>
    <feature var="http://jabber.org/protocol/pubsub#retrieve-subscriptions"/>
    <feature var="http://jabber.org/protocol/pubsub#shim"/>
    <feature var="http://jabber.org/protocol/pubsub#subscribe"/>
    <feature var="http://jabber.org/protocol/pubsub#subscription-notifications"/>
    <feature var="https://apple.com/push"/>
    <feature var="iq"/>
    <feature var="jabber:iq:last"/>
    <feature var="jabber:iq:privacy"/>
    <feature var="jabber:iq:register"/>
    <feature var="jabber:iq:version"/>
    <feature var="msgoffline"/>
    <feature var="presence"/>
    <feature var="urn:xmpp:blocking"/>
    <feature var="urn:xmpp:carbons:1"/>
    <feature var="urn:xmpp:carbons:2"/>
    <feature var="urn:xmpp:mam:0"/>
    <feature var="urn:xmpp:mam:1"/>
    <feature var="urn:xmpp:mam:tmp"/>
    <feature var="urn:xmpp:ping"/>
    <feature var="vcard-temp"/>
  </query>

I think these features are missing:

<feature var="http://jabber.org/protocol/bytestreams">
<feature var="http://jabber.org/protocol/si/profile/file-transfer">
<feature var="http://jabber.org/protocol/sipub">

Any Idea how can I enable them in ejabberd?

Besat
  • 1,428
  • 13
  • 27
  • basically what am saying is that the receiver does not have permission to request the data stream, therefore sender would respond with a forbidden error. Its a permission issue from the receiver side – OlaB Feb 07 '17 at 14:29
  • Thanks but my question is how can I give them permission? I have changed acl to all for any related module but still not working. I think that there is a whole new feature I should add to my server? – Besat Feb 07 '17 at 14:31
  • I helped research and I don't know if you've had this done, but the only plausible solution I found to your error code while retrieving is to Append your server domain name to the back of each user IDs, like so: Bexxx@openfire. Good luck with your project! – OlaB Feb 07 '17 at 15:02
  • Thanks for your time.. Thant's not the case for me – Besat Feb 07 '17 at 15:05
  • no worries.. am sure you're just missing something very minute. http://stackoverflow.com/questions/24695222/xmppframework-error-405-not-allowed-in-file-transfer?rq=1 , that convo might give leads as well. – OlaB Feb 07 '17 at 15:06
  • your very first line, your to="user2@ejabberd.com" has no appended resource, in contrast to other locations you have 'user2@ejabberd.com/sdafz23123sdf' .... double check – OlaB Feb 07 '17 at 15:13
  • This is the message I get from iMessage. I have nothing to do with it. I am trying to crack their custom protocol and find a way to get the file that they are sending. So the situation is: user1 tries to send an image to user2 from iMessage, user2 which is logged in my xmpp client app gets a message from user1 (exactly like what I posted), Then I need to handle this message to get the file in my xmpp client – Besat Feb 07 '17 at 15:23
  • I understand you, all I made known to you that user1 sending the image from is not sending it to the correct resource of user2 from your first line, so its either your send line should be adjusted in user1 to incorporate the full JID of user two 'user2@ejabberd.com/sdafz23123sdf' or user two should log in with its full JID 'user2@ejabberd.com/sdafz23123sdf' . The problem with the not auth 403, is that you are not sending to the appropriate user2 JID. – OlaB Feb 07 '17 at 16:08
  • ...........You see where the message is being sent to now? not the Full JID you are getting from the stack trace which is 'user2@ejabberd.com/sdafz23123sdf' – OlaB Feb 07 '17 at 16:15
  • to="user2@ejabberd.com" is different from "user2@ejabberd.com/sdafz23123sdf", because of the (/resource) you would always get the error even on normal messages if you dont have a valid resource. So the plausible solution would be for user 1 to send the image to the full JID of user 2 as such "user2@ejabberd.com/sdafz23123sdf" or user 2 should create a login resource as such "user2@ejabberd.com/Besat" then after user 2 logs in user1 can send to "user2@ejabberd.com/Besat", Besat would be your resource. – OlaB Feb 07 '17 at 16:24
  • It seems that I have not been clear. User2 sends a msg to User1. There is no need to specify the resource here (server finds the resource for user2 which is online and send it to that) and ALSO there is no way for me to change that, since I don't have access to imessage code. First part of the code which is a message sent from User1 to User2, I have no control over it, I just receive it as is from Apple standard chat app and should handle it. And I am absolutely sure that the resource in that part doesn't matter since I have no issue with other apps such as Adium. – Besat Feb 07 '17 at 16:34
  • The problem should be the features. It seems my user (user2) does not have some essential features, and I don't know how to add them – Besat Feb 07 '17 at 16:37
  • Also you can see the example for XMPP document that shows that sender (user1) send message to receiver (user2) and doesn't specify the resource: http://xmpp.org/extensions/xep-0137.html Example 4. Advertising a stream in a message stanza – Besat Feb 07 '17 at 16:39
  • I see what you mean... – OlaB Feb 07 '17 at 17:55

0 Answers0