February 29th, 2008

Gastman-A graphical manager interface for Asterisk

Gastman is a graphical manager interface asterisk users for viewing the events in the asterisk server console.As in a live asterisk server it very defficult to watch the log and issue commad in the asterisk console gastman is very useful.The can see the current active zap channels and numbers to which the call are going.Also can issue asterisk command with out any disturbence in the console.

You can insall gatman by just a commad

apt-get install gastman

The gastman will ask the ip address of the asterisk server ,manager username and password to enter in to the server.The screen shot our asterisk server status is shown below.

12.jpeg

3.jpeg2.jpeg

February 21st, 2008

Call to undefined function mysql_connect()

Today i stucked an error when i was trying to run a php script in a server eventhough my server was php5-mysql installed on it.At first i checked php, it was installed and working fine.Then checked mySQL.It was also working fine.I got the mysql prompt and the query was also working fine.I was experiencing.Tried the same solution when i experienced first.But this time it did’nt got worked.This time i had to use other solution and it got worked.The problem is actually php.ini file have enabled the mysql extension.

Solutions:

1)Remove php5-mysql with “apt-get remove php5-mysql” or “dpkg –purge remove php5-mysql and install it again or

2) Check your php.ini file to ensure it’s including the mysql.so library (extension=mysql.so) or

3)Type “dpkg-reconfigure php5-mysql” (For ubuntu and debian users)

will prompt 2 screens like this.2.jpg11.jpeg

Select “yes” both and try again hope your problem will get resolved.

In my case it got resloved :)

February 20th, 2008

Shell script for ftp download

It is some time necessary to automatically download a file from a ftp server daily.We can automate it by writing a shell script and putting it as a cron.A sample script is show below.When it got run it will login and download the file “1.txt” in to the current working folder from the directory “ftp” in the ftp server.

#!/bin/sh
rm 1.txt
HOST=’213.104.257.88′
PORT=’21′
USER=’bipin’
PASSWD=’bipin’
FILE=’1.txt’
ftp -n $HOST $PORT <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
cd ftp
bin
get $FILE
quit
END_SCRIPT
exit 0

February 19th, 2008

AndLinux- Linux running in Windows

AndLinix logo

AndLinux is a Debian based Linux distribution that runs in Windows.In other sence we can say running mutiple OS at a time,any one having windows OS can install AndLinux and can run the commands and applications in it just like the normal linux os.The commands and all is same as the Debian or Ubuntu flavour.

For installing any thingyou can use command “apt-get install <applicationname>” like in the ubuntu OS.
For more information and downloads Click Here

The following is the screen shot of Linux running on my windows OS

3.JPG



February 18th, 2008

How To pass argument to Asterisk Dialplan with PHP-AGI!!!

It is some times necessary to pass a argument to asterisk dialplan and read that variable or value
from another script.In PHP-AGI this thing is done as follows
Passing an argument or variable value is setting it in the “orginate application”.

eg:
<?php
require(’phpagi/phpagi.php’);
require_once(’phpagi/phpagi-asmanager.php’);
$number = ‘9946236111′;
$asm = new AGI_AsteriskManager();
if($asm->connect())
{
$call = $asm->send_request(’Originate’,
array(’Channel’=>”SS7/9946236329″,
‘Context’=>’demospeech’,
‘Priority’=>1,
‘Callerid’=>$number,
‘Async’=>’true’,
‘Variable’=>’cnum=9947000XXX′)); //asterisk variable setting as “9947000XXX″
$asm->disconnect();
}
?>

The “cunum variable is accepted in asterisk as

[demospeech]
exten => s,1,AGI(incoming.php|${CNUM}) //here “{CNUM}” will store the variable value.

To get that value in another script is done by as follows

#!/usr/bin/php -q
<?php
set_time_limit(0);
require(’phpagi/phpagi.php’);
$agi = new AGI();
$agi->answer();
$cid = $argv[1]; // ” $argv[1]” contain the asterisk variable value..here the value is 994000XXX                                                                                                             $agi->verbose($cid); //This will print “9947000XXX″
?>

February 18th, 2008

Easy File transfer with ‘rsync’

syntax: For Coping file from a remote system

rsync [OPTIONS]..SRC [SRC]… [USER@]HOST:DEST

example:

rsync -azvc –rsh=’ssh -p22′ root@213.124.200.38:/etc/zaptel.conf /home/bipin/asterisk_ss7/

will copy the file “zaptel.conf” to the local system with path /home/bipin/asterisk_ss7/

February 14th, 2008

Adding favicon in your site

You can add a favicon (favourite icon ) in your website addressbar like this

1.jpeg

All you need an picture with ico extension.You can rename your favourite

picture to extension ico.Upload the picture to your web folder.

Syntax : <’link rel=”shortcut icon” href=”URL” type=”image/ico” /’>

Eg: <’link rel=”shortcut icon” href=”pic.ico” type=”image/ico” /’>

February 13th, 2008

Port forwarding

Port forwarding (sometimes referred to as tunneling) is the act of forwarding a network port from one network node to another. This technique can allow an external user to reach a port on a private IP address (inside a LAN) from the outside via a NAT-enabled router.

Port forwarding allows remote computers (e.g. public machines on the Internet) to connect to a specific computer within a private LAN.

For example:

* forwarding ports 80 or 443 to run an HTTP webserver
* forwarding port 22 to allow Secure Shell access
* forwarding port 21 to allow FTP access

example:
Take vi editor copy and paste the script below. Replace “211.111.111.111″ ip with your Static ip and “192.168.0.22″ with your local ip. Portforwarding of http and ssh port is done here in the example.
save the script with a file name and give executing permission ie
chmod 777 <”filename”>
and execute it….

#!/bin/sh
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
/sbin/iptables -t nat -A PREROUTING -p tcp -i eth0 -d 211.111.111.111 –dport 8181 -j DNAT –to 192.168.0.22:80
/sbin/iptables -A FORWARD -p tcp -i eth1 -d 192.168.0.22 –dport 80 -j ACCEPT

/sbin/iptables -t nat -A PREROUTING -p tcp -i eth0 -d 211.111.111.111 –dport 2222 -j DNAT –to 192.168.0.22:22
/sbin/iptables -A FORWARD -p tcp -i eth1 -d 192.168.0.22 –dport 22 -j ACCEPT

February 13th, 2008

Change default ssh port!!!

Change your default ssh port and secure your network.As the default port of ssh is 22 anybody who want to attack your system will try first with it only.You can change the default port and give any other port you like say for example 2222.

edit the file “vim /etc/ssh/ssh_config”

Uncomment the line “# Port 22″

Give the port you want to set here.

Restart the ssh service

/etc/init.d/ssh restart

Login to this machine from remote machine by

ssh -p 2222 root@192.168.0.22

February 13th, 2008

Share ubuntu Printer with Windows

For sharing a local printer connected with Ubuntu os in the windows network we need to setup a samba server.For this first install samba in our server linux system.
apt-get install samba
apt-get install samba-common
apt-get install smbclient
apt-get install smbfs

edit the file smb.conf

sudo vim /etc/samba/smb.conf

[printers]
comment = All Printers
browseable = yes
path = /tmp
printable = yes
public = yes
writable = yes
create mode = 0700

# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = yes

To define SAMBA network users for your Ubuntu system, you may use the smbpasswd command.

smbpasswd -a bipin

where “bipin” is a user in the samba server

restart samba

sudo /etc/init.d/samba restart

Enjoy Printing!!!!!!