[Asterisk-code-review] app voicemail: Don't delete mailbox state unless mailbox is... (asterisk[16])
Friendly Automation
asteriskteam at digium.com
Wed Dec 19 05:06:05 CST 2018
Friendly Automation has submitted this change and it was merged. ( https://gerrit.asterisk.org/10820 )
Change subject: app_voicemail: Don't delete mailbox state unless mailbox is deleted
......................................................................
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
---
M apps/app_voicemail.c
1 file changed, 14 insertions(+), 5 deletions(-)
Approvals:
Benjamin Keith Ford: Looks good to me, but someone else must approve
Joshua C. Colp: Looks good to me, approved
Friendly Automation: Approved for Submit
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 13dedd3..fb5ee88 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -2043,10 +2043,6 @@
return;
}
- if (!ast_strlen_zero(vmu->mailbox)) {
- ast_delete_mwi_state_full(vmu->mailbox, vmu->context, NULL);
- }
-
ast_free(vmu->email);
vmu->email = NULL;
ast_free(vmu->emailbody);
@@ -2059,6 +2055,19 @@
}
}
+static void free_user_final(struct ast_vm_user *vmu)
+{
+ if (!vmu) {
+ return;
+ }
+
+ if (!ast_strlen_zero(vmu->mailbox)) {
+ ast_delete_mwi_state_full(vmu->mailbox, vmu->context, NULL);
+ }
+
+ free_user(vmu);
+}
+
static int vm_allocate_dh(struct vm_state *vms, struct ast_vm_user *vmu, int count_msg) {
int arraysize = (vmu->maxmsg > count_msg ? vmu->maxmsg : count_msg);
@@ -13540,7 +13549,7 @@
AST_LIST_LOCK(&users);
while ((current = AST_LIST_REMOVE_HEAD(&users, list))) {
ast_set_flag(current, VM_ALLOCED);
- free_user(current);
+ free_user_final(current);
}
AST_LIST_UNLOCK(&users);
}
--
To view, visit https://gerrit.asterisk.org/10820
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-MessageType: merged
Gerrit-Change-Id: I305e8b3c930e9ac41d901e5dc8a58fd7904d98dd
Gerrit-Change-Number: 10820
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation (1000185)
Gerrit-Reviewer: Joshua C. Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181219/7d93ef9c/attachment-0001.html>
More information about the asterisk-code-review
mailing list