diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index cd556f61577153cce3532a64f57dfe18b0b2e7f7..07bd8aa1966175432efa90f84b6957d5615cfb16 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -2571,6 +2571,7 @@ static struct vm_state *create_vm_state_from_user(struct ast_vm_user *vmu)
 {
 	struct vm_state *vms_p;
 
+	pthread_once(&ts_vmstate.once, ts_vmstate.key_init);
 	if ((vms_p = pthread_getspecific(ts_vmstate.key)) && !strcmp(vms_p->imapuser, vmu->imapuser) && !strcmp(vms_p->username, vmu->mailbox)) {
 		return vms_p;
 	}
@@ -2598,6 +2599,7 @@ static struct vm_state *get_vm_state_by_imapuser(const char *user, int interacti
 
 	if (interactive) {
 		struct vm_state *vms;
+		pthread_once(&ts_vmstate.once, ts_vmstate.key_init);
 		vms = pthread_getspecific(ts_vmstate.key);
 		return vms;
 	}
@@ -2633,6 +2635,7 @@ static struct vm_state *get_vm_state_by_mailbox(const char *mailbox, const char
 
 	if (interactive) {
 		struct vm_state *vms;
+		pthread_once(&ts_vmstate.once, ts_vmstate.key_init);
 		vms = pthread_getspecific(ts_vmstate.key);
 		return vms;
 	}