Asterisk Pjsip changing TOP Record-Route Port Problem

Hello,

Subject : Asterisk changing top RR port.

Asterisk 16.1 version pjsip changin RR port part so UAC’s ACK response couldnt reach. There is a flow example and added some examples.

Question, Why does asterisk changes RR port , even if proxy writes own port.

How can i solve this problem . is it a bug?

Thanks.

Yasin CANER

( six years ago ,this day , i joined asterisk community :slight_smile: )

https://community.asterisk.org/t/asterisk-15-x-changing-record-route-set-by-proxy/74701/3this post isnt related my post

Pjsip endpoint configuration

[alice]
type=endpoint
transport=transport-tcp
context=default1
aors=alice
dtmf_mode=rfc4733
identify_by=username
rewrite_contact=yes
direct_media=yes
allow=all
direct_media_glare_mitigation=outgoing
force_rport=no
ice_support=no

FLOW

SIP PACKETS

INVITE
2019/02/11 09:46:36.879350 fd61:c23c:b3b6::c:40475 -> fd61:c23c:b3b6::8:5060
INVITE sip:firat@proxy1net1.test SIP/2.0
Record-Route: <sip:mo@[FD61:C23C:B3B6:0:0:0:0:C]:6060;transport=tcp;lr=on;ftag=3653SIPpTag011;did=d5e.3112>
Record-Route: <sip:mo@[FD61:C23C:B3B6:0:0:0:0:5]:4060;transport=tcp;lr=on;ftag=3653SIPpTag011;did=d5e.0462>
Via: SIP/2.0/TCP [FD61:C23C:B3B6:0:0:0:0:C]:6060;branch=z9hG4bK49eb.9cb8d6581c3eac5a62f19cbd42272974.0;i=5
Via: SIP/2.0/TCP [FD61:C23C:B3B6:0:0:0:0:5]:4060;branch=z9hG4bK49eb.824c61f63bb27126c0ffa9dba0ec8139.0;i=931
Via: SIP/2.0/TCP [fd61:c23c:b3b6::10]:5061;rport=5061;received=FD61:C23C:B3B6:0:0:0:0:10;branch=z9hG4bK-3653-1-11

200 OK
2019/02/11 09:46:43.873420 fd61:c23c:b3b6::8:5060 -> fd61:c23c:b3b6::c:40475
SIP/2.0 200 OK
Via: SIP/2.0/TCP [FD61:C23C:B3B6:0:0:0:0:C]:6060;received=fd61:c23c:b3b6::c;branch=z9hG4bK49eb.9cb8d6581c3eac5a62f19cbd42272974.0;i=5
Via: SIP/2.0/TCP [FD61:C23C:B3B6:0:0:0:0:5]:4060;branch=z9hG4bK49eb.824c61f63bb27126c0ffa9dba0ec8139.0;i=931
Via: SIP/2.0/TCP [fd61:c23c:b3b6::10]:5061;rport=5061;received=FD61:C23C:B3B6:0:0:0:0:10;branch=z9hG4bK-3653-1-11
Record-Route: <sip:mo@[fd61:c23c:b3b6::c]:40475;transport=TCP;lr;ftag=3653SIPpTag011;did=d5e.3112>
Record-Route: <sip:mo@[FD61:C23C:B3B6:0:0:0:0:5]:4060;transport=tcp;lr;ftag=3653SIPpTag011;did=d5e.0462>

I Found problem;

rewrite_contact

			<configOption name="rewrite_contact">
				<synopsis>Allow Contact header to be rewritten with the source IP address-port</synopsis>
				<description><para>
					On inbound SIP messages from this endpoint, the Contact header or an
					appropriate Record-Route header will be changed to have the source IP
					address and port.  This option does not affect outbound messages sent to
					this endpoint.  This option helps servers communicate with endpoints
					that are behind NATs.  This option also helps reuse reliable transport
					connections such as TCP and TLS.
				</para></description>
			</configOption>