Example
exten => 5000,1,system(echo "${DATETIME} - ${CALLERID} - ${CHANNEL}" >> /var/log/asterisk/calls)
You can call asterisk through the command line to parse a command via
Example
asterisk -r -x "console dial 5000@context"
Tuesday, November 24, 2009
Saturday, November 21, 2009
Installing Asterisk on CentOS5
Either via Yum or Source
YUM
1)Create these files in /etc/repos.d
asterisk.repo
[asterisk-tested]
Source
path_root="/usr/src/asterisk"
filez=`ls -1 $path_root/*tar.gz`
mkdir /usr/src/asterisk
`cd $path_root`
wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.4.27.tar.gz
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/releases/dahdi-linux-complete-2.2.0.2+2.2.0.tar.gz
wget http://downloads.asterisk.org/pub/telephony/libpri/releases/libpri-1.4.10.2.tar.gz
for tarballs in $filez
do
clear
echo "Now Extracting ---- $tarballs"
sleep 1
#`tar -zxvf $tarballs -C $path_root`
tar -zxvf $tarballs -C $path_root
echo "Done"
sleep 1
done
#Now start compiling and installing packages
#Let's start off with DAHDI
cd dahdi-linux-complete*
echo "Now installing DAHDI HardWare Interface Drivers"
make && make install & make config && sleep 1
echo "DONE"
cd ..
#Let's install LibPRI
cd libpri*
echo "Now installing LibPRI"
make && make install
echo "DONE"
cd ..
#Install GTALK Modules
yum install iksemel.i386 iksemel-devel.i386
#Let's install Asterisk
cd asterisk-1.*
echo "Now installing Asterisk"
./configure && make && make menuselect && make install && make samples && make config && sleep 1
echo "DONE"
cd ..
YUM
1)Create these files in /etc/repos.d
asterisk.repo
[asterisk-tested]
name=CentOS-$releasever - Asterisk - Tested
baseurl=http://packages.asterisk.org/centos/$releasever/tested/$basearch/
enabled=0
gpgcheck=0
#gpgkey=http://packages.asterisk.org/RPM-GPG-KEY-Digium
[asterisk-current]
name=CentOS-$releasever - Asterisk - Current
baseurl=http://packages.asterisk.org/centos/$releasever/current/$basearch/
enabled=1
gpgcheck=0
#gpgkey=http://packages.asterisk.org/RPM-GPG-KEY-Digium
Create digium.repo
[digium-tested]OR
name=CentOS-$releasever - Digium - Tested
baseurl=http://packages.digium.com/centos/$releasever/tested/$basearch/
enabled=0
gpgcheck=0
#gpgkey=http://packages.digium.com/RPM-GPG-KEY-Digium
[digium-current]
name=CentOS-$releasever - Digium - Current
baseurl=http://packages.digium.com/centos/$releasever/current/$basearch/
enabled=1
gpgcheck=0
#gpgkey=http://packages.digium.com/RPM-GPG-KEY-Digium
2)yum -y install asterisk16 asterisk16-configs asterisk16-voicemail dahdi-linux dahdi-tools libpri iksemel.i386 iksemel-devel.i386
Source
path_root="/usr/src/asterisk"
filez=`ls -1 $path_root/*tar.gz`
mkdir /usr/src/asterisk
`cd $path_root`
wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.4.27.tar.gz
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/releases/dahdi-linux-complete-2.2.0.2+2.2.0.tar.gz
wget http://downloads.asterisk.org/pub/telephony/libpri/releases/libpri-1.4.10.2.tar.gz
for tarballs in $filez
do
clear
echo "Now Extracting ---- $tarballs"
sleep 1
#`tar -zxvf $tarballs -C $path_root`
tar -zxvf $tarballs -C $path_root
echo "Done"
sleep 1
done
#Now start compiling and installing packages
#Let's start off with DAHDI
cd dahdi-linux-complete*
echo "Now installing DAHDI HardWare Interface Drivers"
make && make install & make config && sleep 1
echo "DONE"
cd ..
#Let's install LibPRI
cd libpri*
echo "Now installing LibPRI"
make && make install
echo "DONE"
cd ..
#Install GTALK Modules
yum install iksemel.i386 iksemel-devel.i386
#Let's install Asterisk
cd asterisk-1.*
echo "Now installing Asterisk"
./configure && make && make menuselect && make install && make samples && make config && sleep 1
echo "DONE"
cd ..
Wednesday, November 4, 2009
Aide Notes
1)Creating the Database
aide -c /etc/aide.conf --init
2)Checking the Database against the current FS
aide -c /etc/aide.conf --check
3)Updating the Database after changes
aide -c /etc/aide.conf --update
aide -c /etc/aide.conf --init
2)Checking the Database against the current FS
aide -c /etc/aide.conf --check
3)Updating the Database after changes
aide -c /etc/aide.conf --update
Sunday, October 11, 2009
PureFTP w/ MySQL
1)yum install mysql mysql-server httpd php php-mysql php-mbstring pure-ftpd
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
mysqladmin -h server1.localhost.localdomain -u root password *pwd*
If you have CentOS 5 --> http://centos.karan.org/el4/misc/testing/i386/RPMS
3) groupadd -g 2001 ftpgroup
useradd -u 2001 -s /bin/false -d /bin/null -c "pureftpd user" -g ftpgroup ftpuser
mysql -u root -p
CREATE DATABASE pureftpd;
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON pureftpd.* TO 'pureftpd'@'localhost' IDENTIFIED BY 'ftpdpass';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON pureftpd.* TO 'pureftpd'@'localhost.localdomain' IDENTIFIED BY 'ftpdpass';
FLUSH PRIVILEGES;
USE pureftpd;
CREATE TABLE ftpd (
User varchar(16) NOT NULL default '',
status enum('0','1') NOT NULL default '0',
Password varchar(64) NOT NULL default '',
Uid varchar(11) NOT NULL default '-1',
Gid varchar(11) NOT NULL default '-1',
Dir varchar(128) NOT NULL default '',
ULBandwidth smallint(5) NOT NULL default '0',
DLBandwidth smallint(5) NOT NULL default '0',
comment tinytext NOT NULL,
ipaccess varchar(15) NOT NULL default '*',
QuotaSize smallint(5) NOT NULL default '0',
QuotaFiles int(11) NOT NULL default 0,
PRIMARY KEY (User),
UNIQUE KEY User (User)
) TYPE=MyISAM;quit;
4)vi /etc/pure-ftpd/pure-ftpd.conf
ChrootEveryone yes
MySQLConfigFile /etc/pure-ftpd/pureftpd-mysql.conf
CreateHomeDir yes
5)vi /etc/pure-ftpd/pureftpd-mysql.conf
MYSQLSocket /var/lib/mysql/mysql.sock
#MYSQLServer localhost
#MYSQLPort 3306
MYSQLUser pureftpd
MYSQLPassword ftpdpass
MYSQLDatabase pureftpd
#MYSQLCrypt md5, cleartext, crypt() or password() - md5 is VERY RECOMMENDABLE uppon cleartext
MYSQLCrypt md5
MYSQLGetPW SELECT Password FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MYSQLGetUID SELECT Uid FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MYSQLGetGID SELECT Gid FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MYSQLGetDir SELECT Dir FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MySQLGetBandwidthUL SELECT ULBandwidth FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MySQLGetBandwidthDL SELECT DLBandwidth FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MySQLGetQTASZ SELECT QuotaSize FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MySQLGetQTAFS SELECT QuotaFiles FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
6)mysql -u root -p
USE pureftpd;
INSERT INTO `ftpd` (`User`, `status`, `Password`, `Uid`, `Gid`, `Dir`,
`ULBandwidth`, `DLBandwidth`, `comment`, `ipaccess`, `QuotaSize`,
`QuotaFiles`) VALUES ('exampleuser', '1', MD5('secret'), '2001',
'2001', '/home/www.example.com', '100', '100', '', '*', '50', '0');
7)chkconfig --levels 235 pure-ftpd on
/etc/init.d/pure-ftpd start
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
chkconfig --levels 235 httpd on
/etc/init.d/httpd start
mysqladmin -h server1.localhost.localdomain -u root password *pwd*
If you have CentOS 5 --> http://centos.karan.org/el4/misc/testing/i386/RPMS
3) groupadd -g 2001 ftpgroup
useradd -u 2001 -s /bin/false -d /bin/null -c "pureftpd user" -g ftpgroup ftpuser
mysql -u root -p
CREATE DATABASE pureftpd;
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON pureftpd.* TO 'pureftpd'@'localhost' IDENTIFIED BY 'ftpdpass';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON pureftpd.* TO 'pureftpd'@'localhost.localdomain' IDENTIFIED BY 'ftpdpass';
FLUSH PRIVILEGES;
USE pureftpd;
CREATE TABLE ftpd (
User varchar(16) NOT NULL default '',
status enum('0','1') NOT NULL default '0',
Password varchar(64) NOT NULL default '',
Uid varchar(11) NOT NULL default '-1',
Gid varchar(11) NOT NULL default '-1',
Dir varchar(128) NOT NULL default '',
ULBandwidth smallint(5) NOT NULL default '0',
DLBandwidth smallint(5) NOT NULL default '0',
comment tinytext NOT NULL,
ipaccess varchar(15) NOT NULL default '*',
QuotaSize smallint(5) NOT NULL default '0',
QuotaFiles int(11) NOT NULL default 0,
PRIMARY KEY (User),
UNIQUE KEY User (User)
) TYPE=MyISAM;quit;
4)vi /etc/pure-ftpd/pure-ftpd.conf
ChrootEveryone yes
MySQLConfigFile /etc/pure-ftpd/pureftpd-mysql.conf
CreateHomeDir yes
5)vi /etc/pure-ftpd/pureftpd-mysql.conf
MYSQLSocket /var/lib/mysql/mysql.sock
#MYSQLServer localhost
#MYSQLPort 3306
MYSQLUser pureftpd
MYSQLPassword ftpdpass
MYSQLDatabase pureftpd
#MYSQLCrypt md5, cleartext, crypt() or password() - md5 is VERY RECOMMENDABLE uppon cleartext
MYSQLCrypt md5
MYSQLGetPW SELECT Password FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MYSQLGetUID SELECT Uid FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MYSQLGetGID SELECT Gid FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MYSQLGetDir SELECT Dir FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MySQLGetBandwidthUL SELECT ULBandwidth FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MySQLGetBandwidthDL SELECT DLBandwidth FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MySQLGetQTASZ SELECT QuotaSize FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MySQLGetQTAFS SELECT QuotaFiles FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
6)mysql -u root -p
USE pureftpd;
INSERT INTO `ftpd` (`User`, `status`, `Password`, `Uid`, `Gid`, `Dir`,
`ULBandwidth`, `DLBandwidth`, `comment`, `ipaccess`, `QuotaSize`,
`QuotaFiles`) VALUES ('exampleuser', '1', MD5('secret'), '2001',
'2001', '/home/www.example.com', '100', '100', '', '*', '50', '0');
7)chkconfig --levels 235 pure-ftpd on
/etc/init.d/pure-ftpd start
Saturday, October 3, 2009
Vi Tips #2
Word Boundaries
:%s/\/testing123/g
BackReferences
Use \(\) to make backreferences
%s/\(specification\)/new \1/g
:%s/\
BackReferences
Use \(\) to make backreferences
Thursday, October 1, 2009
Auto Yum Script to install all Deps for OCS Inventory Server and Agent
yum -y install perl-XML-Simple perl-DBI perl-DBD-MySQL perl-Apache-DBI perl-Net-IP perl-SOAP-Lite
yum -y install perl-XML-SAX
yum -y install perl-XML-SAX-Base
yum -y install perl-libwww-perl-5.805-1.1.1
yum -y install perl-Compress-Zlib
yum -y install perl-IO-Compress
yum -y install perl-Compress-Zlib
yum -y install perl-Net-CIDR
yum -y install perl-Test-Mock-LWP
yum -y install perl-Test-Mock-LWP
yum -y install perl-Daemon-Generic
yum -y install perl-Unix-PID.noarch
yum -y install perl-Proc-PID-File.noarch
yum -y install perl-Net-IPv4Addr.noarch
yum -y install perl-Net-Interface.i386
yum -y install perl-Net-IP-CMatch.i386
yum -y install perl-Net-IPv4Addr.noarch
yum -y install perl-Net-IPv6Addr.noarch
perl -MXML::SAX -e "XML::SAX->add_parser(q(XML::SAX::PurePerl))->save_parsers()"
yum -y install perl-XML-SAX
yum -y install perl-XML-SAX-Base
yum -y install perl-libwww-perl-5.805-1.1.1
yum -y install perl-Compress-Zlib
yum -y install perl-IO-Compress
yum -y install perl-Compress-Zlib
yum -y install perl-Net-CIDR
yum -y install perl-Test-Mock-LWP
yum -y install perl-Test-Mock-LWP
yum -y install perl-Daemon-Generic
yum -y install perl-Unix-PID.noarch
yum -y install perl-Proc-PID-File.noarch
yum -y install perl-Net-IPv4Addr.noarch
yum -y install perl-Net-Interface.i386
yum -y install perl-Net-IP-CMatch.i386
yum -y install perl-Net-IPv4Addr.noarch
yum -y install perl-Net-IPv6Addr.noarch
perl -MXML::SAX -e "XML::SAX->add_parser(q(XML::SAX::PurePerl))->save_parsers()"
/Zlib.pm conflicts between attempted installs of perl-IO-Compress- and perl-Compress-Zlib
Tested On - CentOS 5.1
Had this error come up when trying to install perl-IO-Compress
Resolved it by
1)yum update perl
2)yum -y install perl-Compress-Zlib
3)yum -y install perl-IO-Compress
4)yum -y install perl-Compress-Zlib
Had this error come up when trying to install perl-IO-Compress
Resolved it by
1)yum update perl
2)yum -y install perl-Compress-Zlib
3)yum -y install perl-IO-Compress
4)yum -y install perl-Compress-Zlib
Subscribe to:
Posts (Atom)