<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/11015">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Benjamin Keith Ford: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_registrar: blocked threads on reliable transport shutdown take 3<br><br>When a contact was removed by the registrar it did not always check to see if<br>the circumstances involved a monitored reliable transport. For instance, if the<br>'remove_existing' option was set to 'true' then when existing contacts were<br>removed due to 'max_contacts' being reached, those existing contacts being<br>removed did not unregister the transport monitor.<br><br>Also, it was possible to add more than one monitor on a reliable transport for<br>a given aor and contact.<br><br>This patch makes it so all contact removals done by the registrar also remove<br>any associated transport monitors if necessary. It also makes it so duplicate<br>monitors cannot be added for a given transport.<br><br>ASTERISK-28213<br><br>Change-Id: I94b06f9026ed177d6adfd538317c784a42c1b17a<br>---<br>M include/asterisk/res_pjsip.h<br>M res/res_pjsip/pjsip_transport_events.c<br>M res/res_pjsip_registrar.c<br>3 files changed, 133 insertions(+), 83 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h</span><br><span>index 36af15e..b84983e 100644</span><br><span>--- a/include/asterisk/res_pjsip.h</span><br><span>+++ b/include/asterisk/res_pjsip.h</span><br><span>@@ -3143,6 +3143,29 @@</span><br><span> ast_transport_monitor_shutdown_cb cb, void *ao2_data);</span><br><span> </span><br><span> /*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Register a reliable transport shutdown monitor callback replacing any duplicate.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \since 13.26.0</span><br><span style="color: hsl(120, 100%, 40%);">+ * \since 16.3.0</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param transport Transport to monitor for shutdown.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param cb Who to call when transport is shutdown.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param ao2_data Data to pass with the callback.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param matches Matcher function that returns true if data matches a previously</span><br><span style="color: hsl(120, 100%, 40%);">+ * registered data object</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \note The data object passed will have its reference count automatically</span><br><span style="color: hsl(120, 100%, 40%);">+ * incremented by this call and automatically decremented after the callback</span><br><span style="color: hsl(120, 100%, 40%);">+ * runs or when the callback is unregistered.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This function checks for duplicates, and overwrites/replaces the old monitor</span><br><span style="color: hsl(120, 100%, 40%);">+ * with the given one.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return enum ast_transport_monitor_reg</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+enum ast_transport_monitor_reg ast_sip_transport_monitor_register_replace(pjsip_transport *transport,</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_transport_monitor_shutdown_cb cb, void *ao2_data, ast_transport_monitor_data_matcher matches);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span> * \brief Unregister a reliable transport shutdown monitor</span><br><span> * \since 13.20.0</span><br><span> *</span><br><span>diff --git a/res/res_pjsip/pjsip_transport_events.c b/res/res_pjsip/pjsip_transport_events.c</span><br><span>index cc7b7c0..5eb9868 100644</span><br><span>--- a/res/res_pjsip/pjsip_transport_events.c</span><br><span>+++ b/res/res_pjsip/pjsip_transport_events.c</span><br><span>@@ -306,6 +306,12 @@</span><br><span> enum ast_transport_monitor_reg ast_sip_transport_monitor_register(pjsip_transport *transport,</span><br><span> ast_transport_monitor_shutdown_cb cb, void *ao2_data)</span><br><span> {</span><br><span style="color: hsl(120, 100%, 40%);">+ return ast_sip_transport_monitor_register_replace(transport, cb, ao2_data, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+enum ast_transport_monitor_reg ast_sip_transport_monitor_register_replace(pjsip_transport *transport,</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_transport_monitor_shutdown_cb cb, void *ao2_data, ast_transport_monitor_data_matcher matches)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span> struct ao2_container *transports;</span><br><span> struct transport_monitor *monitored;</span><br><span> enum ast_transport_monitor_reg res = AST_TRANSPORT_MONITOR_REG_NOT_FOUND;</span><br><span>@@ -321,6 +327,13 @@</span><br><span> monitored = ao2_find(transports, transport->obj_name, OBJ_SEARCH_KEY | OBJ_NOLOCK);</span><br><span> if (monitored) {</span><br><span> struct transport_monitor_notifier new_monitor;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct callback_data cb_data = {</span><br><span style="color: hsl(120, 100%, 40%);">+ .cb = cb,</span><br><span style="color: hsl(120, 100%, 40%);">+ .data = ao2_data,</span><br><span style="color: hsl(120, 100%, 40%);">+ .matches = matches ?: ptr_matcher,</span><br><span style="color: hsl(120, 100%, 40%);">+ };</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ transport_monitor_unregister_cb(monitored, &cb_data, 0);</span><br><span> </span><br><span> /* Add new monitor to vector */</span><br><span> new_monitor.cb = cb;</span><br><span>diff --git a/res/res_pjsip_registrar.c b/res/res_pjsip_registrar.c</span><br><span>index e6b7901..53f20a3 100644</span><br><span>--- a/res/res_pjsip_registrar.c</span><br><span>+++ b/res/res_pjsip_registrar.c</span><br><span>@@ -197,30 +197,22 @@</span><br><span> return 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+enum contact_delete_type {</span><br><span style="color: hsl(120, 100%, 40%);">+ CONTACT_DELETE_ERROR,</span><br><span style="color: hsl(120, 100%, 40%);">+ CONTACT_DELETE_EXISTING,</span><br><span style="color: hsl(120, 100%, 40%);">+ CONTACT_DELETE_EXPIRE,</span><br><span style="color: hsl(120, 100%, 40%);">+ CONTACT_DELETE_REQUEST,</span><br><span style="color: hsl(120, 100%, 40%);">+ CONTACT_DELETE_SHUTDOWN,</span><br><span style="color: hsl(120, 100%, 40%);">+};</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static int registrar_contact_delete(enum contact_delete_type type, pjsip_transport *transport,</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_sip_contact *contact, const char *aor_name);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*! \brief Internal function used to delete a contact from an AOR */</span><br><span> static int registrar_delete_contact(void *obj, void *arg, int flags)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_sip_contact *contact = obj;</span><br><span style="color: hsl(0, 100%, 40%);">- const char *aor_name = arg;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* Permanent contacts can't be deleted */</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_tvzero(contact->expiration_time)) {</span><br><span style="color: hsl(0, 100%, 40%);">- return 0;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_sip_location_delete_contact(contact);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_strlen_zero(aor_name)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verb(3, "Removed contact '%s' from AOR '%s' due to request\n", contact->uri, aor_name);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_test_suite_event_notify("AOR_CONTACT_REMOVED",</span><br><span style="color: hsl(0, 100%, 40%);">- "Contact: %s\r\n"</span><br><span style="color: hsl(0, 100%, 40%);">- "AOR: %s\r\n"</span><br><span style="color: hsl(0, 100%, 40%);">- "UserAgent: %s",</span><br><span style="color: hsl(0, 100%, 40%);">- contact->uri,</span><br><span style="color: hsl(0, 100%, 40%);">- aor_name,</span><br><span style="color: hsl(0, 100%, 40%);">- contact->user_agent);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return CMP_MATCH;</span><br><span style="color: hsl(120, 100%, 40%);">+ return registrar_contact_delete(</span><br><span style="color: hsl(120, 100%, 40%);">+ CONTACT_DELETE_REQUEST, NULL, obj, arg) ? 0 : CMP_MATCH;</span><br><span> }</span><br><span> </span><br><span> /*! \brief Internal function which adds a contact to a response */</span><br><span>@@ -352,16 +344,7 @@</span><br><span> </span><br><span> contact = ast_sip_location_retrieve_contact(monitor->contact_name);</span><br><span> if (contact) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_sip_location_delete_contact(contact);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verb(3, "Removed contact '%s' from AOR '%s' due to transport shutdown\n",</span><br><span style="color: hsl(0, 100%, 40%);">- contact->uri, monitor->aor_name);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_test_suite_event_notify("AOR_CONTACT_REMOVED",</span><br><span style="color: hsl(0, 100%, 40%);">- "Contact: %s\r\n"</span><br><span style="color: hsl(0, 100%, 40%);">- "AOR: %s\r\n"</span><br><span style="color: hsl(0, 100%, 40%);">- "UserAgent: %s",</span><br><span style="color: hsl(0, 100%, 40%);">- contact->uri,</span><br><span style="color: hsl(0, 100%, 40%);">- monitor->aor_name,</span><br><span style="color: hsl(0, 100%, 40%);">- contact->user_agent);</span><br><span style="color: hsl(120, 100%, 40%);">+ registrar_contact_delete(CONTACT_DELETE_SHUTDOWN, NULL, contact, monitor->aor_name);</span><br><span> ao2_ref(contact, -1);</span><br><span> }</span><br><span> ao2_unlock(aor);</span><br><span>@@ -414,6 +397,81 @@</span><br><span> ao2_unlock(monitor);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static int registrar_contact_delete(enum contact_delete_type type, pjsip_transport *transport,</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_sip_contact *contact, const char *aor_name)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ int aor_size;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Permanent contacts can't be deleted */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_tvzero(contact->expiration_time)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ aor_size = aor_name ? strlen(aor_name) : 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (contact->prune_on_boot && type != CONTACT_DELETE_SHUTDOWN && aor_size) {</span><br><span style="color: hsl(120, 100%, 40%);">+ const char *contact_name = ast_sorcery_object_get_id(contact);</span><br><span style="color: hsl(120, 100%, 40%);">+ struct contact_transport_monitor *monitor = ast_alloca(</span><br><span style="color: hsl(120, 100%, 40%);">+ sizeof(*monitor) + 2 + aor_size + strlen(contact_name));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(monitor->aor_name, aor_name); /* Safe */</span><br><span style="color: hsl(120, 100%, 40%);">+ monitor->contact_name = monitor->aor_name + aor_size + 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(monitor->contact_name, contact_name); /* Safe */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (transport) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_sip_transport_monitor_unregister(transport,</span><br><span style="color: hsl(120, 100%, 40%);">+ register_contact_transport_shutdown_cb, monitor,</span><br><span style="color: hsl(120, 100%, 40%);">+ contact_transport_monitor_matcher);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+ * If a specific transport is not supplied then unregister the matching</span><br><span style="color: hsl(120, 100%, 40%);">+ * monitor from all reliable transports.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_sip_transport_monitor_unregister_all(register_contact_transport_shutdown_cb,</span><br><span style="color: hsl(120, 100%, 40%);">+ monitor, contact_transport_monitor_matcher);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_sip_location_delete_contact(contact);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (aor_size) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (VERBOSITY_ATLEAST(3)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ const char *reason = "none";</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ switch (type) {</span><br><span style="color: hsl(120, 100%, 40%);">+ case CONTACT_DELETE_ERROR:</span><br><span style="color: hsl(120, 100%, 40%);">+ reason = "registration failure";</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case CONTACT_DELETE_EXISTING:</span><br><span style="color: hsl(120, 100%, 40%);">+ reason = "remove existing";</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case CONTACT_DELETE_EXPIRE:</span><br><span style="color: hsl(120, 100%, 40%);">+ reason = "expiration";</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case CONTACT_DELETE_REQUEST:</span><br><span style="color: hsl(120, 100%, 40%);">+ reason = "request";</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case CONTACT_DELETE_SHUTDOWN:</span><br><span style="color: hsl(120, 100%, 40%);">+ reason = "shutdown";</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_verb(3, "Removed contact '%s' from AOR '%s' due to %s\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ contact->uri, aor_name, reason);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_test_suite_event_notify("AOR_CONTACT_REMOVED",</span><br><span style="color: hsl(120, 100%, 40%);">+ "Contact: %s\r\n"</span><br><span style="color: hsl(120, 100%, 40%);">+ "AOR: %s\r\n"</span><br><span style="color: hsl(120, 100%, 40%);">+ "UserAgent: %s",</span><br><span style="color: hsl(120, 100%, 40%);">+ contact->uri,</span><br><span style="color: hsl(120, 100%, 40%);">+ aor_name,</span><br><span style="color: hsl(120, 100%, 40%);">+ contact->user_agent);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> AST_VECTOR(excess_contact_vector, struct ast_sip_contact *);</span><br><span> </span><br><span> static int vec_contact_cmp(struct ast_sip_contact *left, struct ast_sip_contact *right)</span><br><span>@@ -490,16 +548,7 @@</span><br><span> </span><br><span> contact = AST_VECTOR_GET(&contact_vec, to_remove);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- ast_sip_location_delete_contact(contact);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verb(3, "Removed contact '%s' from AOR '%s' due to remove_existing\n",</span><br><span style="color: hsl(0, 100%, 40%);">- contact->uri, contact->aor);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_test_suite_event_notify("AOR_CONTACT_REMOVED",</span><br><span style="color: hsl(0, 100%, 40%);">- "Contact: %s\r\n"</span><br><span style="color: hsl(0, 100%, 40%);">- "AOR: %s\r\n"</span><br><span style="color: hsl(0, 100%, 40%);">- "UserAgent: %s",</span><br><span style="color: hsl(0, 100%, 40%);">- contact->uri,</span><br><span style="color: hsl(0, 100%, 40%);">- contact->aor,</span><br><span style="color: hsl(0, 100%, 40%);">- contact->user_agent);</span><br><span style="color: hsl(120, 100%, 40%);">+ registrar_contact_delete(CONTACT_DELETE_EXISTING, NULL, contact, contact->aor);</span><br><span> </span><br><span> ao2_unlink(response_contacts, contact);</span><br><span> }</span><br><span>@@ -729,8 +778,8 @@</span><br><span> monitor->contact_name = monitor->aor_name + strlen(aor_name) + 1;</span><br><span> strcpy(monitor->contact_name, contact_name);/* Safe */</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- ast_sip_transport_monitor_register(rdata->tp_info.transport,</span><br><span style="color: hsl(0, 100%, 40%);">- register_contact_transport_shutdown_cb, monitor);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_sip_transport_monitor_register_replace(rdata->tp_info.transport,</span><br><span style="color: hsl(120, 100%, 40%);">+ register_contact_transport_shutdown_cb, monitor, contact_transport_monitor_matcher);</span><br><span> ao2_ref(monitor, -1);</span><br><span> }</span><br><span> }</span><br><span>@@ -774,7 +823,8 @@</span><br><span> if (ast_sip_location_update_contact(contact_update)) {</span><br><span> ast_log(LOG_ERROR, "Failed to update contact '%s' expiration time to %d seconds.\n",</span><br><span> contact->uri, expiration);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_sip_location_delete_contact(contact);</span><br><span style="color: hsl(120, 100%, 40%);">+ registrar_contact_delete(CONTACT_DELETE_ERROR, rdata->tp_info.transport,</span><br><span style="color: hsl(120, 100%, 40%);">+ contact, aor_name);</span><br><span> continue;</span><br><span> }</span><br><span> ast_debug(3, "Refreshed contact '%s' on AOR '%s' with new expiration of %d seconds\n",</span><br><span>@@ -791,31 +841,8 @@</span><br><span> ao2_link(contacts, contact_update);</span><br><span> ao2_cleanup(contact_update);</span><br><span> } else {</span><br><span style="color: hsl(0, 100%, 40%);">- if (contact->prune_on_boot) {</span><br><span style="color: hsl(0, 100%, 40%);">- struct contact_transport_monitor *monitor;</span><br><span style="color: hsl(0, 100%, 40%);">- const char *contact_name =</span><br><span style="color: hsl(0, 100%, 40%);">- ast_sorcery_object_get_id(contact);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- monitor = ast_alloca(sizeof(*monitor) + 2 + strlen(aor_name)</span><br><span style="color: hsl(0, 100%, 40%);">- + strlen(contact_name));</span><br><span style="color: hsl(0, 100%, 40%);">- strcpy(monitor->aor_name, aor_name);/* Safe */</span><br><span style="color: hsl(0, 100%, 40%);">- monitor->contact_name = monitor->aor_name + strlen(aor_name) + 1;</span><br><span style="color: hsl(0, 100%, 40%);">- strcpy(monitor->contact_name, contact_name);/* Safe */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_sip_transport_monitor_unregister(rdata->tp_info.transport,</span><br><span style="color: hsl(0, 100%, 40%);">- register_contact_transport_shutdown_cb, monitor, contact_transport_monitor_matcher);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* We want to report the user agent that was actually in the removed contact */</span><br><span style="color: hsl(0, 100%, 40%);">- ast_sip_location_delete_contact(contact);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verb(3, "Removed contact '%s' from AOR '%s' due to request\n", contact_uri, aor_name);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_test_suite_event_notify("AOR_CONTACT_REMOVED",</span><br><span style="color: hsl(0, 100%, 40%);">- "Contact: %s\r\n"</span><br><span style="color: hsl(0, 100%, 40%);">- "AOR: %s\r\n"</span><br><span style="color: hsl(0, 100%, 40%);">- "UserAgent: %s",</span><br><span style="color: hsl(0, 100%, 40%);">- contact_uri,</span><br><span style="color: hsl(0, 100%, 40%);">- aor_name,</span><br><span style="color: hsl(0, 100%, 40%);">- contact->user_agent);</span><br><span style="color: hsl(120, 100%, 40%);">+ registrar_contact_delete(CONTACT_DELETE_REQUEST, rdata->tp_info.transport,</span><br><span style="color: hsl(120, 100%, 40%);">+ contact, aor_name);</span><br><span> }</span><br><span> }</span><br><span> </span><br><span>@@ -1212,20 +1239,7 @@</span><br><span> */</span><br><span> ao2_lock(lock);</span><br><span> if (ast_tvdiff_ms(ast_tvnow(), contact->expiration_time) > 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (contact->prune_on_boot) {</span><br><span style="color: hsl(0, 100%, 40%);">- struct contact_transport_monitor *monitor;</span><br><span style="color: hsl(0, 100%, 40%);">- const char *contact_name = ast_sorcery_object_get_id(contact);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- monitor = ast_alloca(sizeof(*monitor) + 2 + strlen(contact->aor)</span><br><span style="color: hsl(0, 100%, 40%);">- + strlen(contact_name));</span><br><span style="color: hsl(0, 100%, 40%);">- strcpy(monitor->aor_name, contact->aor);/* Safe */</span><br><span style="color: hsl(0, 100%, 40%);">- monitor->contact_name = monitor->aor_name + strlen(contact->aor) + 1;</span><br><span style="color: hsl(0, 100%, 40%);">- strcpy(monitor->contact_name, contact_name);/* Safe */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_sip_transport_monitor_unregister_all(register_contact_transport_shutdown_cb,</span><br><span style="color: hsl(0, 100%, 40%);">- monitor, contact_transport_monitor_matcher);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- ast_sip_location_delete_contact(contact);</span><br><span style="color: hsl(120, 100%, 40%);">+ registrar_contact_delete(CONTACT_DELETE_EXPIRE, NULL, contact, contact->aor);</span><br><span> }</span><br><span> ao2_unlock(lock);</span><br><span> ast_named_lock_put(lock);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/11015">change 11015</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/+/11015"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: I94b06f9026ed177d6adfd538317c784a42c1b17a </div>
<div style="display:none"> Gerrit-Change-Number: 11015 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>