<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Serendipitous altruism &#187; VOIP</title>
	<atom:link href="http://serendipity.ruwenzori.net/index.php/category/voip/feed" rel="self" type="application/rss+xml" />
	<link>http://serendipity.ruwenzori.net</link>
	<description>Pseudo-random experience capitalization by Jean-Marc Liotier, just in case...</description>
	<lastBuildDate>Mon, 17 Jun 2013 10:14:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/><atom:link rel="hub" href="http://ayup.us/"/><cloud domain='serendipity.ruwenzori.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>Routing Asterisk calls using Jabber presence status</title>
		<link>http://serendipity.ruwenzori.net/index.php/2008/06/05/routing-asterisk-calls-using-jabber-presence-status</link>
		<comments>http://serendipity.ruwenzori.net/index.php/2008/06/05/routing-asterisk-calls-using-jabber-presence-status#comments</comments>
		<pubDate>Thu, 05 Jun 2008 22:59:46 +0000</pubDate>
		<dc:creator>Jean-Marc Liotier</dc:creator>
				<category><![CDATA[Jabber]]></category>
		<category><![CDATA[Systems administration]]></category>
		<category><![CDATA[VOIP]]></category>

		<guid isPermaLink="false">http://serendipity.ruwenzori.net/?p=169</guid>
		<description><![CDATA[Since version 1.4, a Jabber module is available in Asterisk. If you know me, then you probably wonder why it took me that long to discover it. I began playing with it tonight and the short story is that it works, it is simple to configure and it makes telephony aware of presence. Of course [...]]]></description>
			<content:encoded><![CDATA[<p>Since version 1.4, a <a href="http://www.jabber.org/about/overview.shtml">Jabber</a> module is available in <a href="http://en.wikipedia.org/wiki/Asterisk_PBX">Asterisk</a>. If you know me, then you probably wonder why it took me that long to discover it. I began playing with it tonight and the short story is that it works, it is simple to configure and it makes telephony aware of presence.</p>
<p>Of course this is still far from the holy grail of a presence-centered converged synchronous communications platform, but it is a start and anything is better than today&#8217;s stupid mass-market telephony.</p>
<p style="text-align: left;">Here is my /etc/asterisk/jabber.conf :</p>
<pre style="padding-left: 30px; text-align: left;">[general]
;Auto register users from buddy list
autoregister=yes</pre>
<pre style="padding-left: 30px; text-align: left;">;Jabber service label
[asterisk]
type=client
serverhost=jabber.grabeuh.com
username=asterisk@jabber.grabeuh.com/kisangani
secret=my_password
port=5222
usetls=yes
statusmessage="Watching the telephone"</pre>
<p>Yes, that&#8217;s it : <a href="http://en.wikipedia.org/wiki/Asterisk_PBX">Asterisk</a> is now registered as a <a href="http://www.jabber.org/about/overview.shtml">Jabber</a> client. There are <a href="http://www.voip-info.org/wiki-Asterisk+Jabber">other ways to do it using external modules</a>, but this one is the simplest &#8211; and since it is now part of the main trunk it is probably the most stable. In particular you should be careful with <a href="http://cjphp.netflint.net/?section=about">class.jabber.php</a> which is not maintained anymore and in the process of being replaced with the much more modern <a href="http://code.google.com/p/xmpphp/">XMPPHP</a>.</p>
<p>Now let&#8217;s declare a macro for taking full advantage of that. This one takes a look at the user&#8217;s presence and routes the call accordingly : if he is online or chatty the call goes to his desk phone &#8211; otherwise it goes his mobile phone.</p>
<pre style="text-align: left; padding-left: 30px;">[macro-reach_user]
; ${ARG3} is a destination such as SIP/whatever
exten =&gt; s,1,jabberstatus(asterisk,${ARG2},STATUS)
; presence in will be 1-6.
; In order : Online, Chatty, Away, XAway, DND, Offline
; If not in roster variable will = 7
exten =&gt; s,2,gotoif($[$[${STATUS}]&lt;3]?available:unavailable)
; GotoIf(condition?label_if_true:label_if_false)
exten =&gt; s,3(available),jabbersend(asterisk,${ARG2},"Call from
 ${CALLERID(name)} at number${CALLERID(num)} on
 ${STRFTIME(,GMT-1,%A %B %d %G at %l:%M:%S %p)}")
exten =&gt; s,4,Dial(${ARG1})
exten =&gt; s,5(unavailable),Dial(${ARG3})</pre>
<p>Since we have declared a macro, we have to call it in the context of our choice and assign the relevant values to the macro&#8217;s variables :</p>
<pre style="padding-left: 30px;">[whatever_context]
; ${ARG1} is the destination when at desk
; ${ARG2} is a jabber address used at desk
; ${ARG3} is the destination when not at desk
exten =&gt; 05600047590,1,Macro(reach_user,SIP/jml-desk,
 jim@jabber.grabeuh.com, SIP/freephonie-out/0666758747);
; repeat last line for each user</pre>
<p>That&#8217;s all folks ! That is all it takes to have your calls routed to the right phone according to your presence status. It is really that easy.</p>
<p>Why no service provider is offering that is beyond me. The big ones are all waiting for the <a href="http://en.wikipedia.org/wiki/IP_Multimedia_Subsystem">IMS</a> systems they are going to deploy with a five years roadmap. But if you want the future right now there is no need to wait : all the technology is here today waiting for you to play with it ! And of course it is 100% <a href="http://en.wikipedia.org/wiki/Free_software">Free software</a>&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://serendipity.ruwenzori.net/index.php/2008/06/05/routing-asterisk-calls-using-jabber-presence-status/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Modified Wondershaper for better VOIP QOS</title>
		<link>http://serendipity.ruwenzori.net/index.php/2008/06/01/modified-wondershaper-for-better-voip-qos</link>
		<comments>http://serendipity.ruwenzori.net/index.php/2008/06/01/modified-wondershaper-for-better-voip-qos#comments</comments>
		<pubDate>Sun, 01 Jun 2008 17:55:29 +0000</pubDate>
		<dc:creator>Jean-Marc Liotier</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Systems administration]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[VOIP]]></category>

		<guid isPermaLink="false">http://serendipity.ruwenzori.net/?p=167</guid>
		<description><![CDATA[Ever since the Linux Advanced Routing &#38; Shaping HOWTO introduced it, I have been a big fan of the Wondershaper, a traffic shaping script that drives Linux&#8216;s class based queuing with stochastic fairness queuing (SFQ) in a pretty effective attempt at maintaining low latency for interactive traffic while at the same time maintaining high throughput. [...]]]></description>
			<content:encoded><![CDATA[<p>Ever since the <a href="http://lartc.org/">Linux Advanced Routing &amp; Shaping HOWTO</a> introduced it, I have been a big fan of <a href="http://lartc.org/wondershaper/">the Wondershaper</a>, a <a href="http://en.wikipedia.org/wiki/Traffic_shaping">traffic shaping</a> script that drives <a href="http://en.wikipedia.org/wiki/Linux_kernel">Linux</a>&#8216;s class based queuing with <a href="http://www.opalsoft.net/qos/DS-25.htm">stochastic fairness queuing</a> (SFQ) in a pretty effective attempt at maintaining low latency for interactive traffic while at the same time maintaining high throughput. There is even a <a href="http://packages.debian.org/unstable/net/wondershaper">&#8216;wondershaper&#8217; Debian package</a> that includes some additional polish. This script is key to the joy of perfectly responsive <a href="http://en.wikipedia.org/wiki/Secure_Shell">SSH</a> sessions while <a href="http://en.wikipedia.org/wiki/File_sharing">peer to peer file sharing</a> traffic saturates the uplink.</p>
<p><a href="http://www.zmonkey.org/blog/node/150">Some people have even concluded the resulting quality of service is good enough for voice traffic</a>. But even with the Debian Wondershaper ruling my <a href="http://en.wikipedia.org/wiki/Asymmetric_Digital_Subscriber_Line">ADSL</a> link I noticed that <a href="http://en.wikipedia.org/wiki/Session_Initiation_Protocol">SIP</a> and <a href="http://en.wikipedia.org/wiki/Inter-Asterisk_eXchange">IAX</a> still suffer too much packet loss with the saturating traffic occupying the background. I needed better traffic control.</p>
<p>As usual, being a late adopter I am not the only one to have hit that obstacle, and solutions have already been put forth. After rummaging through various mutations, I found <a href="http://www.ruwenzori.net/code/wondershaper/wondershaper.akbor">Robert Koch&#8217;s version of the Wondershaper for the Asus WL-xxx</a> documented on the <a href="http://wiki.wl500g.info/index.php/PackageWondershaper">Wondershaper package page of the WL-500G wiki</a> to be quite promising. Compared to the standard version it prioritizes VOIP traffic by source port for idiot proof configuration, but also by <a href="http://en.wikipedia.org/wiki/Type_of_Service">type of service</a> which is much more flexible and can be used thanks to <a href="http://www.asterisk.org/support/about">Asterisk</a> being capable of correctly setting TOS fields. As a bonus, using <a href="http://en.wikipedia.org/wiki/Type_of_Service">TOS</a> also makes this version of the script capable of distinction between console interactive SSH traffic and bulk SCP traffic using the same protocol and port. And to top it all, it is based on the better <a href="http://luxik.cdi.cz/~devik/qos/htb/manual/userg.htm">hierarchical token bucket</a> (HTB) discipline which is standard since Linux 2.4.20 while the Debian Wondershaper version uses the more based queuing which used to be the more widespread one.</p>
<p>The first shortcoming I found is that it prioritizes <a href="http://en.wikipedia.org/wiki/Session_Initiation_Protocol">SIP</a> and <a href="http://en.wikipedia.org/wiki/Real-time_Transport_Protocol">RTP</a> but not <a href="http://en.wikipedia.org/wiki/Inter-Asterisk_eXchange">IAX</a> and others which I&#8217;ll have to add using the <a href="http://en.wikipedia.org/wiki/Session_Initiation_Protocol">SIP</a> stanzas as templates. The other is that taking lists of low priority ports as arguments could make the command line messy and configuration puzzling for the inexperienced user, so I prefer to have this configuration item as a documented variable allocation inside the script. But those are trifles compared to the new VOIP support, enhanced <a href="http://en.wikipedia.org/wiki/Secure_Shell">SSH</a> discrimination and overall upgrade.</p>
<p>Hacking on the script I couldn&#8217;t resist reorganizing a few things. I originally intended to provide a diff, but that would be pointless since I ended up touching most of the lines. Also be warned that I do not understand why putting &#8216;prio 1&#8242; everywhere makes the script work whereas other &#8216;prio&#8217; values at various places made traffic end up in the wrong class and did not make sense at all. In effect, I think that by putting &#8216;prio 1&#8242; everywhere I just eschewed the use of priority bands inside the classes, which is just fine with me for the intended use. But this show that my <a href="http://www.rns-nis.co.yu/~mps/linux-tc.html">tc</a> fluency is still limited and that there are therefore surely ways to enhance this script. I&#8217;ll also welcome feedback &#8211; whether it works for you or not.</p>
<p>Anyway &#8211; it works ! I had a few <a href="http://en.wikipedia.org/wiki/Voice_over_Internet_Protocol">VOIP</a> conversations across an <a href="http://en.wikipedia.org/wiki/Inter-Asterisk_eXchange">IAX</a> trunk with lots of background traffic on the uplink and no perceptible effects on voice quality. Life is good. Now that I have removed the last obstacle to taking full advantage of <a href="http://en.wikipedia.org/wiki/Voice_over_Internet_Protocol">VOIP</a> at home. Soon all my traffic will be routed through <a href="http://www.asterisk.org/support/about">Asterisk</a> and there shall be no more <a href="http://en.wikipedia.org/wiki/RJ11">RJ11</a> nor their <a href="http://fr.wikipedia.org/wiki/Prise_en_T">French T-sockets</a> alter ego in my home.<a href="http://www.asterisk.org/support/about"><br />
</a></p>
<p>Here is my <a href="http://www.ruwenzori.net/code/wondershaper/wondershaper.jml">modified wondershaper script</a> in all its glory &#8211; contrary to <a href="http://www.ruwenzori.net/code/wondershaper/wondershaper.akbor">Robert Koch&#8217;s version</a> it is a drop-in replacement for <a href="http://packages.debian.org/unstable/net/wondershaper">Debian&#8217;s package</a>. Inheriting from <a href="http://lartc.org/wondershaper/">the original Wondershaper</a> it is licensed under the <a href="http://en.wikipedia.org/wiki/GNU_General_Public_License">GPL</a> so enjoy, modify and share !</p>
]]></content:encoded>
			<wfw:commentRss>http://serendipity.ruwenzori.net/index.php/2008/06/01/modified-wondershaper-for-better-voip-qos/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
