app_voicemail: Don't delete mailbox state unless mailbox is deleted
authorGeorge Joseph <gjoseph@digium.com>
Tue, 18 Dec 2018 16:33:50 +0000 (09:33 -0700)
committerGeorge Joseph <gjoseph@digium.com>
Tue, 18 Dec 2018 16:40:22 +0000 (11:40 -0500)
commitc23c8d92d5d016b297e854997b187ac2fd02fc21
tree6ed508b04663b02ae91859d25892740ff1f32e44
parent768be60fbe2ea85a3f1c8d068c8be3e98812e44c
app_voicemail:  Don't delete mailbox state unless mailbox is deleted

The free_user function was automatically deleting the stasis mailbox
state but this only makes sense when the mailbox is actually
deleted, not just the structure freed.  This was causing issues
where leave_voicemail would publish the mwi message to stasis and
delete the state before the message could be processed by
res_pjsip_mwi.

* Removed the delete of state from free_user().

* Created a new free_user_final() function that both frees the data
  structure and deletes the state.  This function is only called
  during module load/unload where it's appropriate to delete the
  state.

ASTERISK-28215

Change-Id: I305e8b3c930e9ac41d901e5dc8a58fd7904d98dd
apps/app_voicemail.c