Why?


Search This Blog

Sunday, January 18, 2015

CENTOS 6.6 and Asterisk 11.15.0 Install

Here is a setup I use in my lab for testing purposes. Production customer equipment is Nortel BCM (PBX) with T1/PRI to Adtran IAD 908 or 908e. The Adtran uses the Ethernet port to connect to our network where we use SIP Trunking via Broadsoft clusters. Since we don’t have spare Nortel BCM’s laying around I use Asterisk as my PBX. This allows me to test everything other than the BCM equipment, which I am not responsible for anyway. The T1/PRI card I use in my Asterisk server is the Digium Wildcard TE110P T1/E1.

I wanted to document the setup so anyone on my team could easily setup an asterisk server for the purpose described above. I will not go into the Adtran IAD setup or anything else outside the Asterisk server in this document.

I hope this helps someone.

CENTOS 6.6 and Asterisk 11.15.0 Install Part 1

1. Download CENTOS 6.6 Minimal Install ISO
2. Burn to CD/DVD
3. Boot PC on CD/DVD
4. Install OS
5. After Install reboot
6. Verify hostname
            # hostname
7. Setup Network

             # cd /etc/sysconfig/network-scripts
  1. change ifcfg-eth0 file to reflect like the following example below. Your UUID and HWADDR should not be changed. Below is just an example.
DEVICE=eth0
HWADDR=00:12:3F:B8:CD:FF
TYPE=Ethernet
UUID=d960e22d-214f-450c-b017-a3ad590bb225
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
IPADDR=x.x.128.8
NETMASK=255.255.255.0
GATEWAY=x.x.128.1
BROADCAST=x.x.128.255
DNS1=x.x.1.10
DNS2=x.x.1.12
8. Restart network services
# services network restart
9. Run ifconfig, ping from remote machine to server, and ping google.com from server to verify. Now you can ssh in from your workstation
10. update new install
# yum update –y
11. Disable SELinux
# vi /etc/selinux/config
and chang to:
SELINUX=disabled
12. Stop iptables
# service iptables stop
13. Prevent iptables from auto starting
# chkconfig iptables off
14. Reboot
# reboot


Setting up NTP in Centos 6.6

 First we need to make sure we have the correct date, time, and timezone. You can verify with:

# cat /etc/localtime

Set your time zone with (for Phoenix AZ USA)

#cp /usr/share/zoneinfo/America/Phoenix /etc/localtime


Now check date

# date
Sun Mar 29 01:10:44 MST 2015

You can verify this at the hardware level with:

# hwclock -r
Sun 29 Mar 2015 01:13:51 AM MST  -0.156631 seconds


If  these are incorrect then we can set the OS first and then update the hardware with the date command. The syntax is: date "day month year hh:mm:ss" So if we wanted to change this to March 2 2015 at 1:00pm we would use:

# date -s "2 MAR 2015 13:00:00"

When we have the date correct in the OS we can update the hardware with:

# hwclock -w

Now that we have the correct date and time lets install and setup ntp. First lets install ntp if not already installed.

# yum -y install ntp*

Next edit the the ntp.conf file so we are using the correct time servers.

# vi /etc/ntp.conf

I usually use the public servers from the pool.ntp.org project of:
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst


After you have those in lets start the service and make sure it is on in startup.

# service ntpd start
Starting ntpd:                                             [  OK  ]
# chkconfig ntpd on

Now lets verify the setup by looking at our peers.

# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*deekayen.net    209.51.161.238   2 u   43   64    3   75.257  -22.456   3.017
 origin.towfowi. 204.9.54.119     2 u   43   64    3   31.405  -14.629   2.683
 NTP2.playallian 129.6.15.30      2 u   43   64    3   50.576  -14.090   3.465
 sola-dal-09.ser 10.0.77.54       4 u   42   64    3   59.879   -1.507   2.629
l

CENTOS 6.6 and Asterisk 11.15.0 Install Part 2

NOTE: 2015/12/28
I have used my own doc many times to install Asterisk. but today I layed down CentOS release 6.6 (Final) with Kernel 2.6.32-504.el6.x86_64. I did not apply any updates. When it tried to install Kernel-devel it could not find it. Just Google "Kerenel-devel 2.6.32-504.el6.x86_64 RPM" and download it. You can then do a "yum install kernel-devel-2.6.32-504.el6.x86_64.rpm". Make sure you have the correct path to the file. After this you can continue. Without Kernel-devel you will not be able to compile the sources. You should try the command "yum install kernel-devel-$(uname -r)" first though before searching and downloading it manually.

1 Installation of Basic Dependencies
Asterisk 11.15.0 requires some prerequisite dependencies. Here is the command line to install them:
# yum -y install kernel-devel-$(uname -r) libtool* make gcc patch perl bison flex-devel gcc-c++ ncurses-devel flex libtermcap-devel autoconf* automake* autoconf libxml2-devel cmake sqlite* wget

2 Downloading Your Asterisk Source Code
Move to directory /usr/src by given command:
# cd /usr/src/
Now download the Source Code tar balls using these commands (one by one or at a time):
# wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
# wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz
# wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11-current.tar.gz

3 Extraction of Downloaded Files
Extract the downloaded tar balls to their corresponding directories using:
# tar -zxvf dahdi-linux-complete*
# tar -zxvf libpri*
# tar -zxvf asterisk*

4 DAHDI Installation
DAHDI (Digium Asterisk Hardware Device Interface) can be installed using the command line:
# cd /usr/src/dahdi-linux-complete*
# make && make install && make config

5 LibPRI Installation
In order to enable your BRI, PRI and QSIG based hardware, you will be needing PRI Library or LibPRI. You can install these libraries using:
# cd /usr/src/libpri*
# make && make install

6 Changing Asterisk Directory
Now you have to move back to the Asterisk Installation Directory:
# cd /usr/src/asterisk*

7 Running Configure Script for Asterisk
At this point, you need to know your CentOS 6 Architecture (32 or 64 Bit). In many cases you are aware of it. In case you are not, try this command:
# uname -a
For 32 Bit, you will be getting response like:
2.6.18-238.12.1.el5 #1 SMP Tue May 31 13:23:01 EDT 2011 i686 i686 i386 GNU/Linux

For 64 Bit, system will respond with something like:
2.6.18-238.19.1.el5 #1 SMP Fri Jul 15 07:31:24 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux

Based on your OS Architecture, go ahead with these commands for Asterisk Configuration Script. During the process the asterisk build menu may be displayed. Simply press the esc key one time to exit and continue the install.
For 32 Bit:
# ./configure && make menuselect && make && make install

For 64 Bit:
# ./configure --libdir=/usr/lib64 && make menuselect && make && make install

8 Installing Sample Files
Install Sample Files using:
# make samples

Once done, add the Asterisk Install Script in directory /etc/init.d/ using:
# make config

9 Starting DAHDI
To start DAHDI Device Drivers, use:
# service dahdi start
Loading DAHDI hardware modules:
  wct4xxp:                                                 [  OK  ]
  wcte43x:                                                 [  OK  ]
  wcte12xp:                                                [  OK  ]
  wcte13xp:                                                [  OK  ]
  wct1xxp:                                                 [  OK  ]
  wcte11xp:                                                [  OK  ]
  wctdm24xxp:                                              [  OK  ]
  wcaxx:                                                   [  OK  ]
  wcfxo:                                                   [  OK  ]
  wctdm:                                                   [  OK  ]
  wcb4xxp:                                                 [  OK  ]
  wctc4xxp:                                                [  OK  ]
  xpp_usb:                                                 [  OK  ]

Running dahdi_cfg:                                         [  OK  ]
 

10 Start Asterisk
Finally, start Asterisk:
# service asterisk start

11. Reboot
# reboot


CENTOS 6.6 and Asterisk 11.15.0 Install Part 3 setting up DAHDI

I am using the Digium Wildcard TE110P T1/E1 Card into an Adtran 908E. The Adtran has a SIP trunk to a CLEC. The T1/PRI card in the Asterisk server is used deliver 23 phone channels (1 channel out of the 24 is used for clocking) to/from the Adtran/Asterisk.
1 Generate system.conf file by running:
# /usr/sbin/dahdi_genconf
My /etc/dahdi/system.conf has the following
# Autogenerated by /usr/sbin/dahdi_genconf on Sun Dec 28 23:00:55 2014
# 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: WCT1/0 "Digium Wildcard TE110P T1/E1 Card 0" (MASTER) ESF/B8ZS
span=1,1,0,esf,b8zs
# termtype: te
bchan=1-23
dchan=24
echocanceller=mg2,1-23
# Global data
loadzone        = us
defaultzone     = us
As it says the above file, “Autogenerated by /usr/sbin/dahdi_genconf”. And “If you edit this file and execute /usr/sbin/dahdi_genconf again, your manual changes will be LOST.”
Now make sure your /etc/asterisk/chan_dahdi.conf has the following, add to end of file: (This will create the channels for you)

context=from-test
switchtype=national
siganling=pri_cpe
group=1
channel => 1-23

2 Now stop and start DAHDI and asterisk

# service asterisk stop
Stopping safe_asterisk:                                    [  OK  ]
Shutting down asterisk:                                    [  OK  ]

# service dahdi stop
Unloading DAHDI hardware modules: done

# service dahdi start
Loading DAHDI hardware modules:
 wct4xxp:                                                 [  OK  ]
 wcte43x:                                                 [  OK  ]
 wcte12xp:                                                [  OK  ]
 wcte13xp:                                                [  OK  ]
 wct1xxp:                                                 [  OK  ]
 wcte11xp:                                                [  OK  ]
 wctdm24xxp:                                              [  OK  ]
 wcaxx:                                                   [  OK  ]
 wcfxo:                                                   [  OK  ]
 wctdm:                                                   [  OK  ]
 wcb4xxp:                                                 [  OK  ]
 wctc4xxp:                                                [  OK  ]
 xpp_usb:                                                 [  OK  ]

D: auto '/sys/bus/dahdi_devices/devices/pci:0000:04:00.0'
auto-assign /sys/bus/dahdi_devices/devices/pci:0000:04:00.0
Running dahdi_cfg:                                         [  OK  ]

# service asterisk start
Starting asterisk:

3 Now lets verify


# lsdahdi
              ### Span  1: WCT1/0 "Digium Wildcard TE110P T1/E1 Card 0" (MASTER) ESF/B8ZS
 1 PRI        Clear       (EC: MG2 - INACTIVE)
 2 PRI        Clear       (EC: MG2 - INACTIVE)
 3 PRI        Clear       (EC: MG2 - INACTIVE)
 4 PRI        Clear       (EC: MG2 - INACTIVE)
 5 PRI        Clear       (EC: MG2 - INACTIVE)
 6 PRI        Clear       (EC: MG2 - INACTIVE)
 7 PRI        Clear       (EC: MG2 - INACTIVE)
 8 PRI        Clear       (EC: MG2 - INACTIVE)
 9 PRI        Clear       (EC: MG2 - INACTIVE)
10 PRI        Clear       (EC: MG2 - INACTIVE)
11 PRI        Clear       (EC: MG2 - INACTIVE)
12 PRI        Clear       (EC: MG2 - INACTIVE)
13 PRI        Clear       (EC: MG2 - INACTIVE)
14 PRI        Clear       (EC: MG2 - INACTIVE)
15 PRI        Clear       (EC: MG2 - INACTIVE)
16 PRI        Clear       (EC: MG2 - INACTIVE)
17 PRI        Clear       (EC: MG2 - INACTIVE)
18 PRI        Clear       (EC: MG2 - INACTIVE)
19 PRI        Clear       (EC: MG2 - INACTIVE)
20 PRI        Clear       (EC: MG2 - INACTIVE)
21 PRI        Clear       (EC: MG2 - INACTIVE)
22 PRI        Clear       (EC: MG2 - INACTIVE)
23 PRI        Clear       (EC: MG2 - INACTIVE)
24 PRI        HDLCFCS

# dahdi_scan
[1]
active=yes
alarms=OK
description=Digium Wildcard TE110P T1/E1 Card 0
name=WCT1/0
manufacturer=Digium
devicetype=Digium Wildcard TE110P T1/E1
location=PCI Bus 04 Slot 01
basechan=1
totchans=24
irq=0
type=digital-T1
syncsrc=0
lbo=0 db (CSU)/0-133 feet (DSX-1)
coding_opts=B8ZS,AMI
framing_opts=ESF,D4
coding=B8ZS
framing=ESF


Now from asterisk console do:
# asterisk -r
localhost*CLI> dahdi show status
Description                              Alarms  IRQ    bpviol CRC    Fra Codi Options  LBO
Digium Wildcard TE110P T1/E1 Card 0      OK      8      0      0      ESF B8ZS          0 db (CSU)/0-133 feet (DSX-1)
localhost*CLI>

localhost*CLI> dahdi show channels
  Chan Extension       Context         Language   MOH Interpret        Blocked    State      Description
pseudo                 default                    default                         In Service
     1                 from-test                  default                         In Service
     2                 from-test                  default                         In Service
     3                 from-test                  default                         In Service
     4                 from-test                  default                         In Service
     5                 from-test                  default                         In Service
     6                 from-test                  default                         In Service
     7                 from-test                  default                         In Service
     8                 from-test                  default                         In Service
     9                 from-test                  default                         In Service
    10                 from-test                  default                         In Service
    11                 from-test                  default                         In Service
    12                 from-test                  default                         In Service
    13                 from-test                  default                         In Service
    14                 from-test                  default                         In Service
    15                 from-test                  default                         In Service
    16                 from-test                  default                         In Service
    17                 from-test                  default                         In Service
    18                 from-test                  default                         In Service
    19                 from-test                  default                         In Service
    20                 from-test                  default                         In Service
    21                 from-test                  default                         In Service
    22                 from-test                  default                         In Service
    23                 from-test                  default                         In Service

Edit your /etc/asterisk/sip.conf and /etc/asterisk/extensions.conf files and get your phones registered.

CENTOS 6.6 and Asterisk Install 11.15.0 Part 4 Setting up Phones

Edit /etc/asterisk/sip.conf and add the example below, to bottom of file. Substitute phone number you will be using

[6026356915]
type=friend
callerid="Asterisk 100" 6026356915
secret=password
context=internal
host=dynamic
allow=all
dtmfmode=rfc2833

Edit /etc/asterisk/extensions.conf and add the following to end of file

[internal]
;used to pass special character’s to DAHDI (T1/PRI)
exten => _[*#0-9]!,1,Dial(DAHDI/g1/${EXTEN})
exten => _[*#0-9]!,n,Hangup

;used to pass numbers dialed to DAHDI (T1/PRI)
exten => _X.,1,Dial(DAHDI/g1/${EXTEN})
exten => _X.,n,Hangup

;used to pass extension dialed, 100, to registered phone of 6026356915
exten => 100,1,Dial(SIP/6026356915,20)
exten => 100,n,Playback(vm-goodbye)
exten => 100,n,Hangup

;this is what we used in chan_dahdi.conf
[from-test]
exten => 6026356915,1,Dial(SIP/6026356915,20)
exten => 6026356915,n,Playback(vm-goodbye)
exten => 6026356915,n,Hangup

Go to the asterisk console:
# asterisk –r

Issue command:
localhost*CLI> core reload
This will reload asterisk modules and reflect your changes.

Setup phone and register. Verify by:
localhost*CLI> sip show peers

Watch messages with
localhost*CLI> core set verbose 99

END

No comments:

Post a Comment