<?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>Cristian Livadaru's blog &#187; VoIP</title>
	<atom:link href="http://cristian.livadaru.net/category/voip/feed/" rel="self" type="application/rss+xml" />
	<link>http://cristian.livadaru.net</link>
	<description>... think again ...</description>
	<lastBuildDate>Sat, 28 Aug 2010 19:47:23 +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>Use Adhearsion to check Asterisk</title>
		<link>http://cristian.livadaru.net/2009/11/03/use-adhearsion-to-check-asterisk/</link>
		<comments>http://cristian.livadaru.net/2009/11/03/use-adhearsion-to-check-asterisk/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 12:10:03 +0000</pubDate>
		<dc:creator>Cristian Livadaru</dc:creator>
				<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[VoIP]]></category>
		<category><![CDATA[Adhearsion]]></category>
		<category><![CDATA[Monit]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[Nagios]]></category>

		<guid isPermaLink="false">http://cristian.livadaru.net/?p=648</guid>
		<description><![CDATA[If you have a business depending on asterisk you need to be sure that everything is running. You could use Nagios or Monit to check if asterisk is running, but is it also working? What about your AGI Server? Is it doing what it&#8217;s supposed to do? The best way to find out if this [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a business depending on asterisk you need to be sure that everything is running. You could use <a href="http://www.nagios.org/">Nagios</a> or <a href="http://mmonit.com/monit/">Monit</a> to check if asterisk is running, but is it also working? What about your AGI Server? Is it doing what it&#8217;s supposed to do?</p>
<p>The best way to find out if this works would be to call and see if the call is accepted and if you get something back from your AGI server and you can do this with automatically with <a href="http://adhearsion.com/">Adhearsion</a>!</p>
<p>What you will need is a wav file containing a DTMF sequence. You can create one with Adobe Audition for example (aka Cooledit before Adobe took over). The Trial version is enough to create the DTMF. Use a 300ms pause at least the other settings didn’t really work for me. Also don&#8217;t forget to set your Asterisk server to dtmfmod=inband.</p>
<p>I created a new adhearsion project and used the Simon game as start of and modified it to look like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">methods_for <span style="color:#ff3333; font-weight:bold;">:dialplan</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> check_call
    CheckCall.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">start</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> CheckCall
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> initialize<span style="color:#006600; font-weight:bold;">&#40;</span>call<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0066ff; font-weight:bold;">@call</span> = call
    <span style="color:#0066ff; font-weight:bold;">@number</span>=<span style="color:#996600;">'12345'</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> start
    collect_attempt
    verify_attempt
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> collect_attempt
    <span style="color:#0066ff; font-weight:bold;">@attempt</span> = <span style="color:#0066ff; font-weight:bold;">@call</span>.<span style="color:#9900CC;">input</span> <span style="color:#0066ff; font-weight:bold;">@number</span>.<span style="color:#9900CC;">length</span>,
      <span style="color:#ff3333; font-weight:bold;">:timeout</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">10</span>.<span style="color:#9900CC;">seconds</span>    
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> verify_attempt
    <span style="color:#9966CC; font-weight:bold;">if</span> attempt_correct? 
		<span style="color:#008000; font-style:italic;"># do something here</span>
    <span style="color:#9966CC; font-weight:bold;">else</span>
		<span style="color:#008000; font-style:italic;"># do something else</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> attempt_correct?
    <span style="color:#0066ff; font-weight:bold;">@attempt</span> == <span style="color:#0066ff; font-weight:bold;">@number</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>What this does is check if the called server sent the DTMF sequence 12345 and if not it would do something.<br/><br />
You cold for example use growl and/or prowl for notification or use some <a href="http://lcx.at/en/products/server-monitoring/">SMS service for notification</a> like <a href="http://lcx.at/en/">lcx.at</a> (I know, shameless self promotion).</p>
<p>Also don&#8217;t forget to activate drb in your adhersion project, do this in startup.rb</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">config.<span style="color:#9900CC;">enable_asterisk</span>
config.<span style="color:#9900CC;">asterisk</span>.<span style="color:#9900CC;">enable_ami</span> <span style="color:#ff3333; font-weight:bold;">:host</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;localhost&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:username</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;amiuser&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:password</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;amipassowrd&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:events</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>
&nbsp;
config.<span style="color:#9900CC;">enable_drb</span> <span style="color:#ff3333; font-weight:bold;">:host</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;0.0.0.0&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:deny</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;0.0.0.0&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:allow</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;127.0.0.1&quot;</span>, <span style="color:#996600;">&quot;213.123.118.123&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span></pre></div></div>

<p>Ok now all we need is the script that triggers the call. This could look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'drb'</span>
<span style="color:#0066ff; font-weight:bold;">@adhearsion</span> = DRbObject.<span style="color:#9900CC;">new_with_uri</span> <span style="color:#996600;">&quot;druby://localhost:9050&quot;</span>
result = <span style="color:#0066ff; font-weight:bold;">@adhearsion</span>.<span style="color:#9900CC;">originate</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:channel</span>   <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;SIP/....&quot;</span>, 
                                 <span style="color:#ff3333; font-weight:bold;">:context</span>   <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;checkcall&quot;</span>, 
                                 <span style="color:#ff3333; font-weight:bold;">:exten</span> 	<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'4000'</span>,
                                 <span style="color:#ff3333; font-weight:bold;">:priority</span>  <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">1</span>,
                                 <span style="color:#ff3333; font-weight:bold;">:callerid</span>  <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;43123456789&quot;</span>,
                                 <span style="color:#ff3333; font-weight:bold;">:async</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'true'</span>,                                     
                                 <span style="color:#ff3333; font-weight:bold;">:variable</span>  <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;call_launcher=true|sleep_time=3600&quot;</span> <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>So, this is it. I know this isn&#8217;t really a copy &#038; paste howto, some things are missing but I don&#8217;t want to repeat things that can be read in the adhearsion documentation.<br />
Oh, what I forgot to mention, I use a separate server which runs Asterisk to do the checks, the checks are NOT done form the same server I am checking, but I think this should be obvious.<br />
If you need a VPS with this Setup, or need someone to verify your VoIP Servers, feel free to <a href="http://lcx.at/en/contact-us/">contact me</a>! </p>
]]></content:encoded>
			<wfw:commentRss>http://cristian.livadaru.net/2009/11/03/use-adhearsion-to-check-asterisk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to avoid being ripped of by your GSM provider</title>
		<link>http://cristian.livadaru.net/2008/10/06/how-to-avoid-being-ripped-of-by-your-gsm-provider/</link>
		<comments>http://cristian.livadaru.net/2008/10/06/how-to-avoid-being-ripped-of-by-your-gsm-provider/#comments</comments>
		<pubDate>Mon, 06 Oct 2008 17:58:23 +0000</pubDate>
		<dc:creator>Cristian Livadaru</dc:creator>
				<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[Travel]]></category>
		<category><![CDATA[VoIP]]></category>
		<category><![CDATA[GSM]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Roaming]]></category>

		<guid isPermaLink="false">http://cristian.livadaru.net/?p=552</guid>
		<description><![CDATA[If you have ever been in a non EU country you sure know the problem with roaming. The prices are really exagerated! As we have been in Ukraine the passive roaming would have been 1,50 Euro! 1 Euro fifty just for receiving a call. I really don&#8217;t understand these prices. Well, I am not writing [...]]]></description>
			<content:encoded><![CDATA[<p>If you have ever been in a non EU country you sure know the problem with roaming. The prices are really exagerated! As we have been in Ukraine the passive roaming would have been 1,50 Euro! 1 Euro fifty just for receiving a call. I really don&#8217;t understand these prices.<br />
Well, I am not writing this to complain about roaming costs, I want to help you save money <img src='http://cristian.livadaru.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
So, what can be done to save some bucks and not give the GSM providers a CENT!<br />
My solutions works by using a asterisk server, a local SIP number from the country I have my GSM contract and a local SIM in the country I am in (in this case Ukraine).<br />
What I have done is to forward all calls to the local SIP number I have (free), this SIP number is picked up by my asterisk server which then called my on my Ukranian mobile phone (about 0.09 Euro) so I get the same result for 1,41 Euro less, <strong>per minute</strong>!</p>
<p>So, if you are in the same situation as I was and don&#8217;t have time to set up your own asterisk server and find some cheap VoIP routes to your destination, just contact me and I will help you <img src='http://cristian.livadaru.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://cristian.livadaru.net/2008/10/06/how-to-avoid-being-ripped-of-by-your-gsm-provider/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

