<?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>phill84.org &#187; linux</title>
	<atom:link href="http://phill84.org/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://phill84.org</link>
	<description>יְהִי אוֹר</description>
	<lastBuildDate>Sat, 17 Apr 2010 13:13:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>iptables port forwarding for emule</title>
		<link>http://phill84.org/2010/01/iptables-port-forwarding-for-emule/</link>
		<comments>http://phill84.org/2010/01/iptables-port-forwarding-for-emule/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 21:20:56 +0000</pubDate>
		<dc:creator>phill84</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[emule]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[port forwarding]]></category>

		<guid isPermaLink="false">http://phill84.org/2010/01/iptables-port-forwarding-for-emule/</guid>
		<description><![CDATA[Suppose you wanna have HighID and open KAD network connection for eMule on a computer in a LAN, and the gateway is running iptables. Just add the rules below to your existing iptables rules and you are done. # this example is based on the assumption that # eth0 is WAN interface and eth1 is [...]]]></description>
			<content:encoded><![CDATA[<p>Suppose you wanna have HighID and open KAD network connection for eMule on a computer in a LAN, and the gateway is running iptables. Just add the rules below to your existing iptables rules and you are done.</p>
<pre class="brush: bash;">
# this example is based on the assumption that
# eth0 is WAN interface and eth1 is LAN interface,
# 192.168.0.2 is the ip address of a computer in LAN,
# 4262 is the tcp port for ed2k network,
# 4272 is the udp port for kad network.

-A PREROUTING -i eth0 -p tcp -m tcp --dport 4262 -j DNAT --to-destination 192.168.0.2:4262
-A PREROUTING -i eth0 -p udp -m udp --dport 4272 -j DNAT --to-destination 192.168.0.2:4272

-A FORWARD -d 192.168.0.2/32 -i eth0 -o eth1 -p tcp --dport 4262 -j ACCEPT
-A FORWARD -d 192.168.0.2/32 -i eth0 -o eth1 -p udp --dport 4272 -j ACCEPT
</pre>
]]></content:encoded>
			<wfw:commentRss>http://phill84.org/2010/01/iptables-port-forwarding-for-emule/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>rtorrent with magnet link support</title>
		<link>http://phill84.org/2009/12/rtorrent-with-magnet-link-support/</link>
		<comments>http://phill84.org/2009/12/rtorrent-with-magnet-link-support/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 07:23:03 +0000</pubDate>
		<dc:creator>phill84</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[deb]]></category>
		<category><![CDATA[i386]]></category>
		<category><![CDATA[magnet]]></category>
		<category><![CDATA[rtorrent]]></category>

		<guid isPermaLink="false">http://phill84.org/2009/12/rtorrent-with-magnet-link-support/</guid>
		<description><![CDATA[Yesterday I wanted to download a file but could find only magnet link. Since rtorrent doesn&#8217;t support magnet link yet officially, I did some research on google and came cross this great tutorial on how to patch the source from svn and get magnet link support. So here they are, deb packages for libtorrent and rtorrent. [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I wanted to download a file but could find only magnet link. Since rtorrent doesn&#8217;t support magnet link yet officially, I did some research on google and came cross <a href="http://www.howtoforge.com/how-to-compile-rtorrent-from-svn-in-ubuntu-9.10-karmic-koala-debian-5-lenny-with-magnet-link-support">this great tutorial</a> on how to patch the source from svn and get magnet link support. So here they are, deb packages for libtorrent and rtorrent. These packages were built for my debian squeeze, so I&#8217;m not sure if they also work on ubuntu, but if you want you can try.</p>
Note: There is a file embedded within this post, please visit this post to download the file. Note: There is a file embedded within this post, please visit this post to download the file.
]]></content:encoded>
			<wfw:commentRss>http://phill84.org/2009/12/rtorrent-with-magnet-link-support/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Syncing twitter to digu using python / 用python同步twitter到嘀咕</title>
		<link>http://phill84.org/2009/10/syncing-twitter-to-digu-using-python-%e7%94%a8python%e5%90%8c%e6%ad%a5twitter%e5%88%b0%e5%98%80%e5%92%95/</link>
		<comments>http://phill84.org/2009/10/syncing-twitter-to-digu-using-python-%e7%94%a8python%e5%90%8c%e6%ad%a5twitter%e5%88%b0%e5%98%80%e5%92%95/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 19:04:19 +0000</pubDate>
		<dc:creator>phill84</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[digu]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[sync]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[同步]]></category>
		<category><![CDATA[嘀咕]]></category>

		<guid isPermaLink="false">http://phill84.org/2009/10/syncing-twitter-to-digu-using-python-%e7%94%a8python%e5%90%8c%e6%ad%a5twitter%e5%88%b0%e5%98%80%e5%92%95/</guid>
		<description><![CDATA[#!/usr/bin/env python import base64 import simplejson as json import os import sys import urllib import urllib2 global twitter_username global digu_username global digu_password twitter_username = 'username' digu_username = 'username' digu_password = 'password' def post_to_digu(msg): url = 'http://api.minicloud.com.cn/statuses/update.json' data = urllib.urlencode(msg) req = urllib2.Request(url, data) req.add_header(&#34;Authorization&#34;, &#34;Basic %s&#34; % base64.encodestring('%s:%s' % (digu_username, digu_password))[:-1]) handle = urllib2.urlopen(req) def [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: python;">#!/usr/bin/env python
import base64
import simplejson as json
import os
import sys
import urllib
import urllib2

global twitter_username
global digu_username
global digu_password
twitter_username = 'username'
digu_username = 'username'
digu_password = 'password'

def post_to_digu(msg):
	url = 'http://api.minicloud.com.cn/statuses/update.json'
	data = urllib.urlencode(msg)
	req = urllib2.Request(url, data)
	req.add_header(&quot;Authorization&quot;, &quot;Basic %s&quot; % base64.encodestring('%s:%s' % (digu_username, digu_password))[:-1])
	handle = urllib2.urlopen(req)

def main():
	path = sys.path[0]
	if (sys.platform[:3] == 'win'):
		path += '\\'
	else:
		path += '/'
	id_file = path + 'last_id'
	last_id = 0
	if os.path.exists(id_file):
		f = open(id_file, 'r')
	        last_id = int(f.read())
        	f.close()
	else:
		f = open(id_file, 'w')
		f.write('0')
		f.close()
	url = 'http://twitter.com/statuses/user_timeline/' + twitter_username + '.json?last_id='
	updates = json.load(urllib.urlopen(url+str(last_id)))
	new_last_id = None
	n = 0
	for update in updates:
		text = update['text']
		id = update['id']
		if (text[0] != '@') and (id &amp;gt; last_id):
			if (new_last_id &amp;lt; id):
				new_last_id = id
			text = urllib.quote(text.encode('utf-8'))
			msg = {'content': text}
                        stack.append(msg)
        while (stack)
                post_to_digu(stack.pop())
	if (new_last_id != None):
		f = open(id_file, 'w')
		f.write(str(new_last_id))

if __name__ == &quot;__main__&quot;:
    main()</pre>
]]></content:encoded>
			<wfw:commentRss>http://phill84.org/2009/10/syncing-twitter-to-digu-using-python-%e7%94%a8python%e5%90%8c%e6%ad%a5twitter%e5%88%b0%e5%98%80%e5%92%95/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>eva 0.4.921 svn79</title>
		<link>http://phill84.org/2009/09/eva-0-4-921-svn79/</link>
		<comments>http://phill84.org/2009/09/eva-0-4-921-svn79/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 21:09:58 +0000</pubDate>
		<dc:creator>phill84</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[0.4.921]]></category>
		<category><![CDATA[79]]></category>
		<category><![CDATA[deb]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[eva]]></category>
		<category><![CDATA[evaq]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://phill84.org/2009/09/eva-0-4-921-svn79/</guid>
		<description><![CDATA[從 jaunty 的 repository 裡面安裝的 eva 登錄就崩潰了, 自己從 svn 拉回來編譯了一個, 只編譯了 x86 的因為現在沒有 x64 的機器, 目前發現隱身可見的用戶發來消息的時候會崩潰&#8230; 有興趣的同學可以裝上試試 順便 fuck 麻花騰, qq for linux 就這麼停了]]></description>
			<content:encoded><![CDATA[<p>從 jaunty 的 repository 裡面安裝的 eva 登錄就崩潰了, 自己從 svn 拉回來編譯了一個, 只編譯了 x86 的因為現在沒有 x64 的機器, 目前發現隱身可見的用戶發來消息的時候會崩潰&#8230; 有興趣的同學可以裝上試試</p>
<p>順便 fuck 麻花騰, qq for linux 就這麼停了</p>
Note: There is a file embedded within this post, please visit this post to download the file.
]]></content:encoded>
			<wfw:commentRss>http://phill84.org/2009/09/eva-0-4-921-svn79/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KDE 4.3.1</title>
		<link>http://phill84.org/2009/09/kde-4-3-1/</link>
		<comments>http://phill84.org/2009/09/kde-4-3-1/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 05:47:42 +0000</pubDate>
		<dc:creator>phill84</dc:creator>
				<category><![CDATA[blah]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[kde4]]></category>
		<category><![CDATA[kubuntu]]></category>

		<guid isPermaLink="false">http://phill84.org/2009/09/kde-4-3-1/</guid>
		<description><![CDATA[好吧 終於我也投奔到kde了]]></description>
			<content:encoded><![CDATA[<p>好吧 終於我也投奔到kde了</p>
<p><a href="http://phill84.org/wp-content/uploads/2009/09/snapshot1.png"><img class="alignnone size-medium wp-image-607 colorbox-609" title="snapshot1" src="http://phill84.org/wp-content/uploads/2009/09/snapshot1-450x270.png" alt="snapshot1 450x270 KDE 4.3.1" width="450" height="270" /></a></p>
<p><a href="http://phill84.org/wp-content/uploads/2009/09/snapshot2.png"><img class="alignnone size-medium wp-image-608 colorbox-609" title="snapshot2" src="http://phill84.org/wp-content/uploads/2009/09/snapshot2-450x270.png" alt="snapshot2 450x270 KDE 4.3.1" width="450" height="270" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://phill84.org/2009/09/kde-4-3-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sysinfo plugin for xchat2 on linux</title>
		<link>http://phill84.org/2009/08/sysinfo-plugin-for-xchat2-on-linux/</link>
		<comments>http://phill84.org/2009/08/sysinfo-plugin-for-xchat2-on-linux/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 19:23:59 +0000</pubDate>
		<dc:creator>phill84</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[sysinfo]]></category>
		<category><![CDATA[xchat]]></category>

		<guid isPermaLink="false">http://phill84.org/2009/08/sysinfo-plugin-for-xchat2-on-linux/</guid>
		<description><![CDATA[It&#8217;s my first time writing something in perl, the code is not very efficient and for now it can only display info of cpu, memory, bandwidth and uptime. # Configuration $eth = &#34;eth0&#34;; # Script Xchat::register(&#34;Sysinfo&#34;, &#34;0.1&#34;, &#34;System Information Displayer&#34;); Xchat::print(&#34;Sysinfo 0.1 Loaded.&#34;); Xchat::hook_command(&#34;uptime&#34;, &#34;uptime&#34;); Xchat::hook_command(&#34;os&#34;, &#34;os&#34;); Xchat::hook_command(&#34;bw&#34;, &#34;bw&#34;); Xchat::hook_command(&#34;cpu&#34;, &#34;cpu&#34;); Xchat::hook_command(&#34;mem&#34;, &#34;mem&#34;); sub uptime [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s my first time writing something in perl, the code is not very efficient and for now it can only display info of cpu, memory, bandwidth and uptime.</p>
<pre class="brush: perl;"># Configuration
$eth = &quot;eth0&quot;;

# Script
Xchat::register(&quot;Sysinfo&quot;, &quot;0.1&quot;, &quot;System Information Displayer&quot;);
Xchat::print(&quot;Sysinfo 0.1 Loaded.&quot;);
Xchat::hook_command(&quot;uptime&quot;, &quot;uptime&quot;);
Xchat::hook_command(&quot;os&quot;, &quot;os&quot;);
Xchat::hook_command(&quot;bw&quot;, &quot;bw&quot;);
Xchat::hook_command(&quot;cpu&quot;, &quot;cpu&quot;);
Xchat::hook_command(&quot;mem&quot;, &quot;mem&quot;);

sub uptime {
	$uptime = `cat /proc/uptime | awk '{printf \$1}'`;
	$_day = 60 * 60 * 24;
	$_hour = 60 * 60;
	$_minute = 60;
	$day = int($uptime/$_day);
	$uptime %= $_day;
	$hour = int($uptime/$_hour);
	$uptime %= $_hour;
	$minute = int($uptime/$_minute);
	$uptime %= $_minute;
	$second = int($uptime);
	$uptime = &quot;&quot;;
	if($day != 0) {
		$uptime .= $day;
		if($day == 1) {
			$uptime .= &quot; day &quot;;
		} else {
			$uptime .= &quot; days &quot;;
		}
	}
	if($hour != 0) {
		$uptime .= $hour;
		if($hour == 1) {
			$uptime .= &quot; hour &quot;;
		} else {
			$uptime .= &quot; hours &quot;;
		}
	}
	if($minute != 0) {
		$uptime .= $minute;
		if($minute == 1) {
			$uptime .= &quot; minute &quot;;
		} else {
			$uptime .= &quot; minutes &quot;;
		}
	}
	$uptime .= $second;
	if($second == 1) {
		$uptime .= &quot; second&quot;;
	} else {
		$uptime .= &quot; seconds&quot;;
	}
	Xchat::command(&quot;SAY &#92;&#48;02[UPTIME]&#92;&#48;02 $uptime&quot;);
	Xchat::EAT_ALL;
}

sub os {
	$_kernel_release = `uname -r`;
	$_operating_system = `uname -o`;
	chomp($_kernel_release);
	chomp($_operating_system);
	$os = $_operating_system . &quot; &quot; . $_kernel_release;
	Xchat::command(&quot;SAY &#92;&#48;02[OS]&#92;&#48;02 $os&quot;);
	Xchat::EAT_ALL;
}

sub bw {
	$old = `cat /proc/net/dev | grep $eth | cut -d &quot;:&quot; -f 2 | tr -s &quot; &quot;| cut -d &quot; &quot; -f 1,9`;
	sleep(1);
	$new = `cat /proc/net/dev | grep $eth | cut -d &quot;:&quot; -f 2 | tr -s &quot; &quot;| cut -d &quot; &quot; -f 1,9`;
	@ary_old = split(/\s/, $old);
	@ary_new = split(/\s/, $new);
	$down = $ary_new[0] - $ary_old[0];
	$up = $ary_new[1] - $ary_old[1];
	$bw = &quot;&quot;;
	if($down &lt; 1000) {
		$bw .= $down . &quot; B/s Down &quot;;
	} else {
		$bw .= sprintf(&quot;%.02f&quot;, $down / 1000) . &quot; KB/s Down &quot;;
	}
	if($up &lt; 1000) {
		$bw .= $up . &quot; B/s Up&quot;;
	} else {
		$bw .= sprintf(&quot;%.02f&quot;, $up / 1000) . &quot; KB/s Up&quot;;
	}
	Xchat::command(&quot;SAY &#92;&#48;02[BW]&#92;&#48;02 $bw&quot;);
	Xchat::EAT_ALL;
}

sub cpu {
	$model_name = `cat /proc/cpuinfo | grep &quot;model name&quot; | tail -1 | cut -d &quot;:&quot; -f 2 | tr -s &quot; &quot;`;
	$number_cores = `cat /proc/cpuinfo | grep &quot;model name&quot; -c`;
	$freq = `cat /proc/cpuinfo | grep &quot;cpu MHz&quot; | tail -1 | cut -d &quot;:&quot; -f 2 | tr -s &quot; &quot;`;
	$idle = `vmstat | tail -1 | awk '{printf \$15}'`;
	$load = 100 - $idle;
	chomp($model_name);
	chomp($number_cores);
	chomp($freq);
	$cpuinfo = $number_cores . &quot; CPU&quot;;
	if($number_cores &gt; 1) {
		$cpuinfo .= &quot;'s&quot;;
	}
	$cpuinfo .= &quot; -&quot; . $model_name;
	$cpuinfo .= &quot; @ &quot; . int($freq) . &quot; MHz&quot; . &quot; (&quot; . $load . &quot;% Load)&quot;;
	Xchat::command(&quot;SAY &#92;&#48;02[CPU]&#92;&#48;02 $cpuinfo&quot;);
	Xchat:EAT_ALL;
}

sub mem {
	$mem_total = `free -m | grep Mem | awk '{printf \$2}'`;
	$mem_used = `free -m | grep - | awk '{printf \$3}'`;
	$swap_total = `free -m| grep Swap | awk '{printf \$2}'`;
	$swap_used = `free -m| grep Swap | awk '{printf \$3}'`;
	$meminfo = &quot;&#92;&#48;02[MEM]&#92;&#48;02 &quot; . $mem_used . &quot;/&quot; . $mem_total . &quot; MB &#92;&#48;02[SWAP]&#92;&#48;02 &quot; . $swap_used . &quot;/&quot; . $swap_total . &quot; MB&quot;;
	Xchat::command(&quot;SAY $meminfo&quot;);
	Xchat::EAT_ALL;
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://phill84.org/2009/08/sysinfo-plugin-for-xchat2-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get rid of unwanted output from bash command</title>
		<link>http://phill84.org/2009/08/get-rid-of-unwanted-output-from-bash-command/</link>
		<comments>http://phill84.org/2009/08/get-rid-of-unwanted-output-from-bash-command/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 08:32:45 +0000</pubDate>
		<dc:creator>phill84</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[null]]></category>
		<category><![CDATA[output]]></category>
		<category><![CDATA[redirect]]></category>

		<guid isPermaLink="false">http://phill84.org/2009/08/get-rid-of-unwanted-output-from-bash-command/</guid>
		<description><![CDATA[I used to redirect the output to /dev/null, but sometimes it&#8217;s not good enough. It&#8217;s much better to just turn off stdout and stderr. $ command 1&#62;&#38;- 2&#62;&#38;- &#38;]]></description>
			<content:encoded><![CDATA[<p>I used to redirect the output to /dev/null, but sometimes it&#8217;s not good enough. It&#8217;s much better to just turn off stdout and stderr.</p>
<pre class="brush: bash;">$ command 1&gt;&amp;- 2&gt;&amp;- &amp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://phill84.org/2009/08/get-rid-of-unwanted-output-from-bash-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>換成文泉驛微米黑了</title>
		<link>http://phill84.org/2009/05/%e6%8f%9b%e6%88%90%e6%96%87%e6%b3%89%e9%a9%9b%e5%be%ae%e7%b1%b3%e9%bb%91%e4%ba%86/</link>
		<comments>http://phill84.org/2009/05/%e6%8f%9b%e6%88%90%e6%96%87%e6%b3%89%e9%a9%9b%e5%be%ae%e7%b1%b3%e9%bb%91%e4%ba%86/#comments</comments>
		<pubDate>Mon, 11 May 2009 20:04:51 +0000</pubDate>
		<dc:creator>phill84</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[microhei]]></category>
		<category><![CDATA[wqy]]></category>
		<category><![CDATA[微米黑]]></category>
		<category><![CDATA[文泉驛]]></category>

		<guid isPermaLink="false">http://phill84.org/2009/05/%e6%8f%9b%e6%88%90%e6%96%87%e6%b3%89%e9%a9%9b%e5%be%ae%e7%b1%b3%e9%bb%91%e4%ba%86/</guid>
		<description><![CDATA[效果比正黑好得不是一點點 一點都沒有虛邊的感覺]]></description>
			<content:encoded><![CDATA[<p>效果比正黑好得不是一點點<br />
一點都沒有虛邊的感覺<br />
<a href="http://phill84.org/wp-content/uploads/2009/05/screenshot.png"><img class="alignnone size-medium wp-image-584 colorbox-585" title="screenshot" src="http://phill84.org/wp-content/uploads/2009/05/screenshot-450x281.png" alt="screenshot 450x281 換成文泉驛微米黑了" width="450" height="281" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://phill84.org/2009/05/%e6%8f%9b%e6%88%90%e6%96%87%e6%b3%89%e9%a9%9b%e5%be%ae%e7%b1%b3%e9%bb%91%e4%ba%86/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Problem with network manager in Jaunty</title>
		<link>http://phill84.org/2009/03/problem-with-network-manager-in-jaunity/</link>
		<comments>http://phill84.org/2009/03/problem-with-network-manager-in-jaunity/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 20:06:56 +0000</pubDate>
		<dc:creator>phill84</dc:creator>
				<category><![CDATA[blah]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[9.04]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[jaunty]]></category>
		<category><![CDATA[network manager]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[wicd]]></category>

		<guid isPermaLink="false">http://phill84.org/?p=570</guid>
		<description><![CDATA[I don&#8217;t know if it&#8217;s a real bug or it&#8217;s just me wired network keeps going up and down from time to time since I don&#8217;t use wireless so I don&#8217;t know if it&#8217;s the same for wireless network anyways, problem solved by replacing network manager with wicd one good thing about jaunty is that [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t know if it&#8217;s a real bug or it&#8217;s just me</p>
<p>wired network keeps going up and down from time to time</p>
<p>since I don&#8217;t use wireless so I don&#8217;t know if it&#8217;s the same for wireless network</p>
<p>anyways, problem solved by replacing network manager with wicd</p>
<p>one good thing about jaunty is that they finally include wicd in the universe repository</p>
]]></content:encoded>
			<wfw:commentRss>http://phill84.org/2009/03/problem-with-network-manager-in-jaunity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to distinguish incoming trunks in asterisk-java</title>
		<link>http://phill84.org/2009/03/how-to-distinguish-incoming-trunks-in-asterisk-java/</link>
		<comments>http://phill84.org/2009/03/how-to-distinguish-incoming-trunks-in-asterisk-java/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 10:28:52 +0000</pubDate>
		<dc:creator>phill84</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[1.6]]></category>
		<category><![CDATA[accountcode]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[sip]]></category>
		<category><![CDATA[trunk]]></category>

		<guid isPermaLink="false">http://phill84.org/2009/03/how-to-distinguish-incoming-trunk-in-asterisk-java/</guid>
		<description><![CDATA[Suppose you have asterisk 1.6 with freepbx and you are developing with the latest asterisk-java library. Somehow you wanna perform different tasks based on calls coming through different SIP trunks. When there&#8217;s a new incoming call, asterisk-java will trigger a newChannelEvent, but there&#8217;s no information in this event that can be used for distinguish from [...]]]></description>
			<content:encoded><![CDATA[<p>Suppose you have asterisk 1.6 with freepbx and you are developing with the latest asterisk-java library. Somehow you wanna perform different tasks based on calls coming through different SIP trunks.</p>
<p>When there&#8217;s a new incoming call, asterisk-java will trigger a newChannelEvent, but there&#8217;s no information in this event that can be used for distinguish from which trunk this call is coming in.</p>
<p>By default the accountcode in this NewChannelEvent is null, which makes sense because the accountcode is used for billing, and no one, at least not many people, wants to record the charge of SIP trunk because that&#8217;s usually done by the SIP provider to which the trunk is registered to. But since the accountcode is null and useless here, maybe we can use it as an identifier to distinguish the incoming trunk, it may be not the smartest solution, but at least it&#8217;s a working one <img src='http://phill84.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley colorbox-563' title="How to distinguish incoming trunks in asterisk java" /> <span id="more-563"></span></p>
<p>The solution is pretty easy. Just open extensions_custom.conf and add<br />
<code>[ext-did-custom]<br />
exten =&gt; &lt;username from your sip provider&gt;,1,Set(CDR(accountcode)=&lt;some account&gt;)</code><br />
et voilà! <img src='http://phill84.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley colorbox-563' title="How to distinguish incoming trunks in asterisk java" /> </p>
<p>If you try to make a call from outside now, in this NewChannelEvent the accountcode is still null, but there will be a NewAccountCodeEvent and you can see that the accountcode is set in this event, and from the same uniqueid you can tell that both the NewChannelEvent and NewAccountCodeEvent belong to the same call.</p>
<p>*note: Remeber that you should never manually edit extensions_additional.conf, the file is generated by freepbx and all the changes you have done will be overrided the next time you apply some changes in freepbx</p>
]]></content:encoded>
			<wfw:commentRss>http://phill84.org/2009/03/how-to-distinguish-incoming-trunks-in-asterisk-java/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
