Problem : I am attempting a TURN Connection (XEP-0065) using the iOS XMPPFramework and an OpenFire Server. I want to be able to send and receive files. However, I am receiving a 503 service-unavailable error.
Note : The base of my code is from the following tutorial : http://mobile.tutsplus.com/tutorials/iphone/building-a-jabber-client-for-ios-server-setup/
XML Error :
I've debugged through TURNSocket.m. It goes into processRequestResponse and has the following XML. (If I am not mistaken, this has been sent from OpenFire to me, rather than vice versa?) ...
<iq xmlns="jabber:client"
type="error"
id="03CC977E-2645-4E87-AE78-536D985CA2B5"
from="[email protected]"
to="[email protected]/12f10b69">
<query xmlns="http://jabber.org/protocol/bytestreams"
sid="03CC977E-2645-4E87-AE78-536D985CA2B5"
mode="tcp">
<streamhost jid="proxy.beta.myCompany.co.uk"
host="127.0.1.1"
port="7777"/>
</query>
<error code="503"
type="cancel">
<service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>
Why is there an error?
Update : XEP-0065 says the following. Even though this error looks a little different to mine, is it relevant? If so, what is the problem?
If the Proxy is unable to act as a StreamHost, the Proxy MUST return an error to the Requester, which SHOULD be
<not-allowed/>
.<iq from='[email protected]/foo' id='uj2c15z9' to='streamer.example.com' type='error'> <error type='cancel'> <not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq>
Update : At the moment I'm looking into whether the inclusion or exclusion of a JID resource in the various sent and retrieved bits of XML is the problem. Or alternatively, I don't even have a 'from' in the following xml. the docs imply i need this. Is this the issue? I dont see a current way in the code to make a 'from' ...
<iq type="get"
to="beta.myCompany.co.uk"
id="215784CF-81A8-403E-89BF-455C926BEAE5">
<query xmlns="http://jabber.org/protocol/disco#items"/>
</iq>
Update 19/04/12 11:00 am : In response to Matt J's response, I am posting more XML. I'm not sure Matt requested the full XML log of what is sent and retrieved, but just in case, here it is. Note that these logs are not all from the same run-through (because when I debug it to get the XML logs, it causes timeouts so I have to start again)
Sent :
<iq type="get" to="beta.myCompany.co.uk"
id="082A1987-384F-43CD-9E7B-A2C0E31F2CA8">
<query xmlns="http://jabber.org/protocol/disco#items"/>
</iq>
Response :
<iq xmlns="jabber:client"
type="result"
id="18EED477-B0E4-492D-89CF-CA692FCF13AD"
from="beta.myCompany.co.uk"
to="[email protected]/72d23cd0">
<query xmlns="http://jabber.org/protocol/disco#items">
<item jid="pubsub.beta.myCompany.co.uk"
name="Publish-Subscribe service"/>
<item jid="broadcast.beta.myCompany.co.uk"
name="Broadcast service"/>
<item jid="search.beta.myCompany.co.uk"
name="User Search"/>
<item jid="conference.beta.myCompany.co.uk"
name="Public Chatrooms"/>
<item jid="proxy.beta.myCompany.co.uk"
name="Socks 5 Bytestreams Proxy"/>
</query>
</iq>
Sent :
<iq type="get"
to="proxy.beta.myCompany.co.uk"
id="F1B5370C-234F-4F2D-93E7-D60D2C35D063">
<query xmlns="http://jabber.org/protocol/disco#info"/>
</iq>
Response :
<iq xmlns="jabber:client"
type="result"
id="F1B5370C-234F-4F2D-93E7-D60D2C35D063"
from="proxy.beta.myCompany.co.uk"
to="[email protected]/32276f6">
<query xmlns="http://jabber.org/protocol/disco#info">
<identity category="proxy"
name="SOCKS5 Bytestreams Service"
type="bytestreams"/>
<feature var="http://jabber.org/protocol/bytestreams"/>
<feature var="http://jabber.org/protocol/disco#info"/>
</query>
</iq>
Sent :
<iq type="get"
to="proxy.beta.myCompany.co.uk"
id="84904B7D-2BB2-4B8E-90BE-BE0F5A934764">
<query xmlns="http://jabber.org/protocol/bytestreams"/>
</iq>
Response :
<iq xmlns="jabber:client"
type="result"
id="B412512B-FA27-4531-88BE-2FC0A26E6ED2"
from="proxy.beta.myCompany.co.uk"
to="[email protected]/45ca808d">
<query xmlns="http://jabber.org/protocol/bytestreams"/>
</iq>
plus we also get a streamhost from the code from the query like this: NSXMLElement *streamhost = [query elementForName:@"streamhost"];
<streamhost xmlns="http://jabber.org/protocol/bytestreams"
jid="proxy.beta.myCompany.co.uk"
host="127.0.1.1"
port="7777"/>
Sent :
<iq type="set"
to="[email protected]/spark"
id="DD96A581-BFA3-47BC-A3C0-D26AD48D7442">
<query xmlns="http://jabber.org/protocol/bytestreams"
sid="DD96A581-BFA3-47BC-A3C0-D26AD48D7442"
mode="tcp">
<streamhost xmlns="http://jabber.org/protocol/bytestreams"
jid="proxy.beta.myCompany.co.uk"
host="127.0.1.1"
port="7777"/>
</query>
</iq>
This gives no response, but it looks ok to me when I compare to example 17 of XEP-0065. HOWEVER, if don't include a resource on the jID passed into TurnSocket.m ([email protected] rather than [email protected]/spark), then this send request changes appropriately
<iq type="set"
to="[email protected]" **LOOK! NO RESOURCE!**
id="5D08B85E-CA78-4AA8-A893-C1DC571A9808">
<query xmlns="http://jabber.org/protocol/bytestreams"
sid="5D08B85E-CA78-4AA8-A893-C1DC571A9808"
mode="tcp">
<streamhost xmlns="http://jabber.org/protocol/bytestreams"
jid="proxy.beta.myCompany.co.uk"
host="127.0.1.1"
port="7777"/>
</query>
</iq>
and the XML in my original question above is returned! (with the 503 error code). Furthermore, I notice that this xml contains 'streamhost', but at this stage should it actually contain 'streamhost-used'? Why is there an error? Should or shouldn't I include the resource in the 'to'?
Minor Update 19/04/2012 15:07 : I have added xmpp.proxy.transfer.required as false on OpenFire. This is due to these discussions: here and here. I didn't set up this server (my colleague did) and I don't understand what it means, but it doesn't seem to have made any difference to my problem.
Update 20/04/2012 10:00 : My 503 error I think is correctly there when I don't include the resource (according to this). Even if this is so though, I'm unsure why I get no response with a full jID.