From: Алексей Правосудов <alex@ntline.ru.>
Newsgroups: email
Date: Mon, 31 Oct 2006 14:31:37 +0000 (UTC)
Subject: Настройка Asterisk под FreeBSD с E1 потоком в Cisco
service nagle
no service pad
service tcp-keepalives-in
service tcp-keepalives-out
Диагностика:
> cisco#show isdn status
Global ISDN Switchtype = primary-net5
ISDN Serial1/1/0:15 interface
dsl 0, interface ISDN Switchtype = primary-net5
Layer 1 Status:
ACTIVE
Layer 2 Status:
TEI = 0, Ces = 1, SAPI = 0, State = MULTIPLE_FRAME_ESTABLISHED
Layer 3 Status:
0 Active Layer 3 Call(s)
Active dsl 0 CCBs = 0
The Free Channel Mask: 0xFFFF7FFF
Number of L2 Discards = 0, L2 Session ID = 139
Total Allocated ISDN CCBs = 0
> cisco#show controller E1 1/1/0
E1 1/1/0 is up.
Applique type is Channelized E1 - balanced
No alarms detected.
alarm-trigger is not set
Framing is NO-CRC4, Line Code is HDB3, Clock Source is Line.
International Bit: 1, National Bits: 11111
Data in current interval (171 seconds elapsed):
0 Line Code Violations, 0 Path Code Violations
0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins
0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs
Data in Interval 1:
3735552 Line Code Violations, 0 Path Code Violations
0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins
0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs
Total Data (last 1 15 minute intervals):
3735552 Line Code Violations, 0 Path Code Violations,
0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins,
0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs
> cisco#show interface Serial1/1/0:15
Serial1/1/0:15 is up, line protocol is up (spoofing)
Hardware is VXB-2T1/E1+
MTU 1500 bytes, BW 64 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, loopback not set
Last input 00:00:09, output 00:00:09, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: weighted fair
Output queue: 0/1000/64/0 (size/max total/threshold/drops)
Conversations 0/1/256 (active/max active/max total)
Reserved Conversations 0/0 (allocated/max allocated)
Available Bandwidth 48 kilobits/sec
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
337250 packets input, 1097919 bytes, 0 no buffer
Received 0 broadcasts, 4294883933 runts, 0 giants, 0 throttles
4294888751 input errors, 4818 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
232395 packets output, 783637 bytes, 0 underruns
0 output errors, 0 collisions, 31 interface resets
0 output buffer failures, 0 output buffers swapped out
30 carrier transitions no alarm present
Timeslot(s) Used:16, subrate: 64Kb/s, transmit delay is 0 flags
> cisco#show dial-peer voice summary
dial-peer hunt 0
AD PRE PASS OUT TAG TYPE MIN OPER PREFIX DEST-PATTERN FER THRU SESS-TARGET STAT PORT
100 pots up up .T 5 up 1/1/0:15 2 voip up up 20. 1 syst sip-server
2. Настройка сервера.
Устанавливаем FreeBSD без ACPI + исходники + порты.
Обновляем исходники.
cd /usr/ports/net/cvsup-without-gui
make install clean
# To avoid building various parts of the base system:
NO_ACPI= # do not build acpiconf(8) and related programs
NO_ATM= # do not build ATM related programs and libraries
NO_BLUETOOTH= # do not build Bluetooth related stuff
NO_GAMES= # do not build games (games/ subdir)
NO_LPR= # do not build lpr and related programs
NO_MAILWRAPPER= # do not build the mailwrapper(8) MTA selector
NO_NIS= # do not build NIS support and related programs.
NO_SENDMAIL= # do not build sendmail and related programs
NO_USB= # do not build usbd(8) and related programs
DOC_LANG= en_US.ISO8859-1 ru_RU.KOI8-R
Переходим в /usr/src/ и пересобираем систему из исходных текстов:
cd /usr/src/
make buildworld
Пока собирается "МИР" будем делать конфиг для ядра
vi usr/src/sys/i386/conf/asterisk
machine i386
cpu I686_CPU
ident asterisk
# To statically compile in device wiring instead of /boot/device.hints
#hints "GENERIC.hints" # Default places to look for devices.
makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols
#options SCHED_ULE # ULE scheduler
options SCHED_4BSD # 4BSD scheduler
options PREEMPTION # Enable kernel thread preemption
options INET # InterNETworking
options INET6 # IPv6 communications protocols
options FFS # Berkeley Fast Filesystem
options SOFTUPDATES # Enable FFS soft updates support
options UFS_ACL # Support for access control lists
options UFS_DIRHASH # Improve performance on big directories
options MD_ROOT # MD is a potential root device
#options NFSCLIENT # Network Filesystem Client
#options NFSSERVER # Network Filesystem Server
#options NFS_ROOT # NFS usable as /, requires NFSCLIENT
options MSDOSFS # MSDOS Filesystem
options CD9660 # ISO 9660 Filesystem
options PROCFS # Process filesystem (requires PSEUDOFS)
options PSEUDOFS # Pseudo-filesystem framework
options GEOM_GPT # GUID Partition Tables.
options COMPAT_43 # Compatible with BSD 4.3 [KEEP THIS!]
options COMPAT_FREEBSD4 # Compatible with FreeBSD4
options COMPAT_FREEBSD5 # Compatible with FreeBSD5
options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI
options KTRACE # ktrace(1) support
options SYSVSHM # SYSV-style shared memory
options SYSVMSG # SYSV-style message queues
options SYSVSEM # SYSV-style semaphores
options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options KBD_INSTALL_CDEV # install a CDEV entry in /dev
options AHC_REG_PRETTY_PRINT # Print register bitfields in debug
# output. Adds ~128k to driver
options AHD_REG_PRETTY_PRINT # Print register bitfields in debug
# output. Adds ~215k to driver.
options ADAPTIVE_GIANT # Giant mutex is adaptive.
device apic # I/O APIC
# Bus support.
#device eisa
device pci
# Floppy drives
device fdc
# ATA and ATAPI devices
device ata
device atadisk # ATA disk drives
device ataraid # ATA RAID drives
device atapicd # ATAPI CDROM drives
device atapifd # ATAPI floppy drives
device atapist # ATAPI tape drives
options ATA_STATIC_ID # Static device numbering
# SCSI Controllers
# atkbdc0 controls both the keyboard and the PS/2 mouse
device atkbdc # AT keyboard controller
device atkbd # AT keyboard
device psm # PS/2 mouse
device kbdmux # keyboard multiplexer
device vga # VGA video card driver
device splash # Splash screen and screen saver support
# syscons is the default console driver, resembling an SCO console
device sc
# Enable this for the pcvt (VT220 compatible) console driver
#device vt
#options XSERVER # support for X server on a vt console
#options FAT_CURSOR # start with block cursor
device agp # support several AGP chipsets
# Power management support (see NOTES for more options)
#device apm
# Add suspend/resume support for the i8254.
device pmtimer
# PCCARD (PCMCIA) support
# PCMCIA and cardbus bridge support
# Serial (COM) ports
device sio # 8250, 16[45]50 based serial ports
# Parallel port
device ppc
device ppbus # Parallel port bus (required)
#device lpt # Printer
#device plip # TCP/IP over parallel
#device ppi # Parallel port interface device
#device vpo # Requires scbus and da
# If you've got a "dumb" serial or parallel PCI card that is
# supported by the puc(4) glue driver, uncomment the following
# line to enable it (connects to the sio and/or ppc drivers):
#device puc
# The `bpf' device enables the Berkeley Packet Filter.
# Be aware of the administrative consequences of enabling this!
# Note that 'bpf' is required for DHCP.
#Squid & Postgresql
options SYSVMSG
options SYSVSHM
options SYSVSEM
options SHMMAXPGS=65536
options NBUF=4096
options NMBCLUSTERS=65535
options PMAP_SHPGPERPROC=500
options SHMMAX="(SHMMAXPGS*PAGE_SIZE+1)"
options SHMMIN=2
options SHMSEG=256
options SHMMNI=512 # max shared mem id's per system
options SHMALL=16384 # max amount of shared memory (pages)
options MSGMNB=65535 # max # of bytes in a queue
options MSGMNI=160 # number of message queue identifiers
options MSGSEG=8192 # number of message segments
options MSGSSZ=256 # size of a message segment
options MSGTQL=2048 # max messages in system
options SEMUME=64
options SEMMAP=512
options SEMMNI=512
options SEMMNS=1024
options SEMMNU=512
options SEMMSL=256
options SEMOPM=256
После сборки "МИРА"
make buildkernel KERNCONF=asterisk
make installkernel KERNCONF=asterisk
shutdown now
ext_if="em0"
tcp_services = "{ 1720, 1721, 5060, >49151 }"
udp_services = "{ 4569, 4520, 1720, 1721, 5060, >49151 }"
set loginterface em0
set optimization normal
set require-order yes
set fingerprints "/etc/pf.os"
scrub all
block all
pass quick on lo0 all
#pass all
pass in on $ext_if inet proto tcp from any to <ip-server> port $tcp_services flags S/SA keep state
pass in on $ext_if inet proto udp from any to <ip-server> port $udp_services keep state
pass in on $ext_if inet proto tcp from <ваш комп> to <ip-server> port 80 flags S/SA keep state
pass in on $ext_if inet proto udp from <ваш комп> to <ip-server> port 80 keep state
pass in on $ext_if inet proto tcp from <ваш комп> to <ip-server> port 22 flags S/SA keep state
pass in on $ext_if inet proto udp from <ваш комп> to <ip-server> port 22 keep state
pass in inet proto icmp all icmp-type echoreq keep state
pass out on $ext_if proto tcp all modulate state flags S/SA
pass out on $ext_if proto { udp, icmp } all keep state
затем
cap_mkdb /etc/login.conf
reboot
Теперь можно установить PuTTY и продолжить настройку.
3. Установка Asterisk, MySQL, Apache и PHP
Устанавливаем Asterisk, MySQL, Apache и PHP из портов
cd /usr/ports/net/asterisk
make install clean
cd /usr/ports/databases/mysql51-server
включаем опции сборки MySQL
BUILD_OPTIMIZED=yes
BUILD_STATIC=yes
продолжаем установку
make install clean
cd /usr/ports/net/asterisk-addons
make install clean
Стандартный mpg123-0.59r_17 глючит поэтому идем на сайт и забираем
mpg123-0.61.tar.bz2
mkdir /usr/local/src/
cd /usr/local/src/
fetch http://www.mpg123.de/download/mpg123-0.61.tar.bz2
tar -jxvf mpg123-0.61.tar.bz2
cd mpg123-0.61
./configure
make
cp mpg123 /usr/local/bin/mpg123
все
стартуем
/usr/local/etc/rc.d/asterisk start
настроим любую программу и попробуем позвонить !
5. Статистика
Создаем /usr/local/www/apache22/data/stat.php
<?php
$username="asterisk";
$passwd="<pass>";
$dbname="asteriskcdrdb";
$hostname="localhost";
@mysql_connect ($hostname, $username, $passwd) or
die ("Cannot connect to database...");
@mysql_select_db($dbname)
or die("Could not select products database!");
$vopr=mysql_query("select * from cdr") or
die ("No way. Can't select.");
while ($line = mysql_fetch_array ($vopr))
{
print "<hr>";
extract($line);
print"$calldate,$src,$dst,$lastapp,$lastdata,$duration,$billsec,$disposition";
}
print "<HR>";
mysql_close();
?>
набираем в браузере http://<ip-server>/stat.php
смотрим - думаем если что-то не так.
Автор Правосудов Алексей <alex@ntline.ru.>
650 Прочтений • [Настройка Asterisk под FreeBSD с E1 потоком в Cisco (cisco voip asterisk e1)] [08.05.2012] [Комментариев: 0]