GIT –  is often referred to as “the open source PBX” and it’s true that you can use to build a PBX, in fact, we’ve done that work for you with our line of turnkey Switchvox solutions, but a PBX is only one of many applications you can build with . The limits of are the limits of your imagination. Here we have outlined a number of the most common solutions built on .

This document “How to and Configure Asterisk with on Centos”  step by step.

1)  yum update

2)  yum install gcc gcc-c++ make openssl-devel newt-devel ncurses-devel libtermcap-devel libxml2-devel kernel-devel perl curl curl-devel

3)  yum install libtool-ltdl libtool-ltdl-devel unixODBC-devel mysql mysql-devel mysql-server mysql-connector-odbc

4)  yum -y install gcc gcc-c++ kernel-devel bison openssl-devel libtermcap-devel ncurses-devel doxygen curl-devel newt-devel mlocate lynx tar wget nmap bzip2 mod_ssl unixODBC unixODBC-devel libtool-ltdl libtool-ltdl-devel mysql-connector-odbc mysql mysql-devel mysql-server php-mysql php-mbstring php-mcrypt flex screen libxml2 libxml2-devel libtiff libtiff-devel gmime gmime-devel net-snmp-utils net-snmp-devel neon libxml2 openssl openssl-devel gnutls-devel gnutls-utils

5)  cd /usr/src
# mkdir asterisk
# cd asterisk
# wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.6.2.0.tar.gz
# wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-addons-1.6.2.0.tar.gz
# wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
# wget http://downloads.digium.com/pub/libpri/libpri-1.4-current.tar.gz
# tar zxvf asterisk-1.6.2.0.tar.gz
# tar zxvf asterisk-addons-1.6.2.0.tar.gz
# tar zxvf dahdi-linux-complete-current.tar.gz
# tar zxvf libpri-1.4-current.tar.gz

6)  # cd /usr/src/asterisk/libpri-1.4.10.2

# make clean
# make
# make install

7)  # cd /usr/src/asterisk/dahdi-linux-complete-2.2.1-rc2+2.2.1-rc2/

# make all
# make install
# make config

# chkconfig dahdi on
# service dahdi start

Next, let’s setup our MySQL database for CDR (Call Detail Records) storage.  Be sure to run the mysql_secure_installation script after you start MySQL in order to set up a to protect your SQL databases!

chkconfig mysqld on

# service mysqld start
# /usr/bin/mysql_secure_installation
# mysql –p

Run The Following sql quries.

SET SQL_MODE=”NO_AUTO_VALUE_ON_ZERO”;

CREATE DATABASE `asterisk` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;

USE `asterisk`;

CREATE TABLE IF NOT EXISTS `cdr` (

`recid` mediumint(8) unsigned NOT auto_increment COMMENT ‘Record ID’,

`calldate` datetime NOT NULL default ’0000-00-00 00:00:00′,

`clid` varchar(80) NOT NULL default ”,

`src` varchar(80) NOT NULL default ”,

`dst` varchar(80) NOT NULL default ”,

`dcontext` varchar(80) NOT NULL default ”,

`channel` varchar(80) NOT NULL default ”,

`dstchannel` varchar(80) NOT NULL default ”,

`lastapp` varchar(80) NOT NULL default ”,

`lastdata` varchar(80) NOT NULL default ”,

`duration` int(11) NOT NULL default ’0′,

`billsec` int(11) NOT NULL default ’0′,

`disposition` varchar(45) NOT NULL default ”,

`amaflags` int(11) NOT NULL default ’0′,

`accountcode` varchar(20) NOT NULL default ”,

`uniqueid` varchar(32) NOT NULL default ”,

`userfield` varchar(255) NOT NULL default ”,

PRIMARY KEY  (`recid`),

KEY `calldate` (`calldate`),

KEY `dst` (`dst`),

KEY `accountcode` (`accountcode`),

KEY `src` (`src`),

KEY `disposition` (`disposition`),

KEY `uniqueid` (`uniqueid`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Now create database user by running the following commands

CREATE USER ‘asterisk’@’localhost’ IDENTIFIED BY ‘PASSWORD’;

GRANT FILE ON * . * TO ‘asterisk’@’localhost’ IDENTIFIED BY ‘PASSWORD’ WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;

GRANT INSERT ON `asterisk`.`cdr` TO ‘asterisk’@’localhost’;

Be sure to set your own password for the asterisk user (where I used ‘PASSWORD’ in the above block).

Now, we’ve got all the prerequisites installed.  Let’s install Asterisk!

8)  # cd /usr/src/asterisk/asterisk-1.6.2.0/
# make clean
# ./configure
# make menuselect

This is where you select all of the modules, applications, resource modules, codecs, sound packages, etc, that you want installed with Asterisk.  Move through menus using the up and down arrow keys, go to the options pane using tab, move up and down through the options and select items using the enter key, and then when you’re ready to save your selections, tab to the “Save and Exit” button and press enter again.

# make
# make install
# make samples
# make config
# chkconfig asterisk on

9) # asterisk -vvvvc
*CLI> core stop now
Next, we need to install some of the options from the Asterisk-Addons download.

# cd /usr/src/asterisk/asterisk-addons-1.6.2.0
# make clean
# ./configure
# make menuselect

At this point, be sure to select at least the following items:
• Applications – app_addon_sql_mysql
• Call Detail Recording – cdr_addon_mysql
• Resource Modules – res_config_mysql
After you’ve got those selected, save and exit. Then proceed with the following steps:

# make
# make install
# make samples

Once we’ve got that done, we need to edit the cdr_mysql.conf file to enter the mysql username and password, database, and table we setup earlier.

# vi /etc/asterisk/cdr_mysql.conf
[global]
hostname=localhost
dbname=asterisk
table=cdr
password=PASSWORD
user=asterisk
port=3306
sock=/var/lib/mysql/mysql.sock
userfield=1
loguniqueid=yes

You should read through several of the key configuration files in order to learn what’s changed, and also how to customize Asterisk for your installation. The files to look into would be:

/etc/asterisk/asterisk.conf
/etc/asterisk/extensions.ael
/etc/asterisk/extensions.conf
/etc/asterisk/sip.conf
/etc/asterisk/iax.conf
/etc/asterisk/voicemail.conf
/etc/asterisk/users.conf

The installation steps are complete and asterisk is running now

Now we need to configure 2 files for setup first one is sip.conf and other one is extension.conf

Sip.conf setting

[008] ; this is template.
type=friend
context=internal
host=dynamic
disallow=all
allow=ulaw
allow=alaw
allow=g723
allow=g729
dtmfmode=rfc2833
username=008
secret=008

Another Template

[007] ; this is template.
type=friend
context=internal
host=dynamic
disallow=all
allow=ulaw
allow=alaw
allow=g723
allow=g729
dtmfmode=rfc2833
username=007
secret=007

Just save it and then open extensions.conf file and add it
[internal]

exten=> _XXX,1,Dial(SIP/${EXTEN})

exten=> _XXX,1,Dial(SIP/${EXTEN})

After that you can setup setting in your Xlite and connected successfully

Print Friendly

Comments

comments

Bài viết liên quan