[asterisk-dev] sessionid at sdp is non-RFC-complaint

Noel R. Morais noelrocha at gmail.com
Fri Dec 7 16:46:43 CST 2007


Hi everybody,

It is my first post at this list, so, nice to meet you.

I've found a wrong behavior on the way that Asterisk generate the sessionid.

When asterisk generates the INVITE, in a Outgoing call for instance,
it uses de PID of the asterisk process as the sessionid.

It is a wrong behavior because the SDP's RFC say that:
"<sess-id> is a numeric string such that the tuple of <username>,
      <sess-id>, <nettype>, <addrtype>, and <unicast-address> forms a
      globally unique identifier for the session.  The method of
      <sess-id> allocation is up to the creating tool, but it has been
      suggested that a Network Time Protocol (NTP) format timestamp be
      used to ensure uniqueness [13]."

So, if asterisk put two or more calls to a same device, like a gateway
(FWD for instance), it will always generating the same "globally
unique identifier for the session", so, it is not a globally unique
identifier.


The problem is in the add_sdp method of chan_sip.c and follow bellow
the source code:
        /* Set RTP Session ID and version */
        if (!p->sessionid) {
                p->sessionid = getpid();
                p->sessionversion = p->sessionid;
        } else
                p->sessionversion++;


The solution is to change the getpid() method for something else that
generates a "unique number". The RFC RECOMMENDED to use an NTP format
timestamp. I don't know to much about C, I would like to help as much
as I can.

Sorry about the poor English, any question, let me know.


Thanks,

Noel



More information about the asterisk-dev mailing list