<div dir="ltr">IAX over one socket/port is a killer feature; Changing it is really hard.<br><br>I was thinking about changing qos on-fly. something like this:<br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">if( is_control_packet && current_tos_is_not_high) setsockop(high_priority)<br></blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div>if( is_voice_packet && current_tos_is_high) setsockop(low_priority) <br></div></blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div>ast_sendto() <br></div></blockquote><div><br></div><div>Don't know what is the long term effects of calling setsockopt many (really many) times. I tried it for small application and it worked without problems (untill now!).<br></div><div></div><div>Also I tried a mock up with this modification on a test setup. It gave more stable connection on congested Internet connection (better delivery chance for control packets).<br><br></div><div>My change in IAX was in transmit_trunk function (in chan_iax2.c). Change it to be like this:<br><br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div>static int transmit_trunk(struct iax_frame *f, struct ast_sockaddr *addr, int sockfd)<br>{ <br> int res;<br><br><br> int tos_before=0,cos_before=0, tos, cos;<br> socklen_t toslen=sizeof(tos), coslen=sizeof(cos);<br> //tos and cos are already set to 184 and 5 (in iax.conf tos=ef and cos=5)<br> getsockopt(sockfd, IPPROTO_IP, IP_TOS, &tos_before, &toslen);<br> getsockopt(sockfd, SOL_SOCKET, SO_PRIORITY, &cos_before, &coslen);<br><br> //lower tos and cos<br> tos = 160;<br> cos = 3;<br><br> setsockopt(sockfd, IPPROTO_IP, IP_TOS, &tos, toslen);<br> setsockopt(sockfd, SOL_SOCKET, SO_PRIORITY, &cos, coslen);<br><br> res = ast_sendto(sockfd, f->data, f->datalen, 0, addr);<br></div> //return them to initial value<br></blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"> setsockopt(sockfd, IPPROTO_IP, IP_TOS, &tos_before, toslen);<br> setsockopt(sockfd, SOL_SOCKET, SO_PRIORITY, &cos_before, coslen);<br><br> if (res < 0) {<br> ast_debug(1, "Received error: %s\n", strerror(errno));<br> handle_error();<br> } else<br> res = 0;<br> return res;<br>}<br></blockquote><br></div><div><br>My trials was on recent Ubuntu on modern computers (not windows, not ancient OS). One IAX client, trunked connection with 100 concurrent calls.<br></div><div>NOTE: code is not multi-threading protected and calling getsockopt/setsockopt shall be removed in production code.<br></div><div><br><br></div><div>Is there any measurements to ensure that this doesn't break something else? (increase CPU load insanely, doesn't scale up after x connections, ...)<br></div><div><br></div><div>I have a running test setup with this mockup if you need some debug logs.<br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 8, 2015 at 6:34 PM, Matthew Jordan <span dir="ltr"><<a href="mailto:mjordan@digium.com" target="_blank">mjordan@digium.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote"><span>On Thu, Mar 5, 2015 at 5:27 AM, Yousf Ateya <span dir="ltr"><<a href="mailto:y.ateya@starkbits.com" target="_blank">y.ateya@starkbits.com</a>></span> wrote:<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Asterisk provides a way to set <a href="https://wiki.asterisk.org/wiki/display/AST/IP+Quality+of+Service" target="_blank">tos and cos fields</a> in IP headers. But as stated in documentation:<br><blockquote>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<br clear="all"></blockquote><div>So the packet priority is assigned to signaling, voice and video; which minimizes the benefit of having packet priority.<br><br></div><div>If there are separate settings for signaling and voice, users can increase priority of signaling; to ensure that control packets get better chance than voice packets.<br></div></div></blockquote><div><br></div></span><div>The issue isn't that the settings for signalling and voice are combined, it is that signalling and voice information are multiplexed over a single socket. These quality settings are set on the socket that services both signalling and media; changing them on the fly between frames on a single socket would probably have "interesting" effects. Keep in mind that the settings determine the priority of packets being sent from the socket. Given how often signalling and media can change on a single socket for a number of chan_iax2 channels, you would defeat the purpose of setting TOS/COS if you changed them frequently.<br><br></div><div>The only way you could overcome that would be to break apart the signalling and media onto different sockets. That has several drawbacks:<br></div><div>(1) One of IAX2's strengths is its ability to pass media and signalling over a single port, which helps with NAT/firewalls<br></div><div>(2) It would make chan_iax2 no longer compliant with its own RFC<br></div><div>(3) It would certainly be a non-trivial amount of work. Since chan_iax2 can really only be tested against itself, it makes verifying that such a change does not inject a large amount of risk into the driver rather difficult.<span><font color="#888888"><br> </font></span></div></div><span><font color="#888888"><br>-- <br><div><div dir="ltr"><div><div dir="ltr"><div>Matthew Jordan<br></div><div>Digium, Inc. | Director of Technology<br></div><div>445 Jan Davis Drive NW - Huntsville, AL 35806 - USA</div><div>Check us out at: <a href="http://digium.com" target="_blank">http://digium.com</a> & <a href="http://asterisk.org" target="_blank">http://asterisk.org</a></div></div></div></div></div>
</font></span></div></div>
<br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-dev" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-dev</a><br></blockquote></div><br><br clear="all"><br>-- <br><div><div dir="ltr"><div><div dir="ltr"><div>Yousf Ateya,<br></div><div></div><div>StarkBits</div><div><a href="http://www.starkbits.com" target="_blank">www.starkbits.com</a></div></div></div></div></div>
</div></div>
<br>
<pre><font size="1" face="Courier New">This e-mail message is intended only for the use of the intended recipient(s).
The information contained therein may be confidential or privileged,
and its disclosure or reproduction is strictly prohibited.
If you are not the intended recipient, please return it immediately to its sender
at the above address and destroy it.
</font></pre>