Summary:ASTERISK-17699: [patch] G.722 support in Google Talk channel
Reporter:avalon73 (avalon73)Labels:
Date Opened:2011-04-15 18:08:35Date Closed:2012-03-20 12:00:20
Versions:1.8.3 Frequency of
Environment:Attachments:( 0) g722.gvoice
( 1) g722-corrected.patch
Description:According to the following FAQ, Google Talk (and I'm guessing Google Voice as well?) supports G.722:


Is there any particular reason why Asterisk doesn't support G.722 over GTalk, or is it just that no one has yet noticed Google's support and implemented it?  I would attempt a patch, myself, if I were more familiar with the Jabber/GTalk protocol.
Comments:By: David Vossel (dvossel) 2011-04-18 14:08:32

It should be a simple feature to add in.  Just look for where the ulaw codec is advertised and copy that logic to add g722.  I don't know when I'll be available to do this, but I am interested in making this happen.  If someone else writes it I will review it/commit it.

By: Malcolm Davenport (mdavenport) 2011-04-18 16:25:21

Please try the attached patch.  I tested against google talk, not google voice, so the name of the patch isn't proper.

By: avalon73 (avalon73) 2011-04-18 16:45:21

I tried adding that after posting the issue and, yes, adding advertisement for g722 to the GTalk invite (if it's in the conf file) is easy.  When I do that, though, the rest of Asterisk has trouble reconciling the available and preferred codecs with the rest of the system.

If I configure the GTalk and SIP channel types to prefer g722 when available, I get the following message after the call is negotiated:

[Apr 18 17:26:17] WARNING[13558]: channel.c:4975 set_format: Unable to find a codec translation path from 0x4 (ulaw) to 0x1000 (g722)
[Apr 18 17:26:17] WARNING[13558]: channel.c:4975 set_format: Unable to find a codec translation path from 0x4 (ulaw) to 0x1000 (g722)

After that, I get warnings from chan_sip and chan_gtalk that the latter is trying to write ulaw frames and the former is trying to use g722.  If I try to call using a phone that doesn't speak g722, I get this:

[Apr 18 17:18:04] WARNING[13519]: channel.c:5605 ast_channel_make_compatible_helper: No path to translate from Gtalk/+****@voice.google.com-29ae to SIP/****-00000000

...followed by Asterisk terminating the call, the GTalk server sending an invite including g722, Asterisk processing that as a new incoming call, and further codec confusion.

In both of these cases, I have ulaw and alaw configured as allowed for internal SIP phones and GTalk, but g722 as preferred.

It looks like it's more than just signaling over the GTalk connection.  This is getting into parts of the code that I REALLY don't understand.

By: Malcolm Davenport (mdavenport) 2011-04-18 17:02:13

I haven't gotten that warning message yet.   There is trouble if, of course, you set g722 as the only allowed codec for a gtalk connection and you're doing Google Voice calling, since they only advertise ulaw.  Good luck to whoever keeps carrying the torch here.

By: avalon73 (avalon73) 2011-04-18 17:51:11

Google Voice is what I've been testing with, and I appear to be getting g722 at least in the response to invite I'm sending.  When I test calling to another GTalk client, I get the same messages I was seeing earlier with outbound calls via GVoice.

Calls coming in from GTalk and GVoice appear to work properly, but then the server isn't advertising g722 in either case.  It's advertising ulaw, and that's what ends up being used.

Like I said before, I have g722 set as the preferred codec (first in the allowed list), but ulaw and alaw are in that list as well.  For GTalk, I'm setting it in the [general] section of gtalk.conf.

By: Michael Spiceland (mspiceland) 2011-10-27 21:13:52.897-0500

There was a small bug in the patch that prevented it from working.  I've attached a corrected version.  I tested it with Asterisk 10 r342604 (latest) and it worked with Google Talk.  I did not test it with Google voice.

Can it be committed as is or does someone need to make sure it works properly with Google Voice too?

By: Michael Spiceland (mspiceland) 2011-11-01 15:16:07.653-0500

avalon73, can you retest with the updated patch?  Also, can you attach your configs when you have the error?  I only tested with google talk, but the corrected version worked for me.

By: Leif Madsen (lmadsen) 2011-11-29 14:08:01.623-0600

Assigned to avalon73 so he can comment on the issue.

By: Leif Madsen (lmadsen) 2011-12-20 08:58:16.096-0600

Pinging original reporter prior to suspending issue due to lack of feedback.

By: Dave Bowerman (dbowerman) 2012-01-04 22:15:29.740-0600

Confirmed corrected patch working in trunk (349670)

By: Matt Jordan (mjordan) 2012-03-20 12:00:14.292-0500

Suspended due to lack of activity. Please request a bug marshal in #asterisk-bugs on the IRC network irc.freenode.net to reopen the issue should you have the additional information requested.  Further information can be found at http://www.asterisk.org/developers/bug-guidelines