[asterisk-bugs] [JIRA] (ASTERISK-28768) No audio on remote NATted phone when using local_net behind another NATted Asterisk

Marc Ketel (JIRA) noreply at issues.asterisk.org
Thu Mar 5 02:21:25 CST 2020


Marc Ketel created ASTERISK-28768:
-------------------------------------

             Summary: No audio on remote NATted phone when using local_net behind another NATted Asterisk
                 Key: ASTERISK-28768
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-28768
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Resources/res_pjsip
    Affects Versions: 16.8.0
         Environment: Asterisk 16.8.0 running on Centos 7 x64.
            Reporter: Marc Ketel
            Severity: Critical


The changes in issue https://issues.asterisk.org/jira/browse/ASTERISK-27248 causes local_net to not function correctly.

In Asterisk 11.10, local_net functioned correctly, in Asterisk 16.8.0 local_net does not function correctly. I traced the change to issue https://issues.asterisk.org/jira/browse/ASTERISK-27248.

Scenario: both Asterisk and phone1 are behind same NAT. phone2 is remotely behind nat. When configuring some unrelated ip subnet in local_net the remote phone2's audio is being send from Asterisk to the local ip of the remote phone2, which does not work. Disabling local_net makes the remote phone2 work. 

When undoing ASTERISK-27248_undo.patch and configuring local_net to the network of phone1 all phones work. The local phone gets RTP from the local address of Asterisk, the remote phone gets audio to its external nat ip.

Remote phone with correct external media adress and working RTP
{noformat}
[Mar  4 14:16:25] DEBUG[31740]: res_pjsip_session.c:902 handle_negotiated_sdp_session_media: Applied negotiated SDP media stream 'audio' using audio SDP handler
[Mar  4 14:16:25] DEBUG[31740]: res_pjsip_session.c:3498 handle_outgoing_response: Method is INVITE, Response is 200 OK
[Mar  4 14:16:25] DEBUG[31740]: res_pjsip/pjsip_message_filter.c:288 filter_on_tx_message: Re-wrote Contact URI host/port to 172.17.32.36:5060 (this may be re-written again later)
[Mar  4 14:16:25] DEBUG[31740]: netsock2.c:170 ast_sockaddr_split_hostport: Splitting '198.51.100.50' into...
[Mar  4 14:16:25] DEBUG[31740]: netsock2.c:224 ast_sockaddr_split_hostport: ...host '198.51.100.50' and port ''.
[Mar  4 14:16:25] DEBUG[31740]: res_pjsip_nat.c:414 process_nat: Re-wrote Contact URI port to 5060
[Mar  4 14:16:25] DEBUG[31740]: netsock2.c:170 ast_sockaddr_split_hostport: Splitting '172.17.32.36' into...
[Mar  4 14:16:25] DEBUG[31740]: netsock2.c:224 ast_sockaddr_split_hostport: ...host '172.17.32.36' and port ''.
[Mar  4 14:16:25] DEBUG[31740]: res_pjsip_session.c:4338 session_outgoing_nat_hook: Setting external media address to 203.0.113.102
<--- Transmitting SIP response (880 bytes) to TCP:198.51.100.50:56924 --->
{noformat}
Local phone that is correctly identified as local with local_net=10.215.152.0/255.255.255.0
{noformat}
[Mar  4 14:19:47] DEBUG[31740]: res_pjsip_session.c:902 handle_negotiated_sdp_session_media: Applied negotiated SDP media stream 'audio' using audio SDP handler
[Mar  4 14:19:47] DEBUG[31740]: res_pjsip_session.c:3498 handle_outgoing_response: Method is INVITE, Response is 200 OK
[Mar  4 14:19:47] DEBUG[31740]: res_pjsip/pjsip_message_filter.c:288 filter_on_tx_message: Re-wrote Contact URI host/port to 172.17.32.36:5060 (this may be re-written again later)
[Mar  4 14:19:47] DEBUG[31740]: netsock2.c:170 ast_sockaddr_split_hostport: Splitting '10.215.152.3' into...
[Mar  4 14:19:47] DEBUG[31740]: netsock2.c:224 ast_sockaddr_split_hostport: ...host '10.215.152.3' and port ''.
[Mar  4 14:19:47] DEBUG[31740]: res_pjsip_nat.c:403 process_nat: Request is being sent to local address, skipping NAT manipulation
<--- Transmitting SIP response (797 bytes) to UDP:10.215.152.3:50611 --->
{noformat}
{noformat}
+		/* Reversed check here. We don't check the remote
+		 * endpoint being in our local net, but whether our
+		 * outgoing session IP is local. If it is, we'll do
+		 * rewriting. No localnet configured? Always rewrite. */
{noformat}
Please reconsider checking the remote ip of the phone and not the outgoing session ip.

Relevant configuration:
{noformat}
[template-transport-ipv6](!)
;local_net=
;external_media_address=
;external_signaling_address=

[template-transport-ipv4](!)
local_net=10.215.152.0/255.255.255.0

external_media_address=203.0.113.102
external_signaling_address=203.0.113.102

[template-transport](!)
type=transport
external_signaling_port=5060
allow_reload=yes
symmetric_transport=yes

[transport-auto-udp6](template-transport,template-transport-ipv6)
protocol=udp
bind=::

[transport-auto-udp4](template-transport,template-transport-ipv4)
protocol=udp
bind=0.0.0.0

[transport-auto-tcp6](template-transport,template-transport-ipv6)
protocol=tcp
bind=::

[transport-auto-tcp4](template-transport,template-transport-ipv4)
protocol=tcp
bind=0.0.0.0


[user_defaults](!)
type = wizard
accepts_registrations = yes
sends_registrations = no
accepts_auth = yes
sends_auth = no
has_hint = yes
hint_context = hints
hint_application = Dial(PJSIP/${EXTEN})

endpoint/allow = !all,alaw,ulaw
endpoint/allow_subscribe = yes
endpoint/allow_transfer = yes
endpoint/context = uitbellen
endpoint/device_state_busy_at = 1
endpoint/direct_media = no
endpoint/direct_media_method = invite
endpoint/disable_direct_media_on_nat = yes
endpoint/force_rport = yes
endpoint/ice_support = no
endpoint/inband_progress = yes
endpoint/moh_suggest = default
endpoint/rewrite_contact = yes
endpoint/rtp_ipv6 = yes
endpoint/rtp_keepalive = 15
endpoint/rtp_timeout = 60
endpoint/rtp_timeout_hold = 14400
endpoint/rtp_symmetric = yes
endpoint/send_diversion = yes
endpoint/send_pai = no
endpoint/send_rpid = no
endpoint/subscribe_context = hints
endpoint/trust_id_inbound = no
endpoint/trust_id_outbound = no
endpoint/language = nl
endpoint/send_connected_line = true
endpoint/trust_connected_line = true

aor/qualify_frequency = 60
aor/authenticate_qualify = no
aor/max_contacts = 1
aor/remove_existing = yes
aor/minimum_expiration = 30
aor/support_path = yes

;(Mitel 6865i)
[2003](user_defaults)
aor/mailboxes=
inbound_auth/username=2003
inbound_auth/password=xxx
endpoint/dtmf_mode=auto
endpoint/call_group=
endpoint/pickup_group=

;Marc softphone ()
[2995](user_defaults)
aor/mailboxes=
inbound_auth/username=2995
inbound_auth/password=xxx
endpoint/call_group=
endpoint/pickup_group=
{noformat}






--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list