terça-feira, maio 20, 2014

Setup Asterisk on CentOS

Setup  on CentOS

We need to install all of Asterisk’s dependencies.  These are programs that are required to be installed before you can compile asterisk.  This is the list I use, it includes the source compilers, some needed development libraries, as well as some dependencies for various asterisk modules I like to load.
  • Install Asterisk dependencies
    yum install gcc gcc-c++ make openssl-devel newt-devel ncurses-devel doxygen libtermcap-devel libxml2-devel kernel-devel perl curl curl-devel
  • We’ll install a MySQL database server to handle our CDR (call detail records) storage, and also to prepare the way for using the Asterisk Realtime Architecture (the ability to store our configuration parameters in a database as opposed to flat files). 

    yum install libtool-ltdl libtool-ltdl-devel unixODBC-devel mysql mysql-devel mysql-server mysql-connector-odbc   
  • Create a directory under /usr/src to keep everything tidy. Download all of the sources for this install.
    cd /usr/src
    mkdir asterisk
    cd asterisk
    wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-
    wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-addons-
    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-
    tar zxvf asterisk-addons-
    tar zxvf dahdi-linux-complete-current.tar.gz
    tar zxvf libpri-1.4-current.tar.gz
  • LibPRI.  LibPRI is a library used by TDM cards (T1 / E1 cards, etc).  Even if you don’t have one of these cards, it’s safe to install LibPRI – it won’t have any negative effects on your system.
    cd /usr/src/asterisk/libpri-
    make clean
    make install
  • DAHDI.  DAHDI means “Digium Asterisk Hardware Device Interface”, it’s pronounced “Daddy”, and it’s the replacement of the old Zaptel driver stack.  DAHDI is the set of linux kernel modules and also a set of tools for interfacing with TDM cards.  More importantly, DAHDI provides timing to several asterisk components, such as the MeetMe application as well as Music on Hold.  If you don’t have a proper timing source installed, you’ll notice lots of stuttering pauses in any kind of audio playback (Music on Hold, IVR prompts, voicemail greetings) from asterisk.  If you don’t have any TDM hardware installed in your server, DAHDI also provides a “dummy” driver that will provide a timing source to asterisk.
    cd /usr/src/asterisk/dahdi-linux-complete-
    make all
    make install
    make config
  • Now you need to configure DAHDI.  You do that by editing the following files, based on your situation.  The files themselves contain lots of documentation, if you have no TDM cards and are only installing DAHDI for the dummy timing source, you can comment out every driver referenced in the modules file.

    nano /etc/dahdi/modules
    nano /etc/dahdi/system.conf      
    Set DAHDI to start automatically and then start it.
    chkconfig dahdi on
    service dahdi start
  • Install Asterisk.
    cd /usr/src/asterisk/asterisk-
    make clean
    ./configure         # or ./configure --disable-xmldoc (if you get error)
    make menuselect
    Choose which options to install (audio files, voicemail storage, codecs etc.)
    make menuselect 
    make install
    Install sample files in /etc/asterisk, install docs/manpages and set to start on boot.
    make samples
    make progdocs
    make config
    chkconfig asterisk on
    Check Asterisk starts properly, by manually starting asterisk from the command line.
    asterisk -vvvvc
    *CLI> core stop now
    Assuming it does start properly, you probably want to start it in the background:
    service asterisk start
  • Asterisk-addons
    cd /usr/src/asterisk/asterisk-addons-
    make clean
    make menuselect
    Choose what you do and don't want. Unless you really need oh323, deselect it as it can be the cause of compilation woes. 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
    make install
    make samples      
    Edit /etc/asterisk/cdr_mysql.conf and add 'loguniqueid=yes' to the global section.

Nenhum comentário: