[ previous ] [ next ] [ threads ]
 To :  yate@v...
 From :  Gerrit Jacobsen <g_jacobsen@y...>
 Subject :  Bug: codec negotiation media.cpp
 Date :  Fri, 2 Apr 2010 17:38:03 +0000 (GMT)
Hello yate team,

there seems to be a bug/logic flaw in the SDP negotiation.

Situation: Two SIP entities, SIP1 and SIP2 and yate
SIP1 to SIP2 call, via yate, proxying RTP

1. SIP1 INVITES to yate and announces alaw in SDP
2. In route stage the formats parameter is set by regexroute or other routing module to "g729,alaw"
e.g.
^\(.*\)$=sip/sip:@2...; xsip_auth_bye=false; formats=g729,alaw
3. SIP2 sends 200ok and accepts g729 codec in sdp

and now comes the problem:
4. Yate sends 200ok with "g729" to SIP1
This should not happen as SIP1 announced only alaw as capability.

5. SIP1 disconnects the call because it doesnt support G729.

The problem does not happen when at point 2.
the formats parameter is set to g729 only (instead of g729 and alaw). 
Yate log then shows the line "Debug(DebugInfo,"Not changing to '%s' from '%s' [%p]", formats,m_formats.c_str(),this);"
Yate then sends correctly at point 3. 200ok with alaw in SDP


The problem seems to be in media.cpp when the bug happens (two codecs in formats set) the SDPMedia::update function concludes that only G729 should be used and changes the formats to G729.


bool SDPMedia::update(const char* formats, int rport, int lport)
{
    DDebug(DebugAll,"SDPMedia::update('%s',%d,%d) [%p]",formats,rport,lport,this);
    bool chg = false;
    String tmp(formats);
    if (m_formats != tmp) {
        if ((tmp.find(',') < 0) && m_formats && m_formats.find(tmp) < 0)
            Debug(DebugInfo,"Not changing to '%s' from '%s' [%p]",
                formats,m_formats.c_str(),this);
        else {                                                                                                  chg = true;                                                                                         m_formats = tmp;
            int q = m_formats.find(',');
            m_format = m_formats.substr(0,q);
        }
    }

Thanks for looking into this.

Cheers 

Gerry




      


Hello yate team,

there seems to be a bug/logic flaw in the SDP negotiation.

Situation: Two SIP entities, SIP1 and SIP2 and yate
SIP1 to SIP2 call, via yate, proxying RTP

1. SIP1 INVITES to yate and announces alaw in SDP
2. In route stage the formats parameter is set by regexroute or other routing module to "g729,alaw"
e.g.
^\(.*\)$=sip/sip:@2...; xsip_auth_bye=false; formats=g729,alaw
3. SIP2 sends 200ok and accepts g729 codec in sdp

and now comes the problem:
4. Yate sends 200ok with "g729" to SIP1
This should not happen as SIP1 announced only alaw as capability.

5. SIP1 disconnects the call because it doesnt support G729.

The problem does not happen when at point 2.
the formats parameter is set to g729 only (instead of g729 and alaw).
Yate log then shows the line "Debug(DebugInfo,"Not changing to '%s' from '%s' [%p]", formats,m_formats.c_str(),this);"
Yate then sends correctly at point 3. 200ok with alaw in SDP


The problem seems to be in media.cpp when the bug happens (two codecs in formats set) the SDPMedia::update function concludes that only G729 should be used and changes the formats to G729.


bool SDPMedia::update(const char* formats, int rport, int lport)
{
    DDebug(DebugAll,"SDPMedia::update('%s',%d,%d) [%p]",formats,rport,lport,this);
    bool chg = false;
    String tmp(formats);
    if (m_formats != tmp) {
        if ((tmp.find(',') < 0) && m_formats && m_formats.find(tmp) < 0)
            Debug(DebugInfo,"Not changing to '%s' from '%s' [%p]",
                formats,m_formats.c_str(),this);
        else {                                                                                                  chg = true;                                                                                         m_formats = tmp;
            int q = m_formats.find(',');
            m_format = m_formats.substr(0,q);
        }
    }

Thanks for looking into this.

Cheers

Gerry