diff -Naur asterisk-84147.orig/channels/chan_h323.c asterisk-84147.patched-tos/channels/chan_h323.c --- asterisk-84147.orig/channels/chan_h323.c 2007-09-24 09:14:10.000000000 +0700 +++ asterisk-84147.patched-tos/channels/chan_h323.c 2007-10-01 13:46:30.000000000 +0700 @@ -2912,7 +2912,7 @@ memcpy(&bindaddr.sin_addr, hp->h_addr, sizeof(bindaddr.sin_addr)); } } else if (!strcasecmp(v->name, "tos")) { - if (ast_str2tos(v->value, &tos)) { + if (ast_str2tos(v->value, &tos, 0)) { 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")) { diff -Naur asterisk-84147.orig/channels/chan_iax2.c asterisk-84147.patched-tos/channels/chan_iax2.c --- asterisk-84147.orig/channels/chan_iax2.c 2007-09-24 09:14:11.000000000 +0700 +++ asterisk-84147.patched-tos/channels/chan_iax2.c 2007-10-01 13:46:48.000000000 +0700 @@ -10043,7 +10043,7 @@ /* Seed initial tos value */ tosval = ast_variable_retrieve(cfg, "general", "tos"); if (tosval) { - if (ast_str2tos(tosval, &tos)) + if (ast_str2tos(tosval, &tos, 0)) ast_log(LOG_WARNING, "Invalid tos value, see doc/qos.tex for more information.\n"); } /* Seed initial cos value */ @@ -10222,7 +10222,7 @@ if (!ast_context_find(regcontext)) ast_context_create(NULL, regcontext, "IAX2"); } else if (!strcasecmp(v->name, "tos")) { - if (ast_str2tos(v->value, &tos)) + if (ast_str2tos(v->value, &tos, 0)) ast_log(LOG_WARNING, "Invalid tos value at line %d, see doc/qos.tex for more information.'\n", v->lineno); } else if (!strcasecmp(v->name, "cos")) { if (ast_str2cos(v->value, &cos)) diff -Naur asterisk-84147.orig/channels/chan_mgcp.c asterisk-84147.patched-tos/channels/chan_mgcp.c --- asterisk-84147.orig/channels/chan_mgcp.c 2007-09-24 09:14:11.000000000 +0700 +++ asterisk-84147.patched-tos/channels/chan_mgcp.c 2007-10-01 13:46:07.000000000 +0700 @@ -4098,7 +4098,7 @@ else capability &= ~format; } else if (!strcasecmp(v->name, "tos")) { - if (ast_str2tos(v->value, &tos)) + if (ast_str2tos(v->value, &tos, 0)) ast_log(LOG_WARNING, "Invalid tos value at line %d, see doc/qos.tex for more information.\n", v->lineno); } else if (!strcasecmp(v->name, "cos")) { if (ast_str2cos(v->value, &cos)) diff -Naur asterisk-84147.orig/channels/chan_sip.c asterisk-84147.patched-tos/channels/chan_sip.c --- asterisk-84147.orig/channels/chan_sip.c 2007-09-27 10:18:09.000000000 +0700 +++ asterisk-84147.patched-tos/channels/chan_sip.c 2007-10-01 13:45:58.000000000 +0700 @@ -156,9 +156,6 @@ #define XMIT_ERROR -2 #define VIDEO_CODEC_MASK 0x1fc0000 /*!< Video codecs from H.261 thru AST_FORMAT_MAX_VIDEO */ -#ifndef IPTOS_MINCOST -#define IPTOS_MINCOST 0x02 -#endif /* #define VOCAL_DATA_HACK */ @@ -18142,16 +18139,16 @@ if (sip_register(v->value, v->lineno) == 0) registry_count++; } else if (!strcasecmp(v->name, "tos_sip")) { - if (ast_str2tos(v->value, &global_tos_sip)) + if (ast_str2tos(v->value, &global_tos_sip, 0)) ast_log(LOG_WARNING, "Invalid tos_sip value at line %d, recommended value is 'cs3'. See doc/qos.tex.\n", v->lineno); } else if (!strcasecmp(v->name, "tos_audio")) { - if (ast_str2tos(v->value, &global_tos_audio)) + if (ast_str2tos(v->value, &global_tos_audio, 0)) ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, recommended value is 'ef'. See doc/qos.tex.\n", v->lineno); } else if (!strcasecmp(v->name, "tos_video")) { - if (ast_str2tos(v->value, &global_tos_video)) + if (ast_str2tos(v->value, &global_tos_video, 0)) ast_log(LOG_WARNING, "Invalid tos_video value at line %d, recommended value is 'af41'. See doc/qos.tex.\n", v->lineno); } else if (!strcasecmp(v->name, "tos_text")) { - if (ast_str2tos(v->value, &global_tos_text)) + if (ast_str2tos(v->value, &global_tos_text, 0)) ast_log(LOG_WARNING, "Invalid tos_text value at line %d, recommended value is 'af41'. See doc/qos.tex.\n", v->lineno); } else if (!strcasecmp(v->name, "cos_sip")) { ast_str2cos(v->value, &global_cos_sip); diff -Naur asterisk-84147.orig/channels/iax2-provision.c asterisk-84147.patched-tos/channels/iax2-provision.c --- asterisk-84147.orig/channels/iax2-provision.c 2007-08-17 09:17:56.000000000 +0700 +++ asterisk-84147.patched-tos/channels/iax2-provision.c 2007-10-01 13:45:14.000000000 +0700 @@ -331,7 +331,7 @@ } 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 (ast_str2tos(v->value, &cur->tos)) + if (ast_str2tos(v->value, &cur->tos, 0)) ast_log(LOG_WARNING, "Invalid tos value at line %d, see doc/qos.tex for more information.\n", v->lineno); } else if (!strcasecmp(v->name, "user")) { strncpy(cur->user, v->value, sizeof(cur->user) - 1); diff -Naur asterisk-84147.orig/configs/dundi.conf.sample asterisk-84147.patched-tos/configs/dundi.conf.sample --- asterisk-84147.orig/configs/dundi.conf.sample 2007-06-06 12:51:58.000000000 +0700 +++ asterisk-84147.patched-tos/configs/dundi.conf.sample 2007-10-01 12:48:58.000000000 +0700 @@ -27,6 +27,9 @@ ;bindaddr=0.0.0.0 ;port=4520 ; +; See doc/qos.tex for a description of the tos parameter. +;tos=ef +; ; Our entity identifier (Should generally be the MAC address of the ; machine it's running on. Defaults to the first eth address, but you ; can override it here, as long as you set it to the MAC of *something* diff -Naur asterisk-84147.orig/doc/tex/qos.tex asterisk-84147.patched-tos/doc/tex/qos.tex --- asterisk-84147.orig/doc/tex/qos.tex 2007-07-30 07:47:59.000000000 +0700 +++ asterisk-84147.patched-tos/doc/tex/qos.tex 2007-10-01 14:56:24.000000000 +0700 @@ -55,7 +55,8 @@ The lowdelay, throughput, reliability, mincost, and none values are deprecated because they set the IP TOS using the outdated "IP precedence" model as defined in RFC 791 and RFC 1349. They still -work in this version of Asterisk, but will be removed in future releases. +work only in pbx_dundi and will be removed in feature releases. + \subsubsection{802.1p CoS values} diff -Naur asterisk-84147.orig/include/asterisk/acl.h asterisk-84147.patched-tos/include/asterisk/acl.h --- asterisk-84147.orig/include/asterisk/acl.h 2007-07-23 08:02:27.000000000 +0700 +++ asterisk-84147.patched-tos/include/asterisk/acl.h 2007-10-01 13:47:33.000000000 +0700 @@ -74,7 +74,8 @@ int ast_str2cos(const char *value, unsigned int *cos); -int ast_str2tos(const char *value, unsigned int *tos); +int ast_str2tos(const char *value, unsigned int *tos, unsigned int depr); + const char *ast_tos2str(unsigned int tos); #if defined(__cplusplus) || defined(c_plusplus) diff -Naur asterisk-84147.orig/main/acl.c asterisk-84147.patched-tos/main/acl.c --- asterisk-84147.orig/main/acl.c 2007-07-23 08:02:28.000000000 +0700 +++ asterisk-84147.patched-tos/main/acl.c 2007-10-01 13:51:51.000000000 +0700 @@ -54,12 +54,8 @@ #endif /* netinet/ip.h may not define the following (See RFCs 791 and 1349) */ -#if !defined(IPTOS_LOWCOST) -#define IPTOS_LOWCOST 0x02 -#endif - #if !defined(IPTOS_MINCOST) -#define IPTOS_MINCOST IPTOS_LOWCOST +#define IPTOS_MINCOST 0x02 #endif #include "asterisk/acl.h" @@ -284,7 +280,7 @@ return -1; } -int ast_str2tos(const char *value, unsigned int *tos) +int ast_str2tos(const char *value, unsigned int *tos, unsigned int depr) { int fval; unsigned int x; @@ -300,6 +296,24 @@ return 0; } } + + if (depr) { + if (!strcasecmp(value, "lowdelay")) + *tos = IPTOS_LOWDELAY; + else if (!strcasecmp(value, "throughput")) + *tos = IPTOS_THROUGHPUT; + else if (!strcasecmp(value, "reliability")) + *tos = IPTOS_RELIABILITY; + else if (!strcasecmp(value, "mincost")) + *tos = IPTOS_MINCOST; + else if (!strcasecmp(value, "none")) + *tos = 0; + else + return -1; + + ast_log(LOG_WARNING, "TOS value %s is deprecated. Please see doc/ip-tos.txt for more information.\n", value); + return 0; + } return -1; } diff -Naur asterisk-84147.orig/pbx/pbx_dundi.c asterisk-84147.patched-tos/pbx/pbx_dundi.c --- asterisk-84147.orig/pbx/pbx_dundi.c 2007-09-27 10:18:09.000000000 +0700 +++ asterisk-84147.patched-tos/pbx/pbx_dundi.c 2007-10-01 14:42:24.000000000 +0700 @@ -4697,26 +4697,8 @@ else ast_log(LOG_WARNING, "Invalid global endpoint identifier '%s' at line %d\n", v->value, v->lineno); } else if (!strcasecmp(v->name, "tos")) { - if (sscanf(v->value, "%d", &format) == 1) - tos = format & 0xff; - else if (!strcasecmp(v->value, "lowdelay")) - tos = IPTOS_LOWDELAY; - else if (!strcasecmp(v->value, "throughput")) - tos = IPTOS_THROUGHPUT; - else if (!strcasecmp(v->value, "reliability")) - tos = IPTOS_RELIABILITY; -#if !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(SOLARIS) - else if (!strcasecmp(v->value, "mincost")) - tos = IPTOS_MINCOST; -#endif - else if (!strcasecmp(v->value, "none")) - tos = 0; - else -#if !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(SOLARIS) - ast_log(LOG_WARNING, "Invalid tos value at line %d, should be 'lowdelay', 'throughput', 'reliability', 'mincost', or 'none'\n", v->lineno); -#else - ast_log(LOG_WARNING, "Invalid tos value at line %d, should be 'lowdelay', 'throughput', 'reliability', or 'none'\n", v->lineno); -#endif + if (ast_str2tos(v->value, &tos, 1)) + ast_log(LOG_WARNING, "Invalid tos value at line %d, please read docs/qos.tex\n", v->lineno); } else if (!strcasecmp(v->name, "department")) { ast_copy_string(dept, v->value, sizeof(dept)); } else if (!strcasecmp(v->name, "organization")) {