[pjmedia] SDP parsing errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

Using tcpreplay to feed a pair of PJSip/PJMedia parsers, I'm seeing a
lot of random SDP parsing errors. More exactly, it seems that the
messages of my call flow are correctly parsed a first time, but when I
replay them again and again, unknown errors (generally 220020, and
sometimes 220021, or even 220030) appear. In some cases, all the SDP
bodies of the call flow generate an error.

Below is the excerpt of my code handling this. sip_message_t is
essentially a structure which embeds a pool, a pjsip_msg structure (msg)
and a pjmedia_sdp_session structure (sdp).

sip_message_t* sip_message_new(const u_char* packet, size_t length)
{
    sip_message_t* m = NULL;

    pj_assert(packet);

    m = (sip_message_t*) object_new("sip_msg", sizeof(sip_message_t), 8000, 8000);

    m->msg = pjsip_parse_msg(
        sip_message_get_pool(m), (char*)packet, length, NULL);
    m->sdp = NULL;

    if (NULL == m->msg)
    {
        PJ_LOG(2, (__FILE__, "SIP Parsing failed"));
        pj_pool_release(sip_message_get_pool(m));
        return NULL;
    }

    sip_message_parse_sdp_body(m);

    return m;
}

void sip_message_parse_sdp_body(sip_message_t* self)
{
    pjsip_msg_body* b = NULL;

    pj_assert(self);

    b = self->msg->body;

    /* Parse the body. */
    if (NULL != b
        && 0 == pj_stricmp2(&b->content_type.type, "application")
        && 0 == pj_stricmp2(&b->content_type.subtype, "sdp"))
    {
        if (PJ_SUCCESS == pjmedia_sdp_parse(sip_message_get_pool(self),
                                            b->data, b->len, &self->sdp))
        {
            /* If successful so far, check further that the contact
             * address and audio media port are present. */
            if (NULL == sip_message_get_sdp_contact(self))
            {
                PJ_LOG(2, (__FILE__, "SDP misses contact address"));
                self->sdp = NULL;
            }
            if (0 == sip_message_get_sdp_audio_port(self))
            {
                PJ_LOG(2, (__FILE__, "SDP misses audio port"));
                self->sdp = NULL;
            }
        }
        else
            PJ_LOG(1, (__FILE__, "SDP Parsing failed"));
    }
}


I know I have few information there, but I'd like to know if someone
ever encountered such a problem, and which steps you would propose to
track the bug. I'm using the 1.x branch of the repository.

-- 
Quand on prend les virage en ligne droite, c'est que ?a ne tourne pas
rond dans le carr? de l'hypot?nuse.
	-+- Pierre Dac -+-



[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux