<?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>JomPeich d&#039;er Bisente &#187; Asterisk</title> <atom:link href="http://www.bisente.com/blog/category/linuxadas/asterisk/feed/" rel="self" type="application/rss+xml" /><link>http://www.bisente.com</link> <description>Este es mi blog. Hay otros muchos pero este es el mío.</description> <lastBuildDate>Mon, 23 Jan 2012 06:37:00 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Caso de éxito de Asterisk/fonebridge2 en español</title><link>http://www.bisente.com/blog/2008/03/04/caso-de-exito-de-asteriskfonebridge2-en-espanol/</link> <comments>http://www.bisente.com/blog/2008/03/04/caso-de-exito-de-asteriskfonebridge2-en-espanol/#comments</comments> <pubDate>Tue, 04 Mar 2008 01:35:27 +0000</pubDate> <dc:creator>bisente</dc:creator> <category><![CDATA[Asterisk]]></category> <category><![CDATA[fonebridge2]]></category> <category><![CDATA[Red-Fone]]></category><guid isPermaLink="false">http://www.bisente.com/blog/2008/03/04/caso-de-exito-de-asteriskfonebridge2-en-espanol/</guid> <description><![CDATA[He traducido el caso de éxito del cluster Asterisk con un fonebridge2 al español, y además lo he montado como una página más del WordPress para admitir comentarios. Está disponible aquí: Caso de éxito: Solución de Asterisk Redundante para Grupo &#8230; <a href="http://www.bisente.com/blog/2008/03/04/caso-de-exito-de-asteriskfonebridge2-en-espanol/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>He traducido el<a href="http://www.bisente.com/blog/2008/02/19/fonebridge2-case-study/" title="fonebridge2 case study"> caso de éxito del cluster Asterisk con un fonebridge2</a> al español, y además lo he montado como una página más del WordPress para admitir comentarios. Está disponible aquí:</p><ul><li><a href="http://www.bisente.com/documentos/fonebridge2-case-study/" rel="bookmark" title="Enlace Permanente a ">Caso de éxito: Solución de Asterisk Redundante para Grupo Editorial</a></li></ul><p>También lo podéis ver en <a href="http://www.bisente.com/wp-content/uploads/2008/03/renr-case-study-es.pdf" title="Caso de éxito: Solución de Asterisk Redundante para Grupo Editorial">formato PDF</a>.</p> ]]></content:encoded> <wfw:commentRss>http://www.bisente.com/blog/2008/03/04/caso-de-exito-de-asteriskfonebridge2-en-espanol/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>fonebridge2 Case Study</title><link>http://www.bisente.com/blog/2008/02/19/fonebridge2-case-study/</link> <comments>http://www.bisente.com/blog/2008/02/19/fonebridge2-case-study/#comments</comments> <pubDate>Mon, 18 Feb 2008 23:10:58 +0000</pubDate> <dc:creator>bisente</dc:creator> <category><![CDATA[Asterisk]]></category> <category><![CDATA[English]]></category> <category><![CDATA[alta disponibilidad]]></category> <category><![CDATA[case study]]></category> <category><![CDATA[cluster]]></category> <category><![CDATA[EPI]]></category> <category><![CDATA[fonebridge2]]></category> <category><![CDATA[Redfone]]></category> <category><![CDATA[redundante]]></category> <category><![CDATA[RenR]]></category><guid isPermaLink="false">http://www.bisente.com/blog/2008/02/19/fonebridge2-case-study/</guid> <description><![CDATA[Some days ago, a representative of Redfone Communications got in touch with me because of a HOWTO I wrote some months ago about building Asteirsk clusters with the fonebridge2: they liked it and wanted me to write a Case Study &#8230; <a href="http://www.bisente.com/blog/2008/02/19/fonebridge2-case-study/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<div class="jLanguage"><ul><li><a href="?lan=english"><img alt="english" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/en.png" /></a></li><li><a href="?lan=spanish"><img alt="spanish" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/es.png" /></a></li></ul></div><p><a href="http://www.bisente.com/blog/2008/02/05/enlace-en-la-portada-de-red-fone/" title="Case Study fonebridge2">Some days ago</a>, a representative of <a href="http://www.red-fone.com" title="Redfone Communications">Redfone Communications</a> got in touch with me because of a HOWTO I wrote some months ago about <a href="http://www.bisente.com/blog/2007/08/26/asterisk-cluster-fonebridge2/" title="Asterisk cluster">building Asteirsk clusters</a> with the <a href="http://www.red-fone.com/Products/fonebridge2" title="fonebridge2">fonebridge2</a>: they liked it and wanted me to write a Case Study about the cluster I built <a href="http://www.epi.es" title="Editorial Prensa Ibérica">at my previous job</a>.</p><p>The Case Study has just been published and is available here:</p><ul><li> <a href="http://www.red-fone.com/assets/documents/RENR-Case-Study.pdf" title="Redundant Asterisk Solution for Spanish Media  Conglomerate">Redundant Asterisk Solution for Spanish Media Conglomerate</a> (<a href="http://www.bisente.com/wp-content/uploads/2008/02/renr-case-study.pdf" title="Redundant Asterisk Solution for Spanish Media  Conglomerate">local copy</a>)</li></ul> ]]></content:encoded> <wfw:commentRss>http://www.bisente.com/blog/2008/02/19/fonebridge2-case-study/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Enlace en la portada de Red-Fone</title><link>http://www.bisente.com/blog/2008/02/05/enlace-en-la-portada-de-red-fone/</link> <comments>http://www.bisente.com/blog/2008/02/05/enlace-en-la-portada-de-red-fone/#comments</comments> <pubDate>Tue, 05 Feb 2008 13:12:50 +0000</pubDate> <dc:creator>bisente</dc:creator> <category><![CDATA[Asterisk]]></category> <category><![CDATA[Personal]]></category> <category><![CDATA[fonebridge2]]></category> <category><![CDATA[Red-Fone]]></category><guid isPermaLink="false">http://www.bisente.com/blog/2008/02/05/enlace-en-la-portada-de-red-fone/</guid> <description><![CDATA[Desde que dejé la otra empresa que no estoy muy metido en el mundillo del Asterisk. En la que estoy ahora también se usa, pero lo administra otra persona. Pues ayer recibí un mail de un representante de Red-Fone, fabricantes &#8230; <a href="http://www.bisente.com/blog/2008/02/05/enlace-en-la-portada-de-red-fone/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>Desde que dejé la otra empresa que no estoy muy metido en el mundillo del <a href="http://www.bisente.com/blog/category/linuxadas/asterisk/" title="Asterisk">Asterisk</a>. En la que estoy ahora también se usa, pero lo administra otra persona. Pues ayer recibí un mail de un representante de <a href="http://www.red-fone.com/" title="Red-Fone">Red-Fone</a>, fabricantes del <a href="http://www.red-fone.com/Products/fonebridge2/" title="Red-Fone's fonebridge2">fonebridge2</a> del que <a href="http://www.bisente.com/blog/2007/08/26/asterisk-cluster-fonebridge2/" title="Alta disponibilidad Asterisk">escribí un artículo</a> explicando cómo configurarlo para obtener <a href="http://www.bisente.com/blog/2007/08/26/asterisk-cluster-fonebridge2/" title="Asterisk high availability">alta disponibilidad con Asterisk</a>, preguntándome si quería escribir un &#8220;<a href="http://en.wikipedia.org/wiki/Case_study" title="Case Study">case study</a>&#8221; para usar como &#8220;success story&#8221; del producto. Mola. <img src='http://www.bisente.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> Tengo que hablar con mi antiguo jefe, ya que al no trabajar ya allí no se, por lo menos pedir permiso antes de hablar del negocio y demás.</p><p>Aparte me he pasado por la web de <a href="http://www.red-fone.com/" title="Red-Fone">Red-Fone</a>, que hacía siglos que no entraba, ¡y tienen un enlace en portada a mi HOWTO! <img src='http://www.bisente.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /></p><p>Nada, una de esas chorradas que te alegran el día. <img src='http://www.bisente.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> Uno, que se conforma con poca cosa. <img src='http://www.bisente.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://www.bisente.com/blog/2008/02/05/enlace-en-la-portada-de-red-fone/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Clusters de Asterisk con el foneBRIDGE2</title><link>http://www.bisente.com/blog/2007/08/26/asterisk-cluster-fonebridge2/</link> <comments>http://www.bisente.com/blog/2007/08/26/asterisk-cluster-fonebridge2/#comments</comments> <pubDate>Sun, 26 Aug 2007 10:05:24 +0000</pubDate> <dc:creator>bisente</dc:creator> <category><![CDATA[Asterisk]]></category> <category><![CDATA[daemontools]]></category> <category><![CDATA[English]]></category> <category><![CDATA[Linuxadas]]></category> <category><![CDATA[Tecnología]]></category><guid isPermaLink="false">http://www.bisente.com/blog/2007/08/26/asterisk-cluster-fonebridge2/</guid> <description><![CDATA[At work we have an Asterisk cluster comprised of two Proliant servers and a Redfone&#8216;s foneBRIDGE2 that handles the ISDN lines. The heartbeat daemon is installed on both servers, monitors them and, in the event of a system failure on &#8230; <a href="http://www.bisente.com/blog/2007/08/26/asterisk-cluster-fonebridge2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<div class="jLanguage"><ul><li><a href="?lan=english"><img alt="english" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/en.png" /></a></li><li><a href="?lan=spanish"><img alt="spanish" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/es.png" /></a></li></ul></div><p><a href="http://www.renr.es" title="Recursos en la Red">At work</a> we have an <a href="http://www.asterisk.org/" title="Asterisk">Asterisk</a> cluster comprised of two Proliant servers and a <a href="http://www.red-fone.com/" title="Redfone Communications">Redfone</a>&#8216;s <a href="http://www.red-fone.com/Products/fonebridge2/" title="foneBRIDGE2">foneBRIDGE2</a> that handles the ISDN lines. The <a href="http://www.linux-ha.org/Heartbeat" title="Heartbeat">heartbeat</a> daemon is installed on both servers, monitors them and, in the event of a system failure on the master, switches the service to the backup server, migrating the main IP and activating all the needed daemons. I&#8217;ll briefly explain the whole setup here as a reference.</p><h2>Overview</h2><p>As I&#8217;ve said we have two Asterisk servers, named asterisk00 and asterisk01.example.com, the former being the master. Each one of them has its IP address (say, 10.10.10.1 and .2) and there&#8217;s an additional &#8220;virtual&#8221; address (.3) that will &#8220;jump&#8221; from one server to the other if the primary crashes.</p><p>Our foneBRIDGE2 is a quad model, but we only use two ISDN lines: one to our telco, and the other to a legacy PBX. Besides the ISDN interfaces, the foneBRIDGE has two ethernet sockets to connect it to the servers, but only one of them (the first one) accepts configuration commands to set up the FB, switch servers, etc. You&#8217;d usually use a switch on that interface so that every server has access to it and can configure the FB, but my boss saw this switch as a single point of failure and refused to use one, a opinion I don&#8217;t share as it also has its drawbacks as we&#8217;ll see. So our setup is a little bit funny in that asterisk01 is connected to the primary FB interface and asterisk00 to the secondary one. The logic here is: asterisk00 is going to be running 99% of the time, and if it crashes, asterisk01 would have to re-configure the FB, so asterisk01 needs to have access to the config port. Of course, now asterisk01 is a SPOF: if our backup server goes down for any reason, we risk losing control of the FB rendering our cluster unusable!</p><p>We use the <a href="http://www.freepbx.org/" title="FreePBX">FreePBX</a> web GUI, which in turn uses a mySQL DB to store all the settings. If you don&#8217;t use it, you can skip all instructions referring to mySQL and Apache.</p><h2>mySQL synchronization</h2><p>mySQL&#8217;s native ndb clustering is quite useful here. Set it up, have the service up at all times on both nodes, and the DB system automatically handles the synchronization across the cluster.</p><p>Setting up a mySQL cluster is out of the scope of this document, check the official docs <a href="http://dev.mysql.com/doc/refman/5.0/en/mysql-cluster-overview.html" title="mysql clustering">here</a> or <a href="http://www.google.com/search?q=mysql+cluster+howto" title="mySQL cluster howtos">look for a howto on Google</a>. <img src='http://www.bisente.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><h2>Filesystem synchronization</h2><p>All of Asterisk&#8217;s config files, libraries, modules, the users&#8217; voicemail dirs&#8230; need to be synchronized over the cluster&#8217;s nodes. There are several alternatives here:</p><ul><li>A SAN. Expensive but convenient. We don&#8217;t have one so it&#8217;s out of the question. <img src='http://www.bisente.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></li><li><a href="http://www.drbd.org/" title="DRBD">DRBD</a>. If you don&#8217;t know it, think of it as a partition-level RAID1 system over the network. Works great, we use it on several other clusters, but not here. DRBD&#8217;s only drawback is that the synchronized partition can&#8217;t be mounted on both servers at once, so you can access the files only on the active node. We wanted to have everything accessible on both servers so that we could use the backup one as a testing ground for new configurations, software upgrades, etc., do DRBD wasn&#8217;t and option.</li><li><a href="http://oss.linbit.com/csync2/" title="csync2">csync2</a>. It&#8217;s like <a href="http://samba.anu.edu.au/rsync/" title="rsync">rsync</a> on steroids. Similar to <a href="http://www.cis.upenn.edu/~bcpierce/unison/" title="Unison">unison</a>, but can synchronize files over more than two nodes. We&#8217;re using it for our Asterisk cluster.</li></ul><p>Our <a href="http://www.bisente.com/wp-content/blogs.dir/bisente/programas/asterisk/fonebridge/etc/csync2.cfg" title="csync2.conf">csync2.conf</a> file looks like this:</p><div class="codesnip-container" ><div class="bash codesnip" style="font-family:monospace;">group asterisk<br /> <span class="br0">&#123;</span><br /> host asterisk00.example.com asterisk01.example.com;</p><p>key <span class="sy0">/</span>etc<span class="sy0">/</span>csync2.key_asterisk;</p><p>backup-directory <span class="sy0">/</span>var<span class="sy0">/</span>backups<span class="sy0">/</span>csync2;<br /> backup-generations <span class="nu0">10</span>;</p><p>auto none;</p><p>exclude &nbsp;<span class="sy0">*</span>~ .<span class="sy0">*</span> ok lock control;<br /> include <span class="sy0">/</span>etc<span class="sy0">/</span>csync2.cfg;</p><p>include <span class="sy0">/</span>etc<span class="sy0">/</span>hosts;<br /> include <span class="sy0">/</span>etc<span class="sy0">/</span>ha.d<span class="sy0">/</span>ha.cf;<br /> include <span class="sy0">/</span>etc<span class="sy0">/</span>ha.d<span class="sy0">/</span>haresources;</p><p>include <span class="sy0">/</span>etc<span class="sy0">/</span>asterisk;<br /> include <span class="sy0">/</span>etc<span class="sy0">/</span>redfone<span class="sy0">*</span>;</p><p>include <span class="sy0">/</span>var<span class="sy0">/</span>www;<br /> include <span class="sy0">/</span>var<span class="sy0">/</span>lib<span class="sy0">/</span>asterisk;<br /> include <span class="sy0">/</span>var<span class="sy0">/</span>spool<span class="sy0">/</span>asterisk;<br /> include <span class="sy0">/</span>usr<span class="sy0">/</span>lib<span class="sy0">/</span>asterisk;<br /> include <span class="sy0">/</span>etc<span class="sy0">/</span>amportal.conf;<br /> include <span class="sy0">/</span>var<span class="sy0">/</span>log<span class="sy0">/</span>asterisk;<br /> <span class="br0">&#125;</span></div></div><p>We run the synchronization every five minutes. There&#8217;s no need to sync more frequently, as there won&#8217;t be that many changes in the configuration (it&#8217;s a stable system, maybe a new phone added every X weeks) and we seldom use the voicemail. The synchronization is launched from <a href="http://www.bisente.com/wp-content/blogs.dir/bisente/programas/asterisk/fonebridge/etc/cron.d/FB-csync2" title="FB-csync2">/etc/cron.d/FB-csync2</a>:</p><div class="codesnip-container" ><div class="bash codesnip" style="font-family:monospace;"><span class="sy0">*/</span>5 <span class="sy0">*</span> <span class="sy0">*</span> <span class="sy0">*</span> <span class="sy0">*</span> root <span class="br0">&#91;</span> <span class="re5">-f</span> <span class="sy0">/</span>tmp<span class="sy0">/</span>.FB-master <span class="br0">&#93;</span> <span class="sy0">&amp;</span>amp;<span class="sy0">&amp;</span>amp; <span class="sy0">/</span>usr<span class="sy0">/</span>sbin<span class="sy0">/</span>csync2 <span class="re5">-xv</span></div></div><p>This /tmp/.FB-master file is just a &#8220;flag&#8221; that marks the master server, so that the synchronization is only run there. On the section about heartbeat we&#8217;ll see how and when this file is created.</p><h2>fonulator</h2><p>fonulator is Redfone&#8217;s utility to configure the foneBRIDGE. As I&#8217;ve explained before, only asterisk01 (the backup system) can configure the FB in our setup, and each server is connected to a different ethernet port on the FB. So in the event of a crash, we need to change the destination server AND the interface used to send it the TDMoE frames.</p><p>To this end, we have two different redfone.conf files (<a href="http://www.bisente.com/wp-content/blogs.dir/bisente/programas/asterisk/fonebridge/etc/redfone_asterisk00.conf" title="redfone_asterisk00.conf">redfone_asterisk00.conf</a> and <a href="http://www.bisente.com/wp-content/blogs.dir/bisente/programas/asterisk/fonebridge/etc/redfone_asterisk01.conf" title="redfone_asterisk01.conf">redfone_asterisk01.conf</a>). They look the same except for the &#8220;serverX&#8221; and &#8220;fbX&#8221; directives on the spans:</p><div class="codesnip-container" ><div class="bash codesnip" style="font-family:monospace;"><span class="br0">&#91;</span>globals<span class="br0">&#93;</span><br /> <span class="re2">fb1</span>=00:50:C2:65:D0:68<br /> <span class="re2">fb2</span>=00:<span class="nu0">50</span>:C2:<span class="nu0">65</span> <img src='http://www.bisente.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> 0:<span class="nu0">69</span></p><p><span class="co0"># asterisk00.example.com</span><br /> <span class="re2">server1</span>=00:<span class="nu0">80</span>:5A:<span class="nu0">61</span>:E7:FF<br /> <span class="co0"># asterisk01.example.com</span><br /> <span class="re2">server2</span>=00:04:76:11:A3:EC</p><p><span class="re2">card</span>=eth1,fb1</p><p><span class="co0"># Telco</span><br /> <span class="br0">&#91;</span>span1<span class="br0">&#93;</span><br /> <span class="re2">span</span>=<span class="nu0">1</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,ccs,hdb3,crc4<br /> server1<br /> fb2<br /> pri</p><p><span class="co0"># Legacy PBX</span><br /> <span class="br0">&#91;</span>span2<span class="br0">&#93;</span><br /> <span class="re2">span</span>=<span class="nu0">2</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,ccs,hdb3,crc4<br /> server1<br /> fb2<br /> pri</div></div><p>That was redfone_asterisk00.conf. It instructs the FB to send the ISDN traffic to asterisk00 (server1 here) over the second ethernet interface (fb2). The redfone_asterisk01.conf file uses server2 and fb1.</p><h2>heartbeat</h2><p>And now, the final piece that ties the rest together: heartbeat. Our <a href="http://www.bisente.com/wp-content/blogs.dir/bisente/programas/asterisk/fonebridge/etc/ha.d/haresources" title="haresources">haresources</a> file looks like this:</p><div class="codesnip-container" ><div class="bash codesnip" style="font-family:monospace;">asterisk00.example.com MailTo::asterisk<span class="sy0">@</span>example.com::Asterisk 10.10.10.3 FB_fonulator FB_master FB_asterisk apache2</div></div><p>Meaning that:</p><ul><li>asterisk00.example.com is the master server</li><li>in the event of a service takeover, send a mail to asterisk@example.com</li><li>the service&#8217;s virtual IP is 10.10.10.3</li><li>start (stop) the FB_fonulator, FB_master, FB_asterisk and apache2 services (remember to unlink the apache2 link from /etc/rc2.d, we don&#8217;t want it to be started at system bootup as heartbeat will handle it)</li></ul><p>Now, the scripts. <a href="http://www.bisente.com/wp-content/blogs.dir/bisente/programas/asterisk/fonebridge/etc/init.d/FB_fonulator" title="FB_fonulator">FB_fonulator</a> runs fonulator in order to configure the FB and send the TDMoE traffic to the appropriate server. One important thing here is that, although this script will be run on both servers, it will only have an effect when run from asterisk01 as this is the server on the FB&#8217;s config interface:</p><div class="codesnip-container" ><div class="bash codesnip" style="font-family:monospace;"><span class="co0">#!/bin/sh</span></p><p><span class="co0"># Chech who I am and who the other host is</span><br /> <span class="re2">THISHOST</span>=<span class="st0">&quot;<span class="es5">`hostname|cut -d. -f1`</span>&quot;</span><br /> <span class="kw1">if</span> <span class="br0">&#91;</span> <span class="st0">&quot;<span class="es2">$THISHOST</span>&quot;</span> == <span class="st0">&quot;asterisk00&quot;</span> <span class="br0">&#93;</span><br /> <span class="kw1">then</span><br /> <span class="re2">OTHERHOST</span>=<span class="st0">&quot;asterisk01&quot;</span><br /> <span class="kw1">else</span><br /> <span class="re2">OTHERHOST</span>=<span class="st0">&quot;asterisk00&quot;</span><br /> <span class="kw1">fi</span></p><p><span class="co0"># Bail out if there is no config file</span><br /> <span class="re2">F</span>=<span class="st0">&quot;/etc/redfone_<span class="es2">$THISHOST</span>.conf&quot;</span><br /> <span class="br0">&#91;</span> <span class="sy0">!</span> <span class="re5">-f</span> <span class="st0">&quot;<span class="es2">$F</span>&quot;</span> <span class="br0">&#93;</span> <span class="sy0">&amp;</span>amp;<span class="sy0">&amp;</span>amp; <span class="kw3">exit</span> <span class="nu0">0</span><br /> <span class="co0"># Guess the appropiate interface card</span><br /> <span class="kw3">export</span> <span class="re2">ETH</span>=<span class="sy0">`</span><span class="kw2">grep</span> <span class="re5">-E</span> <span class="st0">&quot;^card=&quot;</span> <span class="st0">&quot;<span class="es2">$F</span>&quot;</span> <span class="sy0">|</span> <span class="kw2">cut</span> <span class="re5">-d</span>= <span class="re5">-f2</span> <span class="sy0">|</span> <span class="kw2">cut</span> -d, -f1<span class="sy0">`</span></p><p><span class="kw1">case</span> <span class="st0">&quot;$1&quot;</span> <span class="kw1">in</span><br /> start<span class="br0">&#41;</span><br /> <span class="kw3">echo</span> <span class="st0">&quot;Fonulating&#8230;&quot;</span><br /> <span class="sy0">/</span>usr<span class="sy0">/</span>local<span class="sy0">/</span>bin<span class="sy0">/</span>fonulator <span class="re5">-s</span> <span class="re5">-t</span> <span class="nu0">1</span> <span class="st0">&quot;/etc/redfone_<span class="es2">$THISHOST</span>.conf&quot;</span><br /> <span class="sy0">;;</span><br /> stop<span class="br0">&#41;</span><br /> <span class="sy0">/</span>usr<span class="sy0">/</span>local<span class="sy0">/</span>bin<span class="sy0">/</span>fonulator <span class="re5">-s</span> <span class="re5">-t</span> <span class="nu0">1</span> <span class="st0">&quot;/etc/redfone_<span class="es2">$OTHERHOST</span>.conf&quot;</span><br /> <span class="sy0">;;</span><br /> restart<span class="sy0">|</span>status<span class="br0">&#41;</span><br /> <span class="kw3">echo</span> <span class="st0">&quot;Fonulator $1&quot;</span><br /> <span class="kw3">exit</span> 0<br /> <span class="sy0">;;</span><br /> <span class="kw1">esac</span><br /> <span class="kw3">exit</span> <span class="nu0">0</span></div></div><p><a href="http://www.bisente.com/wp-content/blogs.dir/bisente/programas/asterisk/fonebridge/etc/init.d/FB_master" title="FB_master">FB_master</a> creates the /tmp/.FB-master &#8220;flag&#8221; file we talked about before, and forces a sync both on the start (to make sure both servers have the same data) and on the stop (to sync back to the primary server any changes after a takeover-and-back):</p><div class="codesnip-container" ><div class="bash codesnip" style="font-family:monospace;"><span class="co0">#!/bin/sh</span></p><p><span class="re2">F</span>=<span class="sy0">/</span>tmp<span class="sy0">/</span>.FB-master</p><p><span class="kw1">case</span> <span class="st0">&quot;$1&quot;</span> <span class="kw1">in</span><br /> start<span class="br0">&#41;</span><br /> <span class="kw2">touch</span> <span class="st0">&quot;<span class="es2">$F</span>&quot;</span><br /> <span class="co0"># Activate log rotation</span><br /> <span class="kw2">ln</span> <span class="re5">-sf</span> <span class="sy0">/</span>etc<span class="sy0">/</span>asterisk<span class="sy0">/</span>asterisk.logrotate <span class="sy0">/</span>etc<span class="sy0">/</span>logrotate.d<span class="sy0">/</span>asterisk<br /> <span class="co0"># Force sync of these dirs</span><br /> csync2 <span class="re5">-fr</span> <span class="sy0">/</span>var<span class="sy0">/</span><br /> csync2 <span class="re5">-fr</span> <span class="sy0">/</span>etc<span class="sy0">/</span>asterisk<span class="sy0">/</span><br /> csync2 <span class="re5">-xv</span><br /> <span class="sy0">;;</span><br /> stop<span class="br0">&#41;</span><br /> <span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re5">-f</span> <span class="st0">&quot;<span class="es2">$F</span>&quot;</span> <span class="br0">&#93;</span><br /> <span class="kw1">then</span><br /> <span class="co0"># De-activate log rotation</span><br /> <span class="kw2">rm</span> <span class="re5">-f</span> <span class="sy0">/</span>etc<span class="sy0">/</span>logrotate.d<span class="sy0">/</span>asterisk<br /> <span class="co0"># Force a last minute sync to the new master</span><br /> csync2 <span class="re5">-fr</span> <span class="sy0">/</span>var<span class="sy0">/</span><br /> csync2 <span class="re5">-fr</span> <span class="sy0">/</span>etc<span class="sy0">/</span>asterisk<span class="sy0">/</span><br /> csync2 <span class="re5">-xv</span><br /> <span class="kw2">rm</span> <span class="re5">-f</span> <span class="st0">&quot;<span class="es2">$F</span>&quot;</span><br /> <span class="kw1">fi</span><br /> <span class="sy0">;;</span><br /> <span class="kw1">esac</span><br /> <span class="kw3">exit</span> <span class="nu0">0</span></div></div><p>Finally, <a href="http://www.bisente.com/wp-content/blogs.dir/bisente/programas/asterisk/fonebridge/etc/init.d/FB_asterisk" title="FB_asterisk">FB_asterisk</a> starts the Asterisk service. We run <a href="http://www.bisente.com/blog/2007/04/27/spanish-asterisk-y-daemontools-spanishenglish-asterisk-and-daemontools-english/?lan=english" title="Asterisk with daemontools">Asterisk via daemontools using my scripts available here</a>, so basically what this FB_asterisk script has to do is &#8220;svc -u/-d /service/asterisk&#8221;:</p><div class="codesnip-container" ><div class="bash codesnip" style="font-family:monospace;"><span class="co0">#!/bin/sh</span></p><p><span class="kw1">case</span> <span class="st0">&quot;$1&quot;</span> <span class="kw1">in</span><br /> start<span class="br0">&#41;</span><br /> <span class="kw3">echo</span> <span class="st0">&quot;Starting Asterisk&#8230;&quot;</span><br /> <span class="co0"># Check if Asterisk is already running</span><br /> <span class="kw1">if</span> <span class="sy0">/</span>usr<span class="sy0">/</span>sbin<span class="sy0">/</span>asterisk <span class="re5">-r</span> <span class="re5">-x</span> <span class="st0">&quot;quit&quot;</span><br /> <span class="kw1">then</span><br /> <span class="kw3">echo</span> <span class="st0">&quot;Already running&quot;</span><br /> <span class="kw3">exit</span> 0<br /> <span class="kw1">fi</span><br /> <span class="co0"># Just in case&#8230;</span><br /> <span class="kw2">rm</span> <span class="re5">-f</span> <span class="sy0">/</span>service<span class="sy0">/*</span><br /> <span class="co0"># Link services and start them up</span><br /> <span class="kw2">ln</span> <span class="re5">-sf</span> <span class="sy0">/</span>etc<span class="sy0">/</span>asterisk<span class="sy0">/</span>services<span class="sy0">/</span>asterisk<span class="sy0">/</span> <span class="sy0">/</span>service<span class="sy0">/</span>asterisk<br /> <span class="kw2">ln</span> <span class="re5">-sf</span> <span class="sy0">/</span>etc<span class="sy0">/</span>asterisk<span class="sy0">/</span>services<span class="sy0">/</span>fopserver<span class="sy0">/</span> <span class="sy0">/</span>service<span class="sy0">/</span>fopserver<br /> svc <span class="re5">-u</span> <span class="sy0">/</span>service<span class="sy0">/*</span><br /> <span class="sy0">;;</span><br /> stop<span class="br0">&#41;</span><br /> <span class="kw3">echo</span> <span class="st0">&quot;Stopping Asterisk &#8230;&quot;</span><br /> svc <span class="re5">-d</span> <span class="sy0">/</span>service<span class="sy0">/*</span><br /> <span class="kw2">rm</span> <span class="re5">-f</span> <span class="sy0">/</span>service<span class="sy0">/*</span><br /> <span class="sy0">;;</span><br /> restart<span class="br0">&#41;</span><br /> <span class="kw3">echo</span> <span class="st0">&quot;Restarting Astarisk &#8230;&quot;</span><br /> svc <span class="re5">-t</span> <span class="sy0">/</span>service<span class="sy0">/*</span><br /> <span class="sy0">;;</span><br /> reload<span class="br0">&#41;</span><br /> <span class="kw3">echo</span> <span class="st0">&quot;Reloading Asterisk &#8230;&quot;</span><br /> <span class="sy0">/</span>usr<span class="sy0">/</span>sbin<span class="sy0">/</span>asterisk <span class="re5">-r</span> <span class="re5">-x</span> <span class="st0">&quot;reload&quot;</span><br /> <span class="sy0">;;</span><br /> status<span class="br0">&#41;</span><br /> <span class="kw3">echo</span> <span class="st0">&quot;Checking Asterisk&#8217;s status &#8230;&quot;</span><br /> <span class="sy0">/</span>usr<span class="sy0">/</span>sbin<span class="sy0">/</span>asterisk <span class="re5">-r</span> <span class="re5">-x</span> <span class="st0">&quot;quit&quot;</span> <span class="sy0">&amp;</span>amp;<span class="sy0">&amp;</span>amp; <span class="kw3">exit</span> 0 <span class="sy0">||</span> <span class="kw3">exit</span> 1<br /> <span class="sy0">;;</span><br /> <span class="kw1">esac</span><br /> <span class="kw3">exit</span> <span class="nu0">0</span></div></div><h2>Download</h2><p>All the aforementioned scripts and config files are available <a href="http://www.bisente.com/wp-content/blogs.dir/bisente/programas/asterisk/fonebridge/asterisk-fonebridge.tar.bz2" title="asterisk cluster with fonebridge setup">here</a>. Think of them as a base to make your own Asterisk/foneBRIDGE setup. And feel free to mail me back any improvements, errors you may find, etc.</p> ]]></content:encoded> <wfw:commentRss>http://www.bisente.com/blog/2007/08/26/asterisk-cluster-fonebridge2/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Asterisk holidays</title><link>http://www.bisente.com/blog/2007/04/30/asterisk-holidays/</link> <comments>http://www.bisente.com/blog/2007/04/30/asterisk-holidays/#comments</comments> <pubDate>Mon, 30 Apr 2007 15:28:58 +0000</pubDate> <dc:creator>bisente</dc:creator> <category><![CDATA[Asterisk]]></category> <category><![CDATA[English]]></category><guid isPermaLink="false">http://www.bisente.com/blog/2007/04/30/asterisk-holidays/</guid> <description><![CDATA[No, your PBX server is not taking a couple of days off. This is an Asterisk macro that lets you know if today is a holiday, and jump to different places on your dialplan accordingly.]]></description> <content:encoded><![CDATA[<div class="jLanguage"><ul><li><a href="?lan=english"><img alt="english" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/en.png" /></a></li><li><a href="?lan=spanish"><img alt="spanish" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/es.png" /></a></li></ul></div><p>No, your PBX server is not taking a couple of days off. <img src='http://www.bisente.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p><p>This is an <a href="http://www.asteirsk.org">Asterisk</a> macro that lets you know if today is a holiday, and jump to different places on your dialplan accordingly.</p></div> ]]></content:encoded> <wfw:commentRss>http://www.bisente.com/blog/2007/04/30/asterisk-holidays/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Asterisk y daemontools</title><link>http://www.bisente.com/blog/2007/04/27/asterisk-daemontools/</link> <comments>http://www.bisente.com/blog/2007/04/27/asterisk-daemontools/#comments</comments> <pubDate>Fri, 27 Apr 2007 20:45:08 +0000</pubDate> <dc:creator>bisente</dc:creator> <category><![CDATA[Asterisk]]></category> <category><![CDATA[daemontools]]></category> <category><![CDATA[English]]></category><guid isPermaLink="false">http://www.bisente.com/blog/2007/04/27/spanish-asterisk-y-daemontools-spanishenglish-asterisk-and-daemontools-english/</guid> <description><![CDATA[I&#8217;ve just released my daemontools &#8220;run&#8221; scripts for Asterisk. They are here: asterisk-daemontools [README] The scripts let you configure via variables on the &#8220;env&#8221; dir the PATH to the Asterisk exec, the user and group to launch it with, and &#8230; <a href="http://www.bisente.com/blog/2007/04/27/asterisk-daemontools/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<div class="jLanguage"><ul><li><a href="?lan=english"><img alt="english" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/en.png" /></a></li><li><a href="?lan=spanish"><img alt="spanish" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/es.png" /></a></li></ul></div><p>I&#8217;ve just released my <a href="http://cr.yp.to/daemontools.html" title="d.j.b.'s daemontools">daemontools</a> &#8220;run&#8221; scripts for <a href="http://www.asterisk.org/" title="Asterisk">Asterisk</a>. They are here: <a href="http://www.bisente.com/packages/asterisk-daemontools/" title="Asterisk daemontools scripts">asterisk-daemontools</a> [<a href="http://www.bisente.com/packages/asterisk-daemontools/README" title="asterisk-daemontools' README">README</a>]</p><p>The scripts let you configure via variables on the &#8220;env&#8221; dir the PATH to the Asterisk exec, the user and group to launch it with, and the startup options you want to pass it. About running Asterisk with a given user, I&#8217;ve found problems with Asterisk 1.2 and the -U and -G options, so the scripts only use those options if you&#8217;re running Asterisk 1.4 and revert to &#8220;su&#8221; otherwise.</p><p>There&#8217;s also a script for<a href="http://www.asternic.org/" title="Asterisk Flash Operator Panel">Flash Operator Panel</a>&#8216;s &#8220;fopserver&#8221;.</p><p>I&#8217;m using these scripts on several Asterisk 1.2 and 1.4 servers with <a href="http://www.freepbx.org/" title="FreePBX">FreePBX</a>.</p><p>Read the full article to see the &#8220;run&#8221; scripts.</p></div> ]]></content:encoded> <wfw:commentRss>http://www.bisente.com/blog/2007/04/27/asterisk-daemontools/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using apc
Page Caching using disk: enhanced
Database Caching 7/61 queries in 0.012 seconds using apc
Object Caching 937/1010 objects using apc

Served from: www.bisente.com @ 2012-02-12 17:26:15 -->
