September 21, 2010

yahoo imap and STMP server, FREE to ALL

According to Wikipedia, Yahoo has free IMAP services.
"Free IMAP and SMTPs access
It is possible to get direct IMAP access without signing up for paid access nor using software like YPOPs! or FreePOPs. Yahoo operates IMAP servers (imap.mail.yahoo.com in particular), which are globally accessible. However they require a specific, but non-standard IMAP command to be sent before login is done. The command is: “ID ("GUID" "1")” and it is relatively easy to modify any email client to send it. In fact this is the method currently employed by YPOPSs! and FreePOPs. There are modified version of Mutt and Mozilla Thunderbird available that send this command.[23]

There is also an IMAPs server running at imap-ssl.mail.yahoo.com. It is using SSL on the standard port 993.

In addition it is also possible to send mail through mail clients as yahoo also operates an SMTP server (smtp.mail.yahoo.com). It is necessary to enable SSL through port 465. The username is the user's Yahoo mail address and the password is the same as for webmail access, this applies to both IMAP and SMTPs access.yahoo mail address and th e password is the same as for webmail access, the applies to both IMAP and amtps access."

Source(s):

September 17, 2010

Cross Compile cherokee 1.0.8 to ARM

 ac_cv_func_malloc_0_nonnull=yes   \
  ac_cv_func_realloc_0_nonnull=yes  \
./configure                         \
  --host=arm-linux           \
  --disable-readdir_r               \
  --disable-tls                     \
  --enable-static-module=all        \
  --enable-trace                    \
  --enable-static                   \
  --enable-shared=no                \
  --enable-beta                     \
  --disable-ipv6 \
  CC=arm-linux-gcc

 make
you will get an errro about readdir_mutex.

go to file cherokee/util.c line 400, changed it to:

#if defined(HAVE_PTHREAD)

now you are good to go, just type make and the final files are in cherokee/{cherokee,cherokee-worker}

To run Cherokee on an embedded platform:
1. download cherokee-worker, cherokee
2. create a conf file with the following contents:

server!bind!1!port = 80
server!timeout = 60
server!keepalive = 1
server!keepalive_max_requests = 500
server!server_tokens = full
#server!encoder!gzip!allow = html,html,txt,css,js
server!panic_action = /web/cherokee-panic
server!pid_file = /var/run/cherokee.pid
server!user = root
server!group = root

# Default virtual server
#
vserver!default!nick = default
vserver!default!document_root = /web
vserver!default!directory_index = index.php,index.html

vserver!default!logger = combined
vserver!default!logger!access!type = file
vserver!default!logger!access!filename = /var/log/cherokee.access
vserver!default!logger!access!buffsize = 16384
vserver!default!logger!error!type = file
vserver!default!logger!error!filename = /var/log/cherokee.error

vserver!default!rule!1!match = default
vserver!default!rule!1!handler = common
vserver!default!rule!1!handler!iocache = 0

vserver!default!rule!99999!match = extensions
vserver!default!rule!99999!match!extensions = php
vserver!default!rule!99999!handler = fcgi
vserver!default!rule!99999!handler!balancer = round_robin
vserver!default!rule!99999!handler!balancer!type = interpreter
vserver!default!rule!99999!handler!balancer!source!1 = 1
vserver!default!rule!99999!handler!balancer!local1!host = 127.0.0.1:1234
vserver!default!rule!99999!handler!balancer!local1!env!PHP_FCGI_CHILDREN = 5
vserver!default!rule!99999!handler!balancer!local1!interpreter = /web/php-cgi -b 1234

source!1!env!PHP_FCGI_CHILDREN = 5
source!1!host = 127.0.0.1:1234
source!1!interpreter = /web/php-cgi -b 1234
source!1!nick = php
#source!1!type = interpreter
source!1!type = host


3. create a themes directory with the followings files:

ls themes/default/
theme.css logo.png header.html footer.html entry.html


4. run it "./cherokee -C cherokee.conf"

You can enable tracing to see the traces of cherokee.

September 15, 2010

grep multiple strings

grep "foo\|bar"
grep -E "foo|bar"  
egrep "foo|bar"

September 3, 2010

Determine your linux distribution version

Use 'uname -a' to get kernel info

Use 'cat /etc/redhat-release' to find out redhat/FC release info

Use 'cat cat /etc/debian_version' to find out debian release info

Ubuntu? Just use debian. :-)

List of VOIP phone and their codecs

This table is from http://www.ozvoip.com/voip-codecs/devices/

ClientSupported Codecs
Billion BIPAC 7402VL G.711, G.729
Billion BIPAC-7100SV G.711, G.729
Billion BIPAC7402VGP G.711, G.729
Cisco 7960 G.711, G.729
Draytek Vigor 2100V(G) G.711, G.723.1, G.726, G.729
Draytek Vigor 2500V G.711, G.729
Draytek Vigor 2600V(G) G.711, G.723.1, G.726, G.729
Draytek Vigor 2900V(G) G.711, G.723.1, G.726, G.729
eyeBeam GSM, iLBC, G.711, G.722, G.723.1, G.729, Speex
Grandstream BudgeTone 101 iLBC, G.711, G.723.1, G.726, G.728, G.729
Grandstream BudgeTone 102 iLBC, G.711, G.723.1, G.726, G.728, G.729
Grandstream GXP2000 GSM, G.711, G.722, G.723.1, G.726, G.728, G.729
Grandstream HandyTone 286 iLBC, G.711, G.723.1, G.726, G.728, G.729
Grandstream Handytone 486 iLBC, G.711, G.723.1, G.726, G.728, G.729
Leadtek 8051 G.711, G.723.1, G.726, G.729
Linksys PAP2 G.711, G.723.1, G.726, G.729
Linksys RT31P2 G.711, G.723.1, G.726, G.729
Linksys WRT54GP2 G.711, G.729
MS Office Communicator GSM, G.711, G.722, G.723.1, DVI4, Siren
Octtel SPxxxx Series Gateways G.711, G.729
Polycom SoundPoint IP300 G.711, G.729
Polycom SoundPoint IP500 G.711, G.729
Polycom SoundPoint IP600 G.711, G.729
Siemens optiPoint 400 Family G.723.1
Siemens optiPoint 410 Family G.711, G.723.1
Siemens optiPoint 420 Family G.711, G.722, G.723.1, G.729
Sipura SPA-2000 G.711, G.723.1, G.726, G.729
Sipura SPA-2100 G.711, G.723.1, G.726, G.729
Sipura SPA-3000 G.711, G.723.1, G.726, G.729
Sipura SPA-841 G.711, G.729
sipXphone G.711
SJPhone (free version) GSM, iLBC, G.711
Snom 190 GSM, G.711, G.722, G.723.1, G.726, G.729
Snom 320 GSM, G.711, G.722, G.723.1, G.726, G.729
Snom 360 GSM, G.711, G.722, G.723.1, G.726, G.729
SwissVoice IP 10S iLBC, G.729
Uniden UIP-200 G.711, G.729
Windows Messenger GSM, G.711, G.722, G.723.1, DVI4, Siren
X-lite GSM, iLBC, G.711, Speex
X-Pro GSM, iLBC, G.711, G.729, Speex
Zyxel Prestige 2000W G.711, G.729
Zyxel Prestige 2002 G.711, G.729
Zyxel Prestige 2602HW(-L) G.711, G.729

September 2, 2010

Asterisk SIP PBX simple tutorial / quick start guide

Recently I start to investigate how to make asterisk to be an SIP BPX with small foot print, and I have a running SIP PBX now. Below are the notes on how I got it to run.

Platform: I am running asterisk in Colinux under Windows Vista. Debian 5 is running in Colinux.

Short summary:

version: asterisk 1.4 is stable and used widely. 1.6 is considered short-term support. Supposedly 1.8 is another stable version for long-term support. I use 1.4
source : the source tar gzip of asterisk is about 23MB. It uses the standard "./configure;make;make install" procedure to compile. See README in source tar ball.
structure: asterisk uses a lot of ".so" dynamic libraries, which are called modules and are loaded dynamically when program starts. Which one to load or not to load is controlled by the file "modules.conf". Many of the modules are essential to make asterisk useful, while others are optional for our purpose.
directories: configurations are under /etc/asterisk, modules (dynamic library files are under /usr/lib/asterisk/modules). Other directories are determined in compile-time and are listed in "asterisk.conf"
configurations: Unlike most unix programs, "asterisk.conf" is not what you change the most. In fact, you can probably leave it as is. The files we need to change the most for making a IP PBX are:
  • modules.conf ; for configuring which modules to load or not load
  • sip.conf ; for configuring all sip channels, both external and internal
  • extensions.conf; the heart of the PBX, configures what key press/ what extension does what
  1. apt-get install asterisk
  2. /etc/init.d/asterisk stop.  I like to use console for getting thing to run. so stop the daemon
  3. copy modules.conf below as your modules.conf
  4. copy sip.conf as your sip.conf. I use sipgate as my provider. ( I tested incoming call and outgoing call to toll-free numbers)
  5. copy extensions.conf to yours.
  6. start your asterisk in console mode (asterisk -cvvv)
  7. install x-lite software phone on your Windows and configure it as follows:
  8. now you can dial 123 to hear the playback voice from asterisk. go to asterisk CLI, and type "sip show peers" and you should see two peers, your sipgate and your x-lite phone.
  9. You can now make calls and receive calls. 
  10. For further reading, I recommend the O'reilly book "Asterisk".



modules.con
[modules]
autoload=yes
noload => pbx_gtkconsole.so
noload => pbx_kdeconsole.so
noload => app_intercom.so
noload => chan_modem.so
noload => res_musiconhold.so
noload => chan_alsa.so
noload => chan_oss.so
noload => pbx_dundi.so
noload => pbx_realtime.so
noload => app_directory.so
noload => app_userevent.so
noload => app_voicemail.so
noload => app_voicemail_imap.so
noload => app_voicemail_odbc.so
noload => pbx_ael.so
noload => app_directory_odbc.so
noload => app_zapateller.so
noload => app_zapbarge.so
noload => app_zapras.so
noload => app_zapscan.so
noload => cdr_custom.so
noload => cdr_manager.so
noload => cdr_odbc.so
noload => cdr_pgsql.so
noload => cdr_radius.so
noload => cdr_sqlite.so
noload => chan_agent.so
noload => chan_alsa.so
noload => chan_gtalk.so
noload => chan_iax2.so
noload => chan_mgcp.so
noload => chan_oss.so
noload => chan_phone.so
noload => chan_vpb.so
noload => chan_zap.so
noload => codec_zap.so
noload => format_h264.so
noload => format_jpeg.so
noload => format_mp3.so
noload => format_ogg_vorbis.so
noload => pbx_ael.so
noload => pbx_dundi.so
noload => pbx_loopback.so
noload => pbx_realtime.so
noload => pbx_spool.so
noload => res_config_odbc.so
noload => res_config_pgsql.so
noload => res_jabber.so
noload => res_odbc.so
noload => res_smdi.so
noload => res_snmp.so
noload => res_speech.so
noload => res_watchdog.so

[global]




sip.conf
[general]
context=default
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=yes

register => YOUR-SIP-ID:YOUR-SIP-PASSWD@sipgate/YOUR-SIP-ID

[sipgate]
type=peer
secret=YOUR-SIP-PASSWD
insecure=invite
username=YOUR-SIP-ID
defaultuser=YOUR-SIP-ID
fromuser=YOUR-SIP-ID
context=sipgate_in
fromdomain=sipgate.com
host=sipgate.com
outboundproxy=proxy.live.sipgate.com
qualify=yes
disallow=all
allow=ulaw
allow=ilbc
allow=g729
dtmfmode=rfc2833
nat=yes

[1000]
type=friend
context=phones
host=dynamic
qualify=yes





extensions.conf
[general]

[globals]

[sipgate_in]
exten => YOUR-SIP-ID,1,Dial(SIP/1000,30,r)
exten => YOUR-SIP-ID,n,Hangup

[sipgate_out]
exten => _X.,1,Set(CALLERID(num)=YOUR-SIP-ID)
exten => _X.,n,Dial(SIP/${EXTEN}@sipgate,30,trg)
exten => _X.,n,Hangup

[phones]
exten => 123,1,Answer()
exten => 123,n,Background(demo-congrats)
exten => 123,n,WaitExten()

include => outbound-long-distance

exten => 2,1,Playback(digits/2)
exten => 2,n,Goto(phones,123,1)

exten => 3,1,Playback(digits/3)
exten => 3,n,Goto(phones,123,1)

exten => i,1,Playback(pbx-invalid)
exten => i,n,Goto(123,1)

exten => t,1,Playback(vm-goodbye)
exten => t,n,Hangup()

[outbound-long-distance]
exten => _91NXXNXXXXXX,1,Dial(SIP/${EXTEN:1}@sipgate,30,trg)
exten => _91NXXNXXXXXX,n,Playtones(congestion)
exten => _91NXXNXXXXXX,n,Hangup()

Free U.S.domestic phone number

You can get it from any of the following providers:

1. Google voice
2. SipGate
3. IPKall
4. IPComms (http://www.ipcomms.net/product-freedid.html)

I use Google voice and SipGate. Any one has used IPComms?

September 1, 2010

voip codecs and bps


  • g.711 is raw data, highest quality, but requires highest bandwidth 
  • g.729a is the next best, very good quality, very low datarate, but it requires a $10 license per channel for asterisk. There is a free version for research and education use at http://asterisk.hosting.lv/
  • iLBC may be the next best, it is free, good quality, and relatively low datarate. Go to this link to find out how to add iLBC back to Asterisk. Remember, you will need to copy the original Makefile in the ilbc folder to the new ilbc folder.
  • GSM quality is acceptable, but not very good.
  • G722 is wide band, hi-def stuff. 

Real bps numbers:
  • GSM: 30kbps
  • g711: 80kbps
  • iLBC: 30kbps
  • g729: 30kbps (why it is this high? bps seen by bwm-ng)
* G.711 has a Mean Opinion Score of 4.3-4.7 and uses 80 kpbs (if you send 50 packets/second with 20 ms of RTP payload per packet) or 74.7 kbps (@ 30 ms, meaning 33.3 packets/second).
* G.729 (NOT G.729a) has a MOS of 3.9-4.2 and uses 24 kbps @ 20 ms or 18.7 kbps @ 30 ms.
* G.729a has a MOS of 3.7-4.2 and uses 24 kbps @ 20 ms or 18.7 kbps @ 30 ms.
* G.723 has a MOS of 3.8-4.0 and uses 17.1 kbps @ 30 ms.

MOS is what nontechnical people think about each codec (5.0 is perfect). All of the above numbers are in EACH direction, so total bandwidth is double the above figures.

As you can see, there is very little quality or bandwidth difference betweeen G.729a and G.723. However, G.729a can send 50 packets/second, each packet containing 20 ms of voice payload. G.723's lowest setting is 30 ms. I think 20 ms sounds better than 30 ms because of smoothing (used to fill in for late packets). That's why I chose G.729a @ 20 ms over G.723 @ 30 ms for my Sipura adapter. (Sipura's default setting is 20 ms (that is, 'RTP Packet Size' = '0.020').)

It would be a very good idea to turn on silence suppression ('Silence Supp Enable' = 'yes'), because it will reduce your bandwidth usage by 65%. (Apparently each person in a two-person conversation only talks about 1/3 of the time.) With my Sipura 2100, I could not hear any difference between silence suppression being on or off.


G729 uses less compression (less latency problems) and has a higher level of voice quality BUT does use more bandwidth. I personally am not fond of g723.1 but usually find g729 to be OK. Some people despise both.

Packet8 started using g723.1 and later switched to g729 most likely due to customer complaints about the poor quality of g723.1 calls.

    How to upgrade SPA942 IP Phone internal directory using wget

    See the post here:
    http://blog.grimsy.net/2007/02/23/spa942-personal-directory/

    A Recap:

    After trying a number of things, I upgraded to the latest firmware (5.1.5 at time of writing) and after some more stuffing around, I was finally able to get the following line to populate the Personal Directory:



    wget --post-data '24686=n%3DGeoff;p%3D6004;r%3D1&25390=n%3DMatt;p%3D6001;r%3D1' http://myphoneIP/pdir.spa


    A few things about the command.
    Firstly, the command will enter in two contacts in the Directory. These will be under entry #5 (24686) and entry #2 (25390). A complete list of all the codes here can be seen in the source of the Personal Directory page in the phone’s web interface.
    So taking the first of the two entries (24686), what we’re posting is:
    n%3DGeoff;
    n=Geoff; (we need to escape the ‘=’ signs so that wget will actually pass the info on correctly)
    n is the Display Name that will appear in the Directory
    p%3D6004;
    p=6004;
    p is the extension number (or phone number). My extension is 6004.
    r%3D1
    r=1
    r is the ring to use. 0 is no sound, just flashing. Play around with the other numbers to find the ringtone you want to use.
    To add more than one entry at a time, simply separate the strings with ‘&’.