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.
Removing one unref is not ok and it is not 'fixed' by a next unref. This manages a
reference counter, not a mutex.
---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/291#issuecomment-134073572