<?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>Moy Blog &#187; freeswitch</title>
	<atom:link href="http://www.moythreads.com/wordpress/category/voip/freeswitch/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.moythreads.com/wordpress</link>
	<description>Abandon All Hope, Ye Who Read This Blog</description>
	<lastBuildDate>Sun, 01 Jan 2012 19:20:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Busy November 2011</title>
		<link>http://www.moythreads.com/wordpress/2011/12/31/busy-november-2011/</link>
		<comments>http://www.moythreads.com/wordpress/2011/12/31/busy-november-2011/#comments</comments>
		<pubDate>Sun, 01 Jan 2012 00:37:54 +0000</pubDate>
		<dc:creator>moy</dc:creator>
				<category><![CDATA[asterisk]]></category>
		<category><![CDATA[freeswitch]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">http://www.moythreads.com/wordpress/?p=177</guid>
		<description><![CDATA[I attended 3 Linux/Telephony events in this past November 2011. All of them are focused on the Latino American community. Find the presentations below: - Elastix World 2011, Mexico D.F. Nov 3-4 - &#8221;Negociación de codecs en Asterisk&#8221; - FSL, Vallarta, México. Nov 5 &#8211; &#8220;FreeSWITCH &#8211; Asterisk con esteroides&#8221; - 4K Conference, Buenos Aires, Argentina, [...]]]></description>
			<content:encoded><![CDATA[<p>I attended 3 Linux/Telephony events in this past November 2011. All of them are focused on the Latino American community.</p>
<p>Find the presentations below:</p>
<p>- Elastix World 2011, Mexico D.F. Nov 3-4 - &#8221;<a href="http://www.moythreads.com/congresos/elastixworld2011/" target="_blank">Negociación de codecs en Asterisk</a>&#8221;</p>
<p>- FSL, Vallarta, México. Nov 5 &#8211; &#8220;<a href="http://www.moythreads.com/congresos/fslvallarta2011/" target="_blank">FreeSWITCH &#8211; Asterisk con esteroides</a>&#8221;</p>
<p>- 4K Conference, Buenos Aires, Argentina, Nov 24  - &#8220;<a href="http://www.moythreads.com/congresos/4kconference2011/" target="_blank">Manejo de medios en FreeSWITCH</a>&#8220;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moythreads.com/wordpress/2011/12/31/busy-november-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux Core Dumps</title>
		<link>http://www.moythreads.com/wordpress/2011/10/06/linux-core-dumps/</link>
		<comments>http://www.moythreads.com/wordpress/2011/10/06/linux-core-dumps/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 14:07:15 +0000</pubDate>
		<dc:creator>moy</dc:creator>
				<category><![CDATA[asterisk]]></category>
		<category><![CDATA[freeswitch]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.moythreads.com/wordpress/?p=168</guid>
		<description><![CDATA[Note that most of the theory (particularly the low level segmentation fault details) are also valid for Windows platforms and other operating systems. The commands to configure core dumps and retrieve them are Linux specific though. I also assume that the program you are trying to debug is &#8220;FreeSWITCH&#8221;, but you can easily change the [...]]]></description>
			<content:encoded><![CDATA[<p>Note that most of the theory (particularly the low level segmentation fault details) are also valid for Windows platforms and other operating systems. The commands to configure core dumps and retrieve them are Linux specific though. I also assume that the program you are trying to debug is &#8220;FreeSWITCH&#8221;, but you can easily change the program name to the one is misbehaving in your case and you should be fine.</p>
<p><strong>What is a core dump?</strong></p>
<p>Sometimes problems with FreeSWITCH, Asterisk or just about any other program in Linux are hard to debug by just looking at the logs. Sometimes the process crashes and you don&#8217;t have a chance to use the CLI to look at stats. The logs may not reveal anything particularly interesting, or just some minimal information. Sometimes you need to dig deeper into the state of the program to poke around and see what is going on inside. Linux process core dumps are meant for that.</p>
<p>The most typical case for a core dump is when a process <strong>dies violently and unexpectedly</strong>. For example, if a programmer does something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #0000dd;">0</span> <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span></pre></div></div>

<p>Is usually not that straight forward, it may be the that the programmer did not expect certain variable to contain a NULL (0) value. The process is killed by the Linux kernel because by default, a Linux process does not map the memory address 0 to anything. This causes a page fault in the processor which is trapped by the kernel, the kernel then sees that the given process does not have anything mapped at address 0 and then sends the SIGSEGV (Unix signal) to the process. This is called a <strong>segmentation fault</strong>.</p>
<p>The default signal handler for SIGSEGV dumps the memory of the process and kills the process. This memory dump contains all the memory for this process (and all the threads belonging to that process) and that is what is used to determine what went wrong with the program that attempted to reference an invalid address (0 in this case, but any invalid address can cause it).</p>
<p>You can learn more about it here: <a href="http://en.wikipedia.org/wiki/Segmentation_fault">http://en.wikipedia.org/wiki/Segmentation_fault</a></p>
<p><strong>How can I make sure the core dump will be saved?</strong></p>
<p>Each process has a limit for how big this core can be. If the limit is exceeded no core dump will be saved. By default this limit is 0!, that means no core will be dumped by default.</p>
<p>Before starting the process you must use &#8220;<strong>ulimit</strong>&#8220;. The &#8220;<strong>ulimit</strong>&#8221; command sets various limits for the current process. If you execute it from the bash shell, that means the limits are applied to your bash shell process. This also means any processes that you start from bash will inherit those limits (because they are child processes from your bash shell).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">ulimit</span> <span style="color: #660033;">-a</span></pre></div></div>

<p>That shows you all the limits for your bash shell. In order to guarantee that a core will be dumped you must set the &#8220;core file size&#8221; limit to &#8220;unlimited&#8221;.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">ulimit</span> <span style="color: #660033;">-c</span> unlimited</pre></div></div>

<p>If you are starting the process from an init script or something like that, the init script has to do it. Some programs are smart enough to raise their limits themselves, but is always better to make sure you have unlimited core file size for your bash shell. You may then want to add those ulimit instructions inside your $HOME/.bashrc file.</p>
<p><strong>Where is the core dump saved?</strong></p>
<p>Each process has a &#8220;working directory&#8221;. See <a href="http://en.wikipedia.org/wiki/Working_directory">http://en.wikipedia.org/wiki/Working_directory</a></p>
<p>That is where the process core dump will be saved by default. However, some system-wide settings affect where the core is dumped.</p>
<p>&#8220;/proc/sys/kernel/core_pattern&#8221; and &#8220;/proc/sys/kernel/core_uses_pid&#8221; are 2 files that control the base file name pattern for the core, and whether the core name will be appended with the PID (process ID).</p>
<p>The recommended settings are:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>core
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;/var/core/core&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>kernel<span style="color: #000000; font-weight: bold;">/</span>core_pattern
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>kernel<span style="color: #000000; font-weight: bold;">/</span>core_uses_pid</pre></div></div>

<p>You can confirm what you just did with:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>kernel<span style="color: #000000; font-weight: bold;">/</span>core_pattern
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>kernel<span style="color: #000000; font-weight: bold;">/</span>core_uses_pid</pre></div></div>

<p>This settings will cause any process in the system that crashes, to dump the core at:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>core<span style="color: #000000; font-weight: bold;">/</span>core.<span style="color: #000000; font-weight: bold;">&lt;</span>pid<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p><strong>What if I just want a core dump without killing the process?</strong></p>
<p>In some situations, if a process becomes unresponsive or the response times are not ideal. For example, you try to execute CLI commands in Asterisk or FreeSWITCH but there is no output, or worst, your command line prompt gets stuck. The process is still there, it may be even processing calls, but some things are taking lot of time or just don&#8217;t get done. You can use &#8220;gdb&#8221; (The GNU debugger) to dump a core of the process without killing the process and almost with no disruption of the service. I say almost because for a large process, dumping a core may take a second or two, in that time the process is freezed by the kernel, so active calls may drop some audio (if you&#8217;re debugging some real time audio system like Asterisk or FreeSWITCH).</p>
<p>The trick to do it fast is to first create a file with the GDB commands required to dump the core.</p>
<p>Latest versions of CentOS include (with the gdb RPM package) the &#8220;gcore&#8221; command to do everything for you. You only need to execute:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gcore $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">pidof</span> freeswitch<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>To dump the core of the running process.</p>
<p>If you are in a system that does not include gcore, you can do the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;generate-core-file<span style="color: #000099; font-weight: bold;">\n</span>detach<span style="color: #000099; font-weight: bold;">\n</span>quit&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> gdb-instructions.txt</pre></div></div>

<p>The 3 instructions added to the file are:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">generate-core-file
detach
quit</pre></div></div>

<p>This will do exactly what we want. Generate the core file for the attached process, then detach from the process (to let it continue) and then quit gdb.</p>
<p>You then use GDB (you may need to install it with &#8220;yum install gdb&#8221;) to attach to the running process, dump the core, and get out as fast as possible.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">gdb</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>freeswitch<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>freeswitch $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">pidof</span> freeswitch<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #660033;">-x</span> gdb-instructions.txt</pre></div></div>

<p>The arguments to attach to the process include the original binary that was used to start it and the PID of the running process. The -x switch tells GDB to execute the commands in the file after attaching.</p>
<p>The core will be named core.&lt;pid&gt; by default and the path is not affected by the /proc/sys/kernel settings of the system.</p>
<p>This core can now be used by the developer to troubleshoot the problem.</p>
<p>Sometimes though, the developer will be more interested in a full back trace (stack trace), because the core dump itself can&#8217;t be easily examined in any other box than the one where was generated, therefore it might be up to you to provide that stack trace, which you can do with:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">gdb</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>freeswitch<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>freeswitch core.<span style="color: #000000; font-weight: bold;">&lt;</span>pid<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">gdb</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">set</span> logging <span style="color: #c20cb9; font-weight: bold;">file</span> my_back_trace.txt
<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">gdb</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> thread apply all bt full
<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">gdb</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> quit</pre></div></div>

<p>Then send the file my_back_trace.txt to the developer, or analyze it yourself, sometimes is easy to spot the problems even without development experience!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moythreads.com/wordpress/2011/10/06/linux-core-dumps/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Cluecon 2011 &#8211; By Developers For Developers</title>
		<link>http://www.moythreads.com/wordpress/2011/08/13/cluecon-2011-by-developers-for-developers/</link>
		<comments>http://www.moythreads.com/wordpress/2011/08/13/cluecon-2011-by-developers-for-developers/#comments</comments>
		<pubDate>Sat, 13 Aug 2011 20:02:10 +0000</pubDate>
		<dc:creator>moy</dc:creator>
				<category><![CDATA[freeswitch]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">http://www.moythreads.com/wordpress/?p=161</guid>
		<description><![CDATA[I am back from ClueCon once again. I&#8217;m getting lazy, I used to post before going. Anyways, the topic of my session this time was media handling in FreeSWITCH. We&#8217;ll be doing some work in in that area at Sangoma in the following months so I thought I&#8217;d kill two birds with one stone. &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>I am back from ClueCon once again. I&#8217;m getting lazy, I used to post before going.</p>
<p><img src="http://www.moythreads.com/cluecon-logo.png" alt="" align="left" /> Anyways, the topic of my session this time was media handling in FreeSWITCH. We&#8217;ll be doing some work in in that area at Sangoma in the following months so I thought I&#8217;d kill two birds with one stone.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Presentation here:<br />
PPT: <a title="Media Handling in FreeSWITCH" href="http://www.moythreads.com/congresos/cluecon2011/media-handling-freeswitch-final.ppt" target="_blank">http://www.moythreads.com/congresos/cluecon2011/media-handling-freeswitch-final.ppt</a></p>
<p>PDF: <a title="Media Handling in FreeSWITCH" href="http://www.moythreads.com/congresos/cluecon2011/media-handling-freeswitch-final.pdf" target="_blank">http://www.moythreads.com/congresos/cluecon2011/media-handling-freeswitch-final.pdf</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.moythreads.com/wordpress/2011/08/13/cluecon-2011-by-developers-for-developers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenR2 and OpenZap now integrated &#8211; MFCR2 support for FreeSWITCH</title>
		<link>http://www.moythreads.com/wordpress/2009/08/21/openr2-and-openzap-now-integrated-mfcr2-support-for-freeswitch/</link>
		<comments>http://www.moythreads.com/wordpress/2009/08/21/openr2-and-openzap-now-integrated-mfcr2-support-for-freeswitch/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 22:20:30 +0000</pubDate>
		<dc:creator>moy</dc:creator>
				<category><![CDATA[freeswitch]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[openr2]]></category>

		<guid isPermaLink="false">http://www.moythreads.com/wordpress/2009/08/21/openr2-and-openzap-now-integrated-mfcr2-support-for-freeswitch/</guid>
		<description><![CDATA[After putting this off by several weeks, I finally spent some quality time working in getting to work OpenZAP with OpenR2. The result is now available in the openzap project svn trunk: http://svn.openzap.org/svn/openzap/trunk/ I also created some basic documentation about how to set it up: http://wiki.freeswitch.org/wiki/OpenZAP_OpenR2 This means that from now on FreeSWITCH will support [...]]]></description>
			<content:encoded><![CDATA[<p>After putting this off by several weeks, I finally spent some quality time working in getting to work OpenZAP with OpenR2. The result is now available in the openzap project svn trunk:</p>
<p><a href="http://svn.openzap.org/svn/openzap/trunk/" target="_blank">http://svn.openzap.org/svn/openzap/trunk/</a></p>
<p>I also created some basic documentation about how to set it up: <a href="http://wiki.freeswitch.org/wiki/OpenZAP_OpenR2" target="_blank">http://wiki.freeswitch.org/wiki/OpenZAP_OpenR2</a></p>
<p>This means that from now on FreeSWITCH will support MFC-R2 signaling with the same stack that Asterisk is using since 1.6.2</p>
<p>I still need to do some work on the documentation and lots of stress testing, but you can start playing with it and bugging me if it does not work <img src='http://www.moythreads.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.moythreads.com/wordpress/2009/08/21/openr2-and-openzap-now-integrated-mfcr2-support-for-freeswitch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Back from ClueCon 2009 in Chicago</title>
		<link>http://www.moythreads.com/wordpress/2009/08/09/back-from-cluecon-2009-in-chicago/</link>
		<comments>http://www.moythreads.com/wordpress/2009/08/09/back-from-cluecon-2009-in-chicago/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 19:36:24 +0000</pubDate>
		<dc:creator>moy</dc:creator>
				<category><![CDATA[freeswitch]]></category>
		<category><![CDATA[sangoma]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">http://www.moythreads.com/wordpress/2009/08/09/back-from-cluecon-2009-in-chicago/</guid>
		<description><![CDATA[I attended ClueCon 2009 in Chicago the past week to present &#8220;FreeSWITCH modules for Asterisk Developers&#8221;, where I discussed FreeSWITCH internals and interfaces from an Asterisk developer point of view (particularly my point of view). The power point presentation can be found here: FreeSWITCH modules for Asterisk Developers The presentation will show you the key [...]]]></description>
			<content:encoded><![CDATA[<p>I attended ClueCon 2009 in Chicago the past week to present &#8220;FreeSWITCH modules for Asterisk Developers&#8221;, where I discussed FreeSWITCH internals and interfaces from an Asterisk developer point of view (particularly my point of view).</p>
<p>The power point presentation can be found here:  <a href="http://www.moythreads.com/congresos/cluecon2009/freeswitch_modules_for_asterisk_devs.ppt" target="_blank">FreeSWITCH modules for Asterisk Developers</a></p>
<p><img src="http://www.moythreads.com/chicago.jpg" alt="Chicago" /></p>
<p>The presentation will show you the key internal data structures and call flow when making a two-leg call in FreeSWITCH and Asterisk between SIP and PRI protocols. And of course, how to write modules for both telephony engines.</p>
<p>After the talk some people approached me to ask some particular questions, it seems the interest in creating FreeSWITCH modules and applications on top of it is increasing, it&#8217;s definitely going to be interesting what happens in the next years, the future of FreeSWITCH really looks promising.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moythreads.com/wordpress/2009/08/09/back-from-cluecon-2009-in-chicago/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>About the Asterisk development model</title>
		<link>http://www.moythreads.com/wordpress/2009/06/02/about-the-asterisk-development-model/</link>
		<comments>http://www.moythreads.com/wordpress/2009/06/02/about-the-asterisk-development-model/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 16:57:49 +0000</pubDate>
		<dc:creator>moy</dc:creator>
				<category><![CDATA[asterisk]]></category>
		<category><![CDATA[freeswitch]]></category>

		<guid isPermaLink="false">http://www.moythreads.com/wordpress/2009/06/02/about-the-asterisk-development-model/</guid>
		<description><![CDATA[This post is my opinion regarding to http://lists.digium.com/pipermail/asterisk-dev/2009-March/037262.html (English) http://www.saghul.net/blog/2009/03/18/sobre-el-modelo-de-desarrollo-de-asterisk/ (Spanish) For those not involved in the Asterisk users and/or developers community, it all comes down to users complaining about Asterisk reliability and the new (1.6) development model that will allow new features to be introduced in dot releases which (they say) will make it [...]]]></description>
			<content:encoded><![CDATA[<p>This post is my opinion regarding to </p>
<p><a href="http://lists.digium.com/pipermail/asterisk-dev/2009-March/037262.html" target="_blank">http://lists.digium.com/pipermail/asterisk-dev/2009-March/037262.html</a> (English)</p>
<p><a href="http://www.saghul.net/blog/2009/03/18/sobre-el-modelo-de-desarrollo-de-asterisk/" target="_blank">http://www.saghul.net/blog/2009/03/18/sobre-el-modelo-de-desarrollo-de-asterisk/</a> (Spanish)</p>
<p>For those not involved in the Asterisk users and/or developers community, it all comes down to users complaining about Asterisk reliability and the new  (1.6) development model that will allow new features to be introduced in dot releases which (they say) will make it worst. Telephony systems are damn critical. Users are used to see their computer crash (yeah, even Linux users, not that often but it happens). But telephony lines are very reliable circuits (basically because they&#8217;re very simple in nature and have been around a long time). Asterisk started a revolution and I don&#8217;t think anyone can deny that, it has brought a lot of flexibility to telephony systems, but that revolution comes of course with a cost. </p>
<p>I started playing with Asterisk at the beginning of 2004, I&#8217;ve seen segfaults, deadlocks and all kind of funny behaviours here and there. Sometimes a brand new release of Asterisk has basic functionality broken (like originate calls from the manager). That&#8217;s true as well, it can be said that Asterisk, out of the box, is not reliable (scalability is another beast I don&#8217;t want to talk about now), and naturally users don&#8217;t like that.</p>
<p>Having said that, I need to clarify what I mean by &#8220;reliable&#8221;. In this context, by reliable I mean, if you take 1.4.N release, deploy applications on top of it and then you blindly upgrade from 1.4.N to 1.4.(N+1) WITHOUT TESTING and put it in production expecting it to just work, well, good luck with that, and enjoy your new job flipping burgers at McDonalds. That is, Asterisk is not reliable for users who are not willing to put some effort when upgrading. Asterisk is a complex beast (and built on top of somewhat still shaky core), the Asterisk developers had been doing a great job improving the core, however, nasty hacks like <a href="http://www.moythreads.com/wordpress/2006/09/01/asterisk-masquerade/" target="_blank">masquerade</a> are still there.</p>
<p>I don&#8217;t have problems with Asterisk being criticized, that&#8217;s what it will make it better in the end. I do have a problem though with all that people that are nothing but leeches of the community. Here is the kind of user I have a problem with:</p>
<p>1. They typically just ask questions in the mailing list, never spend time helping other users.<br />
2. They download for free Asterisk and expect it to work out-of-the-box for their particular (profit) purpose without spending time not even doing their homework, testing their particular scenarios etc.<br />
3. They bitch about Digium not fixing bugs in the bug-tracker, bugs that according to them are so damn critical to their business that they not even put a bounty on the voip-info wiki or in the asterisk-biz mailing list for someone to fix it.<br />
4. They do not download beta releases or release candidates, they just wait for the &#8220;stable&#8221; release and again, expect things to magically work for them to profit.</p>
<p>In short, they don&#8217;t want to spend a single cent, nor spend some time out of their busy life, all they expect is their life to be free of problems and cash big bucks. One common argument for these users is that they are not developers and cannot help, that&#8217;s just bs, there is other ways to help and in the end you can always spend some of your free-asterisk-based business revenue to place bounties for the development of test beds or whatever you feel is needed to improve Asterisk.</p>
<p>At the end, I agree Asterisk development has to improve. But Digium does not has unlimited resources, and is already paying for a big team of development creating Asterisk and you can download it for free. Being free is not an excuse for lacking quality, but just think, there is limited resources and Digium is allocating those resources where it makes sense for its business. Type &#8220;core show warranty&#8221; in your Asterisk CLI and tell me what your warranty is.</p>
<p>In the other hand, those leech-users should know that not only users, but also some developers are unhappy with the development model (but different arguments than leech-users had). That&#8217;s why <a href="http://www.callweaver.org/" target="_blank">CallWeaver</a> was born, and not only that. The biggest example I like to use of one of the foundations of open source (if you don&#8217;t like it, then fix it) is the <a href="http://www.freeswitch.org/" target="_blank">FreeSwitch</a> project. </p>
<p>The <a href="http://www.freeswitch.org/" target="_blank">FreeSwitch</a> project was born out of the discontent (to put it nicely) of one of the top developers of Asterisk: Anthony Minessale II, he complains a lot about Asterisk, yeah, but he also did a lot more for Asterisk than anyone else I know of beyond Mark himself and just a couple of the top developers of Asterisk. So, yes, from my perspective in some way he has earned the right to talk shit about Asterisk, because he knows it, he has proposed solutions and he has actually brought solutions: <a href="http://www.freeswitch.org/" target="_blank">FreeSwitch</a>. FreeSwitch has brought some serious competition to Asterisk (sorry, but let&#8217;s be serious, CallWeaver and Yate had never been close to match Asterisk functionality and usage, let alone GNU Bayonne).</p>
<p>FreeSwitch, from my perspective has solved many of the core problems that Asterisk has, it also solves the licensing issues (it&#8217;s MPL) and it&#8217;s developer friendly (since there is no business driving force yet behind it and you can get an svn branch right away). Probably FreeSwitch is not a short-term solution for those who are already hooked into Asterisk business, but in any case, at this point I don&#8217;t think there is short-term solutions for the problems Asterisk users complain about, it&#8217;s gonna cost ya baby, one way or another, and from my perspective that is the way is supposed to be.</p>
<p>In the end, Olle Johansson did quite good being the first in reply to that post and resumed the situation, which is not simple, but one thing is for sure, the community has to stop bitching and start doing. Well, I really don&#8217;t care if you keep bitching as long as you fucking do something else to make the situation better.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moythreads.com/wordpress/2009/06/02/about-the-asterisk-development-model/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cluecon 2009</title>
		<link>http://www.moythreads.com/wordpress/2009/05/05/cluecon-2009/</link>
		<comments>http://www.moythreads.com/wordpress/2009/05/05/cluecon-2009/#comments</comments>
		<pubDate>Tue, 05 May 2009 21:40:09 +0000</pubDate>
		<dc:creator>moy</dc:creator>
				<category><![CDATA[freeswitch]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">http://www.moythreads.com/wordpress/2009/05/05/cluecon-2009/</guid>
		<description><![CDATA[I will be speaking at ClueCon this year. The talk will be about writing FreeSwitch modules and how the development process compares to writing modules for Asterisk in terms of APIs. If you are interested in learning how to write modules for Asterisk and/or Freeswitch, this is your chance! The full schedule is still being [...]]]></description>
			<content:encoded><![CDATA[<p>I will be speaking at ClueCon this year. The talk will be about writing <a href ="http://www.freeswitch.org/" target="_blank">FreeSwitch</a> modules and how the development process compares to writing modules for <a href="http://www.asterisk.org/" target="_blank">Asterisk</a> in terms of APIs. If you are interested in learning how to write modules for Asterisk and/or Freeswitch, this is your chance!</p>
<p>The full schedule is still being prepared so be sure to check the site later when it&#8217;s done.</p>
<p>I could not decide which banner to use here, so I decided to put 3 I really liked <img src='http://www.moythreads.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  &#8230; if you use any open source telephony application, support developers by attending or at least putting one of these banners on your site. </p>
<p><a href="http://www.cluecon.com/" target="_blank"><img src="http://files.freeswitch.org/cluecon_2009/image/CC_2009_Joinus.png"></a></p>
<p><a href="http://www.cluecon.com/" target="_blank"><img src="http://files.freeswitch.org/cluecon_2009/image/CC_2009_250x250.png"></a></p>
<p><a href="http://www.cluecon.com/" target="_blank"><img src="http://files.freeswitch.org/cluecon_2009/image/CC_2009_banner2.png"></a></p>
<p>From the ClueCon site:<br />
ClueCon &#8211; is an annual 3-Day Telephony User and Developer Conference bringing together the entire spectrum of Telephony from TDM circuits to VoIP and everything in between. The presentations and discussions will cover several open source telephony applications such as Asterisk/Callweaver, OpenSIPS/Kamailio (formerly OpenSER), Bayonne, YATE and FreeSWITCH. Other great projects that will be discussed include OPAL and Woomera.</p>
<p>More funny banners at: <a href="http://files.freeswitch.org/cluecon_2009/" target="_blank">http://files.freeswitch.org/cluecon_2009/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.moythreads.com/wordpress/2009/05/05/cluecon-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>G729A and G723.1 support for FreeSwitch</title>
		<link>http://www.moythreads.com/wordpress/2009/02/08/g729a-and-g7231-support-for-freeswitch/</link>
		<comments>http://www.moythreads.com/wordpress/2009/02/08/g729a-and-g7231-support-for-freeswitch/#comments</comments>
		<pubDate>Sun, 08 Feb 2009 07:36:16 +0000</pubDate>
		<dc:creator>moy</dc:creator>
				<category><![CDATA[freeswitch]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.moythreads.com/wordpress/2009/02/08/g729a-and-g7231-support-for-freeswitch/</guid>
		<description><![CDATA[.comment { color: #999999; font-style: italic; } .pre { color: #000099; } .string { color: #009900; } .char { color: #009900; } .float { color: #996600; } .int { color: #999900; } .bool { color: #000000; font-weight: bold; } .type { color: #FF6633; } .flow { color: #FF0000; } .keyword { color: #990000; } .operator [...]]]></description>
			<content:encoded><![CDATA[<style type="text/css">
.comment { color: #999999; font-style: italic; }
.pre { color: #000099; }
.string { color: #009900; }
.char { color: #009900; }
.float { color: #996600; }
.int { color: #999900; }
.bool { color: #000000; font-weight: bold; }
.type { color: #FF6633; }
.flow { color: #FF0000; }
.keyword { color: #990000; }
.operator { color: #663300; font-weight: bold; }
</style>
<p>The past weekend I spent some time writing a module for the <a href="http://www.freeswitch.org/" target="_blank">FreeSwitch</a> project in order to support the <a href="http://en.wikipedia.org/wiki/G.729a" target="_blank">G729A codec</a> in it. This codec is patent encumbered, however, my target was not to do this in software, but just create the software interface for FreeSwitch to talk with a PCI card manufactured by <a href="http://www.digium.com/">Digium</a> that does the transcoding for G729A and <a href="http://en.wikipedia.org/wiki/G.723.1" target="_blank">G723.1</a> .</p>
<p><a href="http://www.digium.com/en/products/voice/tc400b.php" target="_blank">This is the data sheet for the TC400B board.</a> The programming interfaces to access the encoders and decoders is not documented (or at least I could not find any documentation), but it&#8217;s enough to have available the source code for the module in <a href="http://www.asterisk.org/" target="_blank">Asterisk</a> that uses that very same board.</p>
<p>This board expose its available encoders to the <a href="http://www.voip-info.org/wiki/view/DAHDI" target="_blank">DAHDI</a> / <a href="http://www.voip-info.org/wiki/view/Zaptel" target="_blank">Zaptel</a> core driver, which in turn exposes all transcoders registered by the boards through the Linux filesystem in /dev/dahdi/transcode or /dev/zap/transcode, depending on whether you have Zaptel or DAHDI drivers.</p>
<p>Here I want to explain the few interfaces required to use this board.</p>
<p>The first thing you usually want to do is verify that there is encoders and decoders available. This is done through an <a href="http://en.wikipedia.org/wiki/Ioctl">ioctl</a> to request the information about the availability of these transcoders. </p>
<pre>
<span class="keyword">        struct</span> dahdi_transcoder_info info<span class="operator"> = {</span><span class="int">0</span><span class="operator">};</span>

        fd<span class="operator"> =</span> open<span class="operator">(</span><span class="string">"/dev/dahdi/transcode"</span><span class="operator">,</span> O_RDWR<span class="operator">);</span><span class="flow">
        if</span><span class="operator"> (</span>fd<span class="operator"> &lt;</span><span class="int"> 0</span><span class="operator">) {</span>

                fprintf<span class="operator">(</span>stderr<span class="operator">,</span><span class="string"> "Failed to open dahdi transcode device\n"</span><span class="operator">);</span>
                exit<span class="operator">(</span><span class="int">1</span><span class="operator">);
        }</span><span class="flow">
        for</span><span class="operator"> (</span>info<span class="operator">.</span>tcnum<span class="operator"> =</span><span class="int"> 0</span><span class="operator">; !(</span>res<span class="operator"> =</span> ioctl<span class="operator">(</span>fd<span class="operator">,</span> DAHDI_TC_GETINFO<span class="operator">, &amp;</span>info<span class="operator">));</span> info<span class="operator">.</span>tcnum<span class="operator">++) {</span>

                printf<span class="operator">(</span><span class="string">"Found transcoder '%s', numchannels = %d, dstfmts = %d, srcfmts = %d.\n"</span><span class="operator">,</span> info<span class="operator">.</span>name<span class="operator">,</span>
                                info<span class="operator">.</span>numchannels<span class="operator">,</span> info<span class="operator">.</span>dstfmts<span class="operator">,</span> info<span class="operator">.</span>srcfmts<span class="operator">);
        }</span>

        close<span class="operator">(</span>fd<span class="operator">);</span>
</pre>
<p>The driver will let you know the number of encoders, decoders and the source and destiny formats. The formats masks can be found in /usr/include/dahdi/kernel.h. In future versions that may change, I discussed this with one of the DAHDI developers, since I think that this should be in dahdi/user.h and not in kernel.h given that is a user space interface.</p>
<p>Once you know which transcoders are available you can request an encoder or decoder, or both.</p>
<pre><span class="type">        int</span> encoder_fd<span class="operator">,</span> decoder_fd<span class="operator">;</span><span class="keyword">

        struct</span> dahdi_transcoder_formats g729_encoder<span class="operator">;</span><span class="keyword">
        struct</span> dahdi_transcoder_formats g729_decoder<span class="operator">;</span>

        g729_encoder<span class="operator">.</span>srcfmt<span class="operator"> =</span> DAHDI_FORMAT_ULAW<span class="operator">;</span>

        g729_encoder<span class="operator">.</span>dstfmt<span class="operator"> =</span> DAHDI_FORMAT_G729A<span class="operator">;</span>

        g729_decoder<span class="operator">.</span>srcfmt<span class="operator"> =</span> DAHDI_FORMAT_G729A<span class="operator">;</span>

        g729_decoder<span class="operator">.</span>dstfmt<span class="operator"> =</span> DAHDI_FORMAT_ULAW<span class="operator">;</span>

        encoder_fd<span class="operator"> =</span> open<span class="operator">(</span><span class="string">"/dev/dahdi/transcode"</span><span class="operator">,</span> O_RDWR<span class="operator">);</span><span class="flow">

        if</span><span class="operator"> (</span>encoder_fd<span class="operator"> &lt;</span><span class="int"> 0</span><span class="operator">) {</span>
                printf<span class="operator">(</span><span class="string">"Failed to open transcode device\n"</span><span class="operator">);</span>
                exit<span class="operator">(</span><span class="int">1</span><span class="operator">);
        }</span><span class="flow">
        if</span><span class="operator"> (</span>ioctl<span class="operator">(</span>fd<span class="operator">,</span> DAHDI_TC_ALLOCATE<span class="operator">, &amp;</span>g729_encoder<span class="operator">)) {</span>

                printf<span class="operator">(</span><span class="string">"Failed to allocate encoder\n"</span><span class="operator">);</span>
                close<span class="operator">(</span>encoder_fd<span class="operator">);</span>
                exit<span class="operator">(</span><span class="int">1</span><span class="operator">);
        }</span>

        decoder_fd<span class="operator"> =</span> open<span class="operator">(</span><span class="string">"/dev/dahdi/transcode"</span><span class="operator">,</span> O_RDWR<span class="operator">);</span><span class="flow">
        if</span><span class="operator"> (</span>decoder_fd<span class="operator"> &lt;</span><span class="int"> 0</span><span class="operator">) {</span>

                printf<span class="operator">(</span><span class="string">"Failed to open transcode device\n"</span><span class="operator">);</span>
                exit<span class="operator">(</span><span class="int">1</span><span class="operator">);
        }</span><span class="flow">
        if</span><span class="operator"> (</span>ioctl<span class="operator">(</span>fd<span class="operator">,</span> DAHDI_TC_ALLOCATE<span class="operator">, &amp;</span>g729_decoder<span class="operator">)) {</span>

                printf<span class="operator">(</span><span class="string">"Failed to allocate decoder\n"</span><span class="operator">);</span>
                close<span class="operator">(</span>fd<span class="operator">);</span>
                exit<span class="operator">(</span><span class="int">1</span><span class="operator">);
        }</span>
</pre>
<p>Finally, once allocated, you just have to write chunks of ulaw data and read chunks of decoded g729 data and viceversa. You can choose whether the device will accept ulaw or alaw to g729 or g723 manipulating the srcfmt and dstfmt members of dahdi_transcoder_formats. Just remember that ulaw or alaw encoded data requires 8 times more bytes than g729 encoded data, therefore if you write a frame of 20ms of alaw (160 bytes for a sampling rate of 8000hz) you will read just 20 bytes of g729 encoded data, of course, the same apply when you decode a g729 frame or for g723 (for which alaw and ulaw requires 12 times more space). </p>
<p>The module is <a href="http://www.moythreads.com/mod_dahdi_codec.c" target="_blank">available here</a> under the MPL license. Also, the module was just commited to trunk yesterday in the Freeswitch SVN repository. I want to thank to <a href="http://www.voiceway.ca/" target="_blank">Voiceway</a> for sponsoring the module and <a href="http://www.neocenter.com.mx/" target="_blank">Neocenter</a> for providing the hardware to test it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moythreads.com/wordpress/2009/02/08/g729a-and-g7231-support-for-freeswitch/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>ztloop with CAS support</title>
		<link>http://www.moythreads.com/wordpress/2008/11/23/ztloop-with-cas-support/</link>
		<comments>http://www.moythreads.com/wordpress/2008/11/23/ztloop-with-cas-support/#comments</comments>
		<pubDate>Sun, 23 Nov 2008 00:36:57 +0000</pubDate>
		<dc:creator>moy</dc:creator>
				<category><![CDATA[asterisk]]></category>
		<category><![CDATA[freeswitch]]></category>

		<guid isPermaLink="false">http://www.moythreads.com/wordpress/2008/11/23/ztloop-with-cas-support/</guid>
		<description><![CDATA[During some time I had the idea that it should be possible to test the user space software that deals with E1/T1 lines (Asterisk, FreeSwitch, OpenR2) without any hardware at all, that way I could work off-line in my laptop (when I am on-line I usually have access to some server with an E1 card [...]]]></description>
			<content:encoded><![CDATA[<p>During some time I had the idea that it should be possible to test the user space software that deals with E1/T1 lines (Asterisk, FreeSwitch, OpenR2) without any hardware at all, that way I could work off-line in my laptop (when I am on-line I usually have access to some server with an E1 card on it). Yesterday I googled a bit about it and found the <a href="http://www.voip-info.org/wiki/view/ztloop" target="_blank">ztloop kernel module</a>, developed by the company <a href="http://www.druidsoftware.com/" target="_blank">DruidSoftware</a>. It&#8217;s a very simple module, based on the <a href="http://www.voip-info.org/wiki-Asterisk+timer+ztdummy" target="_blank">ztdummy module</a>, but is not part of  the zaptel package, so you have to download it, and patch the Makefile to compile it.</p>
<p>The module works by registering 4 zaptel spans. The first 2 are connected, by software, in loop. Which means anything you write to channel 1 (span 1) it will be available for reading in channel 32 (span 2). It does this by soft-wiring the tx and rx buffers of each span channel and registering a timer callback with the kernel, which will call it at a 1024Hz rate (just like ztdummy) and calling zt_transmit() and zt_receive() from within this callback (since there is no E1/T1 hardware interrupts, this timer is required).</p>
<p>The other 2 spans are for <a href="http://en.wikipedia.org/wiki/Telephone_tapping" target="_blank">line tapping</a>. All channels in span 3 tap span 1 and span 4 taps span 2. If you open a channel in span 3 you will be able to eavesdrop the data over the corresponding channel in span 1 (this tapping functionality can also be accomplished by zaptel pseudo devices, that is the way ztmonitor works). </p>
<p>The number of loop and tapping spans is configurable passing parameters to the kernel module.</p>
<p>Even though this module works fine for <a href="http://en.wikipedia.org/wiki/Primary_rate_interface" target="_blank">PRI</a> lines, until today, it did not work for <a href="http://en.wikipedia.org/wiki/R2_signalling" target="_blank">MFC/R2</a> lines, because it was lacking <a href="http://en.wikipedia.org/wiki/Channel_Associated_Signaling" target="_blank">CAS</a> support. After reading for some time Zaptel drivers code it started to make sense and I added a few lines of code required to loop R2 lines. </p>
<p>I basically added the span handler (a function pointer in the zt_span structure) to handle the transmission of CAS bits. This handler is called each time some process from user space calls ioclt(fd, ZT_SETTXBITS), most drivers would talk to the E1/T1 hardware to ask it to change the bits position, but, what I did is to call zt_rbsbits() function in the span that I know this span is looped to, that way the other span will &#8220;see&#8221; the bits and wake up any user space process that is waiting on bits changes.</p>
<p>It&#8217;s kind of cool that now I can test my Asterisk MFC/R2 development in my laptop w/o needing any hardware at all <img src='http://www.moythreads.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>The source code for this modified ztloop kernel module can be found here: <a href="http://www.moythreads.com/ztloop.c" target="_blank">http://www.moythreads.com/ztloop.c</a>. I will send the patch to the DruidSoftware guys to see if they include it in their next release.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moythreads.com/wordpress/2008/11/23/ztloop-with-cas-support/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Asterisk, now with deadlock action!</title>
		<link>http://www.moythreads.com/wordpress/2007/11/20/asterisk-now-with-deadlock-action/</link>
		<comments>http://www.moythreads.com/wordpress/2007/11/20/asterisk-now-with-deadlock-action/#comments</comments>
		<pubDate>Tue, 20 Nov 2007 00:56:01 +0000</pubDate>
		<dc:creator>moy</dc:creator>
				<category><![CDATA[asterisk]]></category>
		<category><![CDATA[freeswitch]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">http://www.moythreads.com/wordpress/2007/11/20/asterisk-now-with-deadlock-action/</guid>
		<description><![CDATA[You gotta belive me, I love Asterisk, I have learned lots of stuff playing with it. However in the last days I have been trying FreeSwitch and reading its code. Yesterday I was hanging out at freeswitch-dev when Anthony posted a link, that I have to admit is so fucking funny! http://www.sofaswitch.org/eg/pix/mfp_small.jpg Enjoy,]]></description>
			<content:encoded><![CDATA[<p>You gotta belive me, I love Asterisk, I have learned lots of stuff playing with it. However in the last days I have been trying FreeSwitch and reading its code. Yesterday I was hanging out at freeswitch-dev when <a href="http://www.oreillynet.com/pub/a/etel/2006/07/25/an-interview-with-the-creator-of-freeswitch.html?CMP=ILC-FV7511446129&#038;ATT=1837" target="_blank">Anthony</a> posted a link, that I have to admit is so fucking funny!</p>
<p><a href="http://www.sofaswitch.org/eg/pix/mfp_small.jpg" target="_blank">http://www.sofaswitch.org/eg/pix/mfp_small.jpg</a></p>
<p>Enjoy,</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moythreads.com/wordpress/2007/11/20/asterisk-now-with-deadlock-action/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

