diff -Naur asterisk-88197.orig/CHANGES asterisk-88197.patched-qoscleanup/CHANGES --- asterisk-88197.orig/CHANGES 2007-11-02 12:03:51.000000000 +0600 +++ asterisk-88197.patched-qoscleanup/CHANGES 2007-11-02 15:29:11.000000000 +0600 @@ -97,6 +97,7 @@ Skinny changes ------------- * Added skinny show device, skinny show line, and skinny show settings CLI commands. + * Added support for control QoS parameters of signaling, audio and video. DUNDi changes ------------- diff -Naur asterisk-88197.orig/UPGRADE.txt asterisk-88197.patched-qoscleanup/UPGRADE.txt --- asterisk-88197.orig/UPGRADE.txt 2007-11-02 12:03:52.000000000 +0600 +++ asterisk-88197.patched-qoscleanup/UPGRADE.txt 2007-11-02 15:28:11.000000000 +0600 @@ -118,6 +118,9 @@ Configuration: +* chan_h323.c: tos parameter renamed to tos_audio to remove disambigous in names + if qos related parameters in different config files. + * pbx_dundi.c: tos parameter changed to use new values. Old values like lowdelay, lowcost and other is not acceptable now. Look into qos.tex for description of this parameter. diff -Naur asterisk-88197.orig/channels/chan_h323.c asterisk-88197.patched-qoscleanup/channels/chan_h323.c --- asterisk-88197.orig/channels/chan_h323.c 2007-11-02 12:03:51.000000000 +0600 +++ asterisk-88197.patched-qoscleanup/channels/chan_h323.c 2007-11-02 15:50:39.000000000 +0600 @@ -978,7 +978,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); @@ -2859,13 +2859,13 @@ } else { memcpy(&bindaddr.sin_addr, hp->h_addr, sizeof(bindaddr.sin_addr)); } - } else if (!strcasecmp(v->name, "tos")) { + } else if (!strcasecmp(v->name, "tos_audio")) { 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); + ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, for more info read doc/qos.tex\n", v->lineno); } - } else if (!strcasecmp(v->name, "cos")) { + } else if (!strcasecmp(v->name, "cos_audio")) { 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, for more info read doc/qos.tex\n", v->lineno); } } else if (!strcasecmp(v->name, "gatekeeper")) { if (!strcasecmp(v->value, "DISABLE")) { diff -Naur asterisk-88197.orig/channels/chan_mgcp.c asterisk-88197.patched-qoscleanup/channels/chan_mgcp.c --- asterisk-88197.orig/channels/chan_mgcp.c 2007-11-02 12:03:50.000000000 +0600 +++ asterisk-88197.patched-qoscleanup/channels/chan_mgcp.c 2007-11-02 12:10:49.000000000 +0600 @@ -161,8 +161,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; @@ -2599,8 +2600,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); @@ -4105,9 +4108,15 @@ } 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); + } else if (!strcasecmp(v->name, "tos_audio")) { + if (ast_str2tos(v->value, &tos_audio)) + 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)) ast_log(LOG_WARNING, "Invalid cos value at line %d, see doc/qos.tex for more information.\n", v->lineno); + } else if (!strcasecmp(v->name, "cos_audio")) { + if (ast_str2cos(v->value, &cos_audio)) + ast_log(LOG_WARNING, "Invalid cos value at line %d, see doc/qos.tex for more information.\n", v->lineno); } else if (!strcasecmp(v->name, "port")) { if (sscanf(v->value, "%d", &ourport) == 1) { bindaddr.sin_port = htons(ourport); @@ -4191,7 +4200,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); diff -Naur asterisk-88197.orig/channels/chan_sip.c asterisk-88197.patched-qoscleanup/channels/chan_sip.c --- asterisk-88197.orig/channels/chan_sip.c 2007-11-02 12:03:51.000000000 +0600 +++ asterisk-88197.patched-qoscleanup/channels/chan_sip.c 2007-11-02 12:10:49.000000000 +0600 @@ -535,9 +535,9 @@ #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_TOS_TEXT 0 /*!< Text packets should be marked as XXXX XXXX, but the default is 0 to be compatible with previous versions. */ -#define DEFAULT_COS_SIP 4 -#define DEFAULT_COS_AUDIO 5 -#define DEFAULT_COS_VIDEO 6 +#define DEFAULT_COS_SIP 0 +#define DEFAULT_COS_AUDIO 0 +#define DEFAULT_COS_VIDEO 0 #define DEFAULT_COS_TEXT 0 #define DEFAULT_ALLOW_EXT_DOM TRUE #define DEFAULT_REALM "asterisk" @@ -5035,14 +5035,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); @@ -5050,7 +5050,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); } @@ -18355,7 +18355,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"); } } } diff -Naur asterisk-88197.orig/channels/chan_skinny.c asterisk-88197.patched-qoscleanup/channels/chan_skinny.c --- asterisk-88197.orig/channels/chan_skinny.c 2007-11-02 12:03:51.000000000 +0600 +++ asterisk-88197.patched-qoscleanup/channels/chan_skinny.c 2007-11-02 12:10:49.000000000 +0600 @@ -58,6 +58,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" @@ -98,6 +99,13 @@ #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 */ static char regcontext[AST_MAX_CONTEXT]; /* Context for auto-extension */ @@ -2981,9 +2989,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 */ @@ -5520,6 +5530,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, see doc/qos.tex for more information.\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, see doc/qos.tex for more information.\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, see doc/qos.tex for more information.\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); + } 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, see doc/qos.tex for more information.\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, see doc/qos.tex for more information.\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")) { @@ -5608,6 +5636,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); } } diff -Naur asterisk-88197.orig/configs/h323.conf.sample asterisk-88197.patched-qoscleanup/configs/h323.conf.sample --- asterisk-88197.orig/configs/h323.conf.sample 2007-11-02 12:03:55.000000000 +0600 +++ asterisk-88197.patched-qoscleanup/configs/h323.conf.sample 2007-11-02 15:26:01.000000000 +0600 @@ -4,7 +4,9 @@ [general] port = 1720 ;bindaddr = 1.2.3.4 ; this SHALL contain a single, valid IP address for this machine -;tos=ef +; See qos.tex for a description of the tos and cos 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 diff -Naur asterisk-88197.orig/configs/mgcp.conf.sample asterisk-88197.patched-qoscleanup/configs/mgcp.conf.sample --- asterisk-88197.orig/configs/mgcp.conf.sample 2007-11-02 12:03:55.000000000 +0600 +++ asterisk-88197.patched-qoscleanup/configs/mgcp.conf.sample 2007-11-02 15:26:17.000000000 +0600 @@ -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 doc/qos.tex for a description of the tos and cos 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 diff -Naur asterisk-88197.orig/configs/sip.conf.sample asterisk-88197.patched-qoscleanup/configs/sip.conf.sample --- asterisk-88197.orig/configs/sip.conf.sample 2007-11-02 12:03:55.000000000 +0600 +++ asterisk-88197.patched-qoscleanup/configs/sip.conf.sample 2007-11-02 12:10:49.000000000 +0600 @@ -63,10 +63,10 @@ ;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) diff -Naur asterisk-88197.orig/configs/skinny.conf.sample asterisk-88197.patched-qoscleanup/configs/skinny.conf.sample --- asterisk-88197.orig/configs/skinny.conf.sample 2007-11-02 12:03:55.000000000 +0600 +++ asterisk-88197.patched-qoscleanup/configs/skinny.conf.sample 2007-11-02 15:58:16.000000000 +0600 @@ -28,6 +28,15 @@ ;allow=all ; see doc/rtp-packetization for framing options ;disallow= +; See doc/qos.tex for a description of the tos and cos 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 ; skinny channel. Defaults to "no". An enabled jitterbuffer will diff -Naur asterisk-88197.orig/doc/tex/qos.tex asterisk-88197.patched-qoscleanup/doc/tex/qos.tex --- asterisk-88197.orig/doc/tex/qos.tex 2007-11-02 12:03:54.000000000 +0600 +++ asterisk-88197.patched-qoscleanup/doc/tex/qos.tex 2007-11-02 15:16:27.000000000 +0600 @@ -10,22 +10,28 @@ enviropment. For maping skb-$>$priority and VLAN CoS mark you need to use command "vconfig set\_egress\_map [vlan-device] [skb-priority] [vlan-qos]". -\subsubsection{SIP} +\subsubsection{IP TOS values} -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. +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), -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. +The tos* parameters also take numeric values. -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. +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{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,57 +43,66 @@ based upon the type of packet. However different IAXy devices can have different TOS settings. -\subsubsection{H.323} -Also support TOS and CoS. - -\subsubsection{MGCP} -Also support TOS and CoS. +\subsubsection{SIP} -\subsubsection{IP TOS values} +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 signalling packets are set to. tos\_audio, tos\_video +and tos\_text controls what TOS RTP audio, video or text accordingly +packets are set to. -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), +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. -The tos* parameters also take numeric values. +\subsubsection{Other RTP channels} -The lowdelay, throughput, reliability, mincost, and none values are -removed in current releases. +chan_mgcp, chan_h323 and chan_skinny also support TOS and CoS via setting +tos and cos parameters in respecting config files. -\subsubsection{802.1p CoS values} +\subsubsection{Other modules} -As 802.1p uses 3 bites from VLAN header, there are parameter can take -integer values from 0 to 7. +Also DUNDi have support for setting TOS value for packets, generated. +Table, which shows +\begin{verbatim} +Channel Drivers ++==============+============+=====+=====+=====+ +| | Signaling |Audio|Video| Text| ++==============+============+=====+=====+=====+ +|chan_sip | + | + | + | + | +|--------------+------------+-----+-----+-----+ +|chan_skinny | + | + | + | | +|--------------+------------+-----+-----+-----+ +|chan_mgcp | + | + | | | +|--------------+------------+-----+-----+-----+ +|chan_h323 | | + | | | +|--------------+------------+-----+-----+-----+ +|chan_iax2 | + | ++==============+============+=====+===========+ + + Other ++==============+==============================+ +| dundi.conf | + (tos setting) | +|--------------+------------------------------+ +| iaxprov.conf | + (tos setting) | ++==============+==============================+ +\end{verbatim} +\subsubsection{Recommended values} +For voice channels \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 | -+==============+============+==============+ ++============+=========+======+ +| | tos | cos | ++============+=========+======+ +|Signaling | cs3 | 3 | +|Audio | ef | 5 | +|Video | af41 | 4 | +|Text | af41 | 3 | +|Other | ef | | ++============+=========+======+ \end{verbatim} + \subsubsection{Reference} IEEE 802.1Q Standard: diff -Naur asterisk-88197.orig/include/asterisk/netsock.h asterisk-88197.patched-qoscleanup/include/asterisk/netsock.h --- asterisk-88197.orig/include/asterisk/netsock.h 2007-11-02 12:03:47.000000000 +0600 +++ asterisk-88197.patched-qoscleanup/include/asterisk/netsock.h 2007-11-02 12:10:49.000000000 +0600 @@ -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); diff -Naur asterisk-88197.orig/include/asterisk/rtp.h asterisk-88197.patched-qoscleanup/include/asterisk/rtp.h --- asterisk-88197.orig/include/asterisk/rtp.h 2007-11-02 12:03:49.000000000 +0600 +++ asterisk-88197.patched-qoscleanup/include/asterisk/rtp.h 2007-11-02 12:10:49.000000000 +0600 @@ -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); diff -Naur asterisk-88197.orig/main/netsock.c asterisk-88197.patched-qoscleanup/main/netsock.c --- asterisk-88197.orig/main/netsock.c 2007-11-02 12:03:43.000000000 +0600 +++ asterisk-88197.patched-qoscleanup/main/netsock.c 2007-11-02 14:40:51.000000000 +0600 @@ -143,7 +143,7 @@ return NULL; } - ast_netsock_set_qos(netsocket, tos, cos); + ast_netsock_set_qos(netsocket, tos, cos, "IAX2"); ast_enable_packet_fragmentation(netsocket); @@ -169,23 +169,23 @@ 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); + ast_log(LOG_WARNING, "Unable to set %s TOS to %d, may be you have no root priveleges\n", desc, tos); else { - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "Using TOS bits %d\n", tos); + if (option_verbose > 1 && tos) + ast_verbose(VERBOSE_PREFIX_2 "Using %s TOS bits %d\n", desc, tos); } -#if defined(linux) +#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); + ast_log(LOG_WARNING, "Unable to set %s CoS to %d\n", desc, cos); else { - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "Using CoS mark %d\n", cos); + if (option_verbose > 1 && cos) + ast_verbose(VERBOSE_PREFIX_2 "Using %s CoS mark %d\n", desc, cos); } #endif diff -Naur asterisk-88197.orig/main/rtp.c asterisk-88197.patched-qoscleanup/main/rtp.c --- asterisk-88197.orig/main/rtp.c 2007-11-02 12:03:43.000000000 +0600 +++ asterisk-88197.patched-qoscleanup/main/rtp.c 2007-11-02 12:10:49.000000000 +0600 @@ -2291,9 +2291,9 @@ return ast_rtp_new_with_bindaddr(sched, io, rtcpenable, callbackmode, ia); } -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) { - return ast_netsock_set_qos(rtp->s, tos, cos); + return ast_netsock_set_qos(rtp->s, tos, cos, desc); } void ast_rtp_set_peer(struct ast_rtp *rtp, struct sockaddr_in *them) diff -Naur asterisk-88197.orig/main/udptl.c asterisk-88197.patched-qoscleanup/main/udptl.c --- asterisk-88197.orig/main/udptl.c 2007-11-02 12:03:42.000000000 +0600 +++ asterisk-88197.patched-qoscleanup/main/udptl.c 2007-11-02 12:10:49.000000000 +0600 @@ -873,7 +873,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) diff -Naur asterisk-88197.orig/pbx/pbx_dundi.c asterisk-88197.patched-qoscleanup/pbx/pbx_dundi.c --- asterisk-88197.orig/pbx/pbx_dundi.c 2007-11-02 12:03:43.000000000 +0600 +++ asterisk-88197.patched-qoscleanup/pbx/pbx_dundi.c 2007-11-02 12:10:50.000000000 +0600 @@ -4874,7 +4874,7 @@ return AST_MODULE_LOAD_FAILURE; } - ast_netsock_set_qos(netsocket, tos, 0); + ast_netsock_set_qos(netsocket, tos, 0, "DUNDi"); if (start_network_thread()) { ast_log(LOG_ERROR, "Unable to start network thread\n");