<?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>Lior Gradstein's Blog &#187; voip</title>
	<atom:link href="http://www.gradstein.info/category/voip/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gradstein.info</link>
	<description></description>
	<lastBuildDate>Thu, 13 May 2010 09:46:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Asterisk: DADHI module not working when using Xen</title>
		<link>http://www.gradstein.info/software/asterisk/asterisk-dadhi-module-not-working-when-using-xen/</link>
		<comments>http://www.gradstein.info/software/asterisk/asterisk-dadhi-module-not-working-when-using-xen/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 11:30:54 +0000</pubDate>
		<dc:creator>Lior Gradstein</dc:creator>
				<category><![CDATA[asterisk]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[voip]]></category>
		<category><![CDATA[digium]]></category>
		<category><![CDATA[hardware card]]></category>
		<category><![CDATA[rtc]]></category>
		<category><![CDATA[timer]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://www.gradstein.info/?p=224</guid>
		<description><![CDATA[If you want to use any Asterisk module that needs a timer, like MeetMe, you have to use a module named dahdi (previously named zaptel). DAHDI has one module for each Digium supported card (B410P), and a dummy module (named dahdi_dummy) if you don&#8217;t have a hardware card, like me.
The problem appears when you have [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to use any <a href="http://www.asterisk.org/" class="liexternal">Asterisk</a> module that needs a timer, like MeetMe, you have to use a module named dahdi (previously named zaptel). DAHDI has one module for each Digium supported card (B410P), and a dummy module (named dahdi_dummy) if you don&#8217;t have a hardware card, like me.</p>
<p>The problem appears when you have your Asterisk in a Xen environment. Xen does not allow the use of the RTC, so when using Dahdi/meetme, you get the following in you logs:</p>
<blockquote><p>res_timing_dahdi.c: Asterisk has detected a problem with your DAHDI configuration and will shutdown for your protection.</p></blockquote>
<p>So get the sources, and let&#8217;s patch it!</p>
<div class="python" style="font-family: monospace;color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">svn co &nbsp;http://svn.<span style="color: black;">digium</span>.<span style="color: black;">com</span>/svn/dahdi/linux-complete/trunk DAHDI</div>
<p>In dahdi_dummy.c, you&#8217;ll have to comment the two defines USE_RTC, as in a Xen, you can&#8217;t use it:</p>
<p><source lang="diff"><br />
# diff -u dahdi_dummy.c.ori dahdi_dummy.c<br />
&#8212; dahdi_dummy.c.ori	2009-03-23 09:50:36.000000000 +0000<br />
+++ dahdi_dummy.c	2009-03-23 08:55:38.000000000 +0000<br />
@@ -59,11 +59,11 @@<br />
 #if defined(CONFIG_HIGH_RES_TIMERS) &#038;&#038; LINUX_VERSION_CODE >= VERSION_CODE(2,6,22)<br />
 #define USE_HIGHRESTIMER<br />
 #else<br />
-#define USE_RTC<br />
+//#define USE_RTC<br />
 #endif<br />
 #else<br />
 #if 0<br />
-#define USE_RTC<br />
+//#define USE_RTC<br />
 #endif<br />
 #endif<br />
 #endif<br />
</source></p>
<p>Then compile the module, as usual, with :</p>
<div class="python" style="font-family: monospace;color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">/etc/init.<span style="color: black;">d</span>/dahdi stop<br />
make all<br />
make install<br />
make config</div>
<p>Verify that your module has been correctly installed:</p>
<div class="python" style="font-family: monospace;color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">ls -<span style="color: #dc143c;">al</span> ./<span style="color: #ff4500;">2.6</span><span style="color: #ff4500;">.24</span><span style="color: #ff4500;">-19</span>-xen/dahdi/dahdi_dummy.<span style="color: black;">ko</span></div>
<p>Comment out all the defined modules in the /etc/dahdi/modules file.</p>
<div class="python" style="font-family: monospace;color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">/etc/init.<span style="color: black;">d</span>/dahdi start<br />
<span style="color: #808080; font-style: italic;">#&amp;gt; dmesg</span><br />
<span style="color: #ff4500;">1007539.576458</span><span style="color: black;">&#93;</span> dahdi: Telephony Interface Registered on major <span style="color: #ff4500;">196</span><br />
<span style="color: black;">&#91;</span><span style="color: #ff4500;">1007539.576468</span><span style="color: black;">&#93;</span> dahdi: Version: SVN-trunk-r6201M<br />
<span style="color: black;">&#91;</span><span style="color: #ff4500;">1007540.642839</span><span style="color: black;">&#93;</span> dahdi: Registered tone zone <span style="color: #ff4500;">2</span> <span style="color: black;">&#40;</span>France<span style="color: black;">&#41;</span></div>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.gradstein.info/python/how-to-dial-a-number-using-asterisk-and-python/" title="How to dial a number using Asterisk and Python (December 17, 2008)">How to dial a number using Asterisk and Python</a> (1)</li>
	<li><a href="http://www.gradstein.info/software/asterisk/asterisk-cirpack-problem-with-free-and-freephonienet/" title="Asterisk cirpack problem with Free and freephonie.net (February 12, 2009)">Asterisk cirpack problem with Free and freephonie.net</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.gradstein.info/software/asterisk/asterisk-dadhi-module-not-working-when-using-xen/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Asterisk cirpack problem with Free and freephonie.net</title>
		<link>http://www.gradstein.info/software/asterisk/asterisk-cirpack-problem-with-free-and-freephonienet/</link>
		<comments>http://www.gradstein.info/software/asterisk/asterisk-cirpack-problem-with-free-and-freephonienet/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 09:34:51 +0000</pubDate>
		<dc:creator>Lior Gradstein</dc:creator>
				<category><![CDATA[asterisk]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[voip]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[cirpack]]></category>
		<category><![CDATA[correction]]></category>
		<category><![CDATA[france]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[free isp provider]]></category>
		<category><![CDATA[freephonie.net]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[provider]]></category>

		<guid isPermaLink="false">http://www.gradstein.info/?p=179</guid>
		<description><![CDATA[If you configured your Asterisk/FreeSWITCH server to talk to your freephonie.net (french Free ISP provider), you&#8217;ll see in the logs the following warning message:
&#91;Feb 12 09:29:06&#93; WARNING&#91;9228&#93;: chan_sip.c:6624 determine_firstline_parts: Bad request protocol Packet
This is not really a problem, but an annoyance, as it fills up your logs. This is a known problem for more than [...]]]></description>
			<content:encoded><![CDATA[<p>If you configured your Asterisk/FreeSWITCH server to talk to your freephonie.net (french Free ISP provider), you&#8217;ll see in the logs the following warning message:</p>
<div class="python" style="font-family: monospace;color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;"><span style="color: black;">&#91;</span>Feb <span style="color: #ff4500;">12</span> <span style="color: #ff4500;">09</span>:<span style="color: #ff4500;">29</span>:<span style="color: #ff4500;">06</span><span style="color: black;">&#93;</span> WARNING<span style="color: black;">&#91;</span><span style="color: #ff4500;">9228</span><span style="color: black;">&#93;</span>: chan_sip.<span style="color: black;">c</span>:<span style="color: #ff4500;">6624</span> determine_firstline_parts: Bad request protocol Packet</div>
<p>This is not really a problem, but an annoyance, as it fills up your logs. This is a <a href="http://bugs.digium.com/view.php?id=7261&#038;nbn=6" class="liexternal">known problem</a> for more than years, but has never been corrected (neither by Asterisk nor by Cirpack devs). The usual correction was to add the following line to your startup scripts (/etc/rc.local on Debian for example):</p>
<div class="python" style="font-family: monospace;color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">iptables -A INPUT -p udp -m udp &#8211;dport <span style="color: #ff4500;">5060</span> -m <span style="color: #dc143c;">string</span> &#8211;<span style="color: #dc143c;">string</span> <span style="color: #483d8b;">&quot;Cirpack KeepAlive Packet&quot;</span> -j DROP</div>
<p>But the syntax has changed in iptables, and you&#8217;ll get the error:</p>
<div class="python" style="font-family: monospace;color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">iptables v1<span style="color: #ff4500;">.3</span><span style="color: #ff4500;">.6</span>: STRING match: You must specify `&#8211;algo<span style="color: #483d8b;">&#8216;</span></div>
<p>so, just add one of the 2 available algorithms (bm and kmp):</p>
<div class="python" style="font-family: monospace;color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;">iptables -A INPUT -p udp -m udp &#8211;dport <span style="color: #ff4500;">5060</span> -m <span style="color: #dc143c;">string</span> &#8211;<span style="color: #dc143c;">string</span> <span style="color: #483d8b;">&quot;Cirpack KeepAlive Packet&quot;</span> &#8211;algo bm -j DROP</div>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.gradstein.info/python/how-to-dial-a-number-using-asterisk-and-python/" title="How to dial a number using Asterisk and Python (December 17, 2008)">How to dial a number using Asterisk and Python</a> (1)</li>
	<li><a href="http://www.gradstein.info/software/asterisk/asterisk-dadhi-module-not-working-when-using-xen/" title="Asterisk: DADHI module not working when using Xen (March 26, 2009)">Asterisk: DADHI module not working when using Xen</a> (5)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.gradstein.info/software/asterisk/asterisk-cirpack-problem-with-free-and-freephonienet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to dial a number using Asterisk and Python</title>
		<link>http://www.gradstein.info/python/how-to-dial-a-number-using-asterisk-and-python/</link>
		<comments>http://www.gradstein.info/python/how-to-dial-a-number-using-asterisk-and-python/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 09:39:17 +0000</pubDate>
		<dc:creator>Lior Gradstein</dc:creator>
				<category><![CDATA[asterisk]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[voip]]></category>
		<category><![CDATA[clickto dial]]></category>
		<category><![CDATA[dial]]></category>

		<guid isPermaLink="false">http://www.gradstein.info/?p=33</guid>
		<description><![CDATA[I didn&#8217;t find any example in Python on how to Dial a number from an Asterisk server and link it to another channel. So here&#8217;s a quick code to do it. You just need to have a manager defined in your /etc/asterisk/manager.conf defined.
import socket
HOST=&#34;192.168.1.116&#34;
PORT=5038
p = &#34;&#34;&#34;Action: login
Events: off
Username: %(username)s
Secret: %(password)s
Action: originate
Channel: SIP/%(local_user)s
WaitTime: 60
CallerId: 600
Exten: %(phone_to_dial)s
Context: [...]]]></description>
			<content:encoded><![CDATA[<p>I didn&#8217;t find any example in Python on how to Dial a number from an Asterisk server and link it to another channel. So here&#8217;s a quick code to do it. You just need to have a manager defined in your /etc/asterisk/manager.conf defined.</p>
<div class="python" style="font-family: monospace;color: #000066; border: 1px solid orange; margin: 5px; padding: 5px; background-color: #ffffff;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">socket</span></p>
<p>HOST=<span style="color: #483d8b;">&quot;192.168.1.116&quot;</span><br />
PORT=<span style="color: #ff4500;">5038</span></p>
<p>p = <span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;Action: login<br />
Events: off<br />
Username: %(username)s<br />
Secret: %(password)s</p>
<p>Action: originate<br />
Channel: SIP/%(local_user)s<br />
WaitTime: 60<br />
CallerId: 600<br />
Exten: %(phone_to_dial)s<br />
Context: default<br />
Priority: 1</p>
<p>Action: Logoff<br />
&quot;</span><span style="color: #483d8b;">&quot;&quot;</span><br />
<span style="color: #ff7700;font-weight:bold;">def</span> click_to_call<span style="color: black;">&#40;</span>phone_to_dial, username, password, local_user<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; pattern = p % <span style="color: black;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&#8216;phone_to_dial&#8217;</span>: phone_to_dial,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&#8216;username&#8217;</span>: username,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&#8216;password&#8217;</span>: password,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">&#8216;local_user&#8217;</span>: local_user<span style="color: black;">&#125;</span></p>
<p>&nbsp; &nbsp; s = <span style="color: #dc143c;">socket</span>.<span style="color: #dc143c;">socket</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">socket</span>.<span style="color: black;">AF_INET</span>, <span style="color: #dc143c;">socket</span>.<span style="color: black;">SOCK_STREAM</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; s.<span style="color: black;">connect</span><span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>HOST, PORT<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></p>
<p>&nbsp; &nbsp; data = s.<span style="color: black;">recv</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1024</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> l <span style="color: #ff7700;font-weight:bold;">in</span> pattern.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&#8216;n&#8217;</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Sending&gt;&quot;</span>, l<br />
&nbsp; &nbsp; &nbsp; &nbsp; s.<span style="color: black;">send</span><span style="color: black;">&#40;</span>l+<span style="color: #483d8b;">&#8216;rn&#8217;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> l == <span style="color: #483d8b;">&quot;&quot;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data = s.<span style="color: black;">recv</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1024</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> data<br />
&nbsp; &nbsp; data = s.<span style="color: black;">recv</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1024</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; s.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></p>
<p><span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&#8216;__main__&#8217;</span>:<br />
&nbsp; &nbsp; click_to_call<span style="color: black;">&#40;</span>phone_to_dial=<span style="color: #483d8b;">&#8216;123456789&#8242;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; username=<span style="color: #483d8b;">&#8216;manager_login&#8217;</span>, password=<span style="color: #483d8b;">&#8216;yourpass&#8217;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; local_user=<span style="color: #483d8b;">&#8216;600&#8242;</span><span style="color: black;">&#41;</span></div>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.gradstein.info/software/asterisk/asterisk-cirpack-problem-with-free-and-freephonienet/" title="Asterisk cirpack problem with Free and freephonie.net (February 12, 2009)">Asterisk cirpack problem with Free and freephonie.net</a> (0)</li>
	<li><a href="http://www.gradstein.info/software/asterisk/asterisk-dadhi-module-not-working-when-using-xen/" title="Asterisk: DADHI module not working when using Xen (March 26, 2009)">Asterisk: DADHI module not working when using Xen</a> (5)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.gradstein.info/python/how-to-dial-a-number-using-asterisk-and-python/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
