[asterisk-commits] oej: trunk r93163 - in /trunk: ./ channels/ configs/ doc/tex/ include/asteris...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Dec 16 04:51:54 CST 2007


Author: oej
Date: Sun Dec 16 04:51:53 2007
New Revision: 93163

URL: http://svn.digium.com/view/asterisk?view=rev&rev=93163
Log:
HUGE improvements to QoS/CoS handling by IgorG

- Refer to the proper documentation
- Implement separate signalling/media QoS/CoS in many channels using RTP
- Improve warnings and verbose messages
- Deprecate some old settings

Minor modifications by me, a big effort from IgorG.
Thanks!


Reported by: IgorG
Patches: 
      qoscleanup-89394-4-trunk.patch uploaded by IgorG (license 20)
Tested by: IgorG
(closes issue #11145)

Modified:
    trunk/CHANGES
    trunk/UPGRADE.txt
    trunk/channels/chan_h323.c
    trunk/channels/chan_iax2.c
    trunk/channels/chan_mgcp.c
    trunk/channels/chan_sip.c
    trunk/channels/chan_skinny.c
    trunk/channels/chan_unistim.c
    trunk/channels/iax2-provision.c
    trunk/configs/dundi.conf.sample
    trunk/configs/h323.conf.sample
    trunk/configs/iax.conf.sample
    trunk/configs/iaxprov.conf.sample
    trunk/configs/mgcp.conf.sample
    trunk/configs/sip.conf.sample
    trunk/configs/skinny.conf.sample
    trunk/configs/unistim.conf.sample
    trunk/doc/tex/qos.tex
    trunk/include/asterisk/netsock.h
    trunk/include/asterisk/rtp.h
    trunk/main/netsock.c
    trunk/main/rtp.c
    trunk/main/udptl.c
    trunk/pbx/pbx_dundi.c

Modified: trunk/CHANGES
URL: http://svn.digium.com/view/asterisk/trunk/CHANGES?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Sun Dec 16 04:51:53 2007
@@ -116,6 +116,11 @@
 -------------
   * Added skinny show device, skinny show line, and skinny show settings CLI commands.
   * Proper codec support in chan_skinny.
+  * Added settings for IP and Ethernet QoS requests
+
+MGCP changes
+------------
+  * Added separate settings for media QoS in mgcp.conf
 
 DUNDi changes
 -------------

Modified: trunk/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/trunk/UPGRADE.txt?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/UPGRADE.txt (original)
+++ trunk/UPGRADE.txt Sun Dec 16 04:51:53 2007
@@ -132,6 +132,9 @@
 * chan_local.c: the comma delimiter inside the channel name has been changed to a
   semicolon, in order to make the Local channel driver compatible with the comma
   delimiter change in applications.
+* H323: The "tos" setting has changed name to "tos_audio" and "cos" to "cos_audio"
+  to be compatible with settings in sip.conf. The "tos" and "cos" configuration
+  is deprecated and will stop working in the next release of Asterisk.
 
 Configuration:
 

Modified: trunk/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_h323.c?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/channels/chan_h323.c (original)
+++ trunk/channels/chan_h323.c Sun Dec 16 04:51:53 2007
@@ -970,7 +970,7 @@
 	if (h323debug)
 		ast_debug(1, "Created RTP channel\n");
 
-	ast_rtp_setqos(pvt->rtp, tos, cos);
+	ast_rtp_setqos(pvt->rtp, tos, cos, "H323 RTP");
 
 	if (h323debug)
 		ast_debug(1, "Setting NAT on RTP to %d\n", pvt->options.nat);
@@ -2904,13 +2904,23 @@
 			} else {
 				memcpy(&bindaddr.sin_addr, hp->h_addr, sizeof(bindaddr.sin_addr));
 			}
-		} else if (!strcasecmp(v->name, "tos")) {
+		} else if (!strcasecmp(v->name, "tos")) {	/* Needs to be removed in next release */
+			ast_log(LOG_WARNING, "The \"tos\" setting is deprecated in this version of Asterisk. Please change to \"tos_audio\".\n");
 			if (ast_str2tos(v->value, &tos)) {
-				ast_log(LOG_WARNING, "Invalid tos value at line %d, for more info read doc/qos.tex\n", v->lineno);			
-			}
-		} else if (!strcasecmp(v->name, "cos")) {		
+				ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, refer to QoS documentation\n", v->lineno);			
+			}
+		} else if (!strcasecmp(v->name, "tos_audio")) {
+			if (ast_str2tos(v->value, &tos)) {
+				ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, refer to QoS documentation\n", v->lineno);			
+			}
+		} else if (!strcasecmp(v->name, "cos")) {
+			ast_log(LOG_WARNING, "The \"cos\" setting is deprecated in this version of Asterisk. Please change to \"cos_audio\".\n");
 			if (ast_str2cos(v->value, &cos)) {
-				ast_log(LOG_WARNING, "Invalid cos value at line %d, for more info read doc/qos.tex\n", v->lineno);			
+				ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);			
+			}
+		} else if (!strcasecmp(v->name, "cos_audio")) {
+			if (ast_str2cos(v->value, &cos)) {
+				ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);			
 			}
 		} else if (!strcasecmp(v->name, "gatekeeper")) {
 			if (!strcasecmp(v->value, "DISABLE")) {

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Sun Dec 16 04:51:53 2007
@@ -10422,13 +10422,13 @@
 	tosval = ast_variable_retrieve(cfg, "general", "tos");
 	if (tosval) {
 		if (ast_str2tos(tosval, &tos))
-			ast_log(LOG_WARNING, "Invalid tos value, see doc/qos.tex for more information.\n");
+			ast_log(LOG_WARNING, "Invalid tos value, refer to QoS documentation\n");
 	}
 	/* Seed initial cos value */
 	tosval = ast_variable_retrieve(cfg, "general", "cos");
 	if (tosval) {
 		if (ast_str2cos(tosval, &cos))
-			ast_log(LOG_WARNING, "Invalid cos value, see doc/qos.tex for more information.\n");
+			ast_log(LOG_WARNING, "Invalid cos value, refer to QoS documentation\n");
 	}
 	while(v) {
 		if (!strcasecmp(v->name, "bindport")){ 
@@ -10601,10 +10601,10 @@
 				ast_context_create(NULL, regcontext, "IAX2");
 		} else if (!strcasecmp(v->name, "tos")) {
 			if (ast_str2tos(v->value, &tos))
-				ast_log(LOG_WARNING, "Invalid tos value at line %d, see doc/qos.tex for more information.'\n", v->lineno);
+				ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "cos")) {
 			if (ast_str2cos(v->value, &cos))
-				ast_log(LOG_WARNING, "Invalid cos value at line %d, see doc/qos.tex for more information.'\n", v->lineno);
+				ast_log(LOG_WARNING, "Invalid cos value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "accountcode")) {
 			ast_copy_string(accountcode, v->value, sizeof(accountcode));
 		} else if (!strcasecmp(v->name, "mohinterpret")) {

Modified: trunk/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_mgcp.c?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/channels/chan_mgcp.c (original)
+++ trunk/channels/chan_mgcp.c Sun Dec 16 04:51:53 2007
@@ -153,8 +153,9 @@
 static ast_group_t cur_pickupgroup = 0;
 
 static unsigned int tos = 0;
-
+static unsigned int tos_audio = 0;
 static unsigned int cos = 0;
+static unsigned int cos_audio = 0;
 
 static int immediate = 0;
 
@@ -2591,8 +2592,10 @@
 	sub->rtp = ast_rtp_new_with_bindaddr(sched, io, 1, 0, bindaddr.sin_addr);
 	if (sub->rtp && sub->owner)
 		ast_channel_set_fd(sub->owner, 0, ast_rtp_fd(sub->rtp));
-	if (sub->rtp)
+	if (sub->rtp) {
+		ast_rtp_setqos(sub->rtp, tos_audio, cos_audio, "MGCP RTP");
 		ast_rtp_setnat(sub->rtp, sub->nat);
+	}
 #if 0
 	ast_rtp_set_callback(p->rtp, rtpready);
 	ast_rtp_set_data(p->rtp, p);
@@ -4097,10 +4100,16 @@
 				capability &= ~format;
 		} else if (!strcasecmp(v->name, "tos")) {
 			if (ast_str2tos(v->value, &tos))
-			    ast_log(LOG_WARNING, "Invalid tos value at line %d, see doc/qos.tex for more information.\n", v->lineno);
+			    ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno);
+		} else if (!strcasecmp(v->name, "tos_audio")) {
+			if (ast_str2tos(v->value, &tos_audio))
+			    ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "cos")) {				
 			if (ast_str2cos(v->value, &cos))
-			    ast_log(LOG_WARNING, "Invalid cos value at line %d, see doc/qos.tex for more information.\n", v->lineno);
+			    ast_log(LOG_WARNING, "Invalid cos value at line %d, refer to QoS documentation\n", v->lineno);
+		} else if (!strcasecmp(v->name, "cos_audio")) {				
+			if (ast_str2cos(v->value, &cos_audio))
+			    ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "port")) {
 			if (sscanf(v->value, "%d", &ourport) == 1) {
 				bindaddr.sin_port = htons(ourport);
@@ -4184,7 +4193,7 @@
 		} else {
 			ast_verb(2, "MGCP Listening on %s:%d\n",
 					ast_inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port));
-			ast_netsock_set_qos(mgcpsock, tos, cos);
+			ast_netsock_set_qos(mgcpsock, tos, cos, "MGCP");
 		}
 	}
 	ast_mutex_unlock(&netlock);

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Sun Dec 16 04:51:53 2007
@@ -545,7 +545,7 @@
 #define DEFAULT_COS_SIP         4
 #define DEFAULT_COS_AUDIO       5
 #define DEFAULT_COS_VIDEO       6
-#define DEFAULT_COS_TEXT        0
+#define DEFAULT_COS_TEXT        5
 #define DEFAULT_ALLOW_EXT_DOM	TRUE
 #define DEFAULT_REALM		"asterisk"
 #define DEFAULT_NOTIFYRINGING	TRUE
@@ -5130,14 +5130,14 @@
 			ast_free(p);
 			return NULL;
 		}
-		ast_rtp_setqos(p->rtp, global_tos_audio, global_cos_audio);
+		ast_rtp_setqos(p->rtp, global_tos_audio, global_cos_audio, "SIP RTP");
 		ast_rtp_setdtmf(p->rtp, ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833);
 		ast_rtp_setdtmfcompensate(p->rtp, ast_test_flag(&p->flags[1], SIP_PAGE2_RFC2833_COMPENSATE));
 		ast_rtp_set_rtptimeout(p->rtp, global_rtptimeout);
 		ast_rtp_set_rtpholdtimeout(p->rtp, global_rtpholdtimeout);
 		ast_rtp_set_rtpkeepalive(p->rtp, global_rtpkeepalive);
 		if (p->vrtp) {
-			ast_rtp_setqos(p->vrtp, global_tos_video, global_cos_video);
+			ast_rtp_setqos(p->vrtp, global_tos_video, global_cos_video, "SIP VRTP");
 			ast_rtp_setdtmf(p->vrtp, 0);
 			ast_rtp_setdtmfcompensate(p->vrtp, 0);
 			ast_rtp_set_rtptimeout(p->vrtp, global_rtptimeout);
@@ -5145,7 +5145,7 @@
 			ast_rtp_set_rtpkeepalive(p->vrtp, global_rtpkeepalive);
 		}
 		if (p->trtp) {
-			ast_rtp_setqos(p->trtp, global_tos_text, global_cos_text);
+			ast_rtp_setqos(p->trtp, global_tos_text, global_cos_text, "SIP TRTP");
 			ast_rtp_setdtmf(p->trtp, 0);
 			ast_rtp_setdtmfcompensate(p->trtp, 0);
 		}
@@ -18575,24 +18575,28 @@
 				registry_count++;
 		} 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/qos.tex.\n", v->lineno);
+				ast_log(LOG_WARNING, "Invalid tos_sip value at line %d, refer to QoS documentation\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/qos.tex.\n", v->lineno);
+				ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, refer to QoS documentation\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/qos.tex.\n", v->lineno);
+				ast_log(LOG_WARNING, "Invalid tos_video value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "tos_text")) {
 			if (ast_str2tos(v->value, &global_tos_text))
-				ast_log(LOG_WARNING, "Invalid tos_text value at line %d, recommended value is 'af41'. See doc/qos.tex.\n", v->lineno);
+				ast_log(LOG_WARNING, "Invalid tos_text value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "cos_sip")) {
-			ast_str2cos(v->value, &global_cos_sip);
+			if (ast_str2cos(v->value, &global_cos_sip))
+				ast_log(LOG_WARNING, "Invalid cos_sip value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "cos_audio")) {
-			ast_str2cos(v->value, &global_cos_audio);
+			if (ast_str2cos(v->value, &global_cos_audio))
+				ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "cos_video")) {
-			ast_str2cos(v->value, &global_cos_video);
+			if (ast_str2cos(v->value, &global_cos_video))
+				ast_log(LOG_WARNING, "Invalid cos_video value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "cos_text")) {
-			ast_str2cos(v->value, &global_cos_text);
+			if (ast_str2cos(v->value, &global_cos_text))
+				ast_log(LOG_WARNING, "Invalid cos_text value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "bindport")) {
 			int i;
 			if (sscanf(v->value, "%d", &i) == 1) {
@@ -18761,7 +18765,7 @@
 			} else {
 				ast_verb(2, "SIP Listening on %s:%d\n",
 						ast_inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port));
-				ast_netsock_set_qos(sipsock, global_tos_sip, global_cos_sip);
+				ast_netsock_set_qos(sipsock, global_tos_sip, global_cos_sip, "SIP");
 			}
 		}
 	}

Modified: trunk/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_skinny.c?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Sun Dec 16 04:51:53 2007
@@ -50,6 +50,7 @@
 #include "asterisk/sched.h"
 #include "asterisk/io.h"
 #include "asterisk/rtp.h"
+#include "asterisk/netsock.h"
 #include "asterisk/acl.h"
 #include "asterisk/callerid.h"
 #include "asterisk/cli.h"
@@ -89,6 +90,13 @@
 #define DEFAULT_SKINNY_PORT	2000
 #define DEFAULT_SKINNY_BACKLOG	2
 #define SKINNY_MAX_PACKET	1000
+
+static unsigned int tos = 0;
+static unsigned int tos_audio = 0;
+static unsigned int tos_video = 0;
+static unsigned int cos = 0;
+static unsigned int cos_audio = 0;
+static unsigned int cos_video = 0;
 
 static int keep_alive = 120;
 static char vmexten[AST_MAX_EXTENSION];		/* Voicemail pilot number */
@@ -2976,9 +2984,11 @@
 		ast_channel_set_fd(sub->owner, 3, ast_rtcp_fd(sub->vrtp));
 	}
 	if (sub->rtp) {
+		ast_rtp_setqos(sub->rtp, tos_audio, cos_audio, "Skinny RTP");
 		ast_rtp_setnat(sub->rtp, l->nat);
 	}
 	if (sub->vrtp) {
+		ast_rtp_setqos(sub->vrtp, tos_video, cos_video, "Skinny VRTP");
 		ast_rtp_setnat(sub->vrtp, l->nat);
 	}
 	/* Set Frame packetization */
@@ -5516,6 +5526,24 @@
 			ast_copy_string(regcontext, v->value, sizeof(regcontext));
 		} else if (!strcasecmp(v->name, "dateformat")) {
 			memcpy(date_format, v->value, sizeof(date_format));
+                } else if (!strcasecmp(v->name, "tos")) {
+                        if (ast_str2tos(v->value, &tos))
+                    		ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno);
+                } else if (!strcasecmp(v->name, "tos_audio")) {
+                        if (ast_str2tos(v->value, &tos_audio))
+                    		ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, refer to QoS documentation\n", v->lineno);
+                } else if (!strcasecmp(v->name, "tos_video")) {
+                        if (ast_str2tos(v->value, &tos_video))
+                    		ast_log(LOG_WARNING, "Invalid tos_video value at line %d, refer to QoS documentation\n", v->lineno);
+		} else if (!strcasecmp(v->name, "cos")) {
+		        if (ast_str2cos(v->value, &cos))
+		                ast_log(LOG_WARNING, "Invalid cos value at line %d, refer to QoS documentation\n", v->lineno);
+		} else if (!strcasecmp(v->name, "cos_audio")) {
+		        if (ast_str2cos(v->value, &cos_audio))
+		                ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);
+		} else if (!strcasecmp(v->name, "cos_video")) {
+		        if (ast_str2cos(v->value, &cos_video))
+		                ast_log(LOG_WARNING, "Invalid cos_video value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "allow")) {
 			ast_parse_allow_disallow(&default_prefs, &default_capability, v->value, 1);
 		} else if (!strcasecmp(v->name, "disallow")) {
@@ -5604,6 +5632,7 @@
 			}
 			ast_verb(2, "Skinny listening on %s:%d\n",
 					ast_inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port));
+			ast_netsock_set_qos(skinnysock, tos, cos, "Skinny");
 			ast_pthread_create_background(&accept_t,NULL, accept_thread, NULL);
 		}
 	}

Modified: trunk/channels/chan_unistim.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_unistim.c?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/channels/chan_unistim.c (original)
+++ trunk/channels/chan_unistim.c Sun Dec 16 04:51:53 2007
@@ -59,6 +59,7 @@
 #include "asterisk/sched.h"
 #include "asterisk/io.h"
 #include "asterisk/rtp.h"
+#include "asterisk/netsock.h"
 #include "asterisk/acl.h"
 #include "asterisk/callerid.h"
 #include "asterisk/cli.h"
@@ -214,6 +215,10 @@
 static enum autoprovision autoprovisioning = AUTOPROVISIONING_NO;
 static int unistim_keepalive;
 static int unistimsock = -1;
+static unsigned int tos = 0;
+static unsigned int tos_audio = 0;
+static unsigned int cos = 0;
+static unsigned int cos_audio = 0;
 static struct io_context *io;
 static struct sched_context *sched;
 static struct sockaddr_in public_ip = { 0, };
@@ -2075,8 +2080,10 @@
 		sub->owner->fds[0] = ast_rtp_fd(sub->rtp);
 		sub->owner->fds[1] = ast_rtcp_fd(sub->rtp);
 	}
-	if (sub->rtp)
+	if (sub->rtp) {
+		ast_rtp_setqos(sub->rtp, tos_audio, cos_audio, "UNISTIM RTP");
 		ast_rtp_setnat(sub->rtp, sub->parent->parent->nat);
+	}
 
 	/* Create the RTP connection */
 	ast_rtp_get_us(sub->rtp, &us);
@@ -5330,7 +5337,19 @@
 			unistim_keepalive = atoi(v->value);
 		else if (!strcasecmp(v->name, "port"))
 			unistim_port = atoi(v->value);
-		else if (!strcasecmp(v->name, "autoprovisioning")) {
+                else if (!strcasecmp(v->name, "tos")) {
+                        if (ast_str2tos(v->value, &tos))
+                            ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno);
+                } else if (!strcasecmp(v->name, "tos_audio")) {
+                        if (ast_str2tos(v->value, &tos_audio))
+                            ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, refer to QoS documentation\n", v->lineno);
+                } else if (!strcasecmp(v->name, "cos")) {
+                        if (ast_str2cos(v->value, &cos))
+                            ast_log(LOG_WARNING, "Invalid cos value at line %d, refer to QoS documentation\n", v->lineno);
+                } else if (!strcasecmp(v->name, "cos_audio")) {
+                        if (ast_str2cos(v->value, &cos_audio))
+                            ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);
+		} else if (!strcasecmp(v->name, "autoprovisioning")) {
 			if (!strcasecmp(v->value, "no"))
 				autoprovisioning = AUTOPROVISIONING_NO;
 			else if (!strcasecmp(v->value, "yes"))
@@ -5511,6 +5530,7 @@
 						"UNISTIM Listening on %s:%d\n",
 						ast_inet_ntoa(bindaddr.sin_addr), htons(bindaddr.sin_port));
 		}
+		ast_netsock_set_qos(unistimsock, tos, cos, "UNISTIM");
 	}
 	return 0;
 }

Modified: trunk/channels/iax2-provision.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/iax2-provision.c?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/channels/iax2-provision.c (original)
+++ trunk/channels/iax2-provision.c Sun Dec 16 04:51:53 2007
@@ -323,7 +323,7 @@
 				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 (ast_str2tos(v->value, &cur->tos))
-				ast_log(LOG_WARNING, "Invalid tos value at line %d, see doc/qos.tex for more information.\n", v->lineno);
+				ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "user")) {
 			strncpy(cur->user, v->value, sizeof(cur->user) - 1);
 			if (strcmp(cur->user, v->value))

Modified: trunk/configs/dundi.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/dundi.conf.sample?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/configs/dundi.conf.sample (original)
+++ trunk/configs/dundi.conf.sample Sun Dec 16 04:51:53 2007
@@ -27,7 +27,7 @@
 ;bindaddr=0.0.0.0
 ;port=4520
 ;
-; See doc/qos.tex for a description of the tos parameter.
+; See qos.tex or Quality of Service section of asterisk.pdf for a description of the tos parameter.
 ;tos=ef
 ;
 ; Our entity identifier (Should generally be the MAC address of the

Modified: trunk/configs/h323.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/h323.conf.sample?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/configs/h323.conf.sample (original)
+++ trunk/configs/h323.conf.sample Sun Dec 16 04:51:53 2007
@@ -4,7 +4,10 @@
 [general]
 port = 1720
 ;bindaddr = 1.2.3.4 	; this SHALL contain a single, valid IP address for this machine
-;tos=ef
+;
+; See qos.tex or Quality of Service section of asterisk.pdf for a description of these parameters.
+;tos_audio=ef		; Sets TOS for RTP audio packets.
+;cos_audio=5		; Sets 802.1p priority for RTP audio packets.
 ;
 ; You may specify a global default AMA flag for iaxtel calls.  It must be
 ; one of 'default', 'omit', 'billing', or 'documentation'.  These flags

Modified: trunk/configs/iax.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/iax.conf.sample?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/configs/iax.conf.sample (original)
+++ trunk/configs/iax.conf.sample Sun Dec 16 04:51:53 2007
@@ -225,7 +225,7 @@
 ;
 ;authdebug=no
 ;
-; See doc/qos.tex for a description of the tos parameters.
+; See qos.tex or Quality of Service section of asterisk.pdf for a description of these parameters.
 ;tos=ef
 ;cos=5
 ;

Modified: trunk/configs/iaxprov.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/iaxprov.conf.sample?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/configs/iaxprov.conf.sample (original)
+++ trunk/configs/iaxprov.conf.sample Sun Dec 16 04:51:53 2007
@@ -53,7 +53,7 @@
 ;
 flags=register,heartbeat
 ;
-; See doc/qos.tex for a description of this parameter.
+; See qos.tex or Quality of Service section of asterisk.pdf for a description of this parameter.
 ;tos=ef
 ;
 ; Example iaxy provisioning

Modified: trunk/configs/mgcp.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/mgcp.conf.sample?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/configs/mgcp.conf.sample (original)
+++ trunk/configs/mgcp.conf.sample Sun Dec 16 04:51:53 2007
@@ -5,8 +5,11 @@
 ;port = 2427
 ;bindaddr = 0.0.0.0
 
-; See doc/qos.tex for a description of the tos parameters.
-;tos=ef
+; See qos.tex or Quality of Service section of asterisk.pdf for a description of these parameters.
+;tos=cs3		; Sets TOS for signaling packets.
+;tos_audio=ef		; Sets TOS for RTP audio packets.
+;cos=3			; Sets 802.1p priority for signaling packets.
+;cos_audio=5		; Sets 802.1p priority for RTP audio packets.
 
 ;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
 ; jbenable = yes              ; Enables the use of a jitterbuffer on the receiving side of a

Modified: trunk/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/sip.conf.sample?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/configs/sip.conf.sample (original)
+++ trunk/configs/sip.conf.sample Sun Dec 16 04:51:53 2007
@@ -66,16 +66,16 @@
 				; and multiline formatted headers for strict
 				; SIP compatibility (defaults to "no")
 
-; See doc/qos.tex for a description of these parameters.
+; See qos.tex or Quality of Service section of asterisk.pdf 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.
 ;tos_text=af41                  ; Sets TOS for RTP text packets.
 
-;cos_sip=4                      ; Sets CoS for SIP packets.
-;cos_audio=6                    ; Sets CoS for RTP audio packets.
-;cos_video=5                    ; Sets CoS for RTP video packets.
-;cos_text=0                     ; Sets CoS for RTP text packets.
+;cos_sip=3                      ; Sets 802.1p priority for SIP packets.
+;cos_audio=5                    ; Sets 802.1p priority for RTP audio packets.
+;cos_video=4                    ; Sets 802.1p priority for RTP video packets.
+;cos_text=3                     ; Sets 802.1p priority for RTP text packets.
 
 ;maxexpiry=3600			; Maximum allowed time of incoming registrations
 				; and subscriptions (seconds)

Modified: trunk/configs/skinny.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/skinny.conf.sample?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/configs/skinny.conf.sample (original)
+++ trunk/configs/skinny.conf.sample Sun Dec 16 04:51:53 2007
@@ -27,6 +27,14 @@
 
 ;allow=all		; see doc/rtp-packetization for framing options
 ;disallow=
+
+; See qos.tex or Quality of Service section of asterisk.pdf for a description of these parameters.
+;tos=cs3		; Sets TOS for signaling packets.
+;tos_audio=ef		; Sets TOS for RTP audio packets.
+;tos_video=af41		; Sets TOS for RTP video packets.
+;cos=3			; Sets 802.1p priority for signaling packets.
+;cos_audio=5		; Sets 802.1p priority for RTP audio packets.
+;cos_video=4		; Sets 802.1p priority for RTP video packets.
 
 ;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
 ;jbenable = yes              ; Enables the use of a jitterbuffer on the receiving side of a

Modified: trunk/configs/unistim.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/unistim.conf.sample?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/configs/unistim.conf.sample (original)
+++ trunk/configs/unistim.conf.sample Sun Dec 16 04:51:53 2007
@@ -4,6 +4,13 @@
 
 [general]
 port=5000                    ; UDP port
+;
+; See qos.tex or Quality of Service section of asterisk.pdf for a description of these parameters.
+;tos=cs3                ; Sets TOS for signaling packets.
+;tos_audio=ef           ; Sets TOS for RTP audio packets.
+;cos=3                  ; Sets 802.1p priority for signaling packets.
+;cos_audio=5            ; Sets 802.1p priority for RTP audio packets.
+;
 ;keepalive=120               ; in seconds, default = 120
 ;public_ip=                  ; if asterisk is behind a nat, specify your public IP
 ;autoprovisioning=no         ; Allow undeclared phones to register an extension. See README for important

Modified: trunk/doc/tex/qos.tex
URL: http://svn.digium.com/view/asterisk/trunk/doc/tex/qos.tex?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/doc/tex/qos.tex (original)
+++ trunk/doc/tex/qos.tex Sun Dec 16 04:51:53 2007
@@ -1,31 +1,85 @@
 \subsubsection{Introduction}
 
-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. 
+Asterisk support different QoS settings on application level on various protocol
+on any of signaling and media. 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.
 
-Also asterisk running on Linux can set 802.1p CoS marks in VLAN packets 
-for all used VoIP protocols. It is useful when you are working in switched 
-enviropment. For maping skb-$>$priority and VLAN CoS mark you need to use 
-command "vconfig set\_egress\_map [vlan-device] [skb-priority] [vlan-qos]".
+Also asterisk running on Linux can set 802.1p CoS marks in VLAN packets for all
+used VoIP protocols. It is useful when you are working in 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:
 
-\subsubsection{SIP}
+\begin{verbatim}
+vconfig set_egress_map [vlan-device] [skb-priority] [vlan-qos]
+\end{verbatim}
 
-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.  
+In table behind shown all voice channels and other modules of asterisk, that
+support QoS settings for network traffic and type of traffic which can have
+QoS settings.
 
-There are four parameters to control 802.1p CoS: "cos\_sip", "cos\_audio", 
-"cos\_video" and "cos\_text". It's behavior the same as writen above.
+\begin{verbatim}
+ Channel Drivers
++==============+===========+=====+=====+=====+
+|              | Signaling |Audio|Video| Text|
++==============+===========+=====+=====+=====+
+|chan_sip      |     +     |  +  |  +  |  +  |
+|--------------+-----------+-----+-----+-----+
+|chan_skinny   |     +     |  +  |  +  |     |
+|--------------+-----------+-----+-----+-----+
+|chan_mgcp     |     +     |  +  |     |     |
+|--------------+-----------+-----+-----+-----+
+|chan_unistim  |     +     |  +  |     |     |
+|--------------+-----------+-----+-----+-----+
+|chan_h323     |           |  +  |     |     |
+|--------------+-----------+-----+-----+-----+
+|chan_iax2     |            +                |
++==============+=============================+
+ Other
++==============+=============================+
+| dundi.conf   |     + (tos setting)         |
+|--------------+-----------------------------+
+| iaxprov.conf |     + (tos setting)         |
++==============+=============================+
+\end{verbatim}
 
-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.
+
+\subsubsection{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 Linux system you can not use ef value if your asterisk running
+from user other then root.
+
+The lowdelay, throughput, reliability, mincost, and none values are removed
+in current releases.
+
+\subsubsection{802.1p CoS values}
+
+As far as 802.1p uses 3 bites from VLAN header, there are parameter can take
+integer values from 0 to 7.
+
+\subsubsection{Recommended values}
+Recommended values shown above and also included in sample configuration files:
+\begin{verbatim}
++============+=========+======+
+|            |  tos    |  cos |
++============+=========+======+
+|Signaling   |  cs3    |  3   |
+|Audio       |  ef     |  5   |
+|Video       |  af41   |  4   |
+|Text        |  af41   |  3   |
+|Other       |  ef     |      |
++============+=========+======+
+\end{verbatim}
 
 \subsubsection{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
@@ -37,56 +91,22 @@
 based upon the type of packet.  However different IAXy devices can
 have different TOS settings.
 
-\subsubsection{H.323}
-Also support TOS and CoS. 
+\subsubsection{SIP}
 
-\subsubsection{MGCP}
-Also support TOS and CoS.
+In sip.conf, there are three 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 controls what TOS RTP audio, video or text accordingly
+packets are set to.
 
-\subsubsection{IP TOS values}
+There are four parameters to control 802.1p CoS: "cos\_sip", "cos\_audio",
+"cos\_video" and "cos\_text". It behavior the same as written above.
 
-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),
+\subsubsection{Other RTP channels}
 
-The tos* parameters also take numeric values.
-
-The lowdelay, throughput, reliability, mincost, and none values are
-removed in current releases.
-
-\subsubsection{802.1p CoS values}
-
-As 802.1p uses 3 bites from VLAN header, there are parameter can take 
-integer values from 0 to 7.
-
-
-\begin{verbatim}
-+==============+============+==============+
-|Configuration | Parameter  | Recommended  |
-|File          | Setting    |              |
-+--------------+------------+--------------+
-|              | tos_sip    | cs3          |
-|              | tos_audio  | ef           |
-|              | tos_video  | af41         |
-| sip.conf     | tos_text   | af41         |
-|              | cos_sip    | 4            |
-|              | cos_audio  | 6            |
-|              | cos_video  | 5            |
-|              | cos_text   | 0            |
-+--------------+------------+--------------+
-| iax.conf     | tos        | ef           |
-|              | cos        | 6            |
-+--------------+------------+--------------+
-| iaxprov.conf | tos        | ef           |
-+--------------+------------+--------------+
-| mgcp.conf    | tos        | ef           |
-|              | cos        | 6            |
-+--------------+------------+--------------+
-| h323.conf    | tos        | ef           |
-|              | cos        | 6            |
-+==============+============+==============+
-\end{verbatim}
+chan\_mgcp, chan\_h323, chan\_skinny and chan\_unistim also support TOS and
+CoS via setting tos and cos parameters in correspond to module config 
+files. Naming style and behavior same as for chan\_sip.
 
 \subsubsection{Reference}
 
@@ -113,4 +133,3 @@
 Service for VoIP networks see the "Enterprise QoS Solution Reference
 Network Design Guide" version 3.3 from Cisco at:
 \url{http://www.cisco.com/application/pdf/en/us/guest/netsol/ns432/c649/ccmigration\_09186a008049b062.pdf}
-

Modified: trunk/include/asterisk/netsock.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/netsock.h?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/include/asterisk/netsock.h (original)
+++ trunk/include/asterisk/netsock.h Sun Dec 16 04:51:53 2007
@@ -53,7 +53,7 @@
 struct ast_netsock *ast_netsock_find(struct ast_netsock_list *list,
 				     struct sockaddr_in *sa);
 
-int ast_netsock_set_qos(int netsocket, int tos, int cos);
+int ast_netsock_set_qos(int netsocket, int tos, int cos, const char *desc);
 
 int ast_netsock_sockfd(const struct ast_netsock *ns);
 

Modified: trunk/include/asterisk/rtp.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/rtp.h?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/include/asterisk/rtp.h (original)
+++ trunk/include/asterisk/rtp.h Sun Dec 16 04:51:53 2007
@@ -168,7 +168,7 @@
 
 int ast_rtp_sendcng(struct ast_rtp *rtp, int level);
 
-int ast_rtp_setqos(struct ast_rtp *rtp, int tos, int cos);
+int ast_rtp_setqos(struct ast_rtp *rtp, int tos, int cos, char *desc);
 
 /*! \brief  Setting RTP payload types from lines in a SDP description: */
 void ast_rtp_pt_clear(struct ast_rtp* rtp);

Modified: trunk/main/netsock.c
URL: http://svn.digium.com/view/asterisk/trunk/main/netsock.c?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/main/netsock.c (original)
+++ trunk/main/netsock.c Sun Dec 16 04:51:53 2007
@@ -117,7 +117,7 @@
 		return NULL;
 	}
 
-	ast_netsock_set_qos(netsocket, tos, cos);
+	ast_netsock_set_qos(netsocket, tos, cos, "IAX2");
 		
 	ast_enable_packet_fragmentation(netsocket);
 
@@ -143,20 +143,20 @@
 	return ns;
 }
 
-int ast_netsock_set_qos(int netsocket, int tos, int cos)
+int ast_netsock_set_qos(int netsocket, int tos, int cos, const char *desc)
 {
 	int res;
 	
 	if ((res = setsockopt(netsocket, IPPROTO_IP, IP_TOS, &tos, sizeof(tos))))
-		ast_log(LOG_WARNING, "Unable to set TOS to %d\n", tos);
-	else 
-		ast_verb(2, "Using TOS bits %d\n", tos);
+		ast_log(LOG_WARNING, "Unable to set %s TOS to %d, may be you have no root privileges\n", desc, tos);
+	else if (tos)
+                ast_verb(2, "Using %s TOS bits %d\n", desc, tos);
 
 #if defined(linux)								
 	if (setsockopt(netsocket, SOL_SOCKET, SO_PRIORITY, &cos, sizeof(cos)))
-		ast_log(LOG_WARNING, "Unable to set CoS to %d\n", cos);
-	else
-		ast_verb(2, "Using CoS mark %d\n", cos);
+		ast_log(LOG_WARNING, "Unable to set %s CoS to %d\n", desc, cos);
+	else if (cos)
+		ast_verb(2, "Using %s CoS mark %d\n", desc, cos);
 #endif
 							
 	return res;

Modified: trunk/main/rtp.c
URL: http://svn.digium.com/view/asterisk/trunk/main/rtp.c?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/main/rtp.c (original)
+++ trunk/main/rtp.c Sun Dec 16 04:51:53 2007
@@ -2292,9 +2292,9 @@
 	return ast_rtp_new_with_bindaddr(sched, io, rtcpenable, callbackmode, ia);
 }
 
-int ast_rtp_setqos(struct ast_rtp *rtp, int tos, int cos)
-{
-	return ast_netsock_set_qos(rtp->s, tos, cos);
+int ast_rtp_setqos(struct ast_rtp *rtp, int tos, int cos, char *desc)
+{
+	return ast_netsock_set_qos(rtp->s, tos, cos, desc);
 }
 
 void ast_rtp_set_peer(struct ast_rtp *rtp, struct sockaddr_in *them)

Modified: trunk/main/udptl.c
URL: http://svn.digium.com/view/asterisk/trunk/main/udptl.c?view=diff&rev=93163&r1=93162&r2=93163
==============================================================================
--- trunk/main/udptl.c (original)
+++ trunk/main/udptl.c Sun Dec 16 04:51:53 2007
@@ -849,7 +849,7 @@
 
 int ast_udptl_setqos(struct ast_udptl *udptl, int tos, int cos)
 {
-	return ast_netsock_set_qos(udptl->fd, tos, cos);
+	return ast_netsock_set_qos(udptl->fd, tos, cos, "UDPTL");
 }
 
 void ast_udptl_set_peer(struct ast_udptl *udptl, struct sockaddr_in *them)

Modified: trunk/pbx/pbx_dundi.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/pbx_dundi.c?view=diff&rev=93163&r1=93162&r2=93163

[... 22 lines stripped ...]



More information about the asterisk-commits mailing list