[asterisk-dev] [Code Review] Use the correct IP address in the c and o sdp lines when using an externally mapped IP address

Russell Bryant russell at digium.com
Tue Aug 10 11:46:40 CDT 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/566/#review2549
-----------------------------------------------------------

Ship it!


- Russell


On 2010-08-09 09:45:56, ebroad wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/566/
> -----------------------------------------------------------
> 
> (Updated 2010-08-09 09:45:56)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> The issue 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(which is what the attached diff does), though I don't know what that might break.
> 
> Edit 1: This patch short-circuits some logic later on in get_our_media_address(). ast_rtp_instance_get_local_address() does exactly as the function name suggests, it gets the local address of the machine the Asterisk is running on, which is bad for NAT setups. Should we be calling this in get_our_media_address() or instead just use p->ourip? or should we try to stick with letting the RTP engine decide, and modifying ast_rtp_instance_get_local_address() to return our externally mapped IP when appropriate, which would break from what the function is supposed to do? Comments anyone? 
> 
> 
> This addresses bug 17044.
>     https://issues.asterisk.org/view.php?id=17044
> 
> 
> Diffs
> -----
> 
>   /trunk/channels/chan_sip.c 281293 
> 
> Diff: https://reviewboard.asterisk.org/r/566/diff
> 
> 
> Testing
> -------
> 
> Applied to trunk, compiled, fax and voice calls made to and from Asterisk successfully.
> 
> 
> Thanks,
> 
> ebroad
> 
>




More information about the asterisk-dev mailing list