<p>Richard Mudgett has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7236">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_pjsip.c: Improve answer failure log messages.<br><br>* Balanced the session->inv_session refs on answer failure.<br><br>Change-Id: I33542d639d37e692cb46550b972a5fcfc3b804b8<br>---<br>M channels/chan_pjsip.c<br>1 file changed, 21 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/36/7236/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c<br>index 0160425..e4e8fa5 100644<br>--- a/channels/chan_pjsip.c<br>+++ b/channels/chan_pjsip.c<br>@@ -672,7 +672,19 @@<br> pjsip_inv_dec_ref(session->inv_session);<br> #endif<br> <br>- return (status == PJ_SUCCESS) ? 0 : -1;<br>+ if (status != PJ_SUCCESS) {<br>+ char err[PJ_ERR_MSG_SIZE];<br>+<br>+ pj_strerror(status, err, sizeof(err));<br>+ ast_log(LOG_WARNING,"Cannot answer '%s': %s\n",<br>+ ast_channel_name(session->channel), err);<br>+ /*<br>+ * Return this value so we can distinguish between this<br>+ * failure and the threadpool synchronous push failing.<br>+ */<br>+ return -2;<br>+ }<br>+ return 0;<br> }<br> <br> /*! \brief Function called by core when we should answer a PJSIP session */<br>@@ -680,6 +692,7 @@<br> {<br> struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(ast);<br> struct ast_sip_session *session;<br>+ int res;<br> <br> if (ast_channel_state(ast) == AST_STATE_UP) {<br> return 0;<br>@@ -700,11 +713,15 @@<br> can occur between this thread and bridging (specifically when native bridging<br> attempts to do direct media) */<br> ast_channel_unlock(ast);<br>- if (ast_sip_push_task_synchronous(session->serializer, answer, session)) {<br>- ast_log(LOG_WARNING, "Unable to push answer task to the threadpool. Cannot answer call\n");<br>+ res = ast_sip_push_task_synchronous(session->serializer, answer, session);<br>+ if (res) {<br>+ if (res == -1) {<br>+ ast_log(LOG_ERROR,"Cannot answer '%s': Unable to push answer task to the threadpool.\n",<br>+ ast_channel_name(session->channel));<br> #ifdef HAVE_PJSIP_INV_SESSION_REF<br>- pjsip_inv_dec_ref(session->inv_session);<br>+ pjsip_inv_dec_ref(session->inv_session);<br> #endif<br>+ }<br> ao2_ref(session, -1);<br> ast_channel_lock(ast);<br> return -1;<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7236">change 7236</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/7236"/><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: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I33542d639d37e692cb46550b972a5fcfc3b804b8 </div>
<div style="display:none"> Gerrit-Change-Number: 7236 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>