<p>Indeed, it seems that terminate_call() triggers ending of the dialog, which call backs deletion of call structure from cnxcc. But after the part ending of the dialog, cnxcc executes __notify_call_termination(&call->sip_data), accessing the data of the call just deleted.</p>

<p>For me, it looks like __notify_call_termination(&call->sip_data) should be executed before ending the dialog via MI in terminate_call(), or at least, the fake msg needed inside __notify_call_termination() has to be built before.</p>

<p>Maybe <a href="https://github.com/caruizdiaz" class="user-mention">@caruizdiaz</a> can review and propose a fix, being the architect and developer of the module.</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/issues/324#issuecomment-140030661">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36ZTYUQSp1YpJidKIj_UOJu4k8VAmIks5oxpkOgaJpZM4F7nNY.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/issues/324#issuecomment-140030661"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>