[svn-commits] branch oej/iptos r8975 - in /team/oej/iptos: ./
channels/ configs/ doc/
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Tue Jan 31 07:29:03 MST 2006
Author: oej
Date: Tue Jan 31 08:28:56 2006
New Revision: 8975
URL: http://svn.digium.com/view/asterisk?rev=8975&view=rev
Log:
Adding jcollie's patch from issue 6355
Added:
team/oej/iptos/doc/README.tos
Modified:
team/oej/iptos/ (props changed)
team/oej/iptos/acl.c
team/oej/iptos/channels/chan_iax2.c
team/oej/iptos/channels/chan_sip.c
team/oej/iptos/channels/iax2-provision.c
team/oej/iptos/configs/iax.conf.sample
team/oej/iptos/configs/iaxprov.conf.sample
team/oej/iptos/configs/sip.conf.sample
Propchange: team/oej/iptos/
------------------------------------------------------------------------------
svnmerge-integrated = /trunk:1-8972
Modified: team/oej/iptos/acl.c
URL: http://svn.digium.com/view/asterisk/team/oej/iptos/acl.c?rev=8975&r1=8974&r2=8975&view=diff
==============================================================================
--- team/oej/iptos/acl.c (original)
+++ team/oej/iptos/acl.c Tue Jan 31 08:28:56 2006
@@ -253,15 +253,56 @@
int fval;
if (sscanf(value, "%i", &fval) == 1)
*tos = fval & 0xff;
- else if (!strcasecmp(value, "lowdelay"))
+ else if (!strcasecmp(value, "lowdelay")) {
*tos = IPTOS_LOWDELAY;
- else if (!strcasecmp(value, "throughput"))
+ ast_log(LOG_WARNING, "tos value %s is deprecated. See doc/README.tos for more information.", value);
+ } else if (!strcasecmp(value, "throughput")) {
*tos = IPTOS_THROUGHPUT;
- else if (!strcasecmp(value, "reliability"))
+ ast_log(LOG_WARNING, "tos value %s is deprecated. See doc/README.tos for more information.", value);
+ } else if (!strcasecmp(value, "reliability")) {
*tos = IPTOS_RELIABILITY;
- else if (!strcasecmp(value, "mincost"))
+ ast_log(LOG_WARNING, "tos value %s is deprecated. See doc/README.tos for more information.", value);
+ } else if (!strcasecmp(value, "mincost")) {
*tos = IPTOS_MINCOST;
- else if (!strcasecmp(value, "none"))
+ ast_log(LOG_WARNING, "tos value %s is deprecated. See doc/README.tos for more information.", value);
+ } else if (!strcasecmp(value, "none")) {
+ *tos = 0;
+ ast_log(LOG_WARNING, "tos value %s is deprecated. See doc/README.tos for more information.", value);
+ } else if (!strcasecmp(value, "ef"))
+ *tos = 46 << 2;
+ else if (!strcasecmp(value, "af43"))
+ *tos = 38 << 2;
+ else if (!strcasecmp(value, "af42"))
+ *tos = 36 << 2;
+ else if (!strcasecmp(value, "af41"))
+ *tos = 34 << 2;
+ else if (!strcasecmp(value, "cs4"))
+ *tos = 32 << 2;
+ else if (!strcasecmp(value, "af33"))
+ *tos = 30 << 2;
+ else if (!strcasecmp(value, "af32"))
+ *tos = 28 << 2;
+ else if (!strcasecmp(value, "af31"))
+ *tos = 26 << 2;
+ else if (!strcasecmp(value, "cs3"))
+ *tos = 24 << 2;
+ else if (!strcasecmp(value, "af23"))
+ *tos = 22 << 2;
+ else if (!strcasecmp(value, "af22"))
+ *tos = 20 << 2;
+ else if (!strcasecmp(value, "af21"))
+ *tos = 18 << 2;
+ else if (!strcasecmp(value, "cs2"))
+ *tos = 16 << 2;
+ else if (!strcasecmp(value, "af13"))
+ *tos = 14 << 2;
+ else if (!strcasecmp(value, "af12"))
+ *tos = 12 << 2;
+ else if (!strcasecmp(value, "af11"))
+ *tos = 10 << 2;
+ else if (!strcasecmp(value, "cs1"))
+ *tos = 8 << 2;
+ else if (!strcasecmp(value, "be"))
*tos = 0;
else
return -1;
Modified: team/oej/iptos/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/iptos/channels/chan_iax2.c?rev=8975&r1=8974&r2=8975&view=diff
==============================================================================
--- team/oej/iptos/channels/chan_iax2.c (original)
+++ team/oej/iptos/channels/chan_iax2.c Tue Jan 31 08:28:56 2006
@@ -8594,7 +8594,7 @@
tosval = ast_variable_retrieve(cfg, "general", "tos");
if (tosval) {
if (ast_str2tos(tosval, &tos))
- ast_log(LOG_WARNING, "Invalid tos value, should be 'lowdelay', 'throughput', 'reliability', 'mincost', or 'none'\n");
+ ast_log(LOG_WARNING, "Invalid tos value, see doc/README.tos for more information.\n");
}
while(v) {
if (!strcasecmp(v->name, "bindport")){
@@ -8732,7 +8732,7 @@
ast_context_create(NULL, regcontext, channeltype);
} else if (!strcasecmp(v->name, "tos")) {
if (ast_str2tos(v->value, &tos))
- ast_log(LOG_WARNING, "Invalid tos value at line %d, should be 'lowdelay', 'throughput', 'reliability', 'mincost', or 'none'\n", v->lineno);
+ ast_log(LOG_WARNING, "Invalid tos value at line %d, see doc/README.tos for more information.'\n", v->lineno);
} else if (!strcasecmp(v->name, "accountcode")) {
ast_copy_string(accountcode, v->value, sizeof(accountcode));
} else if (!strcasecmp(v->name, "amaflags")) {
Modified: team/oej/iptos/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/iptos/channels/chan_sip.c?rev=8975&r1=8974&r2=8975&view=diff
==============================================================================
--- team/oej/iptos/channels/chan_sip.c (original)
+++ team/oej/iptos/channels/chan_sip.c Tue Jan 31 08:28:56 2006
@@ -356,7 +356,9 @@
#define DEFAULT_VIDEOSUPPORT FALSE
#define DEFAULT_SRVLOOKUP FALSE /*!< Recommended setting is ON */
#define DEFAULT_COMPACTHEADERS FALSE
-#define DEFAULT_TOS FALSE
+#define DEFAULT_TOS_SIP 0 /*!< Call signalling packets should be marked as DSCP CS3, but the default is 0 to be compatible with previous versions. */
+#define DEFAULT_TOS_AUDIO 0 /*!< Audio packets should be marked as DSCP EF (Expedited Forwarding), but the default is 0 to be compatible with previous versions. */
+#define DEFAULT_TOS_VIDEO 0 /*!< Video packets should be marked as DSCP AF41, but the default is 0 to be compatible with previous versions. */
#define DEFAULT_ALLOW_EXT_DOM TRUE
#define DEFAULT_REALM "asterisk"
#define DEFAULT_NOTIFYRINGING TRUE
@@ -394,7 +396,9 @@
static int global_regattempts_max; /*!< Registration attempts before giving up */
static int global_allowguest; /*!< allow unauthenticated users/peers to connect? */
static int global_mwitime; /*!< Time between MWI checks for peers */
-static int global_tos; /*!< IP Type of service */
+static int global_tos_sip; /*!< IP type of service for SIP packets */
+static int global_tos_audio; /*!< IP type of service for audio RTP packets */
+static int global_tos_video; /*!< IP type of service for video RTP packets */
static int global_videosupport; /*!< Videosupport on or off */
static int compactheaders; /*!< send compact sip headers */
static int recordhistory; /*!< Record SIP history. Off by default */
@@ -3201,9 +3205,9 @@
free(p);
return NULL;
}
- ast_rtp_settos(p->rtp, global_tos);
+ ast_rtp_settos(p->rtp, global_tos_audio);
if (p->vrtp)
- ast_rtp_settos(p->vrtp, global_tos);
+ ast_rtp_settos(p->vrtp, global_tos_video);
p->rtptimeout = global_rtptimeout;
p->rtpholdtimeout = global_rtpholdtimeout;
p->rtpkeepalive = global_rtpkeepalive;
@@ -8299,7 +8303,9 @@
ast_cli(fd, " From: Domain: %s\n", default_fromdomain);
ast_cli(fd, " Record SIP history: %s\n", recordhistory ? "On" : "Off");
ast_cli(fd, " Call Events: %s\n", global_callevents ? "On" : "Off");
- ast_cli(fd, " IP ToS: 0x%x\n", global_tos);
+ ast_cli(fd, " IP ToS SIP: 0x%x\n", global_tos_sip);
+ ast_cli(fd, " IP ToS RTP audio: 0x%x\n", global_tos_audio);
+ ast_cli(fd, " IP ToS RTP video: 0x%x\n", global_tos_video);
#ifdef OSP_SUPPORT
ast_cli(fd, " OSP Support: Yes\n");
#else
@@ -12357,6 +12363,7 @@
int auto_sip_domains = FALSE;
struct sockaddr_in old_bindaddr = bindaddr;
int registry_count = 0, peer_count = 0, user_count = 0;
+ int temp_tos = 0;
cfg = ast_config_load(config);
@@ -12378,7 +12385,9 @@
outboundproxyip.sin_family = AF_INET; /* Type of address: IPv4 */
ourport = DEFAULT_SIP_PORT;
srvlookup = DEFAULT_SRVLOOKUP;
- global_tos = DEFAULT_TOS;
+ global_tos_sip = DEFAULT_TOS_SIP;
+ global_tos_audio = DEFAULT_TOS_AUDIO;
+ global_tos_video = DEFAULT_TOS_VIDEO;
externhost[0] = '\0'; /* External host name (for behind NAT DynDNS support) */
externexpire = 0; /* Expiration for DNS re-issuing */
externrefresh = 10;
@@ -12598,8 +12607,22 @@
if (sip_register(v->value, v->lineno) == 0)
registry_count++;
} else if (!strcasecmp(v->name, "tos")) {
- if (ast_str2tos(v->value, &global_tos))
- ast_log(LOG_WARNING, "Invalid tos value at line %d, should be 'lowdelay', 'throughput', 'reliability', 'mincost', or 'none'\n", v->lineno);
+ if (!ast_str2tos(v->value, &temp_tos)) {
+ global_tos_sip = temp_tos;
+ global_tos_audio = temp_tos;
+ global_tos_video = temp_tos;
+ ast_log(LOG_WARNING, "tos value at line %s is deprecated. See doc/README.tos for more information.", v->lineno);
+ } else
+ ast_log(LOG_WARNING, "Invalid tos value at line %d, See doc/README.tos for more information.\n", v->lineno);
+ } else if (!strcasecmp(v->name, "tos_sip")) {
+ if (ast_str2tos(v->value, &global_tos_sip))
+ ast_log(LOG_WARNING, "Invalid tos_sip value at line %d, recommended value is 'cs3'. See doc/README.tos.\n", v->lineno);
+ } else if (!strcasecmp(v->name, "tos_audio")) {
+ if (ast_str2tos(v->value, &global_tos_audio))
+ ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, recommended value is 'ef'. See doc/README.tos.\n", v->lineno);
+ } else if (!strcasecmp(v->name, "tos_video")) {
+ if (ast_str2tos(v->value, &global_tos_video))
+ ast_log(LOG_WARNING, "Invalid tos_video value at line %d, recommended value is 'af41'. See doc/README.tos.\n", v->lineno);
} else if (!strcasecmp(v->name, "bindport")) {
if (sscanf(v->value, "%d", &ourport) == 1) {
bindaddr.sin_port = htons(ourport);
@@ -12708,10 +12731,10 @@
if (option_verbose > 1) {
ast_verbose(VERBOSE_PREFIX_2 "SIP Listening on %s:%d\n",
ast_inet_ntoa(iabuf, sizeof(iabuf), bindaddr.sin_addr), ntohs(bindaddr.sin_port));
- ast_verbose(VERBOSE_PREFIX_2 "Using TOS bits %d\n", global_tos);
+ ast_verbose(VERBOSE_PREFIX_2 "Using SIP TOS bits %d\n", global_tos_sip);
}
- if (setsockopt(sipsock, IPPROTO_IP, IP_TOS, &global_tos, sizeof(global_tos)))
- ast_log(LOG_WARNING, "Unable to set TOS to %d\n", global_tos);
+ if (setsockopt(sipsock, IPPROTO_IP, IP_TOS, &global_tos_sip, sizeof(global_tos_sip)))
+ ast_log(LOG_WARNING, "Unable to set SIP TOS to %d\n", global_tos_sip);
}
}
}
Modified: team/oej/iptos/channels/iax2-provision.c
URL: http://svn.digium.com/view/asterisk/team/oej/iptos/channels/iax2-provision.c?rev=8975&r1=8974&r2=8975&view=diff
==============================================================================
--- team/oej/iptos/channels/iax2-provision.c (original)
+++ team/oej/iptos/channels/iax2-provision.c Tue Jan 31 08:28:56 2006
@@ -328,20 +328,8 @@
} else
ast_log(LOG_WARNING, "Ignoring invalid codec '%s' for '%s' at line %d\n", v->value, s, v->lineno);
} else if (!strcasecmp(v->name, "tos")) {
- if (sscanf(v->value, "%d", &x) == 1)
- cur->tos = x & 0xff;
- else if (!strcasecmp(v->value, "lowdelay"))
- cur->tos = IPTOS_LOWDELAY;
- else if (!strcasecmp(v->value, "throughput"))
- cur->tos = IPTOS_THROUGHPUT;
- else if (!strcasecmp(v->value, "reliability"))
- cur->tos = IPTOS_RELIABILITY;
- else if (!strcasecmp(v->value, "mincost"))
- cur->tos = IPTOS_MINCOST;
- else if (!strcasecmp(v->value, "none"))
- cur->tos = 0;
- else
- ast_log(LOG_WARNING, "Invalid tos value at line %d, should be 'lowdelay', 'throughput', 'reliability', 'mincost', or 'none'\n", v->lineno);
+ if (ast_str2tos(v->value, &cur->tos))
+ ast_log(LOG_WARNING, "Invalid tos value at line %d, see doc/README.tos for more information.\n", v->lineno);
} else if (!strcasecmp(v->name, "user")) {
strncpy(cur->user, v->value, sizeof(cur->user) - 1);
if (strcmp(cur->user, v->value))
@@ -453,7 +441,7 @@
ast_cli(fd, "Alternate: %s\n", iax_server(iabuf, sizeof(iabuf), cur->altserver));
ast_cli(fd, "Flags: %s\n", iax_provflags2str(iabuf, sizeof(iabuf), cur->flags));
ast_cli(fd, "Format: %s\n", ast_getformatname(cur->format));
- ast_cli(fd, "TOS: %d\n", cur->tos);
+ ast_cli(fd, "TOS: 0x%x\n", cur->tos);
found++;
}
}
Modified: team/oej/iptos/configs/iax.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/iptos/configs/iax.conf.sample?rev=8975&r1=8974&r2=8975&view=diff
==============================================================================
--- team/oej/iptos/configs/iax.conf.sample (original)
+++ team/oej/iptos/configs/iax.conf.sample Tue Jan 31 08:28:56 2006
@@ -203,15 +203,8 @@
;
;authdebug=no
;
-; Finally, you can set values for your TOS bits to help improve
-; performance. Valid values are:
-; lowdelay -- Minimize delay
-; throughput -- Maximize throughput
-; reliability -- Maximize reliability
-; mincost -- Minimize cost
-; none -- No flags
-;
-tos=lowdelay
+; See doc/README.tos for a description of the tos parameters.
+;tos=ef
;
; If mailboxdetail is set to "yes", the user receives
; the actual new/old message counts, not just a yes/no
Modified: team/oej/iptos/configs/iaxprov.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/iptos/configs/iaxprov.conf.sample?rev=8975&r1=8974&r2=8975&view=diff
==============================================================================
--- team/oej/iptos/configs/iaxprov.conf.sample (original)
+++ team/oej/iptos/configs/iaxprov.conf.sample Tue Jan 31 08:28:56 2006
@@ -53,10 +53,8 @@
;
flags=register,heartbeat
;
-; tos is the requested type of service setting and may be one a number or
-; 'lowdelay','throughput','reliability','mincost' or 'none'
-;
-tos=lowdelay
+; See doc/README.tos for a description of this parameter.
+;tos=ef
;
; Example iaxy provisioning
;
Modified: team/oej/iptos/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/iptos/configs/sip.conf.sample?rev=8975&r1=8974&r2=8975&view=diff
==============================================================================
--- team/oej/iptos/configs/sip.conf.sample (original)
+++ team/oej/iptos/configs/sip.conf.sample Tue Jan 31 08:28:56 2006
@@ -56,8 +56,12 @@
;pedantic=yes ; Enable slow, pedantic checking for Pingtel
; and multiline formatted headers for strict
; SIP compatibility (defaults to "no")
-;tos=184 ; Set IP QoS to either a keyword or numeric val
-;tos=lowdelay ; lowdelay,throughput,reliability,mincost,none
+
+; See doc/README.tos for a description of these parameters.
+;tos_sip=cs3 ; Sets TOS for SIP packets.
+;tos_audio=ef ; Sets TOS for RTP audio packets.
+;tos_video=af41 ; Sets TOS for RTP video packets.
+
;maxexpiry=3600 ; Max length of incoming registrations/subscriptions we allow (seconds)
;minexpiry=60 ; Minimum length of registrations/subscriptions (default 60)
;defaultexpiry=120 ; Default length of incoming/outoing registration
Added: team/oej/iptos/doc/README.tos
URL: http://svn.digium.com/view/asterisk/team/oej/iptos/doc/README.tos?rev=8975&view=auto
==============================================================================
--- team/oej/iptos/doc/README.tos (added)
+++ team/oej/iptos/doc/README.tos Tue Jan 31 08:28:56 2006
@@ -1,0 +1,60 @@
+Asterisk can set the Type of Service (TOS) byte 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. For more information on Quality of
+Service for VoIP networks see the "Enterprise QoS Solution Reference
+Network Design Guide" version 3.3 from Cisco at:
+
+<http://www.cisco.com/application/pdf/en/us/guest/netsol/ns432/c649/ccmigration_09186a008049b062.pdf>
+
+In sip.conf, there are three parameters that control the TOS settings:
+tos_sip, tos_audio, and tos_video. tos_sip controls what TOS SIP call
+signalling packets are set to. tos_audio controls what TOS RTP audio
+packets are set to. tos_video controls what TOS RTP video packets are
+set to. There is a "tos" parameter that is supported for backwards
+compatibility. The tos parameter should be avoided in sip.conf
+because it sets all three tos settings in sip.conf to the same value.
+
+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.
+
+The allowable values for any of the tos* parameters are:
+
+be (best effort), cs1, af11, af12, af13, cs2, af21, af22, af23, cs3,
+af31, af32, af33, cs4, af41, af42, af42, ef (expedited forwarding),
+lowdelay, throughput, reliability, mincost, none
+
+The tos* parameters also take numeric values.
+
+The lowdelay, throughput, reliability, mincost, and none values are
+deprecated because they set the IP TOS using the outdated "IP
+prececence" model as defined in RFC 791 and RFC 1349.
+
+===========================================
+Configuation Parameter Recommended
+File Setting
+-------------------------------------------
+sip.conf tos_sip cs3
+sip.conf tos_audio ef
+sip.conf tos_video af41
+-------------------------------------------
+iax.conf tos ef
+-------------------------------------------
+iaxprov.conf tos ef
+===========================================
+
+To get the most out of setting the TOS on packets generated by
+Asterisk, you will need to ensure that your network handles packets
+with a TOS properly. For Cisco devices, see the previously mentioned
+"Enterprise QoS Solution Reference Network Design Guide". For Linux
+systems see the "Linux Advanced Routing & Traffic Control HOWTO" at
+<http://www.lartc.org/>.
+
More information about the svn-commits
mailing list