We've had a weird problem where we though that there must be gremlins in the network or providers playing tricks on us. We've tried everything, reviewing our firewall rules, inserting log statements in our firewall rules, running tcpdump, analyzing STUN server traffic, everything !!
We have lost quite a bit of time looking in the wrong place (e.g. the network). We found out that Asterisk (version 1.4.10 and below) has some problems in filtering invalid characters in CIDNAME (CallerID Name). The problem could have been caused exclusively by our custom CIDNAME lookup application but it could affect other users, we did not take the time to look into it further.
Asterisk send the CIDNUMBER and the CIDNAME to our custom CIDNAME lookup application. If our application doesn't find detailed info related to the CIDNUMBER , it just sends back the CIDNAME name that Asterisk sent to us in the first place. We had to patch our application so it trims invalid chars from the CIDNAME that Asterisk sent us in the first place before returning it to Asterisk to solve our one way audio problem.
The one way audio problem was caused by Asterisk and/or devices sending invalid SIP packets.
Look for open double quotes without a closing one in your SIP packets by running asterisk -r and then sip debug.
SIP/2.0 200 OK
Via: SIP/2.0/UDP xxx.xxx.xxx.xxx:5060;branch=z9hG4bK4a2fdbb1;rport
CSeq: 102 OPTIONS
User-Agent: Grandstream GXP2000 18.104.22.168
Warning: 399 xxx.xxx.xxx.xxx "detected NAT type is symmetric NAT"
Supported: replaces, timer
That One-Way audio problem with Asterisk 1.4.10 and FreePBX 2.3.0 that we spent so much time on had nothing to do with the network ! Just with stupid malformed headers ;-(