[asterisk-dev] STUN support in chan_sip revisited

Klaus Darilion klaus.mailinglists at pernau.at
Tue Aug 10 02:43:21 CDT 2010



Am 09.08.2010 15:32, schrieb Simon Perreault:
> On 2010-08-09 09:24, Klaus Darilion wrote:
>>
>>
>> Am 09.08.2010 14:11, schrieb Simon Perreault:
>>>> Thus Asterisk would need
>>>> a feature to send REGISTERs with the required high Expires header, but
>>>> reregisters much earlier although the registration has not expired.
>>>
>>> Yes!
>>>
>>> And note that this is 100% compliant with RFC 3261. The only purpose of
>>> the Expires header returned by the registrar is to inform the client of
>>> the registration's life-time. The client is free to re-register (or not)
>>> at any moment.
>>>
>>> The right value for the Expires header to be sent to the registrar could
>>> be determined automatically from the Min-Expires header that the
>>> registrar sends us when it rejects the initial REGISTER with a 423
>>> (Interval Too Brief). Asterisk would send a new REGISTER request with
>>> this value but the actual re-registration interval would be the one
>>> configured statically in sip.conf. Would that work?
>>
>> I think yes. But IMO it is not elegant - using STUN or CRLF is more
>> elegant. Although not defined in RFC3261, CRLF as keep-alive for UDP is
>> well supported.
>
> Yes, but they serve different purposes.
>
> When e.g. the DSL modem gets assigned a new IP address, all existing
> connections die, even if they were kept-alive using STUN or CRLF.
> (Related use cases: the NAT device crashes and reboots, the NAT device
> runs out of memory and kills our binding, etc.)
>
> To solve these problems, we need to send a REGISTER request as soon as
> the event happens. We can either try to detect the event (I couldn't
> figure out a good method), or just send REGISTER requests at small interval.

I would not send reREGISTER requests on spec. Just use STUN regularly to 
detect changes (either public STUN port changes (e.g. reboot of NAT 
router) or IP address change) and if a change in network is detected, 
send this event to all interested modules. Then the modules, e.g. 
chan_sip, can take proper action and send REGISTER (1. deREGISTER old 
contact, REGISTER new contact).

regards
klaus



More information about the asterisk-dev mailing list