Настройка Asterisk и DAHDI для работы с устройством
Cronyx E1-L/M-DAHDI
1. Создаем резервную копию файла конфигурации DAHDI
#mv /etc/dahdi/system.conf /etc/dahdi/system.conf.sample
2. Создаем пустой файл конфигурации
#touch /etc/dahdi/system.conf
3. Открываем файл конфигурации DAHDI
#nano /etc/dahdi/system.conf
и вписываем туда:
dynamic=eth,eth0/00:09:94:00:76:57,31,1
# В качестве MAC адреса указываем MAC устройства
# Cronyx E1-L/M-DAHDI
# Единичка в конце - тип синхронизации "от потока E1"
bchan=1-15
dchan=16
bchan=17-31
alaw=1-15,17-31
loadzone = us
defaultzone = us
4. Создаем резервную копию файла конфигурации DAHDI каналов Asterisk
#mv /etc/asterisk/chan_dahdi.conf /etc/asterisk/chan_dahdi.conf.sample
5. Создаем пустой файл конфигурации DAHDI каналов Asterisk
#touch /etc/asterisk/chan_dahdi.conf
6. Открываем файл конфигурации DAHDI каналов Asterisk
#nano /etc/asterisk/chan_dahdi.conf
и вписываем туда:
[channels]
group=1
context=from-trunk
switchtype = euroisdn
signalling = pri_cpe
callerid=asreceived
usecallerid=yes
hidecallerid=no
callwaiting=yes
overlapdial=yes
pridialplan=unknown
usecallingpres=yes
callwaitingcallerid=yes
rxgain=0.0
txgain=0.0
threewaycalling=yes
echocancel=yes
echocancelwhenbridged=yes
faxdetect=both
faxbuffers=>8,full
channel => 1-15,17-31
7. Перечитываем конфигурацию DAHDI
# dahdi_cfg -vv
DAHDI Tools Version - 2.6.1
DAHDI Version: 2.6.1
Echo Canceller(s): HWEC
Configuration
======================
Dynamic span 1: driver eth, addr eth0/00:09:94:00:76:57, channels 31, timing 1
Channel map:Channel 01: Clear channel (A-law) (Echo Canceler: none) (Slaves: 01)
Channel 02: Clear channel (A-law) (Echo Canceler: none) (Slaves: 02)
Channel 03: Clear channel (A-law) (Echo Canceler: none) (Slaves: 03)
Channel 04: Clear channel (A-law) (Echo Canceler: none) (Slaves: 04)
Channel 05: Clear channel (A-law) (Echo Canceler: none) (Slaves: 05)
Channel 06: Clear channel (A-law) (Echo Canceler: none) (Slaves: 06)
Channel 07: Clear channel (A-law) (Echo Canceler: none) (Slaves: 07)
Channel 08: Clear channel (A-law) (Echo Canceler: none) (Slaves: 08)
Channel 09: Clear channel (A-law) (Echo Canceler: none) (Slaves: 09)
Channel 10: Clear channel (A-law) (Echo Canceler: none) (Slaves: 10)
Channel 11: Clear channel (A-law) (Echo Canceler: none) (Slaves: 11)Channel 12: Clear channel (A-law) (Echo Canceler: none) (Slaves: 12)
Channel 13: Clear channel (A-law) (Echo Canceler: none) (Slaves: 13)
Channel 14: Clear channel (A-law) (Echo Canceler: none) (Slaves: 14)
Channel 15: Clear channel (A-law) (Echo Canceler: none) (Slaves: 15)
Channel 16: D-channel (Default) (Echo Canceler: none) (Slaves: 16)
Channel 17: Clear channel (A-law) (Echo Canceler: none) (Slaves: 17)
Channel 18: Clear channel (A-law) (Echo Canceler: none) (Slaves: 18)
Channel 19: Clear channel (A-law) (Echo Canceler: none) (Slaves: 19)
Channel 20: Clear channel (A-law) (Echo Canceler: none) (Slaves: 20)
Channel 21: Clear channel (A-law) (Echo Canceler: none) (Slaves: 21)
Channel 22: Clear channel (A-law) (Echo Canceler: none) (Slaves: 22)
Channel 23: Clear channel (A-law) (Echo Canceler: none) (Slaves: 23)
Channel 24: Clear channel (A-law) (Echo Canceler: none) (Slaves: 24)
Channel 25: Clear channel (A-law) (Echo Canceler: none) (Slaves: 25)
Channel 26: Clear channel (A-law) (Echo Canceler: none) (Slaves: 26)
Channel 27: Clear channel (A-law) (Echo Canceler: none) (Slaves: 27)
Channel 28: Clear channel (A-law) (Echo Canceler: none) (Slaves: 28)
Channel 29: Clear channel (A-law) (Echo Canceler: none) (Slaves: 29)Channel 30: Clear channel (A-law) (Echo Canceler: none) (Slaves: 30)
Channel 31: Clear channel (A-law) (Echo Canceler: none) (Slaves: 31)
31 channels to configure.
Changing signalling on channel 1 from Unused to Clear channelChanging law on channel 1 from Mu-law to A-law
Setting echocan for channel 1 to none
Changing signalling on channel 2 from Unused to Clear channel
Changing law on channel 2 from Mu-law to A-law
Setting echocan for channel 2 to none
Changing signalling on channel 3 from Unused to Clear channel
Changing law on channel 3 from Mu-law to A-law
Setting echocan for channel 3 to none
Changing signalling on channel 4 from Unused to Clear channel
Changing law on channel 4 from Mu-law to A-law
Setting echocan for channel 4 to none
Changing signalling on channel 5 from Unused to Clear channel
Changing law on channel 5 from Mu-law to A-law
Setting echocan for channel 5 to none
Changing signalling on channel 6 from Unused to Clear channel
Changing law on channel 6 from Mu-law to A-law
Setting echocan for channel 6 to none
Changing signalling on channel 7 from Unused to Clear channel
Changing law on channel 7 from Mu-law to A-law
Setting echocan for channel 7 to none
Changing signalling on channel 8 from Unused to Clear channel
Changing law on channel 8 from Mu-law to A-law
Setting echocan for channel 8 to none
Changing signalling on channel 9 from Unused to Clear channel
Changing law on channel 9 from Mu-law to A-law
Setting echocan for channel 9 to none
Changing signalling on channel 10 from Unused to Clear channel
Changing law on channel 10 from Mu-law to A-law
Setting echocan for channel 10 to none
Changing signalling on channel 11 from Unused to Clear channel
Changing law on channel 11 from Mu-law to A-law
Setting echocan for channel 11 to none
Changing signalling on channel 12 from Unused to Clear channel
Changing law on channel 12 from Mu-law to A-law
Setting echocan for channel 12 to none
Changing signalling on channel 13 from Unused to Clear channel
Changing law on channel 13 from Mu-law to A-law
Setting echocan for channel 13 to none
Changing signalling on channel 14 from Unused to Clear channel
Changing law on channel 14 from Mu-law to A-lawSetting echocan for channel 14 to none
Changing signalling on channel 15 from Unused to Clear channel
Changing law on channel 15 from Mu-law to A-law
Setting echocan for channel 15 to none
Changing signalling on channel 16 from Unused to HDLC with FCS check
Setting echocan for channel 16 to none
Changing signalling on channel 17 from Unused to Clear channel
Changing law on channel 17 from Mu-law to A-law
Setting echocan for channel 17 to none
Changing signalling on channel 18 from Unused to Clear channel
Changing law on channel 18 from Mu-law to A-lawSetting echocan for channel 18 to none
Changing signalling on channel 19 from Unused to Clear channel
Changing law on channel 19 from Mu-law to A-law
Setting echocan for channel 19 to none
Changing signalling on channel 20 from Unused to Clear channel
Changing law on channel 20 from Mu-law to A-law
Setting echocan for channel 20 to none
Changing signalling on channel 21 from Unused to Clear channel
Changing law on channel 21 from Mu-law to A-law
Setting echocan for channel 21 to none
Changing signalling on channel 22 from Unused to Clear channel
Changing law on channel 22 from Mu-law to A-law
Setting echocan for channel 22 to none
Changing signalling on channel 23 from Unused to Clear channel
Changing law on channel 23 from Mu-law to A-law
Setting echocan for channel 23 to none
Changing signalling on channel 24 from Unused to Clear channel
Changing law on channel 24 from Mu-law to A-lawSetting echocan for channel 24 to none
Changing signalling on channel 25 from Unused to Clear channel
Changing law on channel 25 from Mu-law to A-law
Setting echocan for channel 25 to none
Changing signalling on channel 26 from Unused to Clear channel
Changing law on channel 26 from Mu-law to A-lawSetting echocan for channel 26 to none
Changing signalling on channel 27 from Unused to Clear channel
Changing law on channel 27 from Mu-law to A-law
Setting echocan for channel 27 to none
Changing signalling on channel 28 from Unused to Clear channel
Changing law on channel 28 from Mu-law to A-law
Setting echocan for channel 28 to none
Changing signalling on channel 29 from Unused to Clear channel
Changing law on channel 29 from Mu-law to A-law
Setting echocan for channel 29 to noneChanging signalling on channel 30 from Unused to Clear channel
Changing law on channel 30 from Mu-law to A-law
Setting echocan for channel 30 to none
Changing signalling on channel 31 from Unused to Clear channel
Changing law on channel 31 from Mu-law to A-law
Setting echocan for channel 31 to none
8. Рестартуем сервис DAHDI
# service dahdi restart
Unloading DAHDI hardware modules: done
Loading DAHDI hardware modules:
wct4xxp: [ OK ]
wcte12xp: [ OK ]
wct1xxp: [ OK ]
wcte11xp: [ OK ]
wctdm24xxp: [ OK ]
wcfxo: [ OK ]
wctdm: [ OK ]
wcb4xxp: [ OK ]
wctc4xxp: [ OK ]
xpp_usb: [ OK ]
Running dahdi_cfg: [ OK ]
9. Рестартуем сервис Asterisk
# service asterisk restart
Stopping safe_asterisk: [ OK ]
Shutting down asterisk: [ OK ]
Запускается asterisk:
10. Проверяем статусы DAHDI каналов.
#dahdi_tool
Все статусы должны быть ОК, No alarms
Из консоли Asterisk:
localhost*CLI> dahdi show channels
Chan Extension Context Language MOH Interpret Blocked State
pseudo default default In Service
1 from-trunk default In Service
2 from-trunk default In Service
3 from-trunk default In Service
4 from-trunk default In Service
5 from-trunk default In Service
6 from-trunk default In Service
7 from-trunk default In Service
8 from-trunk default In Service
9 from-trunk default In Service
10 from-trunk default In Service
11 from-trunk default In Service
12 from-trunk default In Service
13 from-trunk default In Service
14 from-trunk default In Service
15 from-trunk default In Service
17 from-trunk default In Service
18 from-trunk default In Service
19 from-trunk default In Service
20 from-trunk default In Service
21 from-trunk default In Service
22 from-trunk default In Service
23 from-trunk default In Service
24 from-trunk default In Service
25 from-trunk default In Service
26 from-trunk default In Service
27 from-trunk default In Service
28 from-trunk default In Service
29 from-trunk default In Service
30 from-trunk default In Service
31 from-trunk default In Service
localhost*CLI> dahdi show status
Description Alarms IRQ bpviol CRC Fra Codi Options LBO
Dynamic 'eth' span at 'eth0/00:09:94:00 OK 0 0 0 CAS Unk 0 db (CSU)/0-133 feet (DSX-1)
E1 Port:
# service asterisk restart
Stopping safe_asterisk: [ OK ]
Shutting down asterisk: [ OK ]
Запускается asterisk:
10. Проверяем статусы DAHDI каналов.
#dahdi_tool
Все статусы должны быть ОК, No alarms
Из консоли Asterisk:
localhost*CLI> dahdi show channels
Chan Extension Context Language MOH Interpret Blocked State
pseudo default default In Service
1 from-trunk default In Service
2 from-trunk default In Service
3 from-trunk default In Service
4 from-trunk default In Service
5 from-trunk default In Service
6 from-trunk default In Service
7 from-trunk default In Service
8 from-trunk default In Service
9 from-trunk default In Service
10 from-trunk default In Service
11 from-trunk default In Service
12 from-trunk default In Service
13 from-trunk default In Service
14 from-trunk default In Service
15 from-trunk default In Service
17 from-trunk default In Service
18 from-trunk default In Service
19 from-trunk default In Service
20 from-trunk default In Service
21 from-trunk default In Service
22 from-trunk default In Service
23 from-trunk default In Service
24 from-trunk default In Service
25 from-trunk default In Service
26 from-trunk default In Service
27 from-trunk default In Service
28 from-trunk default In Service
29 from-trunk default In Service
30 from-trunk default In Service
31 from-trunk default In Service
localhost*CLI> dahdi show status
Description Alarms IRQ bpviol CRC Fra Codi Options LBO
Dynamic 'eth' span at 'eth0/00:09:94:00 OK 0 0 0 CAS Unk 0 db (CSU)/0-133 feet (DSX-1)
Cronyx E1-L/M-DAHDI. Типовые настройки.
1) Transmit clock: Internal
2) E1 mode: CCS3) Crc4: Generate
4) Receiver gain: High
5) Monitoring channel bit: Off
6) Action on LOS/LOF: Remote Alarm
7) Line code: HDB3
8) Remote control: Disabled
Ethernet:
2) E1 mode: CCS3) Crc4: Generate
4) Receiver gain: High
5) Monitoring channel bit: Off
6) Action on LOS/LOF: Remote Alarm
7) Line code: HDB3
8) Remote control: Disabled
Ethernet:
*) MAC address: 00:09:94:00:76:57
1) Buffer size: 32 ms
2) Mode: Eth
3) DAHDI MAC address: 00:0c:29:38:75:e3
4) IP address/netmask: 10.200.16.233 / 245) Gateway IP address: 10.200.16.254
6) Negotiation: Automatic
1) Buffer size: 32 ms
2) Mode: Eth
3) DAHDI MAC address: 00:0c:29:38:75:e3
4) IP address/netmask: 10.200.16.233 / 245) Gateway IP address: 10.200.16.254
6) Negotiation: Automatic
Telnet:
1) Permitted address/netmask: 10.0.0.0 / 8
2) Inactivity timeout: 30 min
3) Change password...
1) Permitted address/netmask: 10.0.0.0 / 8
2) Inactivity timeout: 30 min
3) Change password...
Примечание:
DAHDI MAC address - это MAC адрес интерфейса сервера Asterisk, который смотрит на устройство Cronyx E1-L/M-DAHDI
Transmit clock - тип синхронизации. Когда устройство подключено к сети SDH ТТК выставить нужно From E1 port receiver
Crc4 - можно отключить генерацию кодов проверок на ошибки в потоке E1, если удаленная станция не поддерживает такой режим
Change password - установка пароля на Telnet.
При нормальном статусе в консоли Cronyx будет примерно следующее:
State: Normal
E1 Port: Sync=Int, High gain, HDB3, TS16=CCS, CRC4=Check, Mon=Off, Ok
Ethernet: 100Base-T, Full duplex, Ok
Файл /etc/asterisk/extensions.conf[general]
...
[globals]
OUTCRONYX=DAHDI/g1
[default]exten => _X.,1,Hangup
[macro-outtrunk];; Макрос для совершения звонков через Cronyx
exten => s,1,Dial(${OUTCRONYX}/${ARG1},120,rt)
exten => s,n,Busy()
exten => s,n,Congestion()
exten => s,n,Hangup()
[uss]exten => 01,1,Dial(${OUTCRONYX}/${EXTEN},120,r)
exten => 02,1,Dial(${OUTCRONYX}/${EXTEN},120,r)
exten => 03,1,Dial(${OUTCRONYX}/${EXTEN},120,r)
exten => 04,1,Dial(${OUTCRONYX}/${EXTEN},120,r)
[mestn]exten => _NXXXXXX,1,Macro(outtrunk,${EXTEN})
[uss-mestn]include => uss
include => mestn
[from-trunk]
exten => 9735998,1,Dial(SIP/9735998,120,r)
E1 Port: Sync=Int, High gain, HDB3, TS16=CCS, CRC4=Check, Mon=Off, Ok
Ethernet: 100Base-T, Full duplex, Ok
Пример использования каналов DAHDI в Asterisk
...
[globals]
OUTCRONYX=DAHDI/g1
[default]exten => _X.,1,Hangup
[macro-outtrunk];; Макрос для совершения звонков через Cronyx
exten => s,1,Dial(${OUTCRONYX}/${ARG1},120,rt)
exten => s,n,Busy()
exten => s,n,Congestion()
exten => s,n,Hangup()
[uss]exten => 01,1,Dial(${OUTCRONYX}/${EXTEN},120,r)
exten => 02,1,Dial(${OUTCRONYX}/${EXTEN},120,r)
exten => 03,1,Dial(${OUTCRONYX}/${EXTEN},120,r)
exten => 04,1,Dial(${OUTCRONYX}/${EXTEN},120,r)
[mestn]exten => _NXXXXXX,1,Macro(outtrunk,${EXTEN})
[uss-mestn]include => uss
include => mestn
[from-trunk]
exten => 9735998,1,Dial(SIP/9735998,120,r)
Возможные ошибки:
1. При рестарте DAHDI выдаются ошибки FAILED
[root@localhost ~]# service dahdi restart
Unloading DAHDI hardware modules: done
Loading DAHDI hardware modules:
FATAL: Module dahdi not found.
wct4xxp: FATAL: Module wct4xxp not found.
[FAILED]
wcte12xp: FATAL: Module wcte12xp not found.
[FAILED]
wct1xxp: FATAL: Module wct1xxp not found.
[FAILED]
wcte11xp: FATAL: Module wcte11xp not found.
[FAILED]
wctdm24xxp: FATAL: Module wctdm24xxp not found.
[FAILED]
wcfxo: FATAL: Module wcfxo not found.
[FAILED]
wctdm: FATAL: Module wctdm not found.
[FAILED]
wcb4xxp: FATAL: Module wcb4xxp not found.
[FAILED]
wctc4xxp: FATAL: Module wctc4xxp not found.
[FAILED]
xpp_usb: FATAL: Module xpp_usb not found.
[FAILED]
[FAILED]
wcte12xp: FATAL: Module wcte12xp not found.
[FAILED]
wct1xxp: FATAL: Module wct1xxp not found.
[FAILED]
wcte11xp: FATAL: Module wcte11xp not found.
[FAILED]
wctdm24xxp: FATAL: Module wctdm24xxp not found.
[FAILED]
wcfxo: FATAL: Module wcfxo not found.
[FAILED]
wctdm: FATAL: Module wctdm not found.
[FAILED]
wcb4xxp: FATAL: Module wcb4xxp not found.
[FAILED]
wctc4xxp: FATAL: Module wctc4xxp not found.
[FAILED]
xpp_usb: FATAL: Module xpp_usb not found.
[FAILED]
Решается переустановкой DAHDIВыполнить из папки исходных кодов DAHDI
#make clean
#make all
#make install
#make config
После этого скорее всего файл /etc/dahdi/system.conf нужно будет создать и сконфигурировать заново.
2. Не до конца выполняется команда dahdi_cfg или service dahdi restart
В конце выдается сообщение:
DAHDI dynamic span creation failed: File exists.
Скорее всего файл конфигурации занят сервисом Asterisk.
В данном случае необходимо остановить сервис asterisk, выполнить команды по рестартингу dahdi и вновь запустить asterisk
#service asterisk stop
#dahdi_cfg -vv
#service dahdi restart
#service asterisk start
3. Команда dahdi_tool выдает красный код ошибки - RED
В консоли Asterisk аналогичная ситуация
asterisk1*CLI> dahdi show status
Description Alarms IRQ bpviol CRC Fra Codi Options LBO
Dynamic 'eth' span at 'eth0/00:09:94:00 RED 0 0 0 CAS Unk 0 db (CSU)/0-133 feet (DSX-1)
Это значит, что Asterisk по каким-то причинам "не видит" устройство Cronyx E1-L/M-DAHDI. Необходимо проверить firewall, наличие пинга до устройства Cronyx E1-L/M-DAHDI(пинг должен быть обязательно), виден ли MAC адрес устройства Cronyx на интерфейсе сервера (команда arp) - устройство Cronyx E1-L/M-DAHDI обязательно должно находиться с сервером Asterisk в одной сети, в одном VLAN.
Полезные ссылки:
http://www.asterisk-pbx.ru/wiki/doku.php/asterisk_channels_dahdi