Summary: | ASTERISK-15826: [regression][patch] SDP c and o lines contain the wrong IP address when using an externally mapped IP(extern{ip,host}) | ||
Reporter: | Elazar Broad (ebroad) | Labels: | |
Date Opened: | 2010-03-16 15:45:18 | Date Closed: | 2010-08-10 11:55:50 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Channels/chan_sip/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ||
Description: | The problem stems from a call to ast_rtp_instance_get_local_address() in chan_sip.c in get_our_media_address(). ast_rtp_instance_get_local_address() will always return the internal IP address of the Asterisk machine, which could pose a problem when using NAT. A simple solution would be to override {v,t}sin->sin_addr in get_our_media_address() with p->ourip.sin_addr.s_addr if it is different, though I don't know what that might break. ****** ADDITIONAL INFORMATION ****** SIP/2.0 200 OK Via: SIP/2.0/UDP 64.154.41.100:5060;branch=z9hG4bK02f92e83f22e56e634998f3e31edc07f;received=64.154.41.100;rport=5060 From: <sip:6463126269@64.154.41.100>;tag=3477761011-584029 To: <sip:401xxxxxxx@64.154.41.100>;tag=as26d7ea77 Call-ID: 5808065-3477761011-583993@msx71.mydomain.com CSeq: 1 INVITE Server: Asterisk PBX Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces, timer Contact: <sip:401xxxxxxx@72.xx.157.xx> Content-Type: application/sdp Content-Length: 254 v=0 o=asterisk 2050955676 2050955676 IN IP4 10.xx.50.xx s=Asterisk PBX c=IN IP4 10.xx.50.xx t=0 0 m=audio 16482 RTP/AVP 0 8 101 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=ptime:20 a=sendrecv | ||
Comments: | By: Leif Madsen (lmadsen) 2010-03-16 18:43:12 Marking this as Confirmed as I think this should be put on reviewboard as any non-trivial changes to chan_sip should go through that process. By: Elazar Broad (ebroad) 2010-03-16 21:01:41 Duly noted and done, thanks Leif! By: Elazar Broad (ebroad) 2010-08-10 11:46:11 chan_sip r250617(http://svnview.digium.com/svn/asterisk?view=revision&revision=250917) changed the behavior of get_our_media_address(). Before the commit, if media_address was set, we would us it, otherwise, we would use p->ourip which would contain the external mapped IP address of the machine when running Asterisk behind NAT, which is correct. Now, we go through the following order: 1. media_address 2. Local address returned by the RTP engine 3. p->ourip The problem is that the RTP engine will always return the local address of the machine(AFAIK, it is not NAT aware), which means the IP address sent in the SDP payload will be incorrect in a NAT scenario. By: Digium Subversion (svnbot) 2010-08-10 11:54:18 Repository: asterisk Revision: 281532 U branches/1.8/channels/chan_sip.c ------------------------------------------------------------------------ r281532 | russell | 2010-08-10 11:54:18 -0500 (Tue, 10 Aug 2010) | 8 lines Ensure that the proper external address is used for the RTP destination. (closes issue ASTERISK-15826) Reported by: ebroad Tested by: ebroad Review: https://reviewboard.asterisk.org/r/566/ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=281532 By: Digium Subversion (svnbot) 2010-08-10 11:55:50 Repository: asterisk Revision: 281533 _U trunk/ U trunk/channels/chan_sip.c ------------------------------------------------------------------------ r281533 | russell | 2010-08-10 11:55:49 -0500 (Tue, 10 Aug 2010) | 15 lines Merged revisions 281532 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r281532 | russell | 2010-08-10 11:54:20 -0500 (Tue, 10 Aug 2010) | 8 lines Ensure that the proper external address is used for the RTP destination. (closes issue ASTERISK-15826) Reported by: ebroad Tested by: ebroad Review: https://reviewboard.asterisk.org/r/566/ ........ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=281533 |