Настройка Asterisk под FreeBSD с E1 потоком в Cisco (cisco voip asterisk e1)

Оцените материал
(0 голосов)
Настройка Asterisk под FreeBSD с E1 потоком в Cisco (cisco voip asterisk e1) Настройка Asterisk под FreeBSD с E1 потоком в Cisco (cisco voip asterisk e1)

asterisk-1.2.13 + asterisk-addons-1.2.3_1 + Cisco 7507 + FreeBSD 6.1

Вступление:

   <ip-server> - адрес сервера с asterisk.
   <ip-cisco> - адрес Cisco 7507
   <ip-dns> - DNS orem ip

1. Cisco 7507

   Прошивка "Cisco IOS Software, VIP Software (SVIP-DW-M), Version 12.4(7),
   RELEASE SOFTWARE (fc6)"

   Оговорюсь сразу канал не я прокладывал. В Cisco 7507 вставлена плата
   VXB-2T1/E1.

   Итак настройки.

   Пишем

           !
           isdn switch-type primary-net5
           isdn voice-call-failure 0
           !
           voice class codec 1
           codec preference 1 g711alaw
           codec preference 2 g726r16
           codec preference 3 g729r8
           !
           controller E1 1/1/0
           framing NO-CRC4
           pri-group timeslots 1-31
           !
           controller E1 1/1/1
           framing NO-CRC4
           !
           interface Serial1/1/0:15
           no ip address
           encapsulation hdlc
           isdn switch-type primary-net5
           isdn incoming-voice voice
           no keepalive
           no cdp enable
           !
           voice-port 1/1/0:15
           !
           dial-peer voice 100 pots
           preference 5
           service session
           destination-pattern .T
           direct-inward-dial
           port 1/1/0:15
           forward-digits all
           !
           dial-peer voice 2 voip
           preference 1
           destination-pattern 20.
           voice-class codec 1
           session protocol sipv2
           session target sip-server
           dtmf-relay rtp-nte
           fax rate 9600
           fax protocol pass-through g711alaw
           no vad
           !
           sip-ua
           no redirection
           retry invite 3
           retry response 3
           retry bye 3
           retry cancel 3
           retry register 3
           timers trying 1000
           timers register 150
           sip-server ipv4:<ip-server>
           !


   Небольшой тюнинг

           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




   далее создаем файл для cvsup /etc/cvsupfile

           *default host=cvsup.ru.freebsd.org
           *default base=/usr
           *default prefix=/usr
           *default release=cvs tag=RELENG_6_1
           *default delete use-rel-suffix
           *default compress
           src-all
           *default tag=.
           ports-all
           doc-all


   Стартуем cvsup.

           cd /usr/ports
           cvsup /etc/cvsupfile
           make fetchindex
           cp /usr/share/examples/etc/make.conf /etc/


   Набираем

           dmesg | less


   У меня:


   CPU: Intel(R) Pentium(R) 4 CPU 2.26GHz (2260.24-MHz 686-class CPU)
    Origin = "GenuineIntel"  Id = 0xf25  Stepping = 5
    Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,
   PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,
   FXSR,SSE,SSE2,SS,HTT,TM,PBE>
    Features2=0x4400<CNTX-ID,<b14>>
   real memory  = 259981312 (247 MB)
   avail memory = 248270848 (236 MB)
   em0:  <Intel(R)  PRO/1000  Network  Connection  Version - 3.2.18> port
   0xa000-0xa01f mem 0xfa000000-0xfa01ffff irq 18 at
   device 1.0 on pci1




   Правим /etc/make.conf

           CPUTYPE?=pentium4
           CFLAGS= -O2 -pipe -mmmx -msse -msse2
           COPTFLAGS= -O2 -pipe -mmmx -msse -msse2

           # 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

   # PCI Ethernet NICs.
   #device         de              # DEC/Intel DC21x4x (``Tulip'')
   device          em               #  Intel  PRO/1000  adapter  Gigabit Ethernet Card
   #device         ixgb            # Intel PRO/10GbE Ethernet Card
   #device         txp             # 3Com 3cR990 (``Typhoon'')
   #device         vx              # 3Com 3c590, 3c595 (``Vortex'')

   # PCI Ethernet NICs that use the common MII bus controller code.
   # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs!

   device          miibus          # MII bus support
   #device         bce             #  Broadcom  BCM5706/BCM5708 Gigabit Ethernet
   #device         bfe             # Broadcom BCM440x 10/100 Ethernet
   #device         bge             # Broadcom BCM570xx Gigabit Ethernet
   #device         dc              #   DEC/Intel  21143  and  various workalikes
   #device         fxp             # Intel EtherExpress PRO/100B (82557, 82558)
   #device         lge             # Level 1 LXT1001 gigabit Ethernet
   #device         nge             # NatSemi DP83820 gigabit Ethernet
   #device         nve             # nVidia nForce MCP on-board Ethernet Networking
   #device         pcn             # AMD Am79C97x PCI 10/100(precedence over 'lnc')
   #device         re              # RealTek 8139C+/8169/8169S/8110S
   device          rl              # RealTek 8129/8139
   #device         sf              # Adaptec AIC-6915 (``Starfire'')
   #device         sis             #  Silicon  Integrated  Systems  SiS 900/SiS 7016
   #device         sk              # SysKonnect SK-984x & SK-982x gigabit Ethernet
   #device         ste             # Sundance ST201 (D-Link DFE-550TX)
   #device         ti              # Alteon Networks Tigon I/II gigabit Ethernet
   #device         tl              # Texas Instruments ThunderLAN
   #device         tx              # SMC EtherPower II (83c170 ``EPIC'')
   #device         vge             # VIA VT612x gigabit Ethernet
   #device         vr              # VIA Rhine, Rhine II
   #device         wb              # Winbond W89C840F
   #device         xl              #   3Com   3c90x   (``Boomerang'', ``Cyclone'')

   # Pseudo devices.
   device          loop            # Network loopback
   device          random          # Entropy device
   device          ether           # Ethernet support
   #device         sl              # Kernel SLIP
   device          ppp             # Kernel PPP
   device          tun             # Packet tunnel.
   device          pty             # Pseudo-ttys (telnet etc)
   device          md              # Memory "disks"
   device          gif             # IPv6 and IPv4 tunneling
   device          faith           # IPv6-to-IPv4 relaying (translation)

   # The `bpf' device enables the Berkeley Packet Filter.
   # Be aware of the administrative consequences of enabling this!
   # Note that 'bpf' is required for DHCP.

   device          bpf             # Berkeley packet filter
   #
   options         ALTQ
   options         ALTQ_CBQ
   options         ALTQ_RED
   options         ALTQ_RIO
   options         ALTQ_HFSC
   options         ALTQ_CDNR
   options         ALTQ_PRIQ
   options         ALTQ_NOPCC
   device          pf
   device          pflog
   device          pfsync
   device          carp
   options         IPSTEALTH
   options         MBUF_STRESS_TEST
   options         ACCEPT_FILTER_DATA
   options         ACCEPT_FILTER_HTTP
   options         TCP_DROP_SYNFIN
   options         SC_DISABLE_KDBKEY
   options         SC_DISABLE_REBOOT
   options         CPU_SUSP_HLT
   options         PERFMON
   options         DEVICE_POLLING
   #options        MAXMEM=(1024*1024)

   #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


   соглашаемся на /bin/sh

           cd /usr/src
           make installworld
           reboot


   небольшой тюнинг

   vi /etc/sysctl.conf

           security.bsd.see_other_uids=0
           kern.corefile="/tmp/%U.%N.core"
           kern.maxfiles=65536
           kern.maxfilesperproc=32768
           kern.polling.enable=1
           net.inet.ip.portrange.first=49152
           #net.inet.ip.redirect=1
           net.inet.ip.ttl=255
           #net.inet.tcp.blackhole=2
           net.inet.tcp.recvspace=131072
           net.inet.tcp.sendspace=131072
           #net.inet.udp.blackhole=1
           net.inet.udp.maxdgram=28672
           net.inet.udp.recvspace=131072
           net.local.stream.recvspace=65535
           net.local.stream.sendspace=65535
           #net.inet.icmp.icmplim=50
           net.inet.ip.portrange.last=65535
           #net.inet.ip.forwarding=1
           #kern.ipc.shm_use_phys=1


   vi /boot/loader.conf

           hint.acpi.0.disabled=1
           kern.ipc.nmbclusters=65535
           kern.ipc.nsfbufs=4096


   правим /etc/rc.conf

         hostname="asterisk.<домен>"
         pf_enable="YES"
         tcp_extensions="YES"
         tcp_keepalive="YES"
         tcp_drop_synfin="YES"
         icmp_drop_redirect="YES"
         ifconfig_em0="inet <ip-server> netmask <МАСКА>"
         defaultrouter="ip-cisco"
         sshd_enable="YES"


   /etc/resolv.conf

           domain  <домен>
           nameserver      <днс-сервер>


   /etc/hosts

        127.0.0.1             localhost       localhost.<домен>
        <ip-server>           asterisk        asterisk.<домен>


   для безопасности

   vi /etc/login.conf

           :passwd_format=blf:\


   vi /etc/pf.conf

           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

           cd /usr/ports/www/apache22
           make install clean

           cd /usr/ports/lang/php5-extensions


   включаем опции установки PHP

           WITH_GD=true
           WITH_GETTEXT=true
           WITH_MYSQL=true


   продолжаем установку

           make install clean


   Настройки.

   Редактируем файл конфигурации Apache2 /usr/local/etc/apache22/httpd.conf

   добавим использование index.php в качестве индексного файла

           <IfModule dir_module>
              DirectoryIndex index.html index.php
           </IfModule>


   и поддержку PHP в блок <IfModule mime_module>

          AddType application/x-httpd-php .php .phtml
          AddType application/x-httpd-php-source .phps


   добавим автозапуск при загрузке MySQL, Asterisk и Apache
   в /etc/rc.conf

           mysql_enable="YES"
           asterisk_enable="YES"
           apache22_enable="YES"


   стартуем

           /usr/local/etc/rc.d/apache22 start
           /usr/local/etc/rc.d/mysql-server start


   Проверяем

   Создадим скрипт

   vi /usr/local/www/apache22/data/index.php

           <?php
           phpinfo();
           ?>


   затем

           chown www:www /usr/local/www/apache22/data/index.php


   в браузере набирем http://<;ip-server>/index.php

   должна показаться страница с настройками PHP.



4.Настройка Asterisk.

   Статистику по звонкам будем хранить в базе.

   Создадим базу и таблицу.

           mysqladmin create databasename asteriskcdrdb

           mysql

           mysql> GRANT ALL ON asteriskcdrdb TO asterisk @localhost IDENTIFIED  BY 'pass';
           mysql> flush privileges;
           mysql>exit


   далее

           mysql asteriskcdrdb -u asterisk -p <pass>


   Создадим базу

           mysql>CREATE TABLE cdr (
            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 ''
           );

           mysql>exit


   перейдем к настройкам asterisk.conf

   cd /usr/local/etc/asterisk/
   vi asterisk.conf

           [files]
           astctlpermissions = 0660
           astctlowner = www
           astctlgroup = www
           astctl = asterisk.<домен>


   добавим в конец файла extensions.conf

           [bogon-calls]
           include => lan-phones
           exten => _X.,2,Congestion

           [pstn-incoming]
           include => lan-phones

           [local-phones]
           include => lan-phones
           include => pstn-outbound

           [pstn-outbound]
           exten => _X.,1,Dial(SIP/${EXTEN}@<ip-cisco>,20)
           exten => _X.,2,Congestion

           [lan-phones]
           exten => 201,1,Dial(SIP/1001,20)
           exten => 201,2,Hangup
           exten => 202,1,Dial(SIP/1002,20)
           exten => 202,2,Hangup


   Редактируем sip.conf
   в блок [general] добавляем

           context=bogon-calls
           bindaddr=<ip-server>


   в конец дописываем

           [<ip-cisco>]
           context=pstn-incoming
           type=friend
           host= <ip-cisco>; IP address of Cisco gateway
           dtmfmode=rfc2833
           ;disallow=all
           allow=all
       
           [201]
           context=local-phones
           type=friend
           username=201
           secret=201
           host=dynamic
           mailbox=201
       
           [202]
           context=local-phones
           type=friend
           username=202
           secret=202
           host=dynamic
           mailbox=202


   редактируем cdr_mysql.conf

           [global]
           hostname=localhost
           dbname=asteriskcdrdb
           table=cdr
           password=<pass>
           user=asterisk
           port=3306
           sock=/tmp/mysql.sock
           userfield=1


   редактируем indications.conf

           country=ru


   редактируем musiconhold.conf

           [default]
           mode=mp3


   Стандартный 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

   смотрим - думаем если что-то не так.

Прочитано 101233 раз Последнее изменение Понедельник, 13 июня 2016 10:56

Оставить комментарий

Убедитесь, что вы вводите (*) необходимую информацию, где нужно
HTML-коды запрещены

Свяжитесь с нами и мы Вам поможем

*

Техническая поддержка Вашего бизнеса.

 

Вопрос? Звони

Техническая поддержка
В любой день: 8(7172) 57-69-08
Понедельник-пятница: с 9.00 до 18.00
Суббота: с 10.00 до 14.00

 

Нужна поддержка?

Вы можете задать вопрос на нашем сайте и мы в кратчайшие сроки ответим на него.
Задать ...

 

Live chat сейчас

Также для Вас доступен круглосуточный Чат с нашими сотрудниками.Мы ответим на любой вопрос.