[asterisk-dev] [Code Review] 4318: res_pjsip_pubsub: Fix persistent subscriptions not surviving graceful shutdown

Mark Michelson reviewboard at asterisk.org
Thu Jan 8 15:16:10 CST 2015


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

Ship it!


After IRC discussions yesterday, I relented that the permanent shutdown case was likely much more rare than the temporary one where you would want to persist subscriptions.

Also, I learned that most phones do not automatically resubscribe at any point if their subscriptions are terminated, so even if things are configured to "just work" on the phones during a server migration they probably won't.

So yeah, ship it!

- Mark Michelson


On Jan. 7, 2015, 6:49 p.m., George Joseph wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/4318/
> -----------------------------------------------------------
> 
> (Updated Jan. 7, 2015, 6:49 p.m.)
> 
> 
> Review request for Asterisk Developers and Mark Michelson.
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> If you do a 'core (shutdown|restart) graceful' persistent subscriptions won't survive.  If you do a 'core (shutdown|restart) now' or asterisk terminates for some reason, they do.  Here's why...
> 
> When asterisk shuts down gracefully, it sends a 'NOTIFY/terminated' to subscribers for each subscription.  This not only tells the subscribers that the dialog/state machine is done, it also frees the last reference to the subscription tree which causes the persistent subscription to get deleted from astdb.  When asterisk restarts, nothing's left.  Just preventing the delete from astdb doesn't work because we already told the subscriber to terminate the dialog so we can't restart it even if it was still in astdb.  Everything works OK if asterisk terminates unexpectedly because we never send the 'terminated' message so on restart, the subscription is still in astdb and the subscriber is none the wiser.
> 
> This patch suppresses the sending of 'NOTIFY/terminated' on shutdown for persistent connections.  To do this, I've had to add a new AST_OPT_FLAG_SHUTTING DOWN to options so we know that a shut down is in progress.
> 
> 
> Diffs
> -----
> 
>   branches/13/res/res_pjsip_pubsub.c 430336 
> 
> Diff: https://reviewboard.asterisk.org/r/4318/diff/
> 
> 
> Testing
> -------
> 
> Lots of before and after Wireshark testing with Digium, Grandstream, Unidata and soft phones.  Now when asterisk comes back up, it sends NOTIFY/active messages with updated expires to persistent subscribers which all return OK and further notifies are processed correctly.
> 
> 
> Thanks,
> 
> George Joseph
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150108/abe1fe9c/attachment.html>


More information about the asterisk-dev mailing list