Страница 6 из 6

Re: Asterisk 1.8.5.0 и GSM-шлюз AddPac AP-GS1001.

Добавлено: 07 сен 2011, 20:20
BorisTheBlade
там тоже предлагают настройки покрутить, правда не уточняют телнетом или через GUЙ

Re: Asterisk 1.8.5.0 и GSM-шлюз AddPac AP-GS1001.

Добавлено: 26 сен 2011, 22:49
kmpp1
Большое спасибо всем. Особенно Vlad1983 за методические и практические советы,а dedу за наставничество на путь истинный :).
Конечная конфигурация сети приняла вид :
Asterisk - NAT1 - Интернет - NAT2 - addpac
2а СИП-провайдера.
PROV1 - только входящие, звонок приходит одновременно на 1003 и 1004.
PROV2 - только исходящие при чем при звонках всюду кроме Москвы.
addpac - только исходящие на Москву (в префиксах в конфиге возможны ошибки, если будете копировать...). Входящие не проходят. Но и не надо.
<a.b.c.d> - внешний IP на роутере с NAT1.
<x.y.z.a> - внешний IP на роутере с NAT2.
Реализована запись разговоров в wav-файлы.
Абсолютно не прорабатывалась безопасность.
Пароли на сипофонах нужны конечно более сложные...
allowguest=yes выставить в no.


apos.cfg на шлюзе. чтобы работало за вторым NAT надо еще прописать в конфу внешний ip <x.y.z.a>, у меня сделано, но здесь нет.

Код: Выделить всё

!
! APOS(tm) configuration saved from vty
!  2011/09/04 17:24:52 
!
version 8.51.002
!
hostname GS1001
!
username root password router administrator
username guest password guest user
!
!
interface Loopback0
 ip address 127.0.0.1 255.0.0.0
!
interface FastEthernet0/0
 no ip address
 speed auto
 no qos-control
!
interface FastEthernet0/1
 ip address 192.168.0.3 255.255.255.0
 speed auto
 no qos-control
!
ip route 0.0.0.0 0.0.0.0 192.168.0.1
!
!
!
!
ftp server
http server
!
logging command
logging event 4-warning
logging on
! 
! 
! 
! 
! VoIP configuration. 
! 
! 
! Voice service voip configuration. 
! 
voice service voip 
 protocol sip
 dtmf-relay rfc-2833
 fax protocol t38 redundancy 0 
 fax rate 9600 
 h323 call start fast 
 h323 call tunnel enable 
 no call-barring unconfigured-ip-address
  call-barring allow-ip 192.168.0.2
 voip-inbound-call-barring enable
 voip-inbound-call-barring allow-digits 11 11
! 
! 
! Voice port configuration. 
! 
! GSM 
voice-port 0/0 
 connection plar 1003 
 caller-id enable 
! 
! 
! FXO 
voice-port 0/1 
 connection plar 1004 
 no caller-id enable 
! 
! 
! 
! 
! service port group configuration. 
! 
! 
! 
! Pots peer configuration. 
! 
dial-peer voice 1 pots
 destination-pattern T 
! 
dial-peer voice 900 pots
 destination-pattern 8T 
 port 0/0 
 no register e164 
! 
! 
! 
! Voip peer configuration. 
! 
dial-peer voice 10100 voip 
 destination-pattern [0-79]T 
 session target sip-server  
 session protocol sip 
 voice-class codec 0 
 no vad
 dtmf-relay rtp-2833 
! 
! 
! 
! 
! 
! 
gatekeeper
! 
! 
! Gateway configuration. 
! 
gateway 
 h323-id voip.192.168.0.3 
 gkip 192.168.0.3 1719 128 
 no ignore-msg-from-other-gk 
! 
! 
! Codec classes configuration. 
! 
voice class codec 0 
 codec preference 1 g711alaw 
 codec preference 2 g711ulaw 
! 
! 
! 
! SIP UA configuration. 
! 
sip-ua 
 sip-server 192.168.0.2 
 hook-flash-info-ignore 
! 
! 
! Tones 
!
! 
! 
voip-interface ip FastEthernet0/1
!
line console
!
line vty
!
gsm dev-restart-by-unreg 300
!
gsm 0/0
 sms-language utf8
!

sip.conf

Код: Выделить всё

[general]
context=incoming
allowguest=yes
udpbindaddr=0.0.0.0:5060
disallow=all
allow=all
mohinterpret=default
language=en
dtmfmode=rfc2833
videosupport=no
externaddr=<a.b.c.d>
localnet=192.168.0.0/255.255.255.0
register=><sip1-login>:<sip1-passw>@sip.prov1.ru:9060/s
register=><sip2-login>:<sip2-passw>@sip.prov2.ru:5060
nat=yes

[PROV1]
type=friend
username=<sip1-login>
secret=<sip1-passw>
context=incoming
host=sip.prov1.ru
port=9060
fromuser=<sip1-login>
nat=yes
canreinvite=no
qualify=yes
dtmfmode=rfc2833
disallow=all
allow=alaw
insecure=port,invite

[addpac]
type=peer
context=zona
host=<x.y.z.a>
port=5060
canreinvite=no
disallow=all
allow=alaw
insecure=port,invite
dtmfmode=rfc2833
nat=yes

[PROV2]
type=peer
username=<sip2-login>
secret=<sip2-passw>
context=zona
host=sip.prov2.ru
port=5060
fromuser=<sip2-login>
nat=yes
qualify=no
allow=alaw

[1001]
type=friend
context=zona
username=1001
host=dynamic
secret=1001
nat=yes
canreinvite=no
qualify=yes
sipreinvite=no
allow=alaw

[1002]
type=friend
context=zona
username=1002
host=dynamic
secret=1002
nat=yes
canreinvite=no
qualify=yes
sipreinvite=no
allow=alaw

[1003]
type=friend
context=zona
username=1003
host=dynamic
secret=1003
nat=yes
canreinvite=no
qualify=no
sipreinvite=no
allow=alaw

[1004]
type=friend
context=zona
username=1004
host=dynamic
secret=1004
nat=yes
canreinvite=no
qualify=yes
sipreinvite=no
allow=alaw

[1005]
type=friend
context=zona
username=1005
host=dynamic
secret=1005
nat=yes
canreinvite=no
qualify=yes
sipreinvite=no
allow=alaw

[1006]
type=friend
context=zona
username=1006
host=dynamic
secret=1006
nat=yes
canreinvite=no
qualify=yes
sipreinvite=no
allow=alaw
extensions.conf

Код: Выделить всё

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

[globals]
CONSOLE=Console/dsp
IAXINFO=guest
TRUNK=DAHDI/G2
TRUNKMSD=1

[general]
autofallthrough=yes

[default]

[incoming]
exten=> s,1,Set(myid=${CALLERID(ani)})
exten=> s,n,Set(fname=${STRFTIME(${EPOCH},,%Y%m%d%H%M)}-${CALLERID(number)}-${EXTEN})
exten=> s,n,MixMonitor(/home/svv/${fname}.wav)
exten=> s,n,Answer
exten=> s,n,NoOp(${myid})
exten=> s,n,Dial(SIP/1003&SIP/1004,30,T)
exten=> s,n,Hangup()

[zona]
exten => _100[123456],1,Set(fname=${STRFTIME(${EPOCH},,%Y%m%d%H%M)}-${CALLERID(number)}-${EXTEN})
exten => _100[123456],n,MixMonitor(/home/svv/${fname}.wav)
exten => _100[123456],n,Dial(SIP/${EXTEN},30,T)
exten => _100[123456],n,Hangup()
exten => _8495XXXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8499XXXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _896236XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _896372XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _896376XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _896392XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89639[67]XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _896399XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89017XXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8967[0-2]XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89688XXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89689XXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8968[67]XXXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89647[0-2]XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89647[6-9]XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8965[2-4]XXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89651XXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89652[0-4]XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89629XXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89637[78]XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _896371[4-9]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _896375[1-9]XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _89645[0-3]XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89645[5-9]XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89646[2-4]XXXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _89091[5-6]XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89096[2-9]XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89099XXXXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _89636XXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _896371[0-3]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8963750XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _89037XXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89039[6-7]XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89055XXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89057XXXXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _89060XXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89067XXXXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _89030[0-1]XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8903[1-2]XXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8903363XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89035XXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89036[1-2]XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89036[6-8]XXXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _892510[1-6]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925108XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925130XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925136XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925139XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925220XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _892528[5-8]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _892530[0-5]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89253[0-1][0-47-9]XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _89253[1-6][6-90-2]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89253[6-8][5-90-4]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925232XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _89252[3-4][4-6]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89252[4-5][8-90-7]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89252[5-7][90-2],1,Goto(zona_msk,${EXTEN},1)

exten => _892527[4-8]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _892528[0-2]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _892513[7-8]XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _8925[1-2][4-90]XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925532XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _892521[0-9]XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _8925[1-2][4-90]XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925532XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _892522[1-5]XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _8925[2-3][7-90]XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925428XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _892566[3-5]XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _8925100XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925107XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89251[0-2]9XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _892513[1-5]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _892528[3-4]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925289XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _8925306XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925315XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _892539[0-9]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925424XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _89295XXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89299XXXXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _89260XXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8936600XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _8925273XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925279XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _8925991XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _892599[7-9]XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _89296XXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89250XXXXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _89258XXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925920XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _8925922XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _892596[0-1]XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _89259[6-7][7-90]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925974XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _8925985XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _892554[2-5]XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _8925585XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925589XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _8925642XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925646XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _89257XXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _892541[0-1]XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _8925500XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925502XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _89255[0-1][4-90]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89255[7-8]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925226XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925231XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _8925247XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8925258XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _892536[3-4]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8985XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _891910XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8919139XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _891941[0-1]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _891972XXXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _89197[6-7]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8910015XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _8910019XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89100[4-5][8-90]XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _89100120XXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89100130XXX,1,Goto(zona_msk,${EXTEN},1)

exten => _8916XXXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89175XXXXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _891000[0-5]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _891008[1-9]XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _891000[8-9]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _891006[0-2]XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _8919784XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8919786XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _891996XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8919970XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _891999XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _89104XXXXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _8915[0-4]XXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _890118XXXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _890140XXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8901461XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _8901464XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8901470XXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _89015XXXXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _890190XXXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _890198[2-3]XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _890142XXXXX,1,Goto(zona_msk,${EXTEN},1)

exten => _8901209XXXX,1,Goto(zona_msk,${EXTEN},1)
exten => _8901205XXXX,1,Goto(zona_msk,${EXTEN},1)







exten => _X.,1,Set(fname=${STRFTIME(${EPOCH},,%Y%m%d%H%M)}-${CALLERID(number)}-${EXTEN})
exten => _X.,n,MixMonitor(/home/svv/${fname}.wav)
exten => _X.,n,Dial(SIP/${EXTEN}@PROV2,90,T)
exten => _X.,n,Hangup()


[zona_msk]

exten => _X.,1,Set(fname=${STRFTIME(${EPOCH},,%Y%m%d%H%M)}-${CALLERID(number)}-${EXTEN})
exten => _X.,n,MixMonitor(/home/svv/${fname}.wav)
exten => _X.,n,Dial(SIP/${EXTEN}@addpac,90,T)
exten => _X.,n,Hangup()

[internal]
include => zona


Re: Asterisk 1.8.5.0 и GSM-шлюз AddPac AP-GS1001.

Добавлено: 26 сен 2011, 23:11
ded
Если можно - спрячьте конфиги под спойлер, будет гораздо читабельней.
kmpp1 писал(а):Большое спасибо всем. Особенно Vlad1983 за методические и практические советы,а dedу за наставничество на путь истинный :)
Интересно, что моя точка зрения не поменялась в течение бурной дискуссии, а у топикстартера - на 180 градусов. Что же происходит с людьми?