Google Voice voice quality

Hi friends,

It appears Google Voice has poor quality for calls that are outbound in the path from the caller.

[ul]
[li]Are there any obvious configuration missteps that can cause this?[/li]
[li]Is there a better voice codec that ulaw to use?[/li][/ul]

It’s not a cpu load or main memory or bandwidth problem.

All other type of calls and audio paths work fine, ie. client-to-client, inbound calls both ways, and inbound voice for outbound calls.

I have this on my Asterisk installation, and also experienced it with pbxes.

I am on Debian Wheezy and Asterisk 1:11.13.1~dfsg-2~bpo70+1
configured using official guide:
https://wiki.asterisk.org/wiki/display/AST/Calling+using+Google

I tried CSipSimple and Android native clients.

I did see several similar Hangout complaints:
https://productforums.google.com/forum/#!topic/hangouts/oa5alCiz2Ik

[size=150]Symptom:[/size]

[size=150]Diagnose:[/size]

[ul]
[li]The cause is that Asterisk is behind nat.[/li]
[li]Google Voice login and call setup are initiated by Asterisk, so these functions work fine.[/li]
[li]The inbound audio, however, is initiated from google and has troubles reaching Asterisk.[/li][/ul]

[size=150]Check if Asterisk is behind nat:[/size]

Compare the ip of the default interface eth0 using ifconfig with the public ip as reported by icanhazip.com.

ip -f inet addr list eth02: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc pfifo_fast state UP group default qlen 1000
inet 10.0.0.1/32 brd 10.0.0.0 scope global eth0
valid_lft forever preferred_lft forever

The bold-face IP addresses are different, there is trouble.

[size=150]Deteremine what IP is sent to Google:[/size]

That nat to Google is working properly can be checked in Asterix cli:
on asterisk server do:

sudo asterisk -rvvvv xmpp set debug on
Then initiate a call via Google Voice into your asterisk server, or a call from your asterisk server out to Google Voice.

in the second XMPP sent to ''
there are series of candidate elements provided by Asterisk ice enabled in rtp.conf:

Ice basically lists every ip assigned to the server.

[ul][li]Make sure at least one candidate lists your asterisk server’s public ip, 1.2.3.4 above.[/li][/ul]

[size=150]Fix Google Voice:[/size]

in /etc/asterisk/rtp.conf insert in the [general] section:

Your public ip should no be sent to Google if it wasn’t before.

This is not described in the official instructions here:
https://wiki.asterisk.org/wiki/display/AST/Calling+using+Google

Also note that directmedia (rtp-udp voice packets sent direct from sip phone to sip phone) does not work for Google Voice. Google voice rtp will always go via your Asterisk server.