Hi, I'm chasing a bug in chan_sip.c where Asterisk is removing the rport parameter out of the via headers. Here's my scenario: UA -> Snom NATf -> Snom 4S Proxy -> Asterisk Echo Test Function NATf, the proxy, and Asterisk are all on public IPs. So my question is: In chan_sip.c, copy_via_headers function, I see an if statement testing for "(ast_test_flag(p, SIP_NAT) == SIP_NAT_ALWAYS)" What in sip.conf do I do to toggle/change SIP_NAT to try to match this if statement? Following is my sip.conf for the proxy. Note I've tried nat=yes, nat=no, nat=always but the darn thing always takes the "else" instead of matching the if. #sip.conf ; Make asterisk register with a foreign proxy ; In this case: ; 9723048720 = account on foreign proxy ; passwd = password for foreign account ; abpusa.com = domain to register with ; 2000 = Asterisk extension to ring if somebody on the foreign proxy calls 9723048720 register => 9723048720:passwd@abpusa.com/2000 ; Used in extension.conf [snomproxy] nat=no type=peer context=extensions host=abpusa.com ;disallow=all ;allow=ulaw Here is a sip debug: notice the via for 192.168 in the inbound INVITE, then notice the lack of it on the outbound 200 OK. Sip read: INVITE sip:10@dink.abpusa.com:5070 SIP/2.0 v: SIP/2.0/UDP 209.189.239.106:5060;branch=z9hG4bK-6f04a3acfdd3002c645fcb7605027073.1 v: SIP/2.0/UDP 209.189.239.106:5062;branch=z9hG4bK-dc2a770cf56399c4c0eb8ca964813dc9;nat=true v: SIP/2.0/UDP 192.168.5.102:5060;branch=z9hG4bK-d0t7a9g6nme4;rport=5060;received=4.13.144.17 Record-Route: <sip:abpusa.com:5060;maddr=209.189.239.106;lr=1> Record-Route: <sip:209.189.239.106:5062;transport=udp;dest=4.13.144.17-5060;to-tag=u2dogw3pvf;lr=1> f: <sip:9723048721@abpusa.com>;tag=u2dogw3pvf t: <sip:5551212@abpusa.com;user=phone> i: 3c29b1afbe6e-58hwc55fzbop@192-168-5-102 CSeq: 1 INVITE Max-Forwards: 68 m: <sip:9723048721@192.168.5.102:5060;line=70n796w7> P-Key-Flags: keys="3" User-Agent: snom190-3.56t Accept-Language: en Accept: application/sdp Allow: INVITE, ACK, CANCEL, BYE, REFER, OPTIONS, NOTIFY, SUBSCRIBE, PRACK, MESSAGE, INFO Allow-Events: talk, hold, refer Supported: timer, 100rel, replaces Session-Expires: 3600 P-Asserted-Identity: "Shanon Snom190" <sip:9723048721@abpusa.com>;tag=u2dogw3pvf c: application/sdp l: 392 v=0 o=root 1476297067 1476297067 IN IP4 209.189.239.106 s=call c=IN IP4 209.189.239.106 t=0 0 m=audio 40126 RTP/AVP 18 4 9 3 0 8 101 a=rtpmap:18 g729/8000 a=rtpmap:4 g723/8000 a=rtpmap:9 g722/16000 a=rtpmap:3 gsm/8000 a=rtpmap:0 pcmu/8000 a=rtpmap:8 pcma/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-15 a=ptime:20 a=sendrecv a=silenceSupp:off - - - - a=setup:actpass 23 headers, 18 lines Using latest request as basis request Sending to 209.189.239.106 : 5060 (non-NAT) Found user '9723048721' Found RTP audio format 18 Found RTP audio format 4 Found RTP audio format 9 Found RTP audio format 3 Found RTP audio format 0 Found RTP audio format 8 Found RTP audio format 101 Peer audio RTP is at port 209.189.239.106:40126 Found description format g729 Found description format g723 Found description format g722 Found description format gsm Found description format pcmu Found description format pcma Found description format telephone-event Capabilities: us - 0x4 (ulaw), peer - audio=0x10f (g723|gsm|ulaw|alaw|g729)/video=0x0 (nothing), combined - 0x4 (ulaw) Non-codec capabilities: us - 0x1 (g723), peer - 0x1 (g723), combined - 0x1 (g723) Looking for 10 in extensions list_route: hop: <sip:abpusa.com:5060;maddr=209.189.239.106;lr=1> list_route: hop: <sip:209.189.239.106:5062;transport=udp;dest=4.13.144.17-5060;to-tag=u2dogw3pvf;lr=1> list_route: hop: <sip:9723048721@192.168.5.102:5060;line=70n796w7> Feb 26 09:10:51 NOTICE[10677]: chan_sip.c:3084 copy_via_headers: Shanon: Used Original Via # 0 Feb 26 09:10:51 NOTICE[10677]: chan_sip.c:3084 copy_via_headers: Shanon: Used Original Via # 1 Feb 26 09:10:51 NOTICE[10677]: chan_sip.c:3084 copy_via_headers: Shanon: Used Original Via # 2 Transmitting (no NAT): SIP/2.0 100 Trying Via: SIP/2.0/UDP 209.189.239.106:5060;branch=z9hG4bK-6f04a3acfdd3002c645fcb7605027073.1 Via: SIP/2.0/UDP 209.189.239.106:5062;branch=z9hG4bK-dc2a770cf56399c4c0eb8ca964813dc9;nat=true Via: SIP/2.0/UDP 192.168.5.102:5060;branch=z9hG4bK-d0t7a9g6nme4;received=4.13.144.17 From: <sip:9723048721@abpusa.com>;tag=u2dogw3pvf To: <sip:5551212@abpusa.com;user=phone>;tag=as067bdac9 Call-ID: 3c29b1afbe6e-58hwc55fzbop@192-168-5-102 CSeq: 1 INVITE User-Agent: Asterisk PBX Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER Contact: <sip:10@4.16.23.149:5070> Content-Length: 0 to 209.189.239.106:5060 Feb 26 09:10:51 NOTICE[10677]: chan_sip.c:3084 copy_via_headers: Shanon: Used Original Via # 0 Feb 26 09:10:51 NOTICE[10677]: chan_sip.c:3084 copy_via_headers: Shanon: Used Original Via # 1 Feb 26 09:10:51 NOTICE[10677]: chan_sip.c:3084 copy_via_headers: Shanon: Used Original Via # 2 We're at 4.16.23.149 port 10798 Answering with preferred capability 0x4 (ulaw) Answering with non-codec capability 0x1 (telephone-event) Reliably Transmitting (no NAT): SIP/2.0 200 OK Via: SIP/2.0/UDP 209.189.239.106:5060;branch=z9hG4bK-6f04a3acfdd3002c645fcb7605027073.1 Via: SIP/2.0/UDP 209.189.239.106:5062;branch=z9hG4bK-dc2a770cf56399c4c0eb8ca964813dc9;nat=true Via: SIP/2.0/UDP 192.168.5.102:5060;branch=z9hG4bK-d0t7a9g6nme4;received=4.13.144.17 Record-Route: <sip:abpusa.com:5060;maddr=209.189.239.106;lr=1> Record-Route: <sip:209.189.239.106:5062;transport=udp;dest=4.13.144.17-5060;to-tag=u2dogw3pvf;lr=1> From: <sip:9723048721@abpusa.com>;tag=u2dogw3pvf To: <sip:5551212@abpusa.com;user=phone>;tag=as067bdac9 all-ID: 3c29b1afbe6e-58hwc55fzbop@192-168-5-102 CSeq: 1 INVITE User-Agent: Asterisk PBX Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER Contact: <sip:10@4.16.23.149:5070> Content-Type: application/sdp Content-Length: 214 v=0 o=root 10677 10677 IN IP4 4.16.23.149 s=session c=IN IP4 4.16.23.149 t=0 0 m=audio 10798 RTP/AVP 0 101 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - to 209.189.239.106:5060