[asterisk-bugs] [JIRA] (ASTERISK-25517) G722 codec being used, even though all endpoints prefer PCMA

hristo (JIRA) noreply at issues.asterisk.org
Tue Nov 3 04:30:33 CST 2015


hristo created ASTERISK-25517:
---------------------------------

             Summary: G722 codec being used, even though all endpoints prefer PCMA
                 Key: ASTERISK-25517
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-25517
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Channels/chan_sip/CodecHandling, Core/RTP
    Affects Versions: 11.20.0
         Environment: Debian 7.8, x64
            Reporter: hristo
            Severity: Minor


Asterisk starts sending G722 even though in SDP from Asterisk as well as in SDP from the endpoint the first priority codec is set to PCMA. This only happens for about a second before Asterisk switches to PCMA, but it seems to be a problem for some IP phones and as a result the calls end up having one way audio.

I'd expect that when Asterisk offers PCMA as primary codec in INVITE SDP and when it receives PCMA as primary codec in 200 OK from telephone, that it will only send PCMA, but this isn't the case.

The problem can be reproduced with a default Asterisk installation by simply adding two sip.conf endpoints:

{code}
[Alice]
host=dynamic
type=friend
secret=1000
nat=no
directmedia=no
disallow=all
allow=alaw

[Bob]
host=dynamic
type=friend
secret=2000
nat=no
directmedia=no
disallow=all
allow=g722
allow=alaw
allow=ulaw
{code}

and by adding a single line in extensions.conf in the \[public\] context:
{code}
exten => 2000,1,Dial(SIP/Bob)
{code}

What then happens when Alice calls 2000 (Bob) is:
# Alice is configured with PCMA only, so she sends only PCMA in INVITE SDP
# Asterisk sends an INVITE to Bob with the following codec order in SDP: PCMA, G722, PCMU. Which is presumably done so in order to try to avoid transcoding.
# Bob replies with 200 OK with codec order of PCMA, G722, which results in 200 OK with PCMA in SDP being sent to Alice.

At this point all devices and Asterisk have expressed preference for PCMA. Asterisk however, starts sending G722 RTP to Bob for about a second, before it switches to PCMA.

A workaround is to set the codec order in sip.conf so that the primary codec of Bob matches the codec sent by Alice in INVITE SDP.

Attached:
- sending-g722-instead-of-g711.pcap - packet capture done on the Asterisk server
- debug.log - Asterisk debug log for the same call, with rtp and sip debugging enabled.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list