Page 1 of 1

audio glitch via nat

PostPosted: Thu Oct 14, 2021 8:19 am
by liigi
Hello everyone, I come here to help me with this problem.I have two sites interconnected with each other through a vpn with nat, in both connections it has nat


SITE 1

VERSION: 2.14-769a
BUILD: 200916-0922
ASTERISK 13.21.1-vici
Version: 2.14b0.5
SVN Version: 3298
DB Schema Version: 1606
LAN :192.168.0.9
NAT: 192.168.20.9


SITE2 :
VERSION: 2.14-763a
BUILD: 200719-1645
SVN Version: 3271
DB Schema Version: 1602
ASTERISK :13.34.0-vici
LAN :172.16.20.40
NAT: 172.16.30.40


But i dont have audio , any audio . if i call ext between servers , the call complete but have not audio.It is obvious a communication problem because the nat, but I am a newbie .

when I do packet capture the packets go to the LAN IP but the rtp packets go to the NAT IP

Re: audio glitch via nat

PostPosted: Thu Oct 14, 2021 1:12 pm
by ambiorixg12
Verify that the media address is correct and also the contact header using sip set debug on

Check the media flow with rtp set debug on

Re: audio glitch via nat

PostPosted: Fri Oct 15, 2021 8:45 am
by Rogger
Hi,

Use sngrep and look at the route table.

Good luck

Re: audio glitch via nat

PostPosted: Fri Oct 15, 2021 9:09 am
by liigi
192.168.0.9___________ 172.16.30.40 _____________172.16.20.40
5060 --------------------------------> SIP INVITE
5060 <------------------------------- SIP STATUS 100
5060 <------------------------------- SIP STATUS 200
5060 -------------------------------> SIP INVITE ACK 200
14186 ------------------------------------------------------------> RTP (HERE IS THE PROBLEM RTP GO TO LAN NOT TO NAT IP )
5060 -------------------------------> BYE
5060 <------------------------------- SIP STATUS 200 OK


This is flow sequense form site 1 , it is possible that if I check the sequence from site two I will see the same problem since I use nat on both sites

How can I make the rtp packets go to the nat ip (the nat is done by my firewall, it is responsible for making the transfer of the ip with nat to the lan ip)

Re: audio glitch via nat

PostPosted: Sun Oct 17, 2021 4:05 pm
by ambiorixg12
Make sure you have the correct NAT settings using the sip show settings command, settings should look like this

nat=rtp_force,comedia
directmedia=no
localnet=192.168.0.0/255.255.0.0 ;( chante this by your localnet)
externip=public ip

Re: audio glitch via nat

PostPosted: Mon Oct 18, 2021 8:04 am
by liigi
Hi pall
My sip .conf have de localnet and the public ip set .The nat that I am doing is between sites on my network, it does not go to the public network.

Re: audio glitch via nat

PostPosted: Mon Oct 18, 2021 1:05 pm
by liigi
I think i can solve the problem using IAX trunk insted of SIP .But i recive this error


[Oct 18 14:01:10] VERBOSE[2258] chan_iax2.c: Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 001 Type: IAX Subclass: REGREQ
[Oct 18 14:01:10] VERBOSE[2258] chan_iax2.c: Timestamp: 00009ms SCall: 00754 DCall: 11984 172.16.30.40:4569
[Oct 18 14:01:10] VERBOSE[2258] chan_iax2.c: USERNAME : myuser
[Oct 18 14:01:10] VERBOSE[2258] chan_iax2.c: REFRESH : 60
[Oct 18 14:01:10] VERBOSE[2258] chan_iax2.c: PASSWORD : Mypass
[Oct 18 14:01:10] VERBOSE[2258] chan_iax2.c:
[Oct 18 14:01:10] VERBOSE[2258] chan_iax2.c: Tx-Frame Retry[-01] -- OSeqno: 001 ISeqno: 002 Type: IAX Subclass: ACK
[Oct 18 14:01:10] VERBOSE[2258] chan_iax2.c: Timestamp: 00009ms SCall: 11984 DCall: 00754 172.16.30.40:4569
[Oct 18 14:01:11] VERBOSE[2226] chan_iax2.c: Tx-Frame Retry[000] -- OSeqno: 001 ISeqno: 002 Type: IAX Subclass: REGREJ
[Oct 18 14:01:11] VERBOSE[2226] chan_iax2.c: Timestamp: 01003ms SCall: 11984 DCall: 00754 172.16.30.41:4569
[Oct 18 14:01:11] VERBOSE[2226] chan_iax2.c: CAUSE : Registration Refused
[Oct 18 14:01:11] VERBOSE[2226] chan_iax2.c: CAUSE CODE : 29

i only create a iax trunk (mimic preexisten vicidial iax trunk)

Re: audio glitch via nat

PostPosted: Mon Oct 18, 2021 1:28 pm
by liigi
This is my trunk
register => miuser:mipass@172.16.30.41

[IAXPLAZA]
accountcode=miuser
secret=mipass
type=friend
requirecalltoken=no
context=default
auth=plaintext
host=dynamic
permit=0.0.0.0/0.0.0.0
disallow=all
allow=ulaw
qualify=yes

Re: audio glitch via nat

PostPosted: Mon Oct 18, 2021 2:17 pm
by ambiorixg12
If those 2 boxes have static IP and you know them, you don't need to use registration. I have a while I don't use IAX2 but this setting should work

https://asterisk-rd.blogspot.com/2015/1 ... -iax2.html

Re: audio glitch via nat

PostPosted: Tue Oct 19, 2021 9:57 am
by liigi
thanks u that work , but now a have a error cause 50 in the dial

[IAXAUTANA]
username=1005
secret=1010
host=172.16.30.40
type=friend
context=trunkinbound
qualify=yes
qualifyfreqok=25000
trunk=yes
forceencryption=no
encryption=yes
auth=md5
requirecalltoken=no

exten => _78.,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _78.,2,Dial(${IAXTRUNK}/${EXTEN:2},,To)
exten => _78.,3,Hangup

Re: audio glitch via nat

PostPosted: Tue Oct 19, 2021 11:20 am
by liigi
Thanks I did it like you without problems thanks u. The NAT problem was resolved with an iax trunk
:lol: :lol: :lol: :lol: