The OpenNET Project / Index page

[ новости/++ | форум | wiki | теги ]



"asterisk за натом и перенаправление звонка на внешний SIP"
Вариант для распечатки  
Пред. тема | След. тема 
Форум Открытые системы на сервере (VoIP / FreeBSD)
Изначальное сообщение [ Отслеживать ]

"asterisk за натом и перенаправление звонка на внешний SIP"  +/
Сообщение от petrovr on 09-Фев-18, 08:25 
Добрый день товарищи Спецы!

Помогите советом, как решить вопрос мой.
У меня значит входящий вызов на выданный провайдером номер должен переводиться на внешний SIP сервер, которым не я заведую.

мой asterisk (10.1.1.5) за натом. Порты 5060 и 10000-20000 проброшены.
Вот организация проброса:
-----------------
${FW} nat 1 config ip ${IP_EXT} reset same_ports \
        redirect_port   udp     10.1.1.5:5060 5060 \
        redirect_port   udp     10.1.1.5:10000-20000 10000-20000

sip.conf
-----------------
register=aaa:bbb@voip-prov.ru

externaddr=a.b.c.d
externip=a.b.c.d
localnet=192.168.0.0/255.255.255.0

language=ru
context=default
allowexternaldomains=yes
allowoverlap=no
udpbindaddr=10.1.1.5
tcpenable=no
transport=udp
srvlookup=no
allowguest=no
alwaysauthreject=yes
limitonpeers=yes
nat=force_rport,comedia

.... клиентские линии и пир провайдера ....


extensions.conf
-------------------
[prov-in]
;;входящий звонок на номер мне надо перевести на внешний SIP сервер.
exten   => 1234567,1,Dial(SIP/${EXTEN}@external_ip_server)
exten   => 1234567,n,HangUp()


Вот лог происходящего в астериске:
-----------------------------------
[Feb  9 09:15:40]        > 0x83c0ed000 -- Strict RTP learning after remote address set to: 37.228.85.6:29732
[Feb  9 09:15:40]     -- Executing [1234567@prov-in:1] Dial("SIP/mcn-0000004b", "SIP/1234567@external_ip_server") in new stack
[Feb  9 09:15:40]     -- Called SIP/1234567@external_ip_server
[Feb  9 09:16:05]   == Spawn extension (prov-in, 1234567, 1) exited non-zero on 'SIP/mcn-0000004b'
[2018-02-09 09:16:12.647] WARNING[101424]: chan_sip.c:4065 int retrans_pkt(const void *): Retransmission timeout reached on transmission 0bd4150e75986daa525775a83e0244c7@my_external_ip:5060 for seqno 102 (Critical Request) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
Packet timed out after 31999ms with no response


Вот tcpdump происходящего:
-------------------------------
09:22:37.812206 IP my_external_ip.5060 > external_ip_server.5060: SIP: INVITE sip:1234567@external_ip_server SIP/2.0
09:22:37.823816 IP external_ip_server.5060 > my_external_ip.5060: SIP: SIP/2.0 100 Trying
09:22:37.823860 IP my_external_ip > external_ip_server: ICMP my_external_ip udp port 5060 unreachable, length 36
09:22:37.824054 IP external_ip_server.5060 > my_external_ip.5060: SIP: SIP/2.0 200 OK
09:22:37.824079 IP my_external_ip > external_ip_server: ICMP my_external_ip udp port 5060 unreachable, length 36
09:22:37.882674 IP external_ip_server.15578 > my_external_ip.18158: UDP, length 172
09:22:37.903137 IP external_ip_server.15578 > my_external_ip.18158: UDP, length 172


Подскажите что не так? Повторюсь, внешний udp 5060 порт проброшен на 10.1.1.5:5060 а всё указывает на то, что пакет с внешнего SIP сервера на 5060 не достигает астериска.

Ответить | Правка | Cообщить модератору

Оглавление

Сообщения по теме [Сортировка по времени | RSS]


1. "asterisk за натом и перенаправление звонка на внешний SIP"  +/
Сообщение от _ (??) on 09-Фев-18, 09:25 
>[оверквотинг удален]
> 09:22:37.823860 IP my_external_ip > external_ip_server: ICMP my_external_ip udp port
> 5060 unreachable, length 36
> 09:22:37.824054 IP external_ip_server.5060 > my_external_ip.5060: SIP: SIP/2.0 200 OK
> 09:22:37.824079 IP my_external_ip > external_ip_server: ICMP my_external_ip udp port
> 5060 unreachable, length 36
> 09:22:37.882674 IP external_ip_server.15578 > my_external_ip.18158: UDP, length 172
> 09:22:37.903137 IP external_ip_server.15578 > my_external_ip.18158: UDP, length 172
> Подскажите что не так? Повторюсь, внешний udp 5060 порт проброшен на 10.1.1.5:5060
> а всё указывает на то, что пакет с внешнего SIP сервера
> на 5060 не достигает астериска.

Это tcpdump с маршрутизатора или с сервера Asterisk?
В консоли астериска дайте команду sip set debug ip <external_ip_server>. Что показывает астериск если включить этот дебаг?

Ответить | Правка | ^ к родителю #0 | Наверх | Cообщить модератору

2. "asterisk за натом и перенаправление звонка на внешний SIP"  +/
Сообщение от PetrovR (ok) on 09-Фев-18, 09:43 
> Это tcpdump с маршрутизатора или с сервера Asterisk?
> В консоли астериска дайте команду sip set debug ip <external_ip_server>. Что показывает
> астериск если включить этот дебаг?

Астериск в клетке на шлюзе работает. Этот tcpdump со шлюза на котором получается фактически и астериск.

Вот лог вызова с телефона 9221122345

[Feb  9 11:36:56]     -- Executing [1234567@prov-in:1] Set("SIP/mcn-0000018d", "Var_TO=1234567") in new stack
[Feb  9 11:36:56]     -- Executing [1234567@prov-in:2] Dial("SIP/mcn-0000018d", "SIP/1234567@external_ip_server") in new stack
[Feb  9 11:36:56] Audio is at 12860
[Feb  9 11:36:56] Adding codec alaw to SDP
[Feb  9 11:36:56] Adding codec ulaw to SDP
[Feb  9 11:36:56] Adding codec gsm to SDP
[Feb  9 11:36:56] Adding non-codec 0x1 (telephone-event) to SDP
[Feb  9 11:36:56] Reliably Transmitting (NAT) to external_ip_server:5060:
[Feb  9 11:36:56] INVITE sip:1234567@external_ip_server SIP/2.0
[Feb  9 11:36:56] Via: SIP/2.0/UDP my_external_ip:5060;branch=z9hG4bK739fdfbf;rport
[Feb  9 11:36:56] Max-Forwards: 70
[Feb  9 11:36:56] From: "79221122356" <sip:79221122356@my_external_ip>;tag=as0fa9b5df
[Feb  9 11:36:56] To: <sip:1234567@external_ip_server>
[Feb  9 11:36:56] Contact: <sip:79221122356@my_external_ip:5060>
[Feb  9 11:36:56] Call-ID: 2792b45d3fc43ee4698069bd326ef6f3@my_external_ip:5060
[Feb  9 11:36:56] CSeq: 102 INVITE
[Feb  9 11:36:56] User-Agent: Asterisk PBX 13.19.0
[Feb  9 11:36:56] Date: Fri, 09 Feb 2018 06:36:56 GMT
[Feb  9 11:36:56] Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
[Feb  9 11:36:56] Supported: replaces, timer
[Feb  9 11:36:56] Content-Type: application/sdp
[Feb  9 11:36:56] Content-Length: 289
[Feb  9 11:36:56]
[Feb  9 11:36:56] v=0
[Feb  9 11:36:56] o=root 1124322562 1124322562 IN IP4 my_external_ip
[Feb  9 11:36:56] s=Asterisk PBX 13.19.0
[Feb  9 11:36:56] c=IN IP4 my_external_ip
[Feb  9 11:36:56] t=0 0
[Feb  9 11:36:56] m=audio 12860 RTP/AVP 8 0 3 101
[Feb  9 11:36:56] a=rtpmap:8 PCMA/8000
[Feb  9 11:36:56] a=rtpmap:0 PCMU/8000
[Feb  9 11:36:56] a=rtpmap:3 GSM/8000
[Feb  9 11:36:56] a=rtpmap:101 telephone-event/8000
[Feb  9 11:36:56] a=fmtp:101 0-16
[Feb  9 11:36:56] a=maxptime:150
[Feb  9 11:36:56] a=sendrecv
[Feb  9 11:36:56]
[Feb  9 11:36:56] ---
[Feb  9 11:36:56]     -- Called SIP/1234567@external_ip_server
[Feb  9 11:36:56] Retransmitting #1 (NAT) to external_ip_server:5060:
[Feb  9 11:36:56] INVITE sip:1234567@external_ip_server SIP/2.0
[Feb  9 11:36:56] Via: SIP/2.0/UDP my_external_ip:5060;branch=z9hG4bK739fdfbf;rport
[Feb  9 11:36:56] Max-Forwards: 70
[Feb  9 11:36:56] From: "79221122356" <sip:79221122356@my_external_ip>;tag=as0fa9b5df
[Feb  9 11:36:56] To: <sip:1234567@external_ip_server>
[Feb  9 11:36:56] Contact: <sip:79221122356@my_external_ip:5060>
[Feb  9 11:36:56] Call-ID: 2792b45d3fc43ee4698069bd326ef6f3@my_external_ip:5060
[Feb  9 11:36:56] CSeq: 102 INVITE
[Feb  9 11:36:56] User-Agent: Asterisk PBX 13.19.0
[Feb  9 11:36:56] Date: Fri, 09 Feb 2018 06:36:56 GMT
[Feb  9 11:36:56] Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
[Feb  9 11:36:56] Supported: replaces, timer
[Feb  9 11:36:56] Content-Type: application/sdp
[Feb  9 11:36:56] Content-Length: 289
[Feb  9 11:36:56]
[Feb  9 11:36:56] v=0
[Feb  9 11:36:56] o=root 1124322562 1124322562 IN IP4 my_external_ip
[Feb  9 11:36:56] s=Asterisk PBX 13.19.0
[Feb  9 11:36:56] c=IN IP4 my_external_ip
[Feb  9 11:36:56] t=0 0
[Feb  9 11:36:56] m=audio 12860 RTP/AVP 8 0 3 101
[Feb  9 11:36:56] a=rtpmap:8 PCMA/8000
[Feb  9 11:36:56] a=rtpmap:0 PCMU/8000
[Feb  9 11:36:56] a=rtpmap:3 GSM/8000
[Feb  9 11:36:56] a=rtpmap:101 telephone-event/8000
[Feb  9 11:36:56] a=fmtp:101 0-16
[Feb  9 11:36:56] a=maxptime:150
[Feb  9 11:36:56] a=sendrecv
[Feb  9 11:36:56]
[Feb  9 11:36:56] ---
[Feb  9 11:36:57] Retransmitting #2 (NAT) to external_ip_server:5060:
[Feb  9 11:36:57] INVITE sip:1234567@external_ip_server SIP/2.0
[Feb  9 11:36:57] Via: SIP/2.0/UDP my_external_ip:5060;branch=z9hG4bK739fdfbf;rport
[Feb  9 11:36:57] Max-Forwards: 70
[Feb  9 11:36:57] From: "79221122356" <sip:79221122356@my_external_ip>;tag=as0fa9b5df
[Feb  9 11:36:57] To: <sip:1234567@external_ip_server>
[Feb  9 11:36:57] Contact: <sip:79221122356@my_external_ip:5060>
[Feb  9 11:36:57] Call-ID: 2792b45d3fc43ee4698069bd326ef6f3@my_external_ip:5060
[Feb  9 11:36:57] CSeq: 102 INVITE
[Feb  9 11:36:57] User-Agent: Asterisk PBX 13.19.0
[Feb  9 11:36:57] Date: Fri, 09 Feb 2018 06:36:56 GMT
[Feb  9 11:36:57] Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
[Feb  9 11:36:57] Supported: replaces, timer
[Feb  9 11:36:57] Content-Type: application/sdp
[Feb  9 11:36:57] Content-Length: 289
[Feb  9 11:36:57]
[Feb  9 11:36:57] v=0
[Feb  9 11:36:57] o=root 1124322562 1124322562 IN IP4 my_external_ip
[Feb  9 11:36:57] s=Asterisk PBX 13.19.0
[Feb  9 11:36:57] c=IN IP4 my_external_ip
[Feb  9 11:36:57] t=0 0
[Feb  9 11:36:57] m=audio 12860 RTP/AVP 8 0 3 101
[Feb  9 11:36:57] a=rtpmap:8 PCMA/8000
[Feb  9 11:36:57] a=rtpmap:0 PCMU/8000
[Feb  9 11:36:57] a=rtpmap:3 GSM/8000
[Feb  9 11:36:57] a=rtpmap:101 telephone-event/8000
[Feb  9 11:36:57] a=fmtp:101 0-16
[Feb  9 11:36:57] a=maxptime:150
[Feb  9 11:36:57] a=sendrecv
[Feb  9 11:36:57]
[Feb  9 11:36:57] ---
[Feb  9 11:36:59] Retransmitting #3 (NAT) to external_ip_server:5060:
[Feb  9 11:36:59] INVITE sip:1234567@external_ip_server SIP/2.0
[Feb  9 11:36:59] Via: SIP/2.0/UDP my_external_ip:5060;branch=z9hG4bK739fdfbf;rport
[Feb  9 11:36:59] Max-Forwards: 70
[Feb  9 11:36:59] From: "79221122356" <sip:79221122356@my_external_ip>;tag=as0fa9b5df
[Feb  9 11:36:59] To: <sip:1234567@external_ip_server>
[Feb  9 11:36:59] Contact: <sip:79221122356@my_external_ip:5060>
[Feb  9 11:36:59] Call-ID: 2792b45d3fc43ee4698069bd326ef6f3@my_external_ip:5060
[Feb  9 11:36:59] CSeq: 102 INVITE
[Feb  9 11:36:59] User-Agent: Asterisk PBX 13.19.0
[Feb  9 11:36:59] Date: Fri, 09 Feb 2018 06:36:56 GMT
[Feb  9 11:36:59] Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
[Feb  9 11:36:59] Supported: replaces, timer
[Feb  9 11:36:59] Content-Type: application/sdp
[Feb  9 11:36:59] Content-Length: 289
[Feb  9 11:36:59]
[Feb  9 11:36:59] v=0
[Feb  9 11:36:59] o=root 1124322562 1124322562 IN IP4 my_external_ip
[Feb  9 11:36:59] s=Asterisk PBX 13.19.0
[Feb  9 11:36:59] c=IN IP4 my_external_ip
[Feb  9 11:36:59] t=0 0
[Feb  9 11:36:59] m=audio 12860 RTP/AVP 8 0 3 101
[Feb  9 11:36:59] a=rtpmap:8 PCMA/8000
[Feb  9 11:36:59] a=rtpmap:0 PCMU/8000
[Feb  9 11:36:59] a=rtpmap:3 GSM/8000
[Feb  9 11:36:59] a=rtpmap:101 telephone-event/8000
[Feb  9 11:36:59] a=fmtp:101 0-16
[Feb  9 11:36:59] a=maxptime:150
[Feb  9 11:36:59] a=sendrecv
[Feb  9 11:36:59]
[Feb  9 11:36:59] ---
[Feb  9 11:37:03] Retransmitting #4 (NAT) to external_ip_server:5060:
[Feb  9 11:37:03] INVITE sip:1234567@external_ip_server SIP/2.0
[Feb  9 11:37:03] Via: SIP/2.0/UDP my_external_ip:5060;branch=z9hG4bK739fdfbf;rport
[Feb  9 11:37:03] Max-Forwards: 70
[Feb  9 11:37:03] From: "79221122356" <sip:79221122356@my_external_ip>;tag=as0fa9b5df
[Feb  9 11:37:03] To: <sip:1234567@external_ip_server>
[Feb  9 11:37:03] Contact: <sip:79221122356@my_external_ip:5060>
[Feb  9 11:37:03] Call-ID: 2792b45d3fc43ee4698069bd326ef6f3@my_external_ip:5060
[Feb  9 11:37:03] CSeq: 102 INVITE
[Feb  9 11:37:03] User-Agent: Asterisk PBX 13.19.0
[Feb  9 11:37:03] Date: Fri, 09 Feb 2018 06:36:56 GMT
[Feb  9 11:37:03] Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
[Feb  9 11:37:03] Supported: replaces, timer
[Feb  9 11:37:03] Content-Type: application/sdp
[Feb  9 11:37:03] Content-Length: 289
[Feb  9 11:37:03]
[Feb  9 11:37:03] v=0
[Feb  9 11:37:03] o=root 1124322562 1124322562 IN IP4 my_external_ip
[Feb  9 11:37:03] s=Asterisk PBX 13.19.0
[Feb  9 11:37:03] c=IN IP4 my_external_ip
[Feb  9 11:37:03] t=0 0
[Feb  9 11:37:03] m=audio 12860 RTP/AVP 8 0 3 101
[Feb  9 11:37:03] a=rtpmap:8 PCMA/8000
[Feb  9 11:37:03] a=rtpmap:0 PCMU/8000
[Feb  9 11:37:03] a=rtpmap:3 GSM/8000
[Feb  9 11:37:03] a=rtpmap:101 telephone-event/8000
[Feb  9 11:37:03] a=fmtp:101 0-16
[Feb  9 11:37:03] a=maxptime:150
[Feb  9 11:37:03] a=sendrecv
[Feb  9 11:37:03]
[Feb  9 11:37:03] ---
[Feb  9 11:37:09] Scheduling destruction of SIP dialog '2792b45d3fc43ee4698069bd326ef6f3@my_external_ip:5060' in 32000 ms (Method: INVITE)
[Feb  9 11:37:09]   == Spawn extension (prov-in, 1234567, 2) exited non-zero on 'SIP/mcn-0000018d'
[Feb  9 11:37:11] Retransmitting #5 (NAT) to external_ip_server:5060:
[Feb  9 11:37:11] INVITE sip:1234567@external_ip_server SIP/2.0
[Feb  9 11:37:11] Via: SIP/2.0/UDP my_external_ip:5060;branch=z9hG4bK739fdfbf;rport
[Feb  9 11:37:11] Max-Forwards: 70
[Feb  9 11:37:11] From: "79221122356" <sip:79221122356@my_external_ip>;tag=as0fa9b5df
[Feb  9 11:37:11] To: <sip:1234567@external_ip_server>
[Feb  9 11:37:11] Contact: <sip:79221122356@my_external_ip:5060>
[Feb  9 11:37:11] Call-ID: 2792b45d3fc43ee4698069bd326ef6f3@my_external_ip:5060
[Feb  9 11:37:11] CSeq: 102 INVITE
[Feb  9 11:37:11] User-Agent: Asterisk PBX 13.19.0
[Feb  9 11:37:11] Date: Fri, 09 Feb 2018 06:36:56 GMT
[Feb  9 11:37:11] Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
[Feb  9 11:37:11] Supported: replaces, timer
[Feb  9 11:37:11] Content-Type: application/sdp
[Feb  9 11:37:11] Content-Length: 289
[Feb  9 11:37:11]
[Feb  9 11:37:11] v=0
[Feb  9 11:37:11] o=root 1124322562 1124322562 IN IP4 my_external_ip
[Feb  9 11:37:11] s=Asterisk PBX 13.19.0
[Feb  9 11:37:11] c=IN IP4 my_external_ip
[Feb  9 11:37:11] t=0 0
[Feb  9 11:37:11] m=audio 12860 RTP/AVP 8 0 3 101
[Feb  9 11:37:11] a=rtpmap:8 PCMA/8000
[Feb  9 11:37:11] a=rtpmap:0 PCMU/8000
[Feb  9 11:37:11] a=rtpmap:3 GSM/8000
[Feb  9 11:37:11] a=rtpmap:101 telephone-event/8000
[Feb  9 11:37:11] a=fmtp:101 0-16
[Feb  9 11:37:11] a=maxptime:150
[Feb  9 11:37:11] a=sendrecv
[Feb  9 11:37:11]
[Feb  9 11:37:11] ---

Ответить | Правка | ^ к родителю #1 | Наверх | Cообщить модератору

3. "asterisk за натом и перенаправление звонка на внешний SIP"  +/
Сообщение от Andrey (??) on 10-Фев-18, 13:24 
>[оверквотинг удален]
> [Feb  9 11:37:11] m=audio 12860 RTP/AVP 8 0 3 101
> [Feb  9 11:37:11] a=rtpmap:8 PCMA/8000
> [Feb  9 11:37:11] a=rtpmap:0 PCMU/8000
> [Feb  9 11:37:11] a=rtpmap:3 GSM/8000
> [Feb  9 11:37:11] a=rtpmap:101 telephone-event/8000
> [Feb  9 11:37:11] a=fmtp:101 0-16
> [Feb  9 11:37:11] a=maxptime:150
> [Feb  9 11:37:11] a=sendrecv
> [Feb  9 11:37:11]
> [Feb  9 11:37:11] ---

А у вас вообще регистрация на внешнем SIP проходит?

Ответить | Правка | ^ к родителю #2 | Наверх | Cообщить модератору

Архив | Удалить

Рекомендовать для помещения в FAQ | Индекс форумов | Темы | Пред. тема | След. тема


  Закладки на сайте
  Проследить за страницей
Created 1996-2018 by Maxim Chirkov  
ДобавитьРекламаВебмастеруГИД  
Hosting by Ihor