<p>At that stage, dialog needs to be unref'ed two times in order to be destroyed. If BYE is sent ok, then one unref is done when processing the response of the BYE. If BYE is not sent, then the dialog is unref'ed by that IF condition, because there is no expected response.</p>

<p>Removing one unref is not ok and it is not 'fixed' by a next unref. This manages a reference counter, not a mutex.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/kamailio/kamailio/pull/291#issuecomment-134073572">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36ZS6a0IAVsTyvoH6VB3oaOF9cjVtFks5oqsGQgaJpZM4FtbKv.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/kamailio/kamailio/pull/291#issuecomment-134073572"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>