Notes: RTP debug uses this ast_inet_ntoa(iabuf, sizeof(iabuf), rtp->them.sin_addr) Search for them.sin_addr and NAT in rtp.c gives this: if (rtp->nat) { /* Send to whoever sent to us */ if ((rtp->them.sin_addr.s_addr != sin.sin_addr.s_addr) || (rtp->them.sin_port != sin.sin_port)) { memcpy(&rtp->them, &sin, sizeof(rtp->them)); rtp->rxseqno = 0; ast_log(LOG_DEBUG, "RTP NAT: Using address %s:%d\n", ast_inet_ntoa(iabuf, sizeof(iabuf), rtp->them.sin_addr), ntohs(rtp->them.sin_port)); } } Sep 2 02:04:16 DEBUG[11706] rtp.c: RTP NAT: Using address 67.189.14.105:2235 Structure ast_rtp contains struct for them. us Also function void ast_rtp_setnat(struct ast_rtp *rtp, int nat) { rtp->nat = nat; } which leads to chan_sip.c if (r->rtp) { ast_log(LOG_DEBUG, "Setting NAT on RTP to %d\n", (ast_test_flag(r, SIP_NAT) & SIP_NAT_ROUTE)); ast_rtp_setnat(r->rtp, (ast_test_flag(r, SIP_NAT) & SIP_NAT_ROUTE)); } [root@comcast root]# grep 'Setting NAT on RTP' /var/log/asterisk/full Sep 1 13:35:44 DEBUG[19422] chan_sip.c: Setting NAT on RTP to 0 Sep 1 13:35:44 DEBUG[19422] chan_sip.c: Setting NAT on RTP to 0 Sep 1 13:35:45 DEBUG[19422] chan_sip.c: Setting NAT on RTP to 524288 Sep 1 13:36:12 DEBUG[19422] chan_sip.c: Setting NAT on RTP to 0 Sep 1 13:36:12 DEBUG[19422] chan_sip.c: Setting NAT on RTP to 0 Sep 1 13:36:12 DEBUG[19422] chan_sip.c: Setting NAT on RTP to 524288 Sep 2 01:04:54 DEBUG[11070] chan_sip.c: Setting NAT on RTP to 524288 Sep 2 01:04:54 DEBUG[11070] chan_sip.c: Setting NAT on RTP to 0 Sep 2 01:05:01 DEBUG[11070] chan_sip.c: Setting NAT on RTP to 524288 Sep 2 01:05:01 DEBUG[11070] chan_sip.c: Setting NAT on RTP to 0 Sep 2 01:05:14 DEBUG[11070] chan_sip.c: Setting NAT on RTP to 524288 Sep 2 01:05:38 DEBUG[11167] chan_sip.c: Setting NAT on RTP to 524288 Sep 2 01:05:42 DEBUG[11167] chan_sip.c: Setting NAT on RTP to 524288 Sep 2 01:05:59 DEBUG[11167] chan_sip.c: Setting NAT on RTP to 524288 Sep 2 01:09:53 DEBUG[11260] chan_sip.c: Setting NAT on RTP to 524288 Sep 2 01:10:02 DEBUG[11260] chan_sip.c: Setting NAT on RTP to 524288 Sep 2 01:59:08 DEBUG[11706] chan_sip.c: Setting NAT on RTP to 524288 (ast_test_flag(r, SIP_NAT) & SIP_NAT_ROUTE) is either 0 or 524288 NOT WORKING 'ngrep rport' U 67.189.14.105:5060 -> 10.1.1.12:5060 INVITE sip:6000@67.189.77.121:5060;user=phone SIP/2.0..Via: SIP/2.0/UDP 192.168.1.102;branch=z9hG4bK20d0e15D7F467D0..From: "354" ;tag=E93A4ACF-716D6 7CC..To: ..CSeq: 1 INVITE..Call-ID: 5422ceb3-fc4c88f1-e4c017e@192.168.1.102..Contact: ..Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, INFO, MESSAGE, SUBSCRIBE, NOTIFY, PRACK, UPDATE, REFER..User-Agent: PolycomSoundPointIP-SPIP_500-UA/1.3.1..Supported: 100rel,replace..Allow-Events: talk,h old,conference..Max-Forwards: 70..Content-Type: application/sdp..Content-Length: 239....v=0..o=- 1119089086 1119089086 IN IP4 192.168.1.102..s=Polycom IP Phone..c=IN IP4 1 92.168.1.102..t=0 0..m=audio 2254 RTP/AVP 0 8 18 101..a=rtpmap:0 PCMU/8000..a=rtpmap:8 PCMA/8000..a=rtpmap:18 G729/8000..a=rtpmap:101 telephone-event/8000.. ################### U 10.1.1.12:5060 -> 67.189.14.105:5060 SIP/2.0 200 OK..Via: SIP/2.0/UDP 192.168.1.102;branch=z9hG4bK20d0e15D7F467D0;received=67.189.14.105;rport=5060..From: "354" ;tag=E93A4ACF-716D67CC.. To: ;tag=as2443365b..Call-ID: 5422ceb3-fc4c88f1-e4c017e@192.168.1.102..CSeq: 1 INVITE..User-Agent: Asterisk PBX..Allow: INVITE, ACK, CAN CEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY..Contact: ..Content-Type: application/sdp..Content-Length: 291....v=0..o=root 11706 11706 IN IP4 67.189 .77.121..s=session..c=IN IP4 67.189.77.121..t=0 0..m=audio 29126 RTP/AVP 0 8 18 3 101..a=rtpmap:0 PCMU/8000..a=rtpmap:8 PCMA/8000..a=rtpmap:18 G729/8000..a=rtpmap:3 GSM/80 00..a=rtpmap:101 telephone-event/8000..a=fmtp:101 0-16..a=silenceSupp:off - - - -.. ############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################### WORKING AUDIO 'ngrep rport' U 67.189.14.105:5060 -> 10.1.1.12:5060 INVITE sip:6000@67.189.77.121:5060;user=phone SIP/2.0..Via: SIP/2.0/UDP 192.168.1.102;branch=z9hG4bK643baa2951C9B744..From: "354" ;tag=60BB4623-E3AF E6C0..To: ..CSeq: 1 INVITE..Call-ID: 4aa09687-4c9d3085-e80adeb2@192.168.1.102..Contact: ..Allow: INVITE, ACK, BYE , CANCEL, OPTIONS, INFO, MESSAGE, SUBSCRIBE, NOTIFY, PRACK, UPDATE, REFER..User-Agent: PolycomSoundPointIP-SPIP_500-UA/1.3.1..Supported: 100rel,replace..Allow-Events: talk ,hold,conference..Max-Forwards: 70..Content-Type: application/sdp..Content-Length: 239....v=0..o=- 1119089088 1119089088 IN IP4 192.168.1.102..s=Polycom IP Phone..c=IN IP4 192.168.1.102..t=0 0..m=audio 2256 RTP/AVP 0 8 18 101..a=rtpmap:0 PCMU/8000..a=rtpmap:8 PCMA/8000..a=rtpmap:18 G729/8000..a=rtpmap:101 telephone-event/8000.. #### U 10.1.1.12:5060 -> 67.189.14.105:5060 SIP/2.0 200 OK..Via: SIP/2.0/UDP 192.168.1.102;branch=z9hG4bK643baa2951C9B744;received=67.189.14.105;rport=5060..From: "354" ;tag=60BB4623-E3AFE6C0. .To: ;tag=as5b1f2b2d..Call-ID: 4aa09687-4c9d3085-e80adeb2@192.168.1.102..CSeq: 1 INVITE..User-Agent: Asterisk PBX..Allow: INVITE, ACK, C ANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY..Contact: ..Content-Type: application/sdp..Content-Length: 291....v=0..o=root 11706 11706 IN IP4 67.1 89.77.121..s=session..c=IN IP4 67.189.77.121..t=0 0..m=audio 19594 RTP/AVP 0 8 18 3 101..a=rtpmap:0 PCMU/8000..a=rtpmap:8 PCMA/8000..a=rtpmap:18 G729/8000..a=rtpmap:3 GSM/ 8000..a=rtpmap:101 telephone-event/8000..a=fmtp:101 0-16..a=silenceSupp:off - - - -.. http://www.faqs.org/rfcs/rfc3581.html RFC 3581 - An Extension to the Session Initiation Protocol (SIP) for Symmetric Response Routing " This extension defines a new parameter for the Via header field, called "rport", that allows a client to request that the server send the response back to the source IP address and port from which the request originated."