[Home]

Summary:ASTERISK-15815: Jabber Module, crash and/or no authentication
Reporter:Jeremy Quinn (jquinn)Labels:
Date Opened:2010-03-15 13:13:28Date Closed:2011-06-07 14:00:26
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Resources/res_jabber
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:Before moving from Asterisk 1.4.n to 1.6.2.n, I was using Jabber as a logging/tracking mechanism for my PBX.
With my previously working settings moved to 1.6.2.n, Asterisk crashes within minutes.

I tried switching Asterisk to use iChat Server (Jabberd) on a Mac OSX Snow Leopard server.

Providing a configuration that is identical to a working test client, Asterisk’s res_jabber is not able to hold a connection open.

Here is my config, with some info redacted :
[general]
debug=yes                            ;;Turn on debugging by default.
autoprune=no                        ;;Auto remove users from buddy list.
autoregister=no                        ;;Auto register users from buddy list.

[fiveone]                      ;;label
type=client                          ;;Client or Component connection
serverhost=chat.fiveone.org
username=pbx@fiveone.org  ;;Username with optional roster.
secret=***************          ;;Password
port=5222                            ;;Port to use defaults to 5222
usetls=yes                          ;;Use tls or not
usesasl=yes                          ;;Use sasl or not
buddy=xxxxx@fiveone.org              ;;Manual addition of buddy to list.
statusmessage=Up and Running            ;;Have custom status message for
                                 ;;Asterisk.
timeout=100                          ;;Timeout on the message stack.

auth_policy=accept ;;Auto accept users' subscription requests (default).


****** ADDITIONAL INFORMATION ******

The Jabberd Log :
Mar 15 17:47:44 fiveone jabberd/sm[17760]: session replaced: jid=pbx@fiveone.org/asterisk
Mar 15 17:47:52 fiveone jabberd/c2s[17763]: od_auth_check_service_membership: checking user "pbx" access for service "chat"
Mar 15 17:47:52 fiveone jabberd/c2s[17763]: od_auth_check_service_membership: mbr_check_service_membership returned 2
Mar 15 17:47:52 fiveone jabberd/c2s[17763]: od_auth_check_service_membership: no access restrictions found
Mar 15 17:47:52 fiveone jabberd/c2s[17763]: [15] SASL authentication succeeded: mechanism=PLAIN; authzid=pbx@fiveone.org, TLS negotiated
Mar 15 17:47:52 fiveone jabberd/c2s[17763]: od_auth_check_service_membership: checking user "pbx" access for service "chat"
Mar 15 17:47:52 fiveone jabberd/c2s[17763]: od_auth_check_service_membership: mbr_check_service_membership returned 2
Mar 15 17:47:52 fiveone jabberd/c2s[17763]: od_auth_check_service_membership: no access restrictions found
Mar 15 17:47:52 fiveone jabberd/c2s[17763]: [15] bound: jid=pbx@fiveone.org/asterisk
Mar 15 17:47:52 fiveone jabberd/c2s[17763]: [15] packet sent before session start, closing stream
Mar 15 17:47:52 fiveone jabberd/c2s[17763]: [15] [::ffff:127.0.0.1, port=60212] disconnect jid=pbx@fiveone.org/asterisk, packets: 2
Mar 15 17:47:52 fiveone jabberd/c2s[17763]: [15] [::ffff:127.0.0.1, port=60216] connect
Mar 15 17:47:52 fiveone jabberd/sm[17760]: session replaced: jid=pbx@fiveone.org/asterisk

You can see above that the account used by Asterisk ‘pbx’ is properly authenticated, but it is subsequently disconnected for “packet sent before session start, closing stream”.

Meanwhile, here is what the Asterisk logging looks like (sorry, not captured simultaneously) :

JABBER: fiveone INCOMING: <?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' from='fiveone.org' version='1.0' id='eabgbuhdaj3otsdrue1sw4pr1nbdcuffyx619cmy'><stream:features xmlns:stream='http://etherx.jabber.org/streams'><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'><required/></starttls><auth xmlns='http://jabber.org/features/iq-auth'/></stream:features>

JABBER: fiveone OUTGOING: <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>

JABBER: fiveone INCOMING: <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>

JABBER: fiveone OUTGOING: <?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' to='fiveone.org' version='1.0'>

JABBER: fiveone INCOMING: <?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' from='fiveone.org' version='1.0' id='y5r0ozllnq0bbcvsm12vooltdg2od6nqqth7476f'>

JABBER: fiveone INCOMING: <stream:features xmlns:stream='http://etherx.jabber.org/streams'><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism><mechanism>GSSAPI</mechanism><mechanism>DIGEST-MD5</mechanism></mechanisms><auth xmlns='http://jabber.org/features/iq-auth'/></stream:features>

JABBER: fiveone OUTGOING: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>AHBieABzbWFybXkxJ3BvcnRtYW50ZWF1cw==</auth>

JABBER: fiveone INCOMING: <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>

JABBER: fiveone OUTGOING: <?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' to='fiveone.org' version='1.0'>

JABBER: fiveone INCOMING: <?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' from='fiveone.org' version='1.0' id='46s9y57m70iy777s0qwxgfmizcxdqvlcvj1nx3l0'>

JABBER: fiveone INCOMING: <stream:features xmlns:stream='http://etherx.jabber.org/streams'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><required/></bind><unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></stream:features>

JABBER: fiveone OUTGOING: <iq type='set' id='aaaaa'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><resource>asterisk</resource></bind></iq>

JABBER: fiveone OUTGOING: <iq type='set' id='auth'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq>

JABBER: fiveone INCOMING: <stream:error xmlns:stream='http://etherx.jabber.org/streams'><not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xmlns='urn:ietf:params:xml:ns:xmpp-streams'>stanza sent before session start</text></stream:error>
[Mar 15 18:07:00] ERROR[20402]: res_jabber.c:1621 aji_act_hook: JABBER: Node Error
[Mar 15 18:07:00] WARNING[20402]: res_jabber.c:1334 aji_recv: Parsing failure: Hook returned an error.
[Mar 15 18:07:00] WARNING[20402]: res_jabber.c:2642 aji_recv_loop: JABBER: Got hook event.

JABBER: fiveone INCOMING: </stream:stream>
[Mar 15 18:07:00] WARNING[20402]: res_jabber.c:1331 aji_recv: Parsing failure: Invalid XML.
[Mar 15 18:07:00] WARNING[20402]: res_jabber.c:2653 aji_recv_loop: JABBER: socket read error
Comments:By: Jeremy Quinn (jquinn) 2010-03-15 13:16:29

Sorry, I forgot to mention that the previous jabber server I was using (that now crashes Asterisk), was talk.google.com.

By: Leif Madsen (lmadsen) 2010-03-15 14:59:28

I can confirm this as I saw this the other day when using Asterisk trunk (and likely comes up in 1.6.2 as well, although I haven't found that crashing in my 1.6.2 yet).

However, to move this forward, you'll need to provide a backtrace per the doc/backtrace.txt documentation in your Asterisk source.

Of note is that you'll need to enable DONT_OPTIMIZE in menuselect within the Compiler Flags section, and the re-compile and install.

More information is in the backtrace.txt document I pointed you at. Once you've gotten the backtrace file, upload it as a text file attachment to this issue.

Thanks!

By: Jeremy Quinn (jquinn) 2010-03-18 09:48:43

I tried what you suggested but could no longer reproduce the problem.
Asterisk would no longer crash (quickly) compiled with or without the compile optimisation setting in make menuselect.
The res_jabber module is happily talking to Google Talk.
No resolution to the problems talking to MacOSX iChat server yet.

By: phsultan (phsultan) 2010-03-18 11:05:19

Leif, I suspect this is related to this bug : https://issues.asterisk.org/view.php?id=16760

jquinn, a backtrace of you connection to the iChat server would be useful, indeed.

By: Leif Madsen (lmadsen) 2010-03-18 11:17:08

Awesome, I'll try testing this out again today. I think I'm still having the issues with Google Talk not working though, so I'll give that a shot, and if it's still not working, I'll report back on that other issue about that :)

By: phsultan (phsultan) 2010-03-18 11:24:41

Ok, oh and make sure the 'jabber show buddies' CLI command indicates that the buddy you want to call has Jingle caps.

By: phsultan (phsultan) 2010-03-18 11:27:52

jquinn, I think I misread your bug description. You are encountering two problems, the second being that you can't connect Asterisk to your iChat server right?

I have a jabberd2 server running here. I'll test it out against Asterisk and see how both ends behave.

By: Jeremy Quinn (jquinn) 2010-03-18 12:01:20

phsultan, yes, two bugs in one report, that was my bad.

I can confirm that the error logs above, from jabbered and Asterisk are still relevant.

By: phsultan (phsultan) 2010-03-22 15:49:25

Several threads seem to report a similar issue, apparently caused by the client sending packets too fast to the server :
http://osdir.com/ml/network.jabber.jabberd/2006-04/msg00011.html
http://trac.adium.im/ticket/3798

Could you have Asterisk connect to an XMPP server installed on a remote computer?

On my side, I can connect Asterisk to the jabberd2 server (2.1.14) we're running here.

By: Leif Madsen (lmadsen) 2010-03-24 10:36:31

I personally haven't been getting anymore crashes with jabber on my system.

By: Jeremy Quinn (jquinn) 2010-04-22 14:42:16

phsultan > Could you have Asterisk connect to an XMPP server installed on a remote computer?

Normally I have my Asterisk box connected to GoogleTalk, it works fine, I doubt that helps.

I had some issues, now hopefully resolved with the authentication system on my server (MacOSX Server 10.6).
First I checked via a normal client that Asterisk’s credentials worked.
Then I tried to connect my Asterisk box to my local instance of Jabberd again and got different error conditions depending on different configurations of ‘usetls’, ‘usesasl’ etc.

If you are interested in seeing them, should I post them here or email them to you?

By: Paul Belanger (pabelanger) 2010-05-12 13:02:14

Is this still an issue?

By: Leif Madsen (lmadsen) 2010-05-17 11:02:12

Suspending this issue for now. If the reporter is able to provide the requested information then feel free to reopen this issue. Thanks!