Skip to content

IP Quality of Service

Introduction

Asterisk supports different QoS settings at the application level for various protocols on both signaling and media. The Type of Service (TOS) byte can be set on outgoing IP packets for various protocols. The TOS byte is used by the network to provide some level of Quality of Service (QoS) even if the network is congested with other traffic.

Asterisk running on Linux can also set 802.1p CoS marks in VLAN packets for the VoIP protocols it uses. This is useful when working in a switched environment. In fact Asterisk only set priority for Linux socket. For mapping this priority and VLAN CoS mark you need to use this command:

vconfig set_egress_map [vlan-device] [skb-priority] [vlan-qos] 

The table below shows all VoIP channel drivers and other Asterisk modules that support QoS settings for network traffic. It also shows the type(s) of traffic for which each module can support setting QoS settings:

Signaling Audio Video Text
chan_sip + + + +
chan_skinny + + +
chan_mgcp + +
chan_unistm + +
chan_h323 +
chan_iax2 +
chan_pjsip + + +
DUNDI + (tos setting)
IAXProv + (tos setting)

IP TOS values

The allowable values for any of the tos parameters are: CS0, CS1, CS2, CS3, CS4, CS5, CS6, CS7, AF11, AF12, AF13, AF21, AF22, AF23, AF31, AF32, AF33, AF41, AF42, AF43 and ef (expedited forwarding),*

The tos parameters also take numeric values.*

Note that on a Linux system, Asterisk must be compiled with libcap in order to use the ef tos setting if Asterisk is not run as root.

The lowdelay, throughput, reliability, mincost, and none values have been removed in current releases.

ToS decimal equivalence table:

name decimal value
cs0 0
cs1 32
af11 40
af12 48
af13 56
cs2 64
af21 72
af22 80
af23 88
cs3 96
af31 104
af32 112
af33 120
cs4 128
af41 136
af42 144
af43 152
cs5 160
ef 184
cs6 192
cs7 224

802.1p CoS values

Because 802.1p uses 3 bits of the VLAN header, this parameter can take integer values from 0 to 7.

The recommended values shown below are also included in sample configuration files:

tos cos
Signaling cs3 3
Audio ef 5
Video af41 4
Text af41 3
Other ef

IAX2

In iax.conf, there is a "tos" parameter that sets the global default TOS for IAX packets generated by chan_iax2. Since IAX connections combine signalling, audio, and video into one UDP stream, it is not possible to set the TOS separately for the different types of traffic.

In iaxprov.conf, there is a "tos" parameter that tells the IAXy what TOS to set on packets it generates. As with the parameter in iax.conf, IAX packets generated by an IAXy cannot have different TOS settings based upon the type of packet. However different IAXy devices can have different TOS settings.

CHAN_SIP

In chan_sip, there are four parameters that control the TOS settings: "tos_sip", "tos_audio", "tos_video" and "tos_text". tos_sip controls what TOS SIP call signaling packets are set to. tos_audio, tos_video and tos_text control what TOS values are used for RTP audio, video, and text packets, respectively.

CHAN_PJSIP

In chan_pjsip, there are three parameters that control the TOS settings: a tos option for a type=transportthat controls the TOS of SIP signaling packets, a tos_audio option for a type=endpoint that controls the TOS of RTP audio packets, and a tos_video option for a type=endpoint that controls the TOS of video packets.

Similarly, there are there parameters that control the 802.1p CoS settings: a cos option for a type=transport that controls the 802.1p value for SIP signaling packets, acos_audio option for a type=endpoint that controls the 802.1p value of RTP audio packets, and a cos_video option for a type=endpoint that controls the 802.1p value for video packets.

!!! tip ** Changes to a chan_pjsip **type=transport require an Asterisk restart to be affected. They are not affected by simply reloading Asterisk.

Other RTP channels

chan_mgcp, chan_h323, chan_skinny and chan_unistim also support TOS and CoS via setting tos and cos parameters in their corresponding configuration files. Naming style and behavior are the same as for chan_sip.

Reference

IEEE 802.1Q Standard: http://standards.ieee.org/getieee802/download/802.1Q-1998.pdfRelated protocols: IEEE 802.3, 802.2, 802.1D, 802.1Q

RFC 2474 - "Definition of the Differentiated Services Field (DS field) in the IPv4 and IPv6 Headers", Nichols, K., et al, December 1998.

IANA Assignments, DSCP registry Differentiated Services Field Codepoints http://www.iana.org/assignments/dscp-registry