Unable to connect to Google Talk using Jabber

I am trying to connect Asterisk to a Google Talk account as described here, with the goal being to allow Google Talk users to call my pbx.

I have set up my configuration files as described in that document, but I am unable to connect to my Google Talk account.

My jabber.conf file looks like this:

[general]
debug=yes
autoprune=no
autoregister=yes

[asterisk]
type=client
serverhost=talk.google.com
username=my_username@gmail.com/Talk
secret=my_password
port=5222
usetls=yes
usesasl=yes
statusmessage="I am a robot"
timeout=100

My gtalk.conf looks like this:

[general]
context=incoming-google
bindaddr=0.0.0.0
allowguests=yes

[guest]
disallow=all
allow=ulaw
context=local
connection=asterisk

And finally, this is the output I get in the Asterisk console when I try to connect, with ‘jabber set debug on’.

[code]JABBER: asterisk OUTGOING: <?xml version='1.0'?><stream:stream xmlns:stream=‘http://etherx.jabber.org/streams’ xmlns=‘jabber:client’ to=‘gmail.com’ version=‘1.0’>

JABBER: asterisk INCOMING: <stream:stream from=“gmail.com” id=“D87F9CDF5C58C4E9” version=“1.0” xmlns:stream=“http://etherx.jabber.org/streams” xmlns=“jabber:client”>stream:featuresX-GOOGLE-TOKENX-OAUTH2</stream:features>

JABBER: asterisk OUTGOING:

JABBER: asterisk INCOMING:

JABBER: asterisk OUTGOING: <?xml version='1.0'?><stream:stream xmlns:stream=‘http://etherx.jabber.org/streams’ xmlns=‘jabber:client’ to=‘gmail.com’ version=‘1.0’>

JABBER: asterisk INCOMING: <stream:stream from=“gmail.com” id=“1209DDC90296ABE2” version=“1.0” xmlns:stream=“http://etherx.jabber.org/streams” xmlns=“jabber:client”>

JABBER: asterisk INCOMING: stream:featuresPLAINX-GOOGLE-TOKENX-OAUTH2</stream:features>

JABBER: asterisk OUTGOING: XXXXXXXXX

JABBER: asterisk INCOMING:
[Aug 4 03:12:43] ERROR[3887]: res_jabber.c:1693 aji_act_hook: JABBER: encryption failure. possible bad password.

JABBER: asterisk INCOMING: </stream:stream>
[Aug 4 03:12:43] ERROR[3887]: res_jabber.c:1576 aji_act_hook: aji_act_hook was called with out a packet
[Aug 4 03:12:43] WARNING[3887]: res_jabber.c:1391 aji_recv: Parsing failure: Hook returned an error.
[Aug 4 03:12:43] WARNING[3887]: res_jabber.c:2742 aji_recv_loop: JABBER: Got hook event.
[Aug 4 03:12:43] WARNING[3887]: res_jabber.c:2753 aji_recv_loop: JABBER: socket read error
[/code]

Yes, I’m 100% sure the password is correct. I have successfully tested logging in with these credentials using a standalone Jabber client.

‘jabber show connections’ yields:

computer*CLI> jabber show connections
Jabber Users and their status:
       [asterisk] my_username@gmail.com/Talk     - Disconnected
----
   Number of users: 1

The only other discussions about this issue that I’ve seen were reported several years ago, but I’m under the assumption that this feature works fine in recent releases. I’m running Asterisk 1.8.5, from the current Ubuntu package here on Ubuntu 11.04, with the most recent versions of libiksemel and libssl from the repo (versions 1.2 and 0.9.8, respectively). Any thoughts as to why I am not able to authenticate with Google? Is there a simpler way to achieve the desired functionality?

I have same issue.

Just logged in using Asterisk 10 on an Ubuntu 11.04 system. Did you install iksemel and ssl before you configured and compiled Asterisk?

I did not compile Asterisk from source; I used the packages from the “Asterisk Packages” page. I had both libiksemel and libssl (as well as the libiksemel-dev and libssl-dev) packages installed before I installed the Asterisk package (asterisk-1.8). I saw that the asterisk package depended on the libiksemel and libssl packages I had, so I’ve assumed that the package was configured properly to make use of them.

If the “better” way to set up Asterisk is to build from source, I can try that, but it’d be great to figure out why the packaged version does not work.

Just an update…

Connected to Asterisk 1.8.5.0-1digium1~natty currently running on rutherford (pid = 3491)
rutherford*CLI> core show channeltypes
Type        Description                              Devicestate  Indications  Transfer    
----------  -----------                              -----------  -----------  --------    
Gtalk       Gtalk Channel Driver                     no           yes          no          
Console     OSS Console Channel Driver               no           yes          no          
Phone       Standard Linux Telephony API Driver      no           yes          no          
USTM        UNISTIM Channel Driver                   no           yes          no          
Skinny      Skinny Client Control Protocol (Skinny)  yes          yes          no          
MulticastR  Multicast RTP Paging Channel Driver      no           no           no          
SIP         Session Initiation Protocol (SIP)        yes          yes          yes         
Agent       Call Agent Proxy Channel                 yes          yes          no          
Local       Local Proxy Channel Driver               yes          yes          no          
Jingle      Jingle Channel Driver                    no           yes          no          
DAHDI       DAHDI Telephony Driver w/PRI & SS7 & MFC yes          yes          no          
Bridge      Bridge Interaction Channel               no           no           no          
IAX2        Inter Asterisk eXchange Driver (Ver 2)   yes          yes          yes         
----------
13 channel drivers registered.

Based on another post (this one) not supporting devicestate seemed to be a problem, but I’m not clear exactly why it was one. Maybe this will help…

I compared the initialization sequence of the Asterisk jabber client to that of Pidgin, which successfully connects to Gtalk. The key difference is this line:

Asterisk

[code]INCOMING: stream:featuresPLAINX-GOOGLE-TOKENX-OAUTH2</stream:features>

OUTGOING: password removed
[/code]

Pidgin

INCOMING: <stream:features><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>X-GOOGLE-TOKEN</mechanism><mechanism>X-OAUTH2</mechanism></mechanisms></stream:features>

OUTGOING: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN' xmlns:ga='http://www.google.com/talk/protocol/auth' ga:client-uses-full-bind-result='true'>password removed</auth>

According to the Talk documentation, the extra (bolded) attributes are part of the domain discovery mechanism Google uses for clients that sign in with a gmail.com or googlemail.com domain. Thus it would make sense that not including these attributes would cause login to fail.

I’m thinking this is a bug?

you need to change username = user@gmail.com (i think we don’t need /Talk here). That’s reason why your account is disconnected. i hope it can help you.

Thanks for the tip, but I’ve already tried that (to no avail).

Has anybody discovered a solution for this? I’m having the same problem.

Here’s something I found in the logs (/var/log/asterisk/messages):
[Jan 2 09:44:21] ERROR[16693] res_jabber.c: TLS connection cannot be established. Please install OpenSSL and its development libraries on this system, or disable the TLS option in your configuration file

However, openssl and the development libraries are installed:

rpm -q openssl-devel openssl

openssl-devel-1.0.0b-1.fc12.1.i686
openssl-1.0.0b-1.fc12.1.i686

It seems the jabber module can’t connect to my openssl library. Is this similar to your OP?

John

I don’t know it is the same thing or not. I compiled asterisk10 on my Debian/Dockstar. I can call my cell phone usign GV (the same .conf files as used in asterisk 1.8 ). My cell phone ringed, but when I picked up no audio in either direction. The same result is for my office phone.