Образовательный проект «SnakeProject» Михаила Козлова

Навигация

⇒ Voice(Asterisk\Cisco) ⇐

CISCO

Microsoft

Powershell

Python

SQL\T-SQL

FreeBSD and Nix

Общая

WEB Разработка

ORACLE SQL \ JAVA

Мото

Стрельба, пневматика, оружие

Саморазвитие и психология


Asterisk 1.8 и FreeBSD 9 + Cisco Phones


Имеем свежеустановленную FreeBSD 9.0, задача поставить Asterisk 1.8 и попытаться подружить телефон 7940 Cisco. 

В первом варианте рассматривается вариант с SIP, во втором мы подружим их по SCCP

Установка Астериск тривиальна(собираем по своему вкусу, я например добавлял Н323):

cd /usr/ports/net/asterisk
make config && make && install clean
Добавим в автозагрузку:
echo 'asterisk_enable=YES' >> /etc/rc.conf
/usr/local/etc/rc.d/asterisk start

Подключаемся к консоли Астериска:
asterisk - rvvvvvvv
Теперь опишем сразу клиента sip(В нашем случае телефону я присвою номер 299):
ee /usr/local/et/asterisk/sip.conf

[general]
context=custom-test
allowguest=no
bindport=5060
bindaddr=172.16.0.1
qualify=yes

[299]
type=friend
contex=custom-test
user=299
secret=пароль
qualify=yes
nat=no
callerid=299
host=dynamic
deny=0.0.0.0/0.0.0.0
permit=172.16.0.0/255.255.255.0
disallow=all
allow=alaw
allow=ulaw

И диалплан для проверки(при звонке на 222 нам скажут привет, мир"):

[general]
allowguest=no
static=yes
writeprotect=no
clearglobalvars=no

[globals]

[default]
exten => _X!,1,Hangup()

[custom-test]
exten => 222,1,Answer()
exten => 222,n,Playback(hello-world)
exten => 222,n,Hangup()

Теперь к слову о настройке dhcp и tftp сервера:

tftp будем запускать через inetd:

Разкомментируем строчку(каталог можно задать любой другой):

ee /etc/inetd.conf

tftp dgram udp wait root /usr/libexec/tftpd tftpd -l -w -s /tftpboot

ee /etc/rc.conf

inetd_enable="YES"

Проверить:

sockstat | grep :69

Теперь dhcp(В данном случаем машина Freebsd имеет адрес 172.16.0.1, является и dhcp и tftp сервером):

ee /etc/rc.conf

dhcpd_enable="YES"
dhcpd_conf="/usr/local/etc/dhcpd.conf"
dhcpd_ifaces="em0
В данном случае em0 у меня интерфейс, на котором надо раздавать в сеть айпишники.

cd /usr/ports/net/isc-dhcp42-server

make install clean

ee /usr/local/etc/dhcpd.conf
option domain-name yourdomain";
option domain-name-servers 172.16.0.33, 172.16.0.38;

option option-150 code 150 = ip-address;
option option-66 code 66 = text;

default-lease-time 720000;
max-lease-time 720000;

ddns-update-style interim;

authoritative;

log-facility local7;

subnet 172.16.0.0 netmask 255.255.255.0 {
range 172.16.0.10 172.16.0.20;
option routers 172.16.0.1;
option subnet-mask 255.255.255.0;
option broadcast-address 172.16.0.255;
option option-150 172.16.0.1;
option ntp-servers 172.16.0.1;
option domain-name yourdomain";
option domain-name-servers 172.16.0.1;
}

Теперь качаем прошивку для Телефончика 7940 с просторов интернета, ибо циско на халяву не раздает))) и закачиваем в /tftpboot

У меня в наличии была прошивка 3-08-8-00.

Список файлов нужных нам:

asteriskBSD# ls /tftpboot/ | sort
P003-08-8-00.bin
P003-08-8-00.sbn
P0S3-08-8-00.loads
P0S3-08-8-00.sb2
SIPXXXXXXXX.cnf
SIPDefault.cnf

Где файл SIPXXXXXXXX.cnf" вместо ХХХХХХХХ пишем мак-адрес телефона.

Итак, что внутри:

ee SIPDefault.cnf

# SIP Default Generic Configuration File

#erase protflash
#reset
#Disable debug: tty mon 0

# Image Version
image_version: P0S3-08-8-00(тут название моей версии прошивки)

# Proxy Server
proxy1_address: 172.16.0.1(адрес моей фряхи) ; Can be dotted IP or FQDN
proxy1_port: 5060

# Proxy Registration (0-disable (default), 1-enable)
proxy_register: 1

# Phone Registration Expiration [1-3932100 sec] (Default — 3600)
timer_register_expires: 3600

# Codec for media stream (g711ulaw (default), g711alaw, g729a)
preferred_codec: g711ulaw

# TOS bits in media stream [0-5] (Default — 5)
tos_media: 5

# Inband DTMF Settings (0-disable, 1-enable (default))
dtmf_inband: 1

# Out of band DTMF Settings (none-disable, avt-avt enable (default), avt_always — always avt )
dtmf_outofband: avt

# DTMF dB Level Settings (1-6dB down, 2-3db down, 3-nominal (default), 4-3db up, 5-6dB up)
dtmf_db_level: 3

# SIP Timers
timer_t1: 500 ; Default 500 msec
timer_t2: 4000 ; Default 4 sec
sip_retx: 10 ; Default 10
sip_invite_retx: 6 ; Default 6
timer_invite_expires: 180 ; Default 180 sec

####### New Parameters added in Release 2.0 #######

# Dialplan template (.xml format file relative to the TFTP root directory)
dial_template: dialplan

# TFTP Phone Specific Configuration File Directory
# tftp_cfg_dir: ./cisco/" ; Example: ./sip_phone/

# Time Server (There are multiple values and configurations refer to Admin Guide for Specifics)
sntp_server: 172.16.0.1(адрес моей фряхи) ; SNTP Server IP Address
## sntp_mode: directedbroadcast ; unicast, multicast, anycast, or directedbroadcast (default)
time_zone: BT ; Time Zone Phone is in
dst_offset: 01/00 ; Offset from Phone’s time when DST is in effect
dst_start_month: March ; Month in which DST starts
dst_start_day: " ; Day of month in which DST starts
dst_start_day_of_week: Sunday ; Day of week in which DST starts
dst_start_week_of_month: 8 ; Week of month in which DST starts
dst_start_time: 2 ; Time of day in which DST starts
dst_stop_month: Oct ; Month in which DST stops
dst_stop_day: " ; Day of month in which DST stops
dst_stop_day_of_week: Sunday ; Day of week in which DST stops
dst_stop_week_of_month: 8 ; Week of month in which DST stops 8=last week of month
dst_stop_time: 3 ; Time of day in which DST stops
dst_auto_adjust: 1 ; Enable(1-Default)/Disable(0) DST automatic adjustment
time_format_24hr: 1 ; Enable(1 — 24Hr Default)/Disable(0 — 12Hr)

date_format: D/M/Y"

# Do Not Disturb Control (0-off, 1-on, 2-off with no user control, 3-on with no user control)
dnd_control: 1 ; Default 0 (Do Not Disturb feature is off)

# Caller ID Blocking (0-disabled, 1-enabled, 2-disabled no user control, 3-enabled no user control)
callerid_blocking: 0 ; Default 0 (Disable sending all calls as anonymous)

# Anonymous Call Blocking (0-disabled, 1-enabled, 2-disabled no user control, 3-enabled no user control)
anonymous_call_block: 0 ; Default 0 (Disable blocking of anonymous calls)

# DTMF AVT Payload (Dynamic payload range for AVT tones — 96-127)
dtmf_avt_payload: 101 ; Default 101

# Sync value of the phone used for remote reset
sync: 1 ; Default 1

####### New Parameters added in Release 2.1 #######

# Backup Proxy Support
#proxy_backup: sip.pbxware.ru" ; Dotted IP of Backup Proxy
#proxy_backup_port: 5060 ; Backup Proxy port (default is 5060)

# Emergency Proxy Support
#proxy_emergency: sip.pbxware.ru" ; Dotted IP of Emergency Proxy
#proxy_emergency_port: 5060 ; Emergency Proxy port (default is 5060)

# Configurable VAD option
enable_vad: 0 ; VAD setting 0-disable (Default), 1-enable

####### New Parameters added in Release 2.2 ######

# NAT/Firewall Traversal
nat_enable: 0 ; 0-Disabled (default), 1-Enabled
nat_address: " ; WAN IP address of NAT box (dotted IP or DNS A record only)
voip_control_port: 5060 ; UDP port used for SIP messages (default — 5060)
start_media_port: 16384 ; Start RTP range for media (default — 16384)
end_media_port: 16484 ; End RTP range for media (default — 32766)
nat_received_processing: 0 ; 0-Disabled (default), 1-Enabled

# Outbound Proxy Support
#outbound_proxy: sip.pbxware.ru" ; restricted to dotted IP or DNS A record only
#outbound_proxy_port: 5060 ; default is 5060

####### New Parameter added in Release 3.0 #######

# Allow for the bridge on a 3way call to join remaining parties upon hangup
cnf_join_enable : 1 ; 0-Disabled, 1-Enabled (default)

####### New Parameters added in Release 3.1 #######

# Allow Transfer to be completed while target phone is still ringing
semi_attended_transfer: 1 ; 0-Disabled, 1-Enabled (default)

# Telnet Level (enable or disable the ability to telnet into the phone)
telnet_level: 0 ; 0-Disabled (default), 1-Enabled, 2-Privileged

####### New Parameters added in Release 4.0 #######

# XML URLs
#services_url: " ; URL for external Phone Services
#directory_url: " ; URL for external Directory location
logo_url: http://192.168.0.1/7940.bmp" ; URL for branding logo to be used on phone displ(Можно впаять на телефон свое лого)

# HTTP Proxy Support
http_proxy_addr: " ; Address of HTTP Proxy server
#http_proxy_port: 80 ; Port of HTTP Proxy Server (80-default)

# Dynamic DNS/TFTP Support
dyn_dns_addr_1: " ; restricted to dotted IP
dyn_dns_addr_2: " ; restricted to dotted IP
dyn_tftp_addr: " ; restricted to dotted IP

# Remote Party ID
remote_party_id: 0 ; 0-Disabled (default), 1-Enabled

####### New Parameters added in Release 4.4 #######

# Call Hold Ringback (0-off, 1-on, 2-off with no user control, 3-on with no user control)
call_hold_ringback: 0 ; Default 0 (Call Hold Ringback feature is off)

####### New Parameters added in Release 6.0 #######

# Dialtone Stutter for MWI
stutter_msg_waiting: 1 ; 0-Disabled (default), 1-Enabled

# RTP Call Statistics (SIP BYE/200 OK message exchange)
call_stats: 1 ; 0-Disabled (default), 1-Enabled

Теперь  SIPXXXXXXXX.cnf

line1_name: 299
line1_authname: 299
line1_displayname: 299
line1_password: пароль"

Итак, мы закончили, но предупрежу сразу, у меня возникла проблема, телефон не хотел регистрироваться в астериске, проблема решилась так:

ee /usr/local/etc/asterisk/modules.conf

noload => res_timing_dahdi.so

Не забываем перезагрузить модули:

asterisk -rvvvvvv

module reload

Послушать пакетики на сетевом интерфейсе можно командой:

tcpdump -ni Ваш интерфейс"

 

Теперь попробуем подружить 7940 с Астериском по SCCP 

С цискоком(конечно не просто так) или с других просторов интернета качаем прошивку для телефончика, список нужных файлов:

asteriskBSD# ls /tftpboot/ | sort
P00308010100.bin
P00308010100.loads
P00308010100.sb2
P00308010100.sbn

Создаем файл XMLDefault.cnf.xml:

<Default>
<callManagerGroup>
<members>
<member priority="0>
<callManager>
<ports>
<ethernetPhonePort>2000</ethernetPhonePort>
</ports>
<processNodeName></processNodeName>
</callManager>
</members>
<loadInformation8 model="IP Phone 7940>P00308010100</loadInformation8>
</callManagerGroup>
<authenticationURL></authenticationURL>
<directoryURL></directoryURL>
<idleURL></idleURL>
<informationURL></informationURL>
<messagesURL></messagesURL>
<servicesURL></servicesURL>
</Default>

И файлик SEPMACadressTel.cnf.xml:

<device>
<devicePool>
<callManagerGroup>
<members>
<member priority="0>
<callManager>
<ports>
<ethernetPhonePort>2000</ethernetPhonePort>
</ports>
<processNodeName>Server adress</processNodeName>
</callManager>
</member>
</members>
</callManagerGroup>
</devicePool>
<versionStamp>{Dec 25 2012 00:00:00}</versionStamp>
<loadInformation>P00308010100</loadInformation>
</device>

У меня установлен Астериск 1.8.1, для него я качнул модуль SCCP:

http://sourceforge.net/projects/chan-sccp-b/files/V4/

tar -xvf Chan_SCCP-4_STABLE.tar.gz

cd Chan_SCCP-4_STABLE

make clean

./configure

make && make install

Модуль у меня с первого раза поставился без ошибок, далее подключаем его:

ee /usr/local/etc/asterisk/modules.conf

noload => chan_skinny.so
load => chan_sccp.so
load => res_features.so

asterisk -rvvvvvv

module load chan_sccp.so

quit

Создаем конфиг SCCP:

ee /usr/local/etc/asterisk/sccp.conf

;=========================================================================================
;
; general definitions
;
;=========================================================================================
[general]
servername = Адрес нашего сервера
keepalive = 60
debug = 0
context = Контекст в extensions.conf
dateformat = D.M.Y
bindaddr = Адрес нашего сервера
port = 2000
disallow=all
allow=alaw
allow=ulaw
allow=g729
firstdigittimeout = 16
digittimeout = 8
autoanswer_ring_time = 1
autoanswer_tone = 0×32
remotehangup_tone = 0×32
transfer_tone = 0
callwaiting_tone = 0x2d
musicclass=default
language=en
deny=0.0.0.0/0.0.0.0
permit=Наша сеть/Маска сети
dnd = on
sccp_tos = 0×68
sccp_cos = 4
audio_tos = 0xB8
audio_cos = 6
video_tos = 0×88
video_cos = 5
echocancel = on
silencesuppression = off
trustphoneip = no
private = on
callanswerorder=oldestfirst
protocolversion=17

hotline_enabled=yes ;can devices without configuration register
hotline_context=custom-test ; context for hotline
hotline_extension=custom-test ; extension will be dialed on offHook
;=========================================================================================
;
; actual definitions
;
;=========================================================================================

[SEP001EBE900067] ; MAC of 7937G
description = Hell Tel
devicetype = 7940
type = device
button = line, 299
deny=0.0.0.0/0.0.0.0 ; Same as general
permit=Наша сеть/Маска сети ; Same as general
imageversion = Название нашей скачанной прошивки
pickupcontext = Контекст в extensions.conf
tzoffset = +0
transfer = on
trustphoneip = no
directrtp=off
earlyrtp = progress
private = on
mwilamp = on
mwioncall = off
setvar=testvar=value
cfwdall = on
imageversion = Название нашей скачанной прошивки

[299]
id = 299
type = line
label = Phone 299
description = Line 299
cid_name = Hell Tel
cid_num = 299
echocancel = off
context = Контекст в extensions.conf
transfer = on
vmnum = 600
trnsfvm = 1000
secondary_dialtone_digits = 9
secondary_dialtone_tone = 0×22
musicclass=default
language=en
echocancel = on
silencesuppression = off

 

/usr/local/etc/rc.d/asterisk restart

 

Теперь можем зайти в консоль и проверить регистрацию нашего телефончика:

asterisk -rvvvvvv

sccp show devices


Комментарии пользователей

Эту новость ещё не комментировалиНаписать комментарий
Анонимам нельзя оставоять комментарии, зарегистрируйтесь!

Контакты Группа ВК Сборник материалов по Cisco, Asterisk, Windows Server, Python и Django, SQL и T-SQL, FreeBSD и LinuxКод обмена баннерами Видео к IT статьям на YoutubeВидео на другие темы Смотреть
Мои друзья: Советы, помощь, инструменты для сис.админа, статическая и динамическая маршрутизация, FreeBSD

© Snakeproject.ru создан в 2013 году.
При копировании материала с сайта - оставьте ссылку.
Весь материал на сайте носит ознакомительный характер,
за его использование другими людьми, автор ответственности не несет.

Рейтинг@Mail.ru
Рейтинг@Mail.ru Яндекс.Метрика





Поддержать автора и проект