[asterisk-dev] [Code Review] res_stun_monitor module

Kevin Fleming kpfleming at digium.com
Wed Aug 11 13:40:57 CDT 2010



> On 2010-08-11 13:09:50, Simon Perreault wrote:
> > /trunk/configs/res_stun_monitor.conf.sample, line 24
> > <https://reviewboard.asterisk.org/r/854/diff/2/?file=12181#file12181line24>
> >
> >     Why not let the kernel pick an ephemeral port?
> 
> David Vossel wrote:
>     The idea was to use the same port consistently so we can detect if the NAT device has changed the port mapping.  While this does not mean the port mappings for SIP or IAX have changed, it does indicate an external network change of some sort has occurred.
> 
> Simon Perreault wrote:
>     As long as you don't close the socket, the source port will not change. You don't need to call bind() at all for this.

Right, what Simon said :-)


> On 2010-08-11 13:09:50, Simon Perreault wrote:
> > /trunk/configs/res_stun_monitor.conf.sample, line 28
> > <https://reviewboard.asterisk.org/r/854/diff/2/?file=12181#file12181line28>
> >
> >     I'm not convinced that this option is needed at all.

Same thing here; just let the kernel pick a source address and port number. Since you are keeping the socket open, it can be on any address.


- Kevin


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


On 2010-08-11 11:46:41, David Vossel wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/854/
> -----------------------------------------------------------
> 
> (Updated 2010-08-11 11:46:41)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> The res_stun_monitor module monitors the perceived external ip/port provided by a STUN server and sends out an event when that perceived ip/port changes in any way.  This patch adds chan_sip and chan_iax as listeners to this event.  Both of these channel drivers react to the event by regenerating all outbound registers in order to alert the endpoints being registered with to the new address location.  This feature's primary use case is when Asterisk is behind a NAT in which the external ip address is dynamic or the port mappings of the NAT device are subject to change.
> 
> I will update the CHANGES file before committing this.  That is not included within this review though.
> 
> 
> Diffs
> -----
> 
>   /trunk/channels/chan_iax2.c 281758 
>   /trunk/channels/chan_sip.c 281758 
>   /trunk/configs/iax.conf.sample 281758 
>   /trunk/configs/res_stun_monitor.conf.sample PRE-CREATION 
>   /trunk/configs/sip.conf.sample 281758 
>   /trunk/include/asterisk/event_defs.h 281758 
>   /trunk/res/res_stun_monitor.c PRE-CREATION 
> 
> Diff: https://reviewboard.asterisk.org/r/854/diff
> 
> 
> Testing
> -------
> 
> I tested all the res_stun_monitor.conf options to verify functionality.
> I tested the channel driver's event listening by triggering an address change and verifying registrations are sent via wireshark.
> 
> 
> Thanks,
> 
> David
> 
>




More information about the asterisk-dev mailing list