diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index faeb828d71d44296320b5831e226b4774451c9f2..596fc5c87311cd4fc25c24485786604263d4f420 100755
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -45,9 +45,16 @@
 #include <netdb.h>
 #include <arpa/inet.h>
 #include <sys/signal.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+
 #include <asterisk/dsp.h>
 #include <ctype.h>
 
+#ifndef IPTOS_MINCOST
+#define IPTOS_MINCOST 0x02
+#endif
+
 #define MGCPDUMPER
 #define DEFAULT_EXPIREY 120
 #define MAX_EXPIREY     3600
@@ -100,6 +107,8 @@ static unsigned int cur_pickupgroup = 0;
 /*     inbanddtmf is actually hooked up.   */
 /* static int relaxdtmf = 0; */
 
+static int tos = 0;
+
 static int immediate = 0;
 
 static int callwaiting = 0;
@@ -2890,6 +2899,21 @@ int load_module()
 				ast_log(LOG_WARNING, "Cannot disallow unknown format '%s'\n", v->value);
 			else
 				capability &= ~format;
+		} else if (!strcasecmp(v->name, "tos")) {
+			if (sscanf(v->value, "%i", &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;
+			else if (!strcasecmp(v->value, "mincost"))
+				tos = IPTOS_MINCOST;
+			else if (!strcasecmp(v->value, "none"))
+				tos = 0;
+			else
+				ast_log(LOG_WARNING, "Invalid tos value at line %d, should be 'lowdelay', 'throughput', 'reliability', 'mincost', or 'none'\n", v->lineno);
 		} else if (!strcasecmp(v->name, "port")) {
 			if (sscanf(v->value, "%i", &ourport) == 1) {
 				bindaddr.sin_port = htons(ourport);
@@ -2943,9 +2967,14 @@ int load_module()
 						strerror(errno));
 			close(mgcpsock);
 			mgcpsock = -1;
-		} else if (option_verbose > 1) {
-			ast_verbose(VERBOSE_PREFIX_2 "MGCP Listening on %s:%d\n", 
-				inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port));
+		} else {
+			if (option_verbose > 1) {
+				ast_verbose(VERBOSE_PREFIX_2 "MGCP Listening on %s:%d\n", 
+					inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port));
+				ast_verbose(VERBOSE_PREFIX_2 "Using TOS bits %d\n", tos);
+			}
+			if (setsockopt(mgcpsock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos))) 
+				ast_log(LOG_WARNING, "Unable to set TOS to %d\n", tos);
         }
 	}
 	pthread_mutex_unlock(&netlock);
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 7a58af1ec8eeaccf8fa94fdac22d57545c8058b5..70ea4fd32e28e7e2381d46f804f23d330a41dc34 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -5654,15 +5654,14 @@ static int reload_config(void)
 							strerror(errno));
 				close(sipsock);
 				sipsock = -1;
-			} else if (option_verbose > 1) {
-				ast_verbose(VERBOSE_PREFIX_2 "SIP Listening on %s:%d\n", 
+			} else {
+				if (option_verbose > 1) { 
+						ast_verbose(VERBOSE_PREFIX_2 "SIP Listening on %s:%d\n", 
 					inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port));
-				if (option_verbose > 1)
 					ast_verbose(VERBOSE_PREFIX_2 "Using TOS bits %d\n", tos);
-
+				}
 				if (setsockopt(sipsock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos))) 
 					ast_log(LOG_WARNING, "Unable to set TOS to %d\n", tos);
-	
 			}
 		}
 	}