TOS Field


Does Asterisk use the TOS field in the IP header ?
If so, Which values ?

If somebody has done an ethereal capture it would interest me Smile



It is a little disconcerting that searching the archives for TOS DiffServ comes up with little and that this post from January has not yet been answered.

My interest at present is in SIP so I have only looked at that portion of Asterisk. . . However I notice that the parsing and presentation routines used by SIP for its TOS value are common to other channels in Asterisk, so some of this may be applicable elsewhere in Asterisk.

Looking at the source code the values for the sip.conf tos parameter can only be: “lowdelay”, “throughput”, “reliability”, “mincost”, and “none”. It looks like the default is “none”. I see no way to set the upper three bits in the tos field (the traditional priority portion of the tos field).

Finally, it looks like chan_sip.c uses the one tos value for both the signaling (sip datagrams) and voice (rtp datagrams).

Given that DiffServ (rfc2474) is the current norm and the old TOS designators are deprecated, it seems that Asterisk ought to support DiffServ.

I would suggest that the tos parameter in SIP be changed to reflect DiffServ and, in fact, be made into two parameters: One for voice with a default code point value of 101110xx (0xB8) per rfc2598. And one for signaling with a default code point value of 011010xx (0x68) per rfc2597. These appear to be pretty standard values in the Cisco VoIP world.

It does not look too hard to make these changes and I will be making a patch on my system to try this out to see if it helps an outbound voice quality issue I am suffering from.

However I am new to suggesting code changes to Asterisk and don’t want to propose a general change that others disagree with. Nor do I want to introduce a new or changed parameter to sip.conf unless others agree with its form, syntax and allowed values.

Dont know if this helps you or not … sk+sip+tos

Thanks for pointing out that wiki. I am not sure why I missed it in my searches. I also am a bit embarrassed that I did not notice the line in ast_str2tos() in acl.c that allows this form of entry.

This may be sufficient for my current needs however I still don’t see how to assign different DiffServ code points for voice versus signaling.