D
D
demsi2015-01-15 11:31:18
linux
demsi, 2015-01-15 11:31:18

Why is there no sound in Asterisk?

There is a server on the Debian GNU/Linux Wheezy operating system .
It has Asterisk and xl2tpd installed .
The sip client connects to Asterisk via an l2tp connection.
Asterisk is inaccessible to interfaces that go to the external network.
In an l2tp connection , the server has the address 192.168.68.1 and the client has 192.168.68.10 .
Connecting to Asterisk sip client linphone . Beforehand, of course, having connected to the server via l2tp .
When calling any number (external, not connected to this server), the subscriber hears me perfectly, but I can't hear him at all.
tcpdump from the client during the call gives the following:

3:19:40.090729 IP 192.168.68.10.7078 > 192.168.68.1.15668: UDP, length 172
13:19:40.110629 IP 192.168.68.10.7078 > 192.168.68.1.15668: UDP, length 172
13:19:40.150170 IP 192.168.68.10.7078 > 192.168.68.1.15668: UDP, length 172
13:19:40.163438 IP 192.168.68.10.7078 > 192.168.68.1.15668: UDP, length 172
13:19:40.170718 IP 192.168.68.10.7078 > 192.168.68.1.15668: UDP, length 172
13:19:40.190383 IP 192.168.68.10.7078 > 192.168.68.1.15668: UDP, length 172
13:19:40.231184 IP 192.168.68.10.7078 > 192.168.68.1.15668: UDP, length 172
13:19:40.240969 IP 192.168.68.10.7078 > 192.168.68.1.15668: UDP, length 172
13:19:40.260849 IP 192.168.68.10.7078 > 192.168.68.1.15668: UDP, length 172
13:19:40.270566 IP 192.168.68.10.7078 > 192.168.68.1.15668: UDP, length 172
13:19:40.301064 IP 192.168.68.10.7078 > 192.168.68.1.15668: UDP, length 172
13:19:40.320882 IP 192.168.68.10.7078 > 192.168.68.1.15668: UDP, length 172
....

The same is true on the server side.
If you set the setting in the linphone
program: Behind NAT, external address: 192.168.68.10 Then everything works fine. I can be heard, and I can hear the caller. In this case, tcpdump outputs this:
3:23:29.932392 IP 192.168.68.10.7078 > 192.168.68.1.15336: UDP, length 172
13:23:29.942299 IP 192.168.68.10.7078 > 192.168.68.1.15336: UDP, length 172
13:23:29.944305 IP 192.168.68.1.15336 > 192.168.68.10.7078: UDP, length 172
13:23:29.962740 IP 192.168.68.10.7078 > 192.168.68.1.15336: UDP, length 172
13:23:29.964799 IP 192.168.68.1.15336 > 192.168.68.10.7078: UDP, length 172
13:23:29.971826 IP 192.168.68.10.7078 > 192.168.68.1.15336: UDP, length 172
13:23:29.984661 IP 192.168.68.1.15336 > 192.168.68.10.7078: UDP, length 172
13:23:30.001635 IP 192.168.68.10.7078 > 192.168.68.1.15336: UDP, length 172
13:23:30.005045 IP 192.168.68.1.15336 > 192.168.68.10.7078: UDP, length 172
13:23:30.024650 IP 192.168.68.1.15336 > 192.168.68.10.7078: UDP, length 172
13:23:30.031927 IP 192.168.68.10.7078 > 192.168.68.1.15336: UDP, length 172
....

As you can see, now the packets go in both directions.
What's the matter here? If you need any other information, I can provide it without any problems.
Thanks a lot Vladimir .
Paid attention to SDP in packets. As you said in the case when the setting Behind NAT, external address: 192.168.68.10 is not enabled.
In SDP , the Owner Adress and Connection Adress headers contain 192.168.0.2 - the address of another interface.
If the setting Behind NAT, external address: 192.168.68.10 is enabled, then there is a normal address 192.168.68.10 - as I need.
The funny thing is that in the sip client Ekigathere is no way to set up an external address like in linphone , and at times the sound would just stop working. Apparently Ekiga exposes the ip address of the first found interface in SDP . Now it’s clear where the legs of the problem grow from.
In Asterisk , I added the nat=yes parameter to the peer settings in sip.conf . Now everything works fine, even without setting Behind NAT, external address: 192.168.68.10 in linphone . By the way, to clarify, no one thought that this was some kind of magic. Why does everything work now when the SDP headers still have the wrong ip address? Everyone knows what NAT is.

. But what exactly does the nat=yes option in Asterisk do?
Here is its description:
The nat parameter can be set to yes, no, or never. If
set to yes, Asterisk ignores the IP address in the SIP and SDP headers
and replies to the address and port specified in the IP header. The never option
is for devices that cannot process the
rport field in the SIP header.
As you can see, in my example, it is needed not only when the client is behind NAT . In my case, there is a direct vpn connection to the server, where NAT is not used. But still in SIP and SPD headershits the ip address of another interface. This option tells Asterisk to ignore the ip address from these protocol headers, so everything works now.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir, 2015-01-15
@demsi

the client announces a different IP in SDP
will be visible in sip debug
if there are several interfaces, not all clients are able to correctly determine which IP to substitute
enable nat=yes on the
peer can be easier

M
microphone, 2015-01-15
@microphone

netstat -rn

A
Armenian Radio, 2015-01-15
@gbg

Well, the problem is just in NAT, and what you are doing is its solution.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question