perl -wne'while(/[\w\.\-]+@[\w\.\-]+\w+/g){print "$&\n"}' file_contain_mail_address
Tuesday, November 2, 2010
Tuesday, October 26, 2010
extension.conf
[general]
static=yes
writeprotect=no
clearglobalvars=no
[globals]
OUTBOUNDTRUNK=Zap/g0
[incoming]
exten => s,1,Answer()
exten => s,n,Background(enter-ext-of-person)
exten => s,n,WaitExten()
[local-sip]
exten => _XXXX,1,Dial(SIP/${EXTEN})
exten => _XXXX,n,Congestion()
exten => _XXXX,n,Hangup()
[outbound-local]
exten => _[23457]XXXXXX,1,Dial(${OUTBOUNDTRUNK}/${EXTEN})
exten => _[23457]XXXXXX,n,Congestion()
exten => _[23457]XXXXXX,n,Hangup()
[outbound-national]
exten => _0[1-689]XXXXXXXX,1,Dial(${OUTBOUNDTRUNK}/${EXTEN})
exten => _0[1-689]XXXXXXXX,n,Congestion()
exten => _0[1-689]XXXXXXXX,n,Hangup()
[outbound-mobile]
exten => _07XXXXXXXX,1,Dial(${OUTBOUNDTRUNK}/${EXTEN})
exten => _07XXXXXXXX,n,Congestion()
exten => _07XXXXXXXX,n,Hangup()
[outbound-idd]
exten => _XXXXXXXXXXXXX,1,Dial(${OUTBOUNDTRUNK}/${EXTEN})
exten => _XXXXXXXXXXXXX,n,Congestion()
exten => _XXXXXXXXXXXXX,n,Hangup()
[internal]
include => local-sip
[local]
include => local-sip
include => outbound-local
[local-m]
include => local-sip
include => local
[national]
include => local-sip
include => outbound-local
[national-m]
include => local-sip
include => outbound-mobile
[idd]
include => local-sip
include => outbound-local
include => outbound-mobile
[cmp-a]
exten => _XXXX,1,Dial(SIP/${EXTEN}-a)
exten => _XXXX,n,Congestion()
exten => _XXXX,n,Hangup()
[cmp-b]
exten => _XXXX,1,Dial(SIP/${EXTEN}-b)
exten => _XXXX,n,Congestion()
exten => _XXXX,n,Hangup()
Labels:
Asterisk
Friday, October 1, 2010
Mutt - Set From e-mail address
set realname="Joe User" set from="user@host" set use_from=yes
Labels:
mutt
MySQL backup and restore
- To restore a database from backup file
#mysql db_name < backup-file.sql - To dump one or set of databases
#mysqldump --databases db_name1 [db_name2 ...] > my_databases.sql - To dump all databases
#shell> mysqldump --all-databases > all_databases.sql
Labels:
MySQL
Thursday, September 30, 2010
Compare two mail addresses
#!/usr/bin/perl
use DBI;
%MYSQL = (
hostname => "localhost",
username => "root",
password => "",
database => "asterisk"
);
my $sender= 'abc@onvi.com';
$sender=$ARGV[0];
$sender=~ s/@/\@/;# replace @ with \2 in mail address
# connect to DB
my $dbh = DBI->connect("dbi:mysql:$MYSQL{database}:$MYSQL{hostname}","$MYSQL{username}","$MYSQL{password}");
my $qry = "SELECT * FROM test;";
#print $qry."\n";
my $result = $dbh->prepare($qry);
$result->execute();
my $tmp='';
# write to file
while (@row = $result->fetchrow()) {
$tmp=@row[1]; # assign mail addres to $tmp variable
$tmp=~ s/@/\@/; # replace @ with \2 in mail address
#print $sender." <---> ".$tmp."\n";
if($tmp eq $sender){
print $tmp."==".$sender."\n";
}
#print @row[0]."-->".$tmp."\n";
}#while
Labels:
Perl
Wednesday, September 15, 2010
Sendmail - Postfix
The sendmail compatible mail sending path in postfix.
This is a interface.
Labels:
Postfix
Monday, September 13, 2010
Installing Perl Modules
- perl -MCPAN -e 'install "
"' - perl -MCPAN -e 'install MIME::Parser'
- Installing Perl -Bugzilla
- LiveJournal
- Download Locations
Labels:
Perl
Saturday, September 11, 2010
mutt install and send mail
- #yum install mutt
- mutt -s "Test mail" -a /path/to/attachment receiver@domain < /path/to/body/text
Labels:
mutt
Monday, September 6, 2010
Dialog eZ reload
How to send reload to Dialog mobile from another Dialog mobile.
- Type following text in message.
eZ Amount Dialog_Mobile_No - Send message to 356.
Labels:
SL_TELE
Changing the hostname on CentOS
teChanging the hostname on CentOS: "If the hostname setting is incorrect on your CentOS/RedHat/Fedora machine, it's really easy to change the hostname from the command line. There are also GUI tools for doing this but we'll just look at the CLI tools for doing this."
Labels:
GNU/Linux
Friday, September 3, 2010
CentOS Commands
The shell command in CentOS.
- cat /proc/cpuinfo
Shows, cpu information - netstat -ntl
shows, Active Internet connections (only servers).
Wednesday, September 1, 2010
Postfix Commands
- # postfix reload
When you change the parameters in main.cf or master.cf. - #netstat -na | grep 25
Show status of port 25
Labels:
Postfix
Tuesday, August 31, 2010
Install X-Window Desktop
- yum groupinstall "X Window System" "KDE (K Desktop Environment)"
- yum groupinstall "X Window System" "GNOME Desktop Environment"
- startx
Labels:
CentOS
Monday, August 30, 2010
Sunday, August 29, 2010
Hylafax Downloads
Hylafax packages
Hylafax Pre-requisite
- libtiff
libtiff-evel-3.6.1
libtiff-devel - Ghostscript
Ghostscript 8.71
Desktop Client Software
Labels:
Hylafax
HylaFAX Configuration Files
- /usr/local/lib/fax/hfaxd.conf
- /usr/local/lib/fax/hyla. conf
- /var/spool/hylafax/etc/hosts.hfaxd
Labels:
Hylafax
Saturday, August 28, 2010
Wednesday, August 25, 2010
Hylafax Commands
- faxsetup
- faxaddmodem
- sendfax -s na-let \ Use letter size images (use a4 for A4).
-T 5 -t 2 \ Dial call up to 5 times; attempt to transmit twice.
-f "Erika Plantagenet" \ Fax sender name.
-r "Sales Data" \ Contents of Re: field (subject).
-c "Call if any questions. " \ Comments.
-P high \ Priority (vs. bulk or normal).
-h dalton. ahania. com \ Send to HylaFAX server on this host.
-a 20: 05 \ Transmit fax at 8:05 P.M.
-d "Amy Ng@1. 293. 555. 1212" \ Recipient name and ph
ex: # sendfax -P bulk -d "Sam@5551212" -P high -d "Amy@5552121" fax. txt - # faxstat -s -l
Show status of sending faxes. - # faxstat -r -l
Show status of receiving faxes. - # xferfaxstats
Produce summary report. - # faxalter
Change characteristics of pending fax jobs.
ex: $faxalter -p bulk -a 21: 00 24
This command change characteristics of fax job id 24. - $faxabort
Abort current incoming faxes. - # faxinfo
Show information of receive fax.
Ex: # faxinfo fax00027. tif
Reference: The HylaFAX Fax Service
Labels:
Hylafax
Friday, August 20, 2010
chan_dahdi.conf
The basic parameters of chan_dahdi.conf.
- The zapata.conf become chan_dahdi.conf in DAHDI.
[trunkgroups]
[channels]
context=default
usecallerid=yes
hidecallerid=no
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
canpark=yes
cancallforward=yes
callreturn=yes
echocancel=yes
echocancelwhenbridged=yes
relaxdtmf=yes
rxgain=0.0
txgain=0.0
group=1
callgroup=1
pickupgroup=1
immediate=no
;cidstart=ring
;cidstart=polarity
;callerid=asreceived
cidsignalling=polarity_IN
sendcalleridafter=2
context=from-incoming
group=0
echocancel=yes
signalling = fxs_ks
channel => 1
context=from-incoming
group=0
echocancel=yes
signalling = fxs_ks
channel => 2
Labels:
Asterisk
DAHDI Telephony Interface Driver
The new configuration file names.
- /etc/dahdi/system.conf for /etc/zaptel.conf.
- /etc/asterisk/chan_dahdi.conf for /etc/asterisk/zapata.conf
The steps of configuration
- Fix card in to PBX server.
- Use modprobe command to load drivers.
# modprobe dahdi
#modprobe wcfxo
#modprobe wcfxs
Labels:
Asterisk
Thursday, August 19, 2010
Asterisk-CDR-ODBC Related config Files
The file locations in CentOS 5.2
- /etc/odbcinst.ini
- /etc/odbc.ini
- /etc/asterisk/cdr_mysql.conf
Labels:
Asterisk
Asterisk-CDR-ODBC Related Commands
The command list.
- CLI> cdr status
sample out put:
CDR logging: enabledCDR mode: simpleCDR registered backend: cdr-custom
CDR registered backend: csv
CDR registered backend: cdr_manager
Note: - ; Database Call Detail Records
- load => cdr_odbc.so ; ODBC CDR Backend - Requires N/A
- #odbcinst -q -d
sample out put:
[PostgreSQL]
note:
if your /etc/odbcinst.ini file contain you get above sample output,
[PostgreSQL]
Description = ODBC for PostgreSQL
Driver = /usr/lib/libodbcpsql.so
setup = /usr/lib/libodbcpsqlS.so
FileUsage = 1 - isql -v asterisk-connector
note:
isql application use perform connectivity test with database.
The "asterisk-connector" has to specify in /etc/odbc.ini.
[asterisk-connector]
driver = MySQL
Database = asterisk
Server = localhost
Socket = /var/lib/mysql/mysql.sock
User = root
Password = password - CLI> odbc show
sample out put:
Name: asterisk
DSN: asterisk-connector - Pooled: no
Connected: yes - CLI> module reload
- CLI> cdr status
sample out put:
CDR logging: enabled
CDR mode: simple
CDR registered backend: cdr-custom
CDR registered backend: cdr_manager
CDR registered backend: ODBC - CLI> console dial 100@default
note:
You have to have chan_oss. The above console dial command can make a call.
Labels:
Asterisk
MySQL set privileges to remote pc
grant all privileges on *.* to root@10.10.1.52 identified by 'your_password';
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
How to install mysql-admin
yum install mysql-admin*
Labels:
MySQL
Asterisk cdr
How to install and configure asterisk cdr module in CentOS 5.2
- ODBC stuff
yum -y install unixODBC unixODBC-devel libtool-ltdl libtool-ltdl-devel - Install MySQL ODBC interface/connector
yum -y install mysql-connector-odbc
Edit '/etc/odbcinst.ini' and include following text.
#[MySQL],Description = ODBC for MySQL
#Driver = /usr/lib/libmyodbc.so
Driver = /usr/lib/libmyodbc3.so
Setup = /usr/lib/libodbcmyS.so
FileUsage = 1 - Edit /etc/asterisk/cdr_mysql.conf
[global]
hostname=localhost
dbname=asterisk
table=cdr
password=MYPASS
user=astrealtime
port=3306
sock=/var/lib/mysql/mysql.sock
userfield=1
loguniqueid=yes
[columns]
Labels:
Asterisk
Wednesday, August 18, 2010
Tuesday, August 17, 2010
Sunday, August 15, 2010
How to install Hylafax
The network diagram.
PSTN <-> E1 Card <-> Zaptel <-> Asterisk <-> IAXmodem <-> Hylafax
- Package requirements
libtiff
libtiff-devel - Install IAX modem
Links:
Labels:
Hylafax
Thursday, August 12, 2010
PBX features
- Account code
Can be use different account code for different destinations. When you are calculating cost, you can use account code to find out what is rate of charge per particular call. - Alternate Number Ring
When you get a call to a one extension, it will ring set of extension in a pattern ring-pause -ring. - Attendant
Attendant is the main operator. Normally when you dial 0 in a PABX it will goes to main operator. But actual extension number of the operator may be differ from 0. - Autodialer
Can be use to generate automatic calls as schedule before. - PBX Automatic Line Selection
- PBX Automatic Hold
when you select new line, if there is an active call PABX will put it in to hold. - PBX Automatic Redial
- Automated directory
Automated directory contains all user in the PABX and their extension numbers. When someone call to automated directory, it will prompt to enter desired name by number pad. It takes list of number sequence entered by caller and resolve name from directory. Sometimes more than one name resolve for input. That can be handle. - Automatic Call Distribution (ACD)
The ACD use to route calls in a call-center environment.
It can route call to queues with considering many facts. - Barge-In
- Boss-secretary functions
The phones of boss and secretary are linked. - PBX Busy Ring
- Call Back
- Call Center
- Call Forwarding
This feature use to route calls to another extension. - Call Monitoring
The supervisor can listen to conversation between caller and agent. - PBX Call Recording
VoIP-Link
Labels:
Asterisk
Asterisk standard extensions
Standard extensions
- a: Called when user presses '*' during a voicemail greeting
- h: Hangup extension
- i: invalid extension
- o: Operator extension, used for operator exit by pressing zero in voicemail
- s: Start extension in context
- t: Timeout extension
- T: AbsoluteTimeout() extension
- failed: used if an auto-dial out call fails (that had context, priority and extension specified)
- fax: used for fax detection on Zap channels
- talk: used in conjuction with BackgroundDetect
Labels:
Asterisk
Tuesday, August 10, 2010
How to put banner when user logging.
Display banner when user logged as root.
- Open this with text editor /root/.bash_profile
- Then include text, you want to show with echo command at the end of file as follows,
echo "My banner". - You can use this commad to show ip of the host
"ifconfig eth0 | grep 'inet' | awk '{print $2}' | sed 's/addr://'"
Friday, August 6, 2010
Tuesday, August 3, 2010
Asterisk 1.6 with TDM410P
Configure TDM card to Asterisk.
- Install asterisk 1.6 in CentOS.
- Fix card in correctly to motherboard.
- I use only one green module(FXS).
- use command #dahdi_genconf to generate configuration for dahdi channels. it generates file "/etc/dahdi/system.conf". My system.conf file is as follows.
----------- File begins form here-------------
# Autogenerated by /usr/sbin/dahdi_genconf on Tue Jan 1 06:10:30 2002
# If you edit this file and execute /usr/sbin/dahdi_genconf again,
# your manual changes will be LOST.
# Dahdi Configuration File
#
# This file is parsed by the Dahdi Configurator, dahdi_cfg
#
# Span 1: WCTDM/0 "Wildcard TDM410P Board 1" (MASTER)
fxoks=1
echocanceller=mg2,1
# channel 2, WCTDM/0/1, no module.
# channel 3, WCTDM/0/2, no module.
# channel 4, WCTDM/0/3, no module.
# Global data
loadzone = us
defaultzone = us
----------- File end in here-------------
- use commad #dahdi_cfg to configures DAHDI kernel modules from /etc/dahdi/system.conf
- Use this command # dahdi_cfg -vvvv.
It will show how many channels available in CARD. - Then you have to configure /etc/asterisk/chan_dahdi.conf and /etc/asterisk/dahdi-channels.conf.
Labels:
Asterisk
Saturday, July 31, 2010
Friday, July 30, 2010
Set time in Linux
- In CentOS
date MMDDhhmmccyy
MM - month
DD - date
hh - hour
mm - minute
cc - first two digit of the year (20)
yy - last two digit of the year (10) - Setting the time of your system
Labels:
GNU/Linux
Thursday, July 29, 2010
Install Chrome in Ubuntu 9.10
First way
Second way
- Open file "/etc/apt/sources.list".
- Add test in the file
"deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu karmic main
deb-src http://ppa.launchpad.net/chromium-daily/ppa/ubuntu karmic main". - run command
"sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xfbef0d696de1c72ba5a835fe5a9bf3bb4e5e17b5". - sudo apt-get update
- sudo add-apt-key ppa:chromium-daily/ppa
- sudo apt-get update
- sudo apt-get install chromium-browser
Second way
- Open file "etc/apt/sources.list"
- add text to file
deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/chromium-daily/ppa/ubuntu jaunty main - sudo aptitude install chromium-browser
Labels:
GNU/Linux
Wednesday, July 28, 2010
Configure DNS in CentOS
- Open /etc/resolv.conf file
- put your DNS server ip's as follows. Keep space between "nameserver" and ip addressnameserver (IP of your DNS server)
nameserver (IP of your DNS server)
Tuesday, July 27, 2010
Sinhala Vedio Songs
- Asha Nirasha Mawu..
- Liyu Pem Hasun
- Ege Sinahawa thahanam
- Obata sitha adare karai
- Mage Lowata Oba Wadina Thura
- Wiyo gee gayena
- Obe sina laga
- Duhulu Malak - Bonda Meedum
- Ganga Addara
- Kauruda Pave Pavee
- Sihinayaki Oba
- Obata waram nathi
- Sinahawa atharin
- Mahawarusawata (Somathilaka Jayamaha)
- Ma nisa oba
- Sagawanna epa hasaral
- Premaya Puda Dee Awasanai
- Aradana
- Hinawenna Beri Tharamata
- Soduru Athithaye - T.M Jayarathne
Labels:
Songs
Asterisk CLI
Asterisk CLI commands.
- #asterisk -r
- #asterisk -vvvvvr - If you want debugging output, add one or many v's
- #asterisk –vvvvvvvgrc - this show more debug info.
- #asterisk -rx "logger reload" - If you want to run a CLI command in a shell script, use the x option
Labels:
Asterisk
Primary Rate Interface (PRI)
- T1 ( 23B +D )
B-channel : 64 kbit/s
D-channel
There are 24 channels.
Labels:
Telephony
Basic rate interface -BRI
2B + D = 144 kbit/s
B channel - 64 kbit/s
D channel - 16 kbit/s
B channel : carries data, voice, and other services.
D channel : carries control and signaling information
Labels:
Telephony
Monday, July 26, 2010
Install and configure NTP on CentOS 5.3
- Install NTP (Network Time Protocol):
yum -y install ntp - Edit the NTP config file:
vi /etc/ntp.conf - At line 18, find "server 2.centos.pool.ntp.org" and under, add:
server time.nrc.ca
server time.chu.nrc.ca
server tock.utoronto.ca
server tick.utoronto.ca - Ajust the other NTP config file by editing:
vi /etc/sysconfig/ntpd - At that file's second line:
OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid" - Modify this line to add the option -x that will force a NTP synch at boot time:
OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid" - Restart NTPD service:
service ntpd start - Ajust system to automaticaly start the service at boot:
chkconfig ntpd on
Reference link
Friday, July 23, 2010
SS7
- SS7 Protocol
http://www.protocols.com/papers/ss7.htm
http://www.ulticom.com/html/products/ss7-signaling-convergence-white-paper.aspx
http://www.pt.com/page/tutorials/ss7-tutorial - Asterisk And SS7
http://www.pt.com/page/tutorials/ss7-tutorial - Asterisk and SS7 Performance Tests
http://www.cesnet.cz/doc/techzpravy/2007/asterisk-ss7-performance/#RVR06 - Asterisk libss7 (Original Help File)
http://www.voip-info.org/wiki/view/Asterisk+libss7 - Asterisk SS7 Options
http://wiki.sangoma.com/asterisk-ss7#LibSS7
Labels:
Asterisk
Wednesday, July 21, 2010
Asterisk Installation guides
- Insatll Asterisk 1.6.x in CentOS 5.2
http://www.voip-info.org/wiki/view/CentOS+5.2+and+Asterisk+1.6.x+installation - Install Asterisk in Red Hat 8
http://www.automated.it/guidetoasterisk.htm
Labels:
Asterisk
Asterisk Dialplan
How to write dialplan to restrict a user to call only predefine extensions.
;--------------------------------------------------------------------------------
; Context for allow ext-100 to call only ext-200,201,202,203,204
; and any extension begins with number 3 and contains 3 digits.
;If he get a call to any other number, it will hangup by the context.
[from-restricted]
exten => _200,1,Goto(from-internal,${EXTEN},1)
exten => _201,1,Goto(from-internal,${EXTEN},1)
exten => _202,1,Goto(from-internal,${EXTEN},1)
exten => _203,1,Goto(from-internal,${EXTEN},1)
exten => _204,1,Goto(from-internal,${EXTEN},1)
exten => _3XX,1,Goto(from-internal,${EXTEN},1)
;--------------------------------------------------------------------------------
- You have to include above context inextension.conf file(in CentOS file location is /etc/asterisk/extension.conf).
- Then you can change the context ofextension 100 to from-restricted. (in Asterisk 1.6 file location is /etc/asterisk/user.conf)
Labels:
Asterisk
Subscribe to:
Comments (Atom)