<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6648">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Richard Mudgett: Looks good to me, approved
  Jenkins2: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip: Add REF_DEBUG info to module references.<br><br>This provides better information to REF_DEBUG log for troubleshooting<br>when the system is unable to unload res_pjsip.so during shutdown due to<br>module references.<br><br>ASTERISK-27306<br><br>Change-Id: I63197ad33d1aebe60d12e0a6561718bdc54e4612<br>---<br>M include/asterisk/res_pjsip.h<br>M include/asterisk/res_pjsip_session.h<br>M res/res_pjsip.c<br>M res/res_pjsip.exports.in<br>M res/res_pjsip/pjsip_session.c<br>M res/res_pjsip_session.exports.in<br>6 files changed, 48 insertions(+), 40 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h<br>index b6403d6..e6ccf0a 100644<br>--- a/include/asterisk/res_pjsip.h<br>+++ b/include/asterisk/res_pjsip.h<br>@@ -925,7 +925,9 @@<br>  * \retval 0 Success<br>  * \retval -1 Failure<br>  */<br>-int ast_sip_register_service(pjsip_module *module);<br>+#define ast_sip_register_service(module) \<br>+ __ast_sip_register_service(module, __FILE__, __LINE__, __PRETTY_FUNCTION__)<br>+int __ast_sip_register_service(pjsip_module *module, const char *file, int line, const char *func);<br> <br> /*!<br>  * This is the opposite of ast_sip_register_service().  Unregistering a<br>@@ -934,7 +936,9 @@<br>  *<br>  * \param module The PJSIP module to unregister<br>  */<br>-void ast_sip_unregister_service(pjsip_module *module);<br>+#define ast_sip_unregister_service(module) \<br>+       __ast_sip_unregister_service(module, __FILE__, __LINE__, __PRETTY_FUNCTION__)<br>+void __ast_sip_unregister_service(pjsip_module *module, const char *file, int line, const char *func);<br> <br> /*!<br>  * \brief Register a SIP authenticator<br>@@ -2615,14 +2619,20 @@<br>  * \retval 0 Success<br>  * \retval -1 Failure<br>  */<br>-int ast_sip_register_supplement(struct ast_sip_supplement *supplement);<br>+#define ast_sip_register_supplement(supplement) \<br>+ __ast_sip_register_supplement(supplement, __FILE__, __LINE__, __PRETTY_FUNCTION__)<br>+int __ast_sip_register_supplement(struct ast_sip_supplement *supplement,<br>+        const char *file, int line, const char *func);<br> <br> /*!<br>  * \brief Unregister a an supplement to SIP out of dialog processing<br>  *<br>  * \param supplement The supplement to unregister<br>  */<br>-void ast_sip_unregister_supplement(struct ast_sip_supplement *supplement);<br>+#define ast_sip_unregister_supplement(supplement) \<br>+     __ast_sip_unregister_supplement(supplement, __FILE__, __LINE__, __PRETTY_FUNCTION__)<br>+void __ast_sip_unregister_supplement(struct ast_sip_supplement *supplement,<br>+   const char *file, int line, const char *func);<br> <br> /*!<br>  * \brief Retrieve the global MWI taskprocessor high water alert trigger level.<br>diff --git a/include/asterisk/res_pjsip_session.h b/include/asterisk/res_pjsip_session.h<br>index 70f9468..b7a22b93 100644<br>--- a/include/asterisk/res_pjsip_session.h<br>+++ b/include/asterisk/res_pjsip_session.h<br>@@ -578,14 +578,20 @@<br>  * \retval 0 Success<br>  * \retval -1 Failure<br>  */<br>-int ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement);<br>+#define ast_sip_session_register_supplement(supplement) \<br>+        __ast_sip_session_register_supplement(supplement, __FILE__, __LINE__, __PRETTY_FUNCTION__)<br>+int __ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement,<br>+        const char *file, int line, const char *func);<br> <br> /*!<br>  * \brief Unregister a an supplement to SIP session processing<br>  *<br>  * \param supplement The supplement to unregister<br>  */<br>-void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement);<br>+#define ast_sip_session_unregister_supplement(supplement) \<br>+   __ast_sip_session_unregister_supplement(supplement, __FILE__, __LINE__, __PRETTY_FUNCTION__)<br>+void __ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement,<br>+   const char *file, int line, const char *func);<br> <br> /*!<br>  * \brief Add supplements to a SIP session<br>diff --git a/res/res_pjsip.c b/res/res_pjsip.c<br>index ac275bd..fb919b3 100644<br>--- a/res/res_pjsip.c<br>+++ b/res/res_pjsip.c<br>@@ -2422,25 +2422,20 @@<br>    return 0;<br> }<br> <br>-static int register_service(void *data)<br>-{<br>-       int res;<br>-<br>-  if (!(res = register_service_noref(data))) {<br>-         ast_module_ref(ast_module_info->self);<br>-    }<br>-<br>- return res;<br>-}<br>-<br> int internal_sip_register_service(pjsip_module *module)<br> {<br>      return ast_sip_push_task_synchronous(NULL, register_service_noref, &module);<br> }<br> <br>-int ast_sip_register_service(pjsip_module *module)<br>+int __ast_sip_register_service(pjsip_module *module, const char *file, int line, const char *func)<br> {<br>-        return ast_sip_push_task_synchronous(NULL, register_service, &module);<br>+   int res;<br>+<br>+  if (!(res = ast_sip_push_task_synchronous(NULL, register_service_noref, &module))) {<br>+             __ast_module_ref(ast_module_info->self, file, line, func);<br>+        }<br>+<br>+ return res;<br> }<br> <br> static int unregister_service_noref(void *data)<br>@@ -2454,25 +2449,16 @@<br>         return 0;<br> }<br> <br>-static int unregister_service(void *data)<br>-{<br>-     int res;<br>-<br>-  if (!(res = unregister_service_noref(data))) {<br>-               ast_module_unref(ast_module_info->self);<br>-  }<br>-<br>- return res;<br>-}<br>-<br> int internal_sip_unregister_service(pjsip_module *module)<br> {<br>    return ast_sip_push_task_synchronous(NULL, unregister_service_noref, &module);<br> }<br> <br>-void ast_sip_unregister_service(pjsip_module *module)<br>+void __ast_sip_unregister_service(pjsip_module *module, const char *file, int line, const char *func)<br> {<br>-        ast_sip_push_task_synchronous(NULL, unregister_service, &module);<br>+        if (!ast_sip_push_task_synchronous(NULL, unregister_service_noref, &module)) {<br>+           __ast_module_unref(ast_module_info->self, file, line, func);<br>+      }<br> }<br> <br> static struct ast_sip_authenticator *registered_authenticator;<br>@@ -3536,10 +3522,11 @@<br>    }<br> }<br> <br>-int ast_sip_register_supplement(struct ast_sip_supplement *supplement)<br>+int __ast_sip_register_supplement(struct ast_sip_supplement *supplement,<br>+ const char *file, int line, const char *func)<br> {<br>     internal_sip_register_supplement(supplement);<br>-        ast_module_ref(ast_module_info->self);<br>+    __ast_module_ref(ast_module_info->self, file, line, func);<br> <br>      return 0;<br> }<br>@@ -3562,10 +3549,11 @@<br>        return res;<br> }<br> <br>-void ast_sip_unregister_supplement(struct ast_sip_supplement *supplement)<br>+void __ast_sip_unregister_supplement(struct ast_sip_supplement *supplement,<br>+ const char *file, int line, const char *func)<br> {<br>     if (!internal_sip_unregister_supplement(supplement)) {<br>-               ast_module_unref(ast_module_info->self);<br>+          __ast_module_unref(ast_module_info->self, file, line, func);<br>       }<br> }<br> <br>diff --git a/res/res_pjsip.exports.in b/res/res_pjsip.exports.in<br>index 4adecd4..7ac2b7e 100644<br>--- a/res/res_pjsip.exports.in<br>+++ b/res/res_pjsip.exports.in<br>@@ -1,6 +1,7 @@<br> {<br>        global:<br>               LINKER_SYMBOL_PREFIXast_sip_*;<br>+               LINKER_SYMBOL_PREFIX__ast_sip_*;<br>              LINKER_SYMBOL_PREFIXast_copy_pj_str;<br>          LINKER_SYMBOL_PREFIXast_copy_pj_str2;<br>                 LINKER_SYMBOL_PREFIXast_pjsip_rdata_get_endpoint;<br>diff --git a/res/res_pjsip/pjsip_session.c b/res/res_pjsip/pjsip_session.c<br>index cea7243..4f3e3be 100644<br>--- a/res/res_pjsip/pjsip_session.c<br>+++ b/res/res_pjsip/pjsip_session.c<br>@@ -56,10 +56,11 @@<br>   }<br> }<br> <br>-int ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement)<br>+int __ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement,<br>+ const char *file, int line, const char *func)<br> {<br>     internal_sip_session_register_supplement(supplement);<br>-        ast_module_ref(AST_MODULE_SELF);<br>+     __ast_module_ref(AST_MODULE_SELF, file, line, func);<br> <br>       return 0;<br> }<br>@@ -82,10 +83,11 @@<br>    return res;<br> }<br> <br>-void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement)<br>+void __ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement,<br>+ const char *file, int line, const char *func)<br> {<br>     if (!internal_sip_session_unregister_supplement(supplement)) {<br>-               ast_module_unref(AST_MODULE_SELF);<br>+           __ast_module_unref(AST_MODULE_SELF, file, line, func);<br>        }<br> }<br> <br>diff --git a/res/res_pjsip_session.exports.in b/res/res_pjsip_session.exports.in<br>index b7bd21b8..d65b247 100644<br>--- a/res/res_pjsip_session.exports.in<br>+++ b/res/res_pjsip_session.exports.in<br>@@ -1,6 +1,7 @@<br> {<br>       global:<br>               LINKER_SYMBOL_PREFIXast_sip_session_*;<br>+               LINKER_SYMBOL_PREFIX__ast_sip_session_*;<br>              LINKER_SYMBOL_PREFIXast_sip_dialog_get_session;<br>               LINKER_SYMBOL_PREFIXast_sip_channel_pvt_alloc;<br>        local:<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6648">change 6648</a>. To unsubscribe, 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/6648"/><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-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I63197ad33d1aebe60d12e0a6561718bdc54e4612 </div>
<div style="display:none"> Gerrit-Change-Number: 6648 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>