[asterisk-dev] [Code Review] 2598: chan_pjsip: Stateful Contact Expiration

Mark Michelson reviewboard at asterisk.org
Thu Jun 6 16:15:18 CDT 2013


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


I think this should be either

1) part of res_sip_registrar or
2) in the res_sip "core"

With the current setup, someone could potentially load res_sip_registrar but not res_sip_registrar_expire. This would allow someone to have a registrar set up that will add new contacts but never allow for them to expire. Contact expiration is a vital part of a registrar's duties. If the registrar is the only way that we foresee adding temporary contacts, then I think this set of observers belongs in the registrar code (potentially in a separate file, but still part of the registrar module). If, however, there might be some other method of adding dynamic contacts, then I suggest putting this in the res_sip core so that contacts can be guaranteed to expire no matter how they get added.


/team/group/pimp_my_sip/res/res_sip_registrar_expire.c
<https://reviewboard.asterisk.org/r/2598/#comment17398>

    Currently, permanent contacts will end up in the contact_autoexpire container (though not in the scheduler since attempting to schedule something 0 ms from now will fail). Since this module is only concerned with temporary contacts, I'd suggest the following two changes:
    
    1) If expires == 0, then don't bother continuing. You're either dealing with a permanent contact or one that was set to expire in the past (somehow). In either case, there is no reason to track the contact.
    
    2) If you fail to add the expiration to the scheduler, then this is a big-time failure. You should clean up the expiration and output an error message stating that the created contact will not expire properly.


- Mark Michelson


On June 6, 2013, 7:08 p.m., Joshua Colp wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2598/
> -----------------------------------------------------------
> 
> (Updated June 6, 2013, 7:08 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> This change adds a stand-alone module which uses sorcery observers to delete contacts when they should expire, unless updated. This will allow persistent endpoint state to reflect reality.
> 
> 
> Diffs
> -----
> 
>   /team/group/pimp_my_sip/res/res_sip_registrar_expire.c PRE-CREATION 
> 
> Diff: https://reviewboard.asterisk.org/r/2598/diff/
> 
> 
> Testing
> -------
> 
> Tweaked the code to explicitly expire contacts after 5 seconds, confirmed it happens and that structures get destroyed as expected.
> 
> 
> Thanks,
> 
> Joshua Colp
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130606/7cf4caba/attachment-0001.htm>


More information about the asterisk-dev mailing list