Столкнулся с небольшой проблемой, нужен совет.
У клиента периодически отваливается интернет (частые пропадания электроэнергии на СО провайдера).
Т.к. были оформлены договора на SIP-транки (с привязкой по IP), пришлось выставить транзитный астериск (1.6) на колокэйшн, в офис завел резервного провайдера, настроил два тунеля, ну и все работало идеально, пока не решили подключить sip-линию от Голдена.
В офисе (asterisk 1.4 за NAT-ом)
extention.conf
Код: Выделить всё
exten => _0[69]3XXXXXXX,1,Macro(stddial,colocol,${EXTEN},_мой_номер_лайфа_)
exten => _0[69]7XXXXXXX,1,Macro(stddial,colocol,${EXTEN},_мой_номер_киевстар_)
exten => _NXXXXXX,1,Macro(stddial,colocol,${EXTEN},_мой_номер_голдена_)
...
[macro-stddial]
exten => s,1,NoOp(Dial from cid:${ARG3} to dst:${ARG2} via peer:${ARG1})
exten => s,n,Set(CALLERID(num)=${ARG3})
exten => s,n,Set(CALLERID(name)=${ARG3})
exten => s,n,Set(MONITOR_FILENAME=out-${ARG2}-${STRFTIME(${EPOCH},Europe/Kiev,%C%y_%m_%d-%H_%M_%S)})
exten => s,n,Set(BASE=${STRFTIME(${EPOCH},Europe/Kiev,%y/%m/%d)})
exten => s,n,MixMonitor(${MONITOR_FILENAME}.wav,,/etc/asterisk/rec ^{MONITOR_FILENAME} ^{BASE})
exten => s,n,Set(AUDIOHOOK_INHERIT(MixMonitor)=yes)
exten => s,n,Dial(SIP/${ARG1}/${ARG2},300,T)
exten => s,n,Hangup
...
Код: Выделить всё
[colocol]
type=peer
context=colocol_in
host=192.168.222.222
deny=0.0.0.0/0.0.0.0
permit=192.168.222.222/255.255.255.255
nat=yes
insecure=port,invite
canreinvite=no
qualify=yes
dtmfmode=rfc2833
disallow=all
allow=ulaw
allow=alaw
call-limit=20
...
sip.conf
Код: Выделить всё
[general]
register=_мой_номер_голдена_:_мой_пароль_@62.64.127.43:5060/_мой_номер_голдена_
...
[office]
type=friend
context=from-internal
host=192.168.100.254
deny=all
permit=192.168.100.254/255.255.255.255
nat=yes
insecure=port,invite
canreinvite=no
qualify=yes
dtmfmode=rfc2833
allow=ulaw
allow=alaw
call-limit=20
....
[GT]
type=friend
context=from-pstn
disallow=all
deny=0.0.0.0/0.0.0.0
host=62.64.127.43
username=_мой_номер_голдена_
fromuser=_мой_номер_голдена_
secret=_мой_пароль_
permit=62.64.127.43/255.255.255.252
qualify=yes
allow=ulaw
allow=alaw
dtmfmode=rfc2833
insecure=port,invite
canreinvite=no
call-limit=1
...
Код: Выделить всё
...
exten => _0[69]3XXXXXXX/_мой_номер_лайфа_,1,Dial(SIP/LIFE/${EXTEN},300,)
exten => _0[69]7XXXXXXX/_мой_номер_киевстар_,1,Dial(SIP/KS/${EXTEN},300,)
exten => _NXXXXXX/_мой_номер_голдена_,1,Dial(SIP/GT/${EXTEN},300,)
...
Код: Выделить всё
Audio is at 192.168.100.254 port 14154
Adding codec 0x4 (ulaw) to SDP
Adding codec 0x8 (alaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 192.168.222.222:5060:
INVITE sip:2551411@192.168.222.222 SIP/2.0
Via: SIP/2.0/UDP 192.168.100.254:5060;branch=z9hG4bK46461d6a;rport
From: "_мой_номер_голдена_" <sip:_мой_номер_голдена_@192.168.100.254>;tag=as7fad163a
To: <sip:2551411@192.168.222.222>
Contact: <sip:_мой_номер_голдена_@192.168.100.254>
Call-ID: 79acaf8b1f4dc8195bfbdd3b07971584@192.168.100.254
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Max-Forwards: 70
Date: Thu, 04 Apr 2013 10:30:26 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces
Content-Type: application/sdp
Content-Length: 291
v=0
o=root 3086 3086 IN IP4 192.168.100.254
s=session
c=IN IP4 192.168.100.254
t=0 0
m=audio 14154 RTP/AVP 0 8 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv
---
-- Called colocol/2551411
<--- SIP read from 192.168.222.222:5060 --->
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 192.168.100.254:5060;branch=z9hG4bK46461d6a;received=192.168.100.254;rport=5060
From: "_мой_номер_голдена_" <sip:_мой_номер_голдена_@192.168.100.254>;tag=as7fad163a
To: <sip:2551411@192.168.222.222>;tag=as66fcd551
Call-ID: 79acaf8b1f4dc8195bfbdd3b07971584@192.168.100.254
CSeq: 102 INVITE
Server: Asterisk 1.6.2.20
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Length: 0
<------------->
--- (10 headers 0 lines) ---
Transmitting (NAT) to 192.168.222.222:5060:
ACK sip:2551411@192.168.222.222 SIP/2.0
Via: SIP/2.0/UDP 192.168.100.254:5060;branch=z9hG4bK46461d6a;rport
From: "_мой_номер_голдена_" <sip:_мой_номер_голдена_@192.168.100.254>;tag=as7fad163a
To: <sip:2551411@192.168.222.222>;tag=as66fcd551
Contact: <sip:_мой_номер_голдена_@192.168.100.254>
Call-ID: 79acaf8b1f4dc8195bfbdd3b07971584@192.168.100.254
CSeq: 102 ACK
User-Agent: Asterisk PBX
Max-Forwards: 70
Content-Length: 0
---
[2013-04-04 13:30:26] WARNING[3137]: chan_sip.c:12772 handle_response_invite: Received response: "Forbidden" from '"_мой_номер_голдена_" <sip:_мой_номер_голдена_@192.168.100.254>;tag=as7fad163a'
-- SIP/colocol-09adddb0 is circuit-busy
Really destroying SIP dialog '79acaf8b1f4dc8195bfbdd3b07971584@192.168.100.254' Method: INVITE
== Everyone is busy/congested at this time (1:0/1/0)
Код: Выделить всё
<--- SIP read from UDP:192.168.100.254:5060 --->
INVITE sip:2551411@192.168.222.222 SIP/2.0
Via: SIP/2.0/UDP 192.168.100.254:5060;branch=z9hG4bK5144ecae;rport
From: "_мой_номер_голдена_" <sip:_мой_номер_голдена_@192.168.100.254>;tag=as0bf122bd
To: <sip:2551411@192.168.222.222>
Contact: <sip:_мой_номер_голдена_@192.168.100.254>
Call-ID: 69be113a51d0bb816da8c1fd2a85ce2f@192.168.100.254
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Max-Forwards: 70
Date: Thu, 04 Apr 2013 10:30:56 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces
Content-Type: application/sdp
Content-Length: 291
v=0
o=root 3086 3086 IN IP4 192.168.100.254
s=session
c=IN IP4 192.168.100.254
t=0 0
m=audio 16292 RTP/AVP 0 8 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv
<------------->
--- (14 headers 14 lines) ---
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
Sending to 192.168.100.254 : 5060 (no NAT)
Using INVITE request as basis request - 69be113a51d0bb816da8c1fd2a85ce2f@192.168.100.254
<--- Reliably Transmitting (no NAT) to 192.168.100.254:5060 --->
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 192.168.100.254:5060;branch=z9hG4bK5144ecae;received=192.168.100.254;rport=5060
From: "_мой_номер_голдена_" <sip:_мой_номер_голдена_@192.168.100.254>;tag=as0bf122bd
To: <sip:2551411@192.168.222.222>;tag=as431bd2e5
Call-ID: 69be113a51d0bb816da8c1fd2a85ce2f@192.168.100.254
CSeq: 102 INVITE
Server: Asterisk 1.6.2.20
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Length: 0
<------------>
Scheduling destruction of SIP dialog '69be113a51d0bb816da8c1fd2a85ce2f@192.168.100.254' in 32000 ms (Method: INVITE)
<--- SIP read from UDP:192.168.100.254:5060 --->
ACK sip:2551411@192.168.222.222 SIP/2.0
Via: SIP/2.0/UDP 192.168.100.254:5060;branch=z9hG4bK5144ecae;rport
From: "_мой_номер_голдена_" <sip:_мой_номер_голдена_@192.168.100.254>;tag=as0bf122bd
To: <sip:2551411@192.168.222.222>;tag=as431bd2e5
Contact: <sip:444960707@192.168.100.254>
Call-ID: 69be113a51d0bb816da8c1fd2a85ce2f@192.168.100.254
CSeq: 102 ACK
User-Agent: Asterisk PBX
Max-Forwards: 70
Content-Length: 0
Код: Выделить всё
exten => _NXXXXXX,1,Dial(SIP/GT/${EXTEN},300,)
Если же добавить в офисе
Код: Выделить всё
exten => s,n,Set(CALLERID(num)=${ARG3}:_мой_пароль_)
Ну вот, вроде все описал, теперь можно бить...