Asterisk

From Halfface
Jump to navigation Jump to search

freeworlddialing

823547@fwd.pulver.com
823547@iax.fwdnet.net
+882 9999 432225
+882 9900 52230
Mark Spencer at Digium.

freeswitch

Alternative to Asterisk. More stable.

Usefull commands

sip show registry

sip show users

sip show peers

sip set debug on
sip set debug off
Download source.
http://www.asterisk.org
Mailing list. Commercial , development, user.
http://list.digium.com
Wiki.
http://www.voip-info.org
Documentation project.
http://www.asteriskdocs.org

Glossary

AoR Address-of-Record, a canonical address by which a user is known in SIP
e.164 International Telecominication Union standard for telefon numbers.
fxo Foreign eXchange Office (pstn)
fxs Foreign eXchange Station (phone)
ivr Interactive voice response 
moh Message On Hold
pstn public switched telephone network
proxy servers route requests to the user's current location
registrar registrations, User Agent Server handles registers
rtp Real-time Transport Protocol
sdp Session Description Protocol
tdm Time Division Multiplexing (circuit switched network)

compile asterisk and build freepbx from source

# Install dependencies.
yum -y install gcc libxml2-devel libtiff-devel mysql-server php-gd php-mysql kernel-devel kernel-smp-devel bison ncurses-devel audiofile-devel subversion libogg-devel openssl-devel mysql-devel

# Install livna repository.
rpm -i http://rpm.livna.org/livna-release-7.rpm

# Install lame
yum install lame

# Prepare source.
cd /usr/src
tar zxf /net/www/storage/temp/freepbx-2.3.0.tar.gz
svn co http://svn.digium.com/svn/asterisk/branches/1.2 asterisk
svn co http://svn.digium.com/svn/asterisk-addons/branches/1.2 asterisk-addons
svn co http://svn.digium.com/svn/asterisk-sounds/trunk asterisk-sounds
svn co http://svn.digium.com/svn/zaptel/branches/1.2 zaptel
svn co http://svn.digium.com/svn/libpri/branches/1.2 libpri

# Create ztdummy
cd /usr/src/zaptel
cp ztdummy.c ztdummy.c.orig
sed -i "s/if 0/if 1/" ztdummy.c
make
make install
make config
echo "modprobe ztdummy" >> /etc/rc.d/rc.local

# Install asterisk
cd /usr/src/asterisk
mkdir /var/run/a
make install
make config 

# Create asterisk user.
useradd -c "Asterisk PBX" -d /var/lib/asterisk asterisk
mkdir /var/lib/php/session/
chown asterisk /var/lib/php/session/

# Setup mysql database.
cd /usr/src/freepbx-2.3.0/
mysqladmin create asterisk
mysqladmin create asteriskcdrdb
mysql asterisk < SQL/newinstall.sql
mysql asteriskcdrdb < SQL/cdr_mysql_table.sql

# Setup passwords on databases.
mysql
GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
flush privileges;
\q
mysqladmin -u root password 'password'

# Install FreePBX.
cd /usr/src/asterisk-addons
cp Makefile Makefile.orig
sed -i 's/SOURCE/SOURCE -DMYSQL_LOGUNIQUEID/' Makefile
make && make install

# Backup asterisk database.
tar zcf /temp/etc_asterisk /etc/asterisk/

cd /usr/src/freepbx-2.3.0/
rpm -y install php php-pear-DB

# Error checking.
tail /var/log/asterisk/full

Asterisk/freepbx from rpm

Asterisk/freepbx installation through rpm/svn. Use standard webserver. (not a second one run by asterisk)

Enable atrpms. Read yum wiki.

Install asterisk with dependencies.

yum install lame php php-pear php-pear-DB spandsp zaptel asterisk asterisk-addons

Enable asterisk and apache to use same config files.

chmod -R g+rwx /etc/asterisk
find /etc/asterisk -type d -exec chmod g+s {} \;

Make asterisk and apache to use the same config files. (apache belongs to asterisk group, and asterisk belongs to apache group.

  • /etc/group
apache:x:48:asterisk
asterisk:x:492:apache

Restart webserver to get required access. Start asterisk

service asterisk start

Check out latest freepbx source.

svn co http://svn.freepbx.org/freepbx/trunk /usr/src/freepbx 

Setup mysql database.

cd /usr/src/freepbx-2.3.0/
mysqladmin create asterisk
mysqladmin create asteriskcdrdb
mysql asterisk < SQL/newinstall.sql
mysql asteriskcdrdb < SQL/cdr_mysql_table.sql

# Setup passwords on databases.
mysql
GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
flush privileges;
\q
mysqladmin -u root password 'password'

Start installation of freepbx

/usr/src/freepbx/install_amp

Chose destination of freepbx. (Most likely not this directory)

/www/www-halfface/freepbx

Change destination of binaries.

/var/lib/asterisk/bin > /usr/sbin/

Give permission for group.

chmod -R g+rwx  /www/www-halfface/freepbx/
find /www/www-halfface/freepbx/ -type d -exec chmod g+s {} \;

Make operator accept asterisk. Add useragent=whatever.

  • /etc/asterisk/sip.conf
; If you need to answer unauthenticated calls, you should change this
; next line to 'from-trunk', rather than 'from-sip-external'.
; You'll know this is happening if when you call in you get a message
; saying "The number you have dialed is not in service. Please check the
; number and try again."
context = from-sip-external ; Send unknown SIP callers to this context
callerid = Unknown
tos=0x68
useragent=phonzo rules.

Enable access to virified user.

  • /etc/amportal.conf
AUTHTYPE=database