<p>N A has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19973">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_pubsub: Fix subscription shutdown regression.<br><br>ASTERISK_30325 introduced a regression that results in<br>subscription shutdown callbacks no longer firing when<br>a subscription is terminated by an endpoint. This is<br>as a result of changes in res_pjsip_pubsub to change<br>how subscription cleanup occured.<br><br>However, the fix employed seems to be partial at best,<br>since this can result in the tree cleanup not happening<br>at all, leaving users unaware the subscription has gone away.<br><br>To fix this, a call to clean_sub_tree is made in pubsub_on_refresh_timeout<br>if HAVE_PJSIP_EVSUB_PENDING_NOTIFY is defined.<br><br>ASTERISK-30469 #close<br><br>Change-Id: I677ec5e9c14b36ebffbc2392a79ce4db95d6a3ec<br>---<br>M res/res_pjsip_pubsub.c<br>1 file changed, 34 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/73/19973/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c</span><br><span>index bf07d5a..a21d14d 100644</span><br><span>--- a/res/res_pjsip_pubsub.c</span><br><span>+++ b/res/res_pjsip_pubsub.c</span><br><span>@@ -3853,6 +3853,8 @@</span><br><span>      struct sip_subscription_tree *sub_tree;</span><br><span>      sub_tree = pjsip_evsub_get_mod_data(evsub, pubsub_module.id);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+     ast_debug(3, "Cleaning subscription %p\n", evsub);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>       if (sub_tree->expiration_task) {</span><br><span>          char task_name[256];</span><br><span> </span><br><span>@@ -3920,7 +3922,6 @@</span><br><span>        is called before pubsub_on_rx_refresh and so must be cleaned there.*/</span><br><span>     clean_sub_tree(evsub);</span><br><span> #endif</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> }</span><br><span> </span><br><span> static int pubsub_on_refresh_timeout(void *userdata)</span><br><span>@@ -3953,6 +3954,14 @@</span><br><span> </span><br><span>       send_notify(sub_tree, 1);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#ifdef HAVE_PJSIP_EVSUB_PENDING_NOTIFY</span><br><span style="color: hsl(120, 100%, 40%);">+ /* For >= 2.13, clean_sub_tree is not called in pubsub_on_evsub_state */</span><br><span style="color: hsl(120, 100%, 40%);">+   if (sub_tree->state == SIP_SUB_TREE_TERMINATE_IN_PROGRESS) {</span><br><span style="color: hsl(120, 100%, 40%);">+               ast_debug(5, "Removing terminated subscription %p\n", sub_tree->evsub);</span><br><span style="color: hsl(120, 100%, 40%);">+          clean_sub_tree(sub_tree->evsub);</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  ast_test_suite_event_notify(sub_tree->root->subscription_state == PJSIP_EVSUB_STATE_TERMINATED ?</span><br><span>                               "SUBSCRIPTION_TERMINATED" : "SUBSCRIPTION_REFRESHED",</span><br><span>                            "Resource: %s", sub_tree->root->resource);</span><br><span>@@ -4160,8 +4169,6 @@</span><br><span>                   clean_sub_tree(evsub);</span><br><span>       }</span><br><span> #endif</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> }</span><br><span> </span><br><span> static void pubsub_on_rx_notify(pjsip_evsub *evsub, pjsip_rx_data *rdata, int *p_st_code,</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19973">change 19973</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/19973"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I677ec5e9c14b36ebffbc2392a79ce4db95d6a3ec </div>
<div style="display:none"> Gerrit-Change-Number: 19973 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: N A <asterisk@phreaknet.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>