Hasnain Ali Blog

OpenSoruce Telephony and Technology

Linux VNC Gnome startup

Posted by hasnain110 on March 17, 2009

Step 1:

Edit file vi /root/.vnc/xstartup

#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop”

Step 2:

Edit the last line and it should be like this

#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
exec gnome-session &

Step 3:

Server vncserver restart

Step 4:

On your vnc client enter the ip address like this x.x.x.x:1

Posted in Uncategorized | Leave a Comment »

Using SIPP for stress testing Asterisk

Posted by hasnain110 on March 12, 2009

Step1:

Download SIPP from http://sipp.sourceforge.net/ and install the rpm

Step 2:

Adding Following in /etc/asterisk/extensions.conf

[sipp]
exten => 2005,1,Answer
exten => 2005,2,SetMusicOnHold(default)
exten => 2005,3,WaitMusicOnHold(20)
exten => 2005,4,Hangup

Step 3:

Create this in your /etc/asterisk/sip.conf

[sipp]
type=friend
context=sipp
host=dynamic
port=6000
user=sipp
canreinvite=no
disallow=all
allow=ulaw

Step4:

Reload Asterisk (in debug mode)

asterisk -rvvvv

then type reload in console to make new changes effective

Step 5:

sipp -sn uac -d 20000 -s 2005 IP.OF.YOUR.BOX -l 30

This command will connect as a client, and give the duration of the call 20K miliseconds (or 20 seconds), will dial the server at ip IP.OF.YOUR.BOX, and try to reach the extension 2005, with a limit of 30 simultaneous calls

Posted in Asterisk | Leave a Comment »

Howto: Linux Secure Copy

Posted by hasnain110 on February 23, 2009

Here is a quick howto for copying one file from one machine to another machine using SSH session

Command:

If remote machine’s ssh is running on some different port e.g. 7890

scp -P 7892 filename.tar.gz root@remote-machine-ip:/root/

If remote machine ssh is running on default

scp filename.tar.gz root@remote-machine-ip:/root/

Posted in Uncategorized | Leave a Comment »

Linux kill user process

Posted by hasnain110 on February 16, 2009

Found it few days back so sharing it here:

kill -9 `ps -u <username> -o ”pid=”`

Where <username> should be the user you want to kill along with all its running processes

Posted in Uncategorized | 1 Comment »

Google Andriod Features

Posted by hasnain110 on February 15, 2009

Features

**Specifications taken from Wikipedia

Handset layouts

The platform is adaptable to larger, VGA, 2D graphics library, 3D graphics library based on OpenGL ES 1.0 specifications, and traditional smartphone layouts.

Storage

The Database Software SQLite is used for data storage purposes

Connectivity

Android supports connectivity technologies including GSM/EDGE, CDMA, EV-DO, UMTS, Bluetooth, and Wi-Fi.

Messaging

SMS and MMS are available forms of messaging including threaded text messaging.

Web browser

Main article: WebKit

The web browser available in Android is based on the open-source WebKit application framework.
Dalvik virtual machine
Software written in Java can be compiled into Dalvik bytecodes and executed in the Dalvik virtual machine, which is a specialized VM implementation designed for mobile device use, although not technically a standard Java Virtual Machine.

Media support

Android will support audio/video/still media formats such as MPEG-4, H.264, MP3, AAC, OGG, AMR, JPEG, PNG, GIF.

Additional hardware support

Android can utilize video/still cameras, touchscreens, GPS, accelerometers, and accelerated 3D graphics.

Development environment

Includes a device emulator, tools for debugging, memory and performance profiling, a plugin for the Eclipse IDE.

Market

Similar to the App Store on the iPhone, The Android Market is a catalog of applications that can be downloaded and installed to target hardware over-the-air, without the use of a PC. Currently only freeware applications are supported, although Google has announced plans to allow developers to offer paid applications as well.

Posted in Uncategorized | Leave a Comment »

Howto: Apache .htaccess Password protected directories

Posted by hasnain110 on February 11, 2009

Step # 1: Make sure Apache is configured to use .htaccess file

You need to have AllowOverride AuthConfig directive in httpd.conf file in order for these directives to have any effect.Therefore, my entry in httpd.conf looks like as follows:

<Directory /var/www>
Options None
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>

Save the file and restart Apache
If you are using Red Hat /Fedora Linux:

# service httpd restart

Step # 2: Create a password file with htpasswd

htpasswd command is used to create and update the flat-files (text file) used to store usernames and password for basic authentication of Apache users

htpasswd -c password-file username

where -c means create the password-file

Create directory outside apache document root, so that only Apache can access password file.

# mkdir -p /home/secure/

Add new user called hasnain

# htpasswd -c /home/secure/apasswords hasnain

Make sure /home/secure/apasswords file is readable by Apache web server.

If you are using RedHat and Fedora core, type the following commands :
# grep -e ‘^User’ /etc/httpd/conf/httpd.conf

Output:

apache

Now allow apache user apache to read our password file:
# chown apache:apache /home/secure/apasswords
# chmod 0660 /home/secure/apasswords

Now our user hasnain is added but you need to configure the Apache web server to request a password and tell the server which users are allowed access.

Create a directory /var/www/docs if it does not exist:
# mkdir -p /var/www/docs

Create .htaccess file using text editor:
# cd /var/www/docs
# vi .htaccess

Add following text:

AuthType Basic
AuthName “Restricted Access”
AuthUserFile /home/secure/apasswords
Require user hasnain

Step # 3: Test your configuration

Fire your browser type url http://yourdomain.com/docs/ or http://localhost/docs/ or http://ip-address/docs

Posted in Linux | Leave a Comment »

Howto: Reset MYSQL root password

Posted by hasnain110 on February 11, 2009

  1. Stop mysqld and restart it with the --skip-grant-tables --user=root options (Windows users omit the --user=root portion).
  2. Connect to the mysqld server with this command:
    shell> mysql -u root
  3. Issue the following statements in the mysql client:
    mysql> UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
    mysql> FLUSH PRIVILEGES;
  4. You should be able to connect using the new password.

Posted in Linux | Leave a Comment »

Linux Serial Consoles for Servers and Clusters

Posted by hasnain110 on February 10, 2009

The more Linux servers you’re responsible for, the more that serial consoles can save you money, space and headaches by easing remote administration duties.

Required: Serial/Console Cable

Bootloader Configuration: GRUB

GRUB is a flexible bootloader with excellent support for serial consoles.

Can be found under /etc/grub.conf

Listing 1. An Ordinary grub.conf File

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub
# after making changes to this file
# NOTICE:You have a /boot partition.
#        This means that all kernel
#        and initrd paths are relative
#        to /boot/, eg.
#        root (hd0,1)
#        kernel /vmlinuz-version ro root=/dev/hda6
#        initrd /initrd-version.img
#boot=/dev/hda
default=0
timeout=10
splashimage=(hd0,1)/grub/splash.xpm.gz
title Red Hat Linux (2.4.20-8)
        root (hd0,1)
        kernel /vmlinuz-2.4.20-8 ro root=LABEL=/
        initrd /initrd-2.4.20-8.img
You need to add this console=ttyS0,9600n8 right after LABEL=/

Listing 2. A grub.conf File That Supports Serial Console

#boot=/dev/hda
# Options added for serial console
serial  --unit=0 --speed=9600 \
        --word=8 --parity=no --stop=1
terminal --timeout=10 serial console
default=0
timeout=10
title Red Hat Linux (2.4.20-8)
        root (hd0,1)
        kernel /vmlinuz-2.4.20-8 ro \
                root=LABEL=/ console=ttyS0,9600n8 
        initrd /initrd-2.4.20-8.img
Next time you reboot the server with appropriate setting in windows Hyper terminal
 you should get the the console output… and you are done !!!
 And your done !!!

Posted in Linux | Leave a Comment »

Nokia SIP settings for Asterisk

Posted by hasnain110 on February 10, 2009

Asterisk Configuration for Nokia SIP Phone

Service Profile: IETF

Default Access Point: should be any working wifi

Public Username: sip:your-sip-user-id@asteriskip

Use Compression: NO

Registration: When Needed

Use Security: NO

Proxy Server: No configuration required here

Registrar Server

     Registrar serv. Addr. : sip:asteriskip

     Realm: Asterisk

     Username: your sip username here

     Password: your sip password here

     Transport Type: Auto

     Port: 5060

Posted in Uncategorized | Leave a Comment »

Asterisk g.729 and g.723 Codec Transcoding/Pass-Thru

Posted by hasnain110 on February 10, 2009

Given below are the step by step instruction for making Asterisk work as a codec Transcoder

Step 1:

Download suitable codec binaries for your asterisk platform

Step 2:

Restart asterisk to make asterisk load newly installed codec modules

e.g. amportal restart

Step 3:

log into asterisk console asterisk -rvvvv and type this command core show codec and check if you can see newly install codecs

elastix*CLI> core show codecs
Disclaimer: this command is for informational purposes only.
It does not indicate anything about your configuration.
INT    BINARY        HEX   TYPE       NAME   DESC
——————————————————————————–
1 (1 <<  0)      (0×1)  audio       g723   (G.723.1)
2 (1 <<  1)      (0×2)  audio        gsm   (GSM)
4 (1 <<  2)      (0×4)  audio       ulaw   (G.711 u-law)
8 (1 <<  3)      (0×8)  audio       alaw   (G.711 A-law)
16 (1 <<  4)     (0×10)  audio   g726aal2   (G.726 AAL2)
32 (1 <<  5)     (0×20)  audio      adpcm   (ADPCM)
64 (1 <<  6)     (0×40)  audio       slin   (16 bit Signed Linear PCM)
128 (1 <<  7)     (0×80)  audio      lpc10   (LPC10)
256 (1 <<  8)    (0×100)  audio       g729   (G.729A)
512 (1 <<  9)    (0×200)  audio      speex   (SpeeX)
1024 (1 << 10)    (0×400)  audio       ilbc   (iLBC)
2048 (1 << 11)    (0×800)  audio       g726   (G.726 RFC3551)
4096 (1 << 12)   (0×1000)  audio       g722   (G722)
65536 (1 << 16)  (0×10000)  image       jpeg   (JPEG image)
131072 (1 << 17)  (0×20000)  image        png   (PNG image)
262144 (1 << 18)  (0×40000)  video       h261   (H.261 Video)
524288 (1 << 19)  (0×80000)  video       h263   (H.263 Video)
1048576 (1 << 20) (0×100000)  video      h263p   (H.263+ Video)
2097152 (1 << 21) (0×200000)  video       h264   (H.264 Video)

Step 4:

Choose your fav. editor in linux , mine is Vi

vi /etc/asterisk/extensions.conf and add these lines under the [General]

[general]
#include sip_general_additional.conf
bindport =5060         ; Port to bind to (SIP is 5060)
bindaddr = 0.0.0.0    ; Address to bind to (all addresses on machine)
disallow=all
allow=g723
allow=g729

And for your GW settings do the same

[EXGN]
type=peer
host=x.x.x.x

port=5060
disallow=all
allow=g729
;dtmfmode=inband
;dtmf=inband
nat=no
;insecure=very
Now set your Eyebeam to send calls using g.729 codec to asterisk it should work

To check if calls are going into g.729/723 codec run this command on the main console

sip show channels

I hope this should work

Posted in Asterisk | 5 Comments »