Category Archives: linux

Problem with network manager in Jaunty

I don’t know if it’s a real bug or it’s just me

wired network keeps going up and down from time to time

since I don’t use wireless so I don’t know if it’s the same for wireless network

anyways, problem solved by replacing network manager with wicd

one good thing about jaunty is that they finally include wicd in the universe repository

How to distinguish incoming trunks in asterisk-java

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’s a new incoming call, asterisk-java will trigger a newChannelEvent, but there’s no information in this event that can be used for distinguish from which trunk this call is coming in.

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’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’s a working one 😀 Continue reading

msn-pecan 0.0.17

I am so sick of the msn plugin that comes with pidgin, it takes years to login every time

with msn-pecan the login process took me less than 1sec, which IMO is much better.

you can grab the debian installer package here if you are using 64bits linux and don’t feel like to compile it yourself

  msn-pecan_0.0.17-21-g83bf5f4-1_amd64.deb (104.0 KiB, 790 hits)

a bash script to control spawn-fcgi as a service

first create a file named “php-fastcgi” in /usr/bin/, suppose your spawn-fcgi is in /usr/bin/, don’t forget to chmod +x on the file

#!/bin/sh
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -f /usr/bin/php5-cgi

then create another file named “init-fastcgi” in /etc/init.d/ and run “sudo update-rc.d init-fastcgi defaults”

#!/bin/bash
PHP_SCRIPT=/usr/bin/php-fastcgi
RETVAL=0
case "$1" in
    start)
      $PHP_SCRIPT
      RETVAL=$?
  ;;
    stop)
      killall -9 php5-cgi
      RETVAL=$?
  ;;
    restart)
      killall -9 php5-cgi
      sleep 0.5
      $PHP_SCRIPT
      RETVAL=$?
  ;;
    *)
      echo "Usage: php-fastcgi {start|stop|restart}"
      exit 1
  ;;
esac
exit $RETVAL