static void destroy_dialog( pjsip_dialog *dlg, pj_bool_t unlock_mutex )
{
    if (dlg->tp_sel.type != PJSIP_TPSELECTOR_NONE) {
	pjsip_tpselector_dec_ref(&dlg->tp_sel);
	pj_bzero(&dlg->tp_sel, sizeof(pjsip_tpselector));
    }
    pjsip_auth_clt_deinit(&dlg->auth_sess);

    pj_grp_lock_dec_ref(dlg->grp_lock_);

    if (unlock_mutex)
	pj_grp_lock_release(dlg->grp_lock_);
}
static void destroy_dialog( pjsip_dialog *dlg, pj_bool_t unlock_mutex )
{
    if (dlg->tp_sel.type != PJSIP_TPSELECTOR_NONE) {
	pjsip_tpselector_dec_ref(&dlg->tp_sel);
	pj_bzero(&dlg->tp_sel, sizeof(pjsip_tpselector));
    }
    pjsip_auth_clt_deinit(&dlg->auth_sess);

    pj_grp_lock_dec_ref(dlg->grp_lock_);

    if (unlock_mutex)
	pj_grp_lock_release(dlg->grp_lock_);
}