[svn-commits] mmichelson: branch mmichelson/trunk-digiumphones r363160 - in /team/mmichelso...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Apr 23 09:53:21 CDT 2012


Author: mmichelson
Date: Mon Apr 23 09:53:17 2012
New Revision: 363160

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=363160
Log:
Undo previous two commits for voicemail.

The scope of what needs to be done needs to be narrowed dramatically,
and so I'm going to focus solely on improving the API to not use message
indexes. The result is going to be a (hopefully temporary) performance
decrease since finding a message by unique ID will require more disk reads
than previously required.


Modified:
    team/mmichelson/trunk-digiumphones/apps/app_voicemail.c
    team/mmichelson/trunk-digiumphones/include/asterisk/app_voicemail.h
    team/mmichelson/trunk-digiumphones/tests/test_voicemail_api.c

Modified: team/mmichelson/trunk-digiumphones/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/trunk-digiumphones/apps/app_voicemail.c?view=diff&rev=363160&r1=363159&r2=363160
==============================================================================
--- team/mmichelson/trunk-digiumphones/apps/app_voicemail.c (original)
+++ team/mmichelson/trunk-digiumphones/apps/app_voicemail.c Mon Apr 23 09:53:17 2012
@@ -780,10 +780,6 @@
 	int imapversion;                 /*!< If configuration changes, use the new values */
 #endif
 	double volgain;                  /*!< Volume gain for voicemails sent via email */
-	/*!
-	 * Collection of data for all messages in this user's mailbox
-	 */
-	struct ast_vm_mailbox_snapshot *snapshot;
 	AST_LIST_ENTRY(ast_vm_user) list;
 };
 
@@ -1873,8 +1869,6 @@
 
 		ast_free(vmu->emailsubject);
 		vmu->emailsubject = NULL;
-
-		ast_vm_mailbox_snapshot_destroy(vmu->snapshot);
 
 		ast_free(vmu);
 	}
@@ -14414,17 +14408,11 @@
 	return cmd;
 }
 
-static void vm_msg_snapshot_destroy(void *obj)
-{
-	struct ast_vm_msg_snapshot *msg_snapshot = obj;
-	ast_string_field_free_memory(msg_snapshot);
-}
-
 static struct ast_vm_msg_snapshot *vm_msg_snapshot_alloc(void)
 {
 	struct ast_vm_msg_snapshot *msg_snapshot;
 
-	if (!(msg_snapshot = ao2_alloc(sizeof(*msg_snapshot), vm_msg_snapshot_destroy))) {
+	if (!(msg_snapshot = ast_calloc(1, sizeof(*msg_snapshot)))) {
 		return NULL;
 	}
 
@@ -14434,6 +14422,14 @@
 	}
 
 	return msg_snapshot;
+}
+
+static struct ast_vm_msg_snapshot *vm_msg_snapshot_destroy(struct ast_vm_msg_snapshot *msg_snapshot)
+{
+	ast_string_field_free_memory(msg_snapshot);
+	ast_free(msg_snapshot);
+
+	return NULL;
 }
 
 #ifdef TEST_FRAMEWORK
@@ -14468,52 +14464,6 @@
 }
 
 #endif
-
-static int __attribute__((unused))vm_msg_snapshot_create_from_data(struct ast_vm_user *vmu,
-	const char *msg_id,
-	const char *origmailbox,
-	const char *callerid,
-	const char *rdnis,
-	const char *context,
-	const char *macrocontext,
-	const char *callerchan,
-	const char *exten,
-	const char *origdate,
-	const char *origtime,
-	const char *duration,
-	const char *folder_name,
-	const char *folder_dir,
-	const char *category,
-	const char *flag)
-{
-	struct ast_vm_msg_snapshot *msg_snapshot = vm_msg_snapshot_alloc();
-	if (!msg_snapshot) {
-		return -1;
-	}
-
-	ast_string_field_set(msg_snapshot, msg_id, S_OR(msg_id, ""));
-	ast_string_field_set(msg_snapshot, origmailbox, S_OR(origmailbox, ""));
-	ast_string_field_set(msg_snapshot, callerid, S_OR(callerid, ""));
-	ast_string_field_set(msg_snapshot, rdnis, S_OR(rdnis, ""));
-	ast_string_field_set(msg_snapshot, context, S_OR(context, ""));
-	ast_string_field_set(msg_snapshot, macrocontext, S_OR(macrocontext, ""));
-	ast_string_field_set(msg_snapshot, callerchan, S_OR(callerchan, ""));
-	ast_string_field_set(msg_snapshot, exten, S_OR(exten, ""));
-	ast_string_field_set(msg_snapshot, origdate, S_OR(origdate, ""));
-	ast_string_field_set(msg_snapshot, origtime, S_OR(origtime, ""));
-	ast_string_field_set(msg_snapshot, duration, S_OR(duration, ""));
-	ast_string_field_set(msg_snapshot, folder_name, S_OR(folder_name, ""));
-	ast_string_field_set(msg_snapshot, folder_dir, S_OR(folder_dir, ""));
-	ast_string_field_set(msg_snapshot, category, S_OR(category, ""));
-	ast_string_field_set(msg_snapshot, flag, S_OR(flag, ""));
-	
-	/* XXX Here, we need to link the message snapshot into the user's mailbox
-	 * snapshot. ao2_linking is an easy thing. Placing the message in the folder
-	 * list may be a tad trickier, but nothing too crazy.
-	 */
-
-	return 0;
-}
 
 /*!
  * \brief Create and store off all the msgs in an open mailbox
@@ -14526,7 +14476,7 @@
  *       writing it to the file system.  This is an area that needs
  *       to be made more efficient.
  */
-static int vm_msg_snapshot_create_from_file(struct ast_vm_user *vmu,
+static int vm_msg_snapshot_create(struct ast_vm_user *vmu,
 	struct vm_state *vms,
 	struct ast_vm_mailbox_snapshot *mailbox_snapshot,
 	int snapshot_index,
@@ -14563,21 +14513,9 @@
 		if ((value = ast_variable_retrieve(msg_cfg, "message", "msg_id"))) {
 			ast_string_field_set(msg_snapshot, msg_id, value);
 		}
-		if ((value = ast_variable_retrieve(msg_cfg, "message", "origmailbox"))) {
-			ast_string_field_set(msg_snapshot, origmailbox, value);
-		}
 		if ((value = ast_variable_retrieve(msg_cfg, "message", "callerid"))) {
 			ast_string_field_set(msg_snapshot, callerid, value);
 		}
-		if ((value = ast_variable_retrieve(msg_cfg, "message", "rdnis"))) {
-			ast_string_field_set(msg_snapshot, rdnis, value);
-		}
-		if ((value = ast_variable_retrieve(msg_cfg, "message", "context"))) {
-			ast_string_field_set(msg_snapshot, context, value);
-		}
-		if ((value = ast_variable_retrieve(msg_cfg, "message", "macrocontext"))) {
-			ast_string_field_set(msg_snapshot, rdnis, value);
-		}
 		if ((value = ast_variable_retrieve(msg_cfg, "message", "callerchan"))) {
 			ast_string_field_set(msg_snapshot, callerchan, value);
 		}
@@ -14596,16 +14534,12 @@
 		if ((value = ast_variable_retrieve(msg_cfg, "message", "folder_dir"))) {
 			ast_string_field_set(msg_snapshot, folder_dir, value);
 		}
-		if ((value = ast_variable_retrieve(msg_cfg, "message", "category"))) {
-			ast_string_field_set(msg_snapshot, category, value);
-		}
 		if ((value = ast_variable_retrieve(msg_cfg, "message", "flag"))) {
 			ast_string_field_set(msg_snapshot, flag, value);
 		}
 		msg_snapshot->msg_number = vms->curmsg;
 		ast_string_field_set(msg_snapshot, folder_name, mailbox_folders[mailbox_index]);
 
-		ao2_link(mailbox_snapshot->messages, msg_snapshot);
 		/* store msg snapshot in mailbox snapshot */
 		switch (sort_val) {
 		default:
@@ -14638,6 +14572,8 @@
 			AST_LIST_INSERT_TAIL(&mailbox_snapshot->snapshots[snapshot_index], msg_snapshot, msg);
 		}
 
+		mailbox_snapshot->total_msg_num++;
+
 		/* cleanup configs and msg */
 		ast_config_destroy(msg_cfg);
 		DISPOSE(vms->curdir, vms->curmsg);
@@ -14722,7 +14658,7 @@
 
 		/* Iterate through each msg, storing off info */
 		if (vms.lastmsg != -1) {
-			if ((vm_msg_snapshot_create_from_file(vmu, &vms, mailbox_snapshot, combining_old ? inbox_index : i, i, descending, sort_val))) {
+			if ((vm_msg_snapshot_create(vmu, &vms, mailbox_snapshot, combining_old ? inbox_index : i, i, descending, sort_val))) {
 				ast_log(LOG_WARNING, "Failed to create msg snapshots for %s@%s\n", mailbox, context);
 				goto snapshot_cleanup;
 			}
@@ -14756,10 +14692,9 @@
 
 	for (i = 0; i < AST_VM_FOLDER_NUMBER; i++) {
 		while ((msg_snapshot = AST_LIST_REMOVE_HEAD(&mailbox_snapshot->snapshots[i], msg))) {
-			ao2_ref(msg_snapshot, -1);
-		}
-	}
-	ao2_ref(mailbox_snapshot->messages, -1);
+			msg_snapshot = vm_msg_snapshot_destroy(msg_snapshot);
+		}
+	}
 	ast_free(mailbox_snapshot);
 	return NULL;
 }

Modified: team/mmichelson/trunk-digiumphones/include/asterisk/app_voicemail.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/trunk-digiumphones/include/asterisk/app_voicemail.h?view=diff&rev=363160&r1=363159&r2=363160
==============================================================================
--- team/mmichelson/trunk-digiumphones/include/asterisk/app_voicemail.h (original)
+++ team/mmichelson/trunk-digiumphones/include/asterisk/app_voicemail.h Mon Apr 23 09:53:17 2012
@@ -26,7 +26,6 @@
 
 #include "asterisk/stringfields.h"
 #include "asterisk/linkedlists.h"
-#include "asterisk/astobj2.h"
 
 #define AST_VM_FOLDER_NUMBER 12
 
@@ -38,11 +37,7 @@
 struct ast_vm_msg_snapshot {
 	AST_DECLARE_STRING_FIELDS(
 		AST_STRING_FIELD(msg_id);
-		AST_STRING_FIELD(origmailbox);
 		AST_STRING_FIELD(callerid);
-		AST_STRING_FIELD(rdnis);
-		AST_STRING_FIELD(context);
-		AST_STRING_FIELD(macrocontext);
 		AST_STRING_FIELD(callerchan);
 		AST_STRING_FIELD(exten);
 		AST_STRING_FIELD(origdate);
@@ -50,7 +45,6 @@
 		AST_STRING_FIELD(duration);
 		AST_STRING_FIELD(folder_name);
 		AST_STRING_FIELD(folder_dir);
-		AST_STRING_FIELD(category);
 		AST_STRING_FIELD(flag);
 	);
 	unsigned int msg_number;
@@ -59,20 +53,7 @@
 };
 
 struct ast_vm_mailbox_snapshot {
-	/*!
-	 * This ao2_container contains ALL voicemail messages in the
-	 * mailbox. The messages are indexed by their unique message
-	 * ID. When it comes time to quickly retrieve a message, this is
-	 * your best bet.
-	 */
-	struct ao2_container *messages;
-	/*!
-	 * This is an array of lists of the voicemail messages in the
-	 * mailbox. Each index in the array corresponds to a folder. The
-	 * messages in each folder are listed chronologically. This arrangement
-	 * is useful for cases where the messages are presented to a voicemail
-	 * user.
-	 */
+	int total_msg_num;
 	AST_LIST_HEAD_NOLOCK(, ast_vm_msg_snapshot) snapshots[AST_VM_FOLDER_NUMBER];
 };
 

Modified: team/mmichelson/trunk-digiumphones/tests/test_voicemail_api.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/trunk-digiumphones/tests/test_voicemail_api.c?view=diff&rev=363160&r1=363159&r2=363160
==============================================================================
--- team/mmichelson/trunk-digiumphones/tests/test_voicemail_api.c (original)
+++ team/mmichelson/trunk-digiumphones/tests/test_voicemail_api.c Mon Apr 23 09:53:17 2012
@@ -194,7 +194,7 @@
 		return AST_TEST_FAIL; \
 	} \
 	VM_API_SNAPSHOT_CREATE((mailbox), (context), (folder), 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 0); \
-	VM_API_INT_VERIFY(ao2_container_count(test_mbox_snapshot->messages), 0); \
+	VM_API_INT_VERIFY(test_mbox_snapshot->total_msg_num, 0); \
 	test_mbox_snapshot = ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot); \
 } while (0)
 
@@ -732,60 +732,60 @@
 
 	ast_test_status_update(test, "Test retrieving message 1 from INBOX of test_vm_1234\n");
 	VM_API_SNAPSHOT_CREATE("test_vm_api_1234", "default", "INBOX", 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 0);
-	VM_API_INT_VERIFY(1, ao2_container_count(test_mbox_snapshot->messages));
+	VM_API_INT_VERIFY(1, test_mbox_snapshot->total_msg_num);
 	VM_API_SNAPSHOT_MSG_VERIFY(test_snapshots[1], test_mbox_snapshot, "INBOX", 0);
 	ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	ast_test_status_update(test, "Test retrieving message 0 from Old of test_vm_1234\n");
 	VM_API_SNAPSHOT_CREATE("test_vm_api_1234", "default", "Old", 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 0);
-	VM_API_INT_VERIFY(1, ao2_container_count(test_mbox_snapshot->messages));
+	VM_API_INT_VERIFY(1, test_mbox_snapshot->total_msg_num);
 	VM_API_SNAPSHOT_MSG_VERIFY(test_snapshots[0], test_mbox_snapshot, "Old", 0);
 	ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	ast_test_status_update(test, "Test retrieving message 0, 1 from Old and INBOX of test_vm_1234 ordered by time\n");
 	VM_API_SNAPSHOT_CREATE("test_vm_api_1234", "default", "INBOX", 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 1);
-	VM_API_INT_VERIFY(2, ao2_container_count(test_mbox_snapshot->messages));
+	VM_API_INT_VERIFY(2, test_mbox_snapshot->total_msg_num);
 	VM_API_SNAPSHOT_MSG_VERIFY(test_snapshots[0], test_mbox_snapshot, "INBOX", 0);
 	VM_API_SNAPSHOT_MSG_VERIFY(test_snapshots[1], test_mbox_snapshot, "INBOX", 1);
 
 	ast_test_status_update(test, "Test retrieving message 1, 0 from Old and INBOX of test_vm_1234 ordered by time desc\n");
 	VM_API_SNAPSHOT_CREATE("test_vm_api_1234", "default", "INBOX", 1, AST_VM_SNAPSHOT_SORT_BY_TIME, 1);
-	VM_API_INT_VERIFY(2, ao2_container_count(test_mbox_snapshot->messages));
+	VM_API_INT_VERIFY(2, test_mbox_snapshot->total_msg_num);
 	VM_API_SNAPSHOT_MSG_VERIFY(test_snapshots[1], test_mbox_snapshot, "INBOX", 0);
 	VM_API_SNAPSHOT_MSG_VERIFY(test_snapshots[0], test_mbox_snapshot, "INBOX", 1);
 	ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	ast_test_status_update(test, "Test retrieving message 0, 1 from Old and INBOX of test_vm_1234 ordered by id\n");
 	VM_API_SNAPSHOT_CREATE("test_vm_api_1234", "default", "INBOX", 0, AST_VM_SNAPSHOT_SORT_BY_ID, 1);
-	VM_API_INT_VERIFY(2, ao2_container_count(test_mbox_snapshot->messages));
+	VM_API_INT_VERIFY(2, test_mbox_snapshot->total_msg_num);
 	VM_API_SNAPSHOT_MSG_VERIFY(test_snapshots[1], test_mbox_snapshot, "INBOX", 0);
 	VM_API_SNAPSHOT_MSG_VERIFY(test_snapshots[0], test_mbox_snapshot, "INBOX", 1);
 	ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	ast_test_status_update(test, "Test retrieving message 1, 0 from Old and INBOX of test_vm_1234 ordered by id desc\n");
 	VM_API_SNAPSHOT_CREATE("test_vm_api_1234", "default", "INBOX", 1, AST_VM_SNAPSHOT_SORT_BY_ID, 1);
-	VM_API_INT_VERIFY(2, ao2_container_count(test_mbox_snapshot->messages));
+	VM_API_INT_VERIFY(2, test_mbox_snapshot->total_msg_num);
 	VM_API_SNAPSHOT_MSG_VERIFY(test_snapshots[0], test_mbox_snapshot, "INBOX", 0);
 	VM_API_SNAPSHOT_MSG_VERIFY(test_snapshots[1], test_mbox_snapshot, "INBOX", 1);
 	ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	ast_test_status_update(test, "Test retrieving message 0, 1 from all folders of test_vm_1234 ordered by id\n");
 	VM_API_SNAPSHOT_CREATE("test_vm_api_1234", "default", NULL, 0, AST_VM_SNAPSHOT_SORT_BY_ID, 0);
-	VM_API_INT_VERIFY(2, ao2_container_count(test_mbox_snapshot->messages));
+	VM_API_INT_VERIFY(2, test_mbox_snapshot->total_msg_num);
 	VM_API_SNAPSHOT_MSG_VERIFY(test_snapshots[0], test_mbox_snapshot, "Old", 0);
 	VM_API_SNAPSHOT_MSG_VERIFY(test_snapshots[1], test_mbox_snapshot, "INBOX", 0);
 	ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	ast_test_status_update(test, "Test retrieving message 0, 1 from all folders of test_vm_1234 ordered by time\n");
 	VM_API_SNAPSHOT_CREATE("test_vm_api_1234", "default", NULL, 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 0);
-	VM_API_INT_VERIFY(2, ao2_container_count(test_mbox_snapshot->messages));
+	VM_API_INT_VERIFY(2, test_mbox_snapshot->total_msg_num);
 	VM_API_SNAPSHOT_MSG_VERIFY(test_snapshots[0], test_mbox_snapshot, "Old", 0);
 	VM_API_SNAPSHOT_MSG_VERIFY(test_snapshots[1], test_mbox_snapshot, "INBOX", 0);
 	ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	ast_test_status_update(test, "Test retrieving message 0, 1 from all folders of test_vm_1234, default context ordered by time\n");
 	VM_API_SNAPSHOT_CREATE("test_vm_api_1234", NULL, NULL, 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 0);
-	VM_API_INT_VERIFY(2, ao2_container_count(test_mbox_snapshot->messages));
+	VM_API_INT_VERIFY(2, test_mbox_snapshot->total_msg_num);
 	VM_API_SNAPSHOT_MSG_VERIFY(test_snapshots[0], test_mbox_snapshot, "Old", 0);
 	VM_API_SNAPSHOT_MSG_VERIFY(test_snapshots[1], test_mbox_snapshot, "INBOX", 0);
 	ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
@@ -1098,12 +1098,12 @@
 
 	/* Make sure we didn't delete the message */
 	VM_API_SNAPSHOT_CREATE("test_vm_api_1234", "default", "INBOX", 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 0);
-	VM_API_INT_VERIFY(ao2_container_count(test_mbox_snapshot->messages), 1);
+	VM_API_INT_VERIFY(test_mbox_snapshot->total_msg_num, 1);
 	test_mbox_snapshot = ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	/* We should now have a total of 3 messages in test_vm_api_2345 INBOX */
 	VM_API_SNAPSHOT_CREATE("test_vm_api_2345", "default", "INBOX", 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 0);
-	VM_API_INT_VERIFY(ao2_container_count(test_mbox_snapshot->messages), 3);
+	VM_API_INT_VERIFY(test_mbox_snapshot->total_msg_num, 3);
 	test_mbox_snapshot = ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	ast_test_status_update(test, "Test forwarding message 0 from test_vm_api_1234 INBOX with default context to test_vm_api_2345 INBOX\n");
@@ -1111,12 +1111,12 @@
 
 	/* Make sure we didn't delete the message */
 	VM_API_SNAPSHOT_CREATE("test_vm_api_1234", "default", "INBOX", 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 0);
-	VM_API_INT_VERIFY(ao2_container_count(test_mbox_snapshot->messages), 1);
+	VM_API_INT_VERIFY(test_mbox_snapshot->total_msg_num, 1);
 	test_mbox_snapshot = ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	/* We should now have a total of 4 messages in test_vm_api_2345 INBOX */
 	VM_API_SNAPSHOT_CREATE("test_vm_api_2345", "default", "INBOX", 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 0);
-	VM_API_INT_VERIFY(ao2_container_count(test_mbox_snapshot->messages), 4);
+	VM_API_INT_VERIFY(test_mbox_snapshot->total_msg_num, 4);
 	test_mbox_snapshot = ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	ast_test_status_update(test, "Test forwarding message 0 from test_vm_api_1234 INBOX to test_vm_api_2345 INBOX with default context\n");
@@ -1124,12 +1124,12 @@
 
 	/* Make sure we didn't delete the message */
 	VM_API_SNAPSHOT_CREATE("test_vm_api_1234", "default", "INBOX", 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 0);
-	VM_API_INT_VERIFY(ao2_container_count(test_mbox_snapshot->messages), 1);
+	VM_API_INT_VERIFY(test_mbox_snapshot->total_msg_num, 1);
 	test_mbox_snapshot = ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	/* We should now have a total of 5 messages in test_vm_api_2345 INBOX */
 	VM_API_SNAPSHOT_CREATE("test_vm_api_2345", "default", "INBOX", 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 0);
-	VM_API_INT_VERIFY(ao2_container_count(test_mbox_snapshot->messages), 5);
+	VM_API_INT_VERIFY(test_mbox_snapshot->total_msg_num, 5);
 	test_mbox_snapshot = ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	ast_test_status_update(test, "Test forwarding message 0 from test_vm_api_1234 INBOX to test_vm_api_2345 INBOX, deleting original\n");
@@ -1137,12 +1137,12 @@
 
 	/* Make sure we deleted the message */
 	VM_API_SNAPSHOT_CREATE("test_vm_api_1234", "default", "INBOX", 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 0);
-	VM_API_INT_VERIFY(ao2_container_count(test_mbox_snapshot->messages), 0);
+	VM_API_INT_VERIFY(test_mbox_snapshot->total_msg_num, 0);
 	test_mbox_snapshot = ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	/* We should now have a total of 6 messages in test_vm_api_2345 INBOX */
 	VM_API_SNAPSHOT_CREATE("test_vm_api_2345", "default", "INBOX", 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 0);
-	VM_API_INT_VERIFY(ao2_container_count(test_mbox_snapshot->messages), 6);
+	VM_API_INT_VERIFY(test_mbox_snapshot->total_msg_num, 6);
 	test_mbox_snapshot = ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	ast_test_status_update(test, "Test forwarding 2 messages from test_vm_api_2345 INBOX to test_vm_api_1234 INBOX");
@@ -1150,24 +1150,24 @@
 
 	/* Make sure we didn't delete the messages */
 	VM_API_SNAPSHOT_CREATE("test_vm_api_2345", "default", "INBOX", 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 0);
-	VM_API_INT_VERIFY(ao2_container_count(test_mbox_snapshot->messages), 6);
+	VM_API_INT_VERIFY(test_mbox_snapshot->total_msg_num, 6);
 	test_mbox_snapshot = ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	/* We should now have a total of 2 messages in test_vm_api_1234 INBOX */
 	VM_API_SNAPSHOT_CREATE("test_vm_api_1234", "default", "INBOX", 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 0);
-	VM_API_INT_VERIFY(ao2_container_count(test_mbox_snapshot->messages), 2);
+	VM_API_INT_VERIFY(test_mbox_snapshot->total_msg_num, 2);
 	test_mbox_snapshot = ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	ast_test_status_update(test, "Test forwarding 2 messages from test_vm_api_2345 INBOX to test_vm_api_1234 Family, deleting original\n");
 	VM_API_FORWARD_MESSAGE("test_vm_api_2345", "default", "INBOX", "test_vm_api_1234", "default", "Family", 2, multi_msg_nums, 1);
 	/* Make sure we deleted the messages */
 	VM_API_SNAPSHOT_CREATE("test_vm_api_2345", "default", "INBOX", 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 0);
-	VM_API_INT_VERIFY(ao2_container_count(test_mbox_snapshot->messages), 4);
+	VM_API_INT_VERIFY(test_mbox_snapshot->total_msg_num, 4);
 	test_mbox_snapshot = ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	/* We should now have a total of 2 messages in test_vm_api_1234 Family */
 	VM_API_SNAPSHOT_CREATE("test_vm_api_1234", "default", "Family", 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 0);
-	VM_API_INT_VERIFY(ao2_container_count(test_mbox_snapshot->messages), 2);
+	VM_API_INT_VERIFY(test_mbox_snapshot->total_msg_num, 2);
 	test_mbox_snapshot = ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	VM_API_TEST_CLEANUP;
@@ -1293,11 +1293,11 @@
 	global_entered_playback_callback = 0;
 
 	VM_API_SNAPSHOT_CREATE("test_vm_api_1234", "default", "Old", 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 0);
-	VM_API_INT_VERIFY(ao2_container_count(test_mbox_snapshot->messages), 2);
+	VM_API_INT_VERIFY(test_mbox_snapshot->total_msg_num, 2);
 	test_mbox_snapshot = ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	VM_API_SNAPSHOT_CREATE("test_vm_api_2345", "default", "Old", 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 0);
-	VM_API_INT_VERIFY(ao2_container_count(test_mbox_snapshot->messages), 2);
+	VM_API_INT_VERIFY(test_mbox_snapshot->total_msg_num, 2);
 	test_mbox_snapshot = ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot);
 
 	if (test_channel) {




More information about the svn-commits mailing list