Problem authenticating to onsip xmpp server "service-unavailable"

817 views
Skip to first unread message

Ben

unread,
Feb 20, 2012, 10:54:35 AM2/20/12
to jabber-net
I'm having problems authenticating to an onsip XMPP server. I think
the problem has something to do with the jabber-net library trying to
set a resource ("Jabber.Net"), but the server isn't accepting that
command. How do I get around this?
I have these settings:
username: bentigg
server: allied.onsip.com
password: **********

Why is jabber-net trying to set the resource and why is the server
rejecting it?

Here is the output:
SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams"
id="f9e87d47" xmlns="jabber:client" to="allied.onsip.com"
version="1.0">
RECV: <?xml version='1.0'?><stream:stream xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'
id='cc8654d6-209d-490e-9623-9f5dabc553fa' from='allied.onsip.com'
version='1.0' xml:lang='en'><stream:features><mechanisms
xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/><starttls
xmlns='urn:ietf:params:xml:ns:xmpp-tls'/><auth xmlns='http://
jabber.org/features/iq-auth'/></stream:features>
SEND: <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
RECV: <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams"
id="2bc09403" xmlns="jabber:client" to="allied.onsip.com"
version="1.0">
RECV: <?xml version='1.0'?><stream:stream xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'
id='7cf736f1-164e-48d5-8514-51ffb8a6d061' from='allied.onsip.com'
version='1.0' xml:lang='en'><stream:features><mechanisms
xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism></
mechanisms><auth xmlns='http://jabber.org/features/iq-auth'/></
stream:features>
SEND: <auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-
sasl">AGJlbnRpZ2cARFRzTEhQV01FeUtrU0szQg==</auth>
RECV: <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'></success>
SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams"
id="6ec5a7aa" xmlns="jabber:client" to="allied.onsip.com"
version="1.0">
RECV: <?xml version='1.0'?><stream:stream xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams' id='a4a2632d-0f92-4676-
a6c6-95351ea62f60' from='allied.onsip.com' version='1.0'
xml:lang='en'><stream:features><ver
xmlns='urn:xmpp:features:rosterver'><optional/></ver><bind
xmlns='urn:ietf:params:xml:ns:xmpp-bind'><required/></bind><session
xmlns='urn:ietf:params:xml:ns:xmpp-session'><optional/></session><c
hash='sha-1' ver='9e/BB7zTeVcQzdulvJBstfHooGE=' node='http://
prosody.im' xmlns='http://jabber.org/protocol/caps'/></
stream:features>
SEND: <iq id="JN_1" type="set" to="allied.onsip.com"><bind
xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>Jabber.Net</
resource></bind></iq>
RECV: <iq id='JN_1' type='error' from='allied.onsip.com'><error
type='cancel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-
stanzas'/></error></iq>
-------------------
ERROR: jabber.connection.sasl.AuthenticationFailedException: Error
binding resource: <error type="cancel"><service-unavailable
xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /></error>

Joe Hildebrand

unread,
Feb 20, 2012, 11:35:06 AM2/20/12
to jabbe...@googlegroups.com
Try setting the resource to null - I think I might have wired that up to do the right thing.  Although, I doubt that is the problem unless they've misconfigured Prosody something horrible.

-- 
Joe Hildebrand



sasl">*****</auth>

RECV: <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'></success>
SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams"
id="6ec5a7aa" xmlns="jabber:client" to="allied.onsip.com"
version="1.0">
RECV: <?xml version='1.0'?><stream:stream xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams' id='a4a2632d-0f92-4676-
a6c6-95351ea62f60' from='allied.onsip.com' version='1.0'
xml:lang='en'><stream:features><ver
xmlns='urn:xmpp:features:rosterver'><optional/></ver><bind
xmlns='urn:ietf:params:xml:ns:xmpp-bind'><required/></bind><session
xmlns='urn:ietf:params:xml:ns:xmpp-session'><optional/></session><c
hash='sha-1' ver='9e/BB7zTeVcQzdulvJBstfHooGE=' node='http://
prosody.im' xmlns='http://jabber.org/protocol/caps'/></
stream:features>
SEND: <iq id="JN_1" type="set" to="allied.onsip.com"><bind
xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>Jabber.Net</
resource></bind></iq>
RECV: <iq id='JN_1' type='error' from='allied.onsip.com'><error
type='cancel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-
stanzas'/></error></iq>
-------------------
ERROR: jabber.connection.sasl.AuthenticationFailedException: Error
binding resource: <error type="cancel"><service-unavailable
xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /></error>

--
You received this message because you are subscribed to the Google Groups "jabber-net" group.
To post to this group, send email to jabbe...@googlegroups.com.
To unsubscribe from this group, send email to jabber-net+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jabber-net?hl=en.


Ben Tiggelaar

unread,
Feb 20, 2012, 11:48:49 AM2/20/12
to jabbe...@googlegroups.com
Thanks for responding so quickly, Joe. Unfortunately even when the resource is set to null, I am still getting the same error message.

I am not having any problems connecting to any other server, so I'm guessing it must be a problem with how their server is configured. I contacted them and they say it should just work. Any other suggestions? Maybe someone else is having this same problem. Thanks!

Send:
<iq id="agsXMPP_1" type="set" to="allied.onsip.com"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" /></iq>
RECV:
<iq xmlns="jabber:client" type="error" from="allied.onsip.com" id="agsXMPP_1"><error type="cancel"><service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /></error></iq>
--
Ben Tiggelaar
President
Students in Free Enterprise
University of Nebraska - Lincoln
(605) 212-9157

Joe Hildebrand

unread,
Feb 20, 2012, 3:13:24 PM2/20/12
to jabbe...@googlegroups.com
Have you tried connecting with another client?

-- 
Joe Hildebrand


Ben Tiggelaaar

unread,
Feb 20, 2012, 3:33:44 PM2/20/12
to jabbe...@googlegroups.com
Yes, I successfully connected to the gmail chat xmpp server. 

Ben Tiggelaar

Joe Hildebrand

unread,
Feb 20, 2012, 4:03:11 PM2/20/12
to jabbe...@googlegroups.com
I was unclear.  Have you tried connecting to the "allied.onsip.com" XMPP server with someone else's client, like Swift or Psi?

-- 
Joe Hildebrand


Ben Tiggelaar

unread,
Feb 20, 2012, 4:16:32 PM2/20/12
to jabbe...@googlegroups.com

Oh, yes I was able to connect with psi. It authenticated because I was able to view the the roster contact list.

Joe Hildebrand

unread,
Feb 21, 2012, 7:46:56 PM2/21/12
to jabbe...@googlegroups.com
Can you compare/contrast the protocol that psi sends, then?

-- 
Joe Hildebrand


Ben Tiggelaar

unread,
Feb 22, 2012, 11:02:14 AM2/22/12
to jabbe...@googlegroups.com
I compared the PSI Console with the output I got from using jabber-net. The only difference between the two is that in the last send IQ statement in jabber-net, there is an additional attribute: to="allied.onsip.com". Maybe my resource name needs to be set to something else ? I get the following messages in each:

This is from PSI

[SENT]
<iq type="set" id="bind_1" >

<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
<resource>Joel-HP</resource>
</bind>
</iq>

[REC]
<iq xmlns="jabber:client" type="result" id="bind_1" >

<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
<jid>ben...@allied.onsip.com/Joel-HP</jid>
</bind>
</iq>

[SENT]
<iq type="set" id="aacca" >
<session xmlns="urn:ietf:params:xml:ns:xmpp-session"/>
</iq>

[REC]<iq type="result" id="aacca" to="ben...@allied.onsip.com/Joel-HP" />

This is from Jabber-Net

SEND:
<iq id="JN_1" type="set" to="allied.onsip.com">
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
<resource>Joel-HP</resource>

</bind>
</iq>

RECV:
<iq id='JN_1' type='error' from='allied.onsip.com'>
<error type='cancel'>
<service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>

Thanks for your time! This can be quite frustrating with no specific reason why it's failing.

Ben Tiggelaar

unread,
Feb 22, 2012, 11:37:21 AM2/22/12
to jabbe...@googlegroups.com
The only other difference is in the PSI connection it names the attribute xmlns:xml="http://www.w3.org/XML/1998/namespace" in all of the <stream> attributes:

PSI
<stream:stream xmlns:stream="http://etherx.jabber.org/streams" version="1.0" xmlns="jabber:client" to="allied.onsip.com" xml:lang="en" xmlns:xml="http://www.w3.org/XML/1998/namespace" >

Jabber-net
<stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="ac5498ac" xmlns="jabber:client" to="allied.onsip.com" version="1.0">

Those are literally the only differences. Maybe the stream isn't set up properly in jabber-net because the namespace isn't specifically named??

Joe Hildebrand

unread,
Feb 23, 2012, 2:43:24 AM2/23/12
to jabbe...@googlegroups.com
The namespace thing is a harmless bandwidth-wasting psi bug.  According to http://www.w3.org/TR/REC-xml-names/, section 3:

"The prefix xml is by definition bound to the namespace name http://www.w3.org/XML/1998/namespace. It MAY, but need not, be declared, and MUST NOTbe bound to any other namespace name. Other prefixes MUST NOT be bound to this namespace name, and it MUST NOT be declared as the default namespace."

It's possible the to address on the resource bind is the issue.  However, I don't see that happen in the copy of the source I've got here.  I see this:

<iq id="JN_1" type="set"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>foo</resource></bind></iq>

Can you build from the head of SVN and see if the problem persists?

-- 
Joe Hildebrand



On Feb 22, 2012, at 9:02 AM, Ben Tiggelaar wrote:

I compared the PSI Console with the output I got from using jabber-net. The
only difference between the two is that in the last send IQ statement in
jabber-net, there is an additional attribute: to="allied.onsip.com". Maybe
my resource name needs to be set to something else ? I get the following
messages in each:*

This is from PSI *

[SENT]
<iq type="set" id="bind_1" >
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
<resource>Joel-HP</resource>
</bind>
</iq>

[REC]
<iq xmlns="jabber:client" type="result" id="bind_1" >
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
<jid>ben...@allied.onsip.com/Joel-HP</jid>
</bind>
</iq>

[SENT]
<iq type="set" id="aacca" >
<session xmlns="urn:ietf:params:xml:ns:xmpp-session"/>
</iq>

[REC]<iq type="result" id="aacca" to="ben...@allied.onsip.com/Joel-HP" />

*This is from Jabber-Net*

Ben Tiggelaar

unread,
Feb 27, 2012, 12:07:27 PM2/27/12
to jabbe...@googlegroups.com
The problem still persists even if rebuilding from head. I was talking to the people at Prosody and I think we may have found a bug.


<iq id="agsXMPP_1" type="set" to="allied.onsip.com">

The to attribute in the iq stanza shouldn't be declared. There isn't compact code in Prosody that handles <bind> code.

They said that setting the 'to' to the JID should work. How do I got about addressing this issue from here? Here's the conversation we had:


Florob: bennifer, could you provide a XML log?
bennifer: might be a bit long ^_^
bennifer: Send: http://prosody.im/pastebin/efe070d4-ff96-4772-91dc-c6d296fd68c0
Zash: <iq id="agsXMPP_1" type="set" to="allied.onsip.com"> -- Can you drop the to attr?
bennifer: one sec..
bennifer: That's the problem, it does it automatically in the library...am I not allowed to specify the to in the iq stanza
Florob: !version allied.onsip.com
HAL: Florob: allied.onsip.com is running Prosody version unknown on Linux
Zash: Nice with a lib doing it wrong :)
bennifer: yeah, ain't that annoying lol
Zash: Prosody should handle it tho, there's compat code for it
bennifer: do you know of any c# or java libraries that SHOULD work? I've tried about 5 different libraries and they are either too old or just don't work like this one?
Zash: I'm neither a C# or Java guy
Zash: but have you looked at Stroke? (Swiften (Pretty new C++ lib) ported to Java)
waqas: Ha, it's called Stroke?
Zash: It is. http://swift.im/git/stroke/
waqas: Zash, We don't have compat code for <bind/>, because all clients seem to have gotten that right. It was even in the RFC examples.
waqas: We do have compat code for pointless <session/>, which all clients try to send blindly...
Zash: Oh
Zash: Right, then that's the bug
Florob: would setting 'to' to the JID work?
Zash: Yes
waqas: Florob, Yep
Zash: nil == bare jid
waqas: In client->server
Florob: So... agsXMPP certainly allows setting the 'to' attribute, doesn't it? It probably just auto-fills when you don't. *crosses fingers*
bennifer: do you mean setting the resource to null?
Florob: No. the 'to' attribute of the IQ stanza
Florob: to your JID
Florob: (also does this feel hackish RFC-wise to anyone else. You don't know your JID, until you did a bind, but still implicitly send stanzas to it)
waqas: Florob, The whole login sequence is probably one library call, and happens under the hood
waqas: Well, we've identified the issue. The to attribute needs to not be on the bind IQ.

Joe Hildebrand

unread,
Feb 28, 2012, 12:45:21 AM2/28/12
to jabbe...@googlegroups.com
Hate to ask a dumb question, but are you using Jabber-Net?  It looks like that IQ is from agsXMPP.

I've used Jabber-Net against prosody, and I really don't send a to address.

-- 
Joe Hildebrand


Ben Tiggelaar

unread,
Feb 29, 2012, 9:49:34 AM2/29/12
to jabbe...@googlegroups.com
Well, you were right about the agsXMPP code, I was testing both jabber-net and agsXMPP (and pasted the wrong output) to see if it was a problem with the library or the server. However using Jabber-net, I get the same error which I assume is on the to.


SEND: <iq id="JN_1" type="set" to="allied.onsip.com"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>Joel-HP</resource></bind></iq>
RECV: <iq id='JN_1' type='error' from='allied.onsip.com'><error type='cancel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>

ERROR: jabber.connection.sasl.AuthenticationFailedException: Error binding resource: <error type="cancel"><service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /></error>

I have the full output here: http://tinypaste.com/0b02421a

This might help...These are the following settings I am using. It seems I have tried every single combination possible and with these settings I get the furthest.:
            j.User = username;
            j.Server = server; 
            j.Port = 5222;
            j.Resource = resource;
            j.Password = password;
            j.AutoStartTLS = true;
            j.AutoReconnect = 0;
            j.AutoStartTLS = true;

Ben Tiggelaar

unread,
Feb 29, 2012, 9:58:55 AM2/29/12
to jabbe...@googlegroups.com
Ok! I re-downloaded the jabber-net dll and everything worked perfectly (I should have done this at the start). Must have been a problem with an old dll file or something....Thanks for your help!

markmac

unread,
Jul 28, 2013, 8:49:47 AM7/28/13
to jabbe...@googlegroups.com, ben...@gmail.com
Hi Ben,

I know this is an old thread, but I am having the exact same issue as you but I dont seem to be able to fix it by downloading the latest DLL.

Can you share any code you may have so I can compare why this issue is occuring?
Reply all
Reply to author
Forward
0 new messages