[svn-commits] mjordan: branch mjordan/voicemail_refactor_01_08_11 r330573 - /team/mjordan/v...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Aug 2 09:48:06 CDT 2011


Author: mjordan
Date: Tue Aug  2 09:48:02 2011
New Revision: 330573

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=330573
Log:
initial update

Added:
    team/mjordan/voicemail_refactor_01_08_11/apps/voicemail/
    team/mjordan/voicemail_refactor_01_08_11/apps/voicemail/test_vm_config_parser.c   (with props)
    team/mjordan/voicemail_refactor_01_08_11/apps/voicemail/test_vm_filesystem.c   (with props)
    team/mjordan/voicemail_refactor_01_08_11/apps/voicemail/vm_config_parser.c   (with props)
    team/mjordan/voicemail_refactor_01_08_11/apps/voicemail/vm_filesystem.c   (with props)
    team/mjordan/voicemail_refactor_01_08_11/apps/voicemail/vm_imap.c   (with props)
    team/mjordan/voicemail_refactor_01_08_11/apps/voicemail/vm_mail.c   (with props)
    team/mjordan/voicemail_refactor_01_08_11/apps/voicemail/vm_odbc.c   (with props)

Added: team/mjordan/voicemail_refactor_01_08_11/apps/voicemail/test_vm_config_parser.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/voicemail_refactor_01_08_11/apps/voicemail/test_vm_config_parser.c?view=auto&rev=330573
==============================================================================
--- team/mjordan/voicemail_refactor_01_08_11/apps/voicemail/test_vm_config_parser.c (added)
+++ team/mjordan/voicemail_refactor_01_08_11/apps/voicemail/test_vm_config_parser.c Tue Aug  2 09:48:02 2011
@@ -1,0 +1,650 @@
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/test.h"
+#include "asterisk/app.h"
+
+#include "include/voicemail.h"
+#include "include/test_voicemail.h"
+
+/* The current default values, from vm_config_parser.c */
+
+static const unsigned int default_max_messages = 100;
+static const unsigned int default_max_messages_limit = 9999;
+static const unsigned int default_min_password_length = 0;
+static const char * default_sound_vm_password = "vm-password";
+static const char * default_sound_vm_newpassword = "vm-newpassword";
+static const char * default_sound_vm_password_changed = "vm-passchanged";
+static const char * default_sound_vm_reenter_password = "vm-reenterpassword";
+static const char * default_sound_vm_mismatch = "vm-mismatch";
+static const char * default_sound_vm_invalid_password = "vm-invalid-password";
+static const char * default_sound_vm_pls_try_again = "vm-pls-try-again";
+static const char * default_character_set = "ISO-8859-1";
+
+static const char * default_listen_control_forward_key = "#";
+static const char * default_listen_control_reverse_key = "*";
+static const char * default_listen_control_pause_key = "0";
+static const char * default_listen_control_restart_key = "2";
+static const char * default_listen_control_stop_key = "13456789";
+
+static const char * default_smdi_interface = "/dev/ttyS0";
+static const char * default_format_string = "wav";
+static const unsigned int default_skip_ms = 3000;
+static const unsigned int default_max_logins = 3;
+static const unsigned int default_min_say_duration = 2;
+static const unsigned int default_poll_frequency = 30;
+static const char * default_users_context = "default";
+static unsigned char default_adsifdn[4] = "\x00\x00\x00\x0F";
+static unsigned char default_adsisec[4] = "\x9B\xDB\xF7\xAC";
+static unsigned int default_adsiver = 1;
+static char default_email_date_format[32] = "%A, %B %d, %Y at %r";
+static char default_pager_date_format[32] = "%A, %B %d, %Y at %r";
+
+
+static struct ast_config * make_empty_config(void)
+{
+	struct ast_config *cfg = ast_config_new();
+	struct ast_category *tmp_category;
+
+	/* Add the [general] category */
+	tmp_category = ast_category_new("general", "voicemail.conf", 1);
+	ast_category_append(cfg, tmp_category);
+
+	return cfg;
+}
+
+static struct ast_config * make_populated_config(void)
+{
+	struct ast_config * cfg = ast_config_new();
+	struct ast_category *tmp_category;
+	struct ast_variable *tmp_variable;
+
+	/* Add the [general] category */
+	tmp_category = ast_category_new("general", "voicemail.conf", 1);
+
+	tmp_variable = ast_variable_new("format", "wav49|gsm|wav", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("serveremail", "asterisk", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("attach", "yes", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("maxmsg", "0", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("maxsecs", "180", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("minsecs", "3", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("maxgreet", "60", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("skipms", "4000", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("maxsilence", "10", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("silencethreshold", "128", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("maxlogins", "5", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("moveheard", "yes", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("forward_urgent_auto", "yes", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("userscontext", "not_default", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("externpass", "/usr/bin/myapp", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("externnotify", "/usr/bin/myapp", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("externpasscheck", "/usr/local/bin/voicemailpwcheck.py", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("directoryintro", "dir-intro", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("charset", "UTF-8", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("pbxskip", "yes", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("usedirectory", "yes", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("fromstring", "The Asterisk PBX", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("emailsubject", "[PBX]: New message ${VM_MSGNUM} in mailbox ${VM_MAILBOX}", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("emailbody", "Dear ${VM_NAME}:\n\n\tjust wanted to let you know you were just ${IF($[\"${VM_CIDNUM}\" = \"${ORIG_VM_CIDNUM}\"]?left:forwarded)} a ${VM_DUR} long message (number ${VM_MSGNUM})\nin mailbox ${VM_MAILBOX} from ${VM_CALLERID}, on ${VM_DATE},\n${IF($[\"${VM_CIDNUM}\" = \"${ORIG_VM_CIDNUM}\"]?so:(originally sent by ${ORIG_VM_CALLERID} on ${ORIG_VM_DATE})\nso)} you might want to check it when you get a chance.  Thanks!\n\n\t\t\t\t--Asterisk\n", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("pagerfromstring", "The Asterisk PBX", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("pagersubject", "New VM", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("pagerbody", "New ${VM_DUR} long msg in box ${VM_MAILBOX}\nfrom ${VM_CALLERID}, on ${VM_DATE}", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("emaildateformat", "%A, %B, %Y", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("pagerdateformat", "%T %D", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("mailcmd", "/usr/sbin/fakemail", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("pollmailboxes", "yes", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("pollfreq", "180", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("passwordlocation", "spooldir", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("messagewrap", "yes", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("minpassword", "4", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("backupdeleted", "1000", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("tz", "central", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("attachfmt", "gsm", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("saycid", "yes", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("cidinternalcontexts", "default,internal", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("sayduration", "no", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("saydurationm", "5", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("dialout", "fromvm", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("sendvoicemail", "yes", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("callback", "fromvm", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("exitcontext", "fromvm", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("review", "yes", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("operator", "yes", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("envelope", "no", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("volgain", "1.0", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("nextaftercmd", "yes", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("forcename", "yes", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("forcegreetings", "yes", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("tempgreetwarn", "yes", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("locale", "de_DE.UTF-8", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("folderpath", "/var/spool/test/", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+
+	/* SMDI */
+	tmp_variable = ast_variable_new("smdienable", "yes", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("smdiport", "/dev/ttyS1", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+
+	/* ADSI */
+	tmp_variable = ast_variable_new("adsifdn", "ABABABAB", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("adsisec", "CDCDCDCD", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("adsiver", "9", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+
+	/* Sounds */
+	tmp_variable = ast_variable_new("vm-password", "custom-vm-password", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("vm-newpassword", "custom-vm-newpassword", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("vm-passchanged", "custom-vm-passchanged", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("vm-reenterpassword", "custom-vm-reenterpassword", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("vm-mismatch", "custom-vm-mismatch", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("vm-invalid-password", "custom-vm-invalid-password", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("vm-pls-try-again", "custom-vm-pls-try-again", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+
+	/* Listen control */
+	tmp_variable = ast_variable_new("listen-control-forward-key", "*", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("listen-control-reverse-key", "#", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("listen-control-pause-key", "1", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("listen-control-restart-key", "0", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("listen-control-stop-key", "23456789", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+
+	ast_category_append(cfg, tmp_category);
+
+	/* zone messages */
+	tmp_category = ast_category_new("zonemessages", "voicemail.conf", 1);
+
+	tmp_variable = ast_variable_new("eastern", "America/New_York|'vm-received' Q 'digits/at' IMp", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("central", "America/Chicago|'vm-received' Q 'digits/at' IMp", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("central24", "America/Chicago|'vm-received' q 'digits/at' H N 'hours'", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("military", "Zulu|'vm-received' q 'digits/at' H N 'hours' 'phonetic/z_p'", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("european", "Europe/Copenhagen|'vm-received' a d b 'digits/at' HM", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+
+	ast_category_append(cfg, tmp_category);
+
+	/* users */
+	tmp_category = ast_category_new("default", "voicemail.conf", 1);
+
+	tmp_variable = ast_variable_new("1234", "4242,Example Mailbox,root at localhost", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("4200", "9855,Mark Spencer,markster at linux-support.net,mypager at digium.com,attach=no|serveremail=myaddy at digium.com|tz=central|maxmsg=10", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("4069", "6522,Matt Brooks,matt at marko.net,,|tz=central|attach=yes|saycid=yes|dialout=fromvm|callback=fromvm|review=yes|operator=yes|envelope=yes|moveheard=yes|sayduration=yes|saydurationm=1", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+	tmp_variable = ast_variable_new("7200", "6522,Matt Jordan,,,delete=1|emailsubject=You have a new voicemail.|emailbody=Click on the attachment to listen.\n\nThanks-\tAsterisk!\n|rip=2010-06-04", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+
+	ast_category_append(cfg, tmp_category);
+
+	tmp_category = ast_category_new("test", "voicemail.conf", 1);
+
+	tmp_variable = ast_variable_new("7200", "6522,Matt Jordan,,,delete=1|emailsubject=You have a new voicemail.|emailbody=Click on the attachment to listen.\n\nThanks-\tAsterisk!\n|rip=2010-06-04", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+
+	ast_category_append(cfg, tmp_category);
+
+	return cfg;
+}
+
+AST_TEST_DEFINE(test_vm_default_config)
+{
+	int result = AST_TEST_PASS;
+	struct ast_config * cfg = make_empty_config();
+	struct ast_category * tmp_category;
+	struct ast_variable * tmp_variable;
+	struct vm_config * vm_config;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "test_vm_default_config";
+		info->category = "/apps/app_voicemail/";
+		info->summary = "VoiceMail Config Parser (default) unit test";
+		info->description =
+			"This tests the parsing of an empty ast_config object and the populating of the default field values";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	/* Test loading an empty ast_config object */
+	if (vm_load_config(0, &cfg, &vm_config)) {
+		ast_test_status_update(test, "Failed to load vm_config using empty (default) ast_config object\n");
+		result = AST_TEST_FAIL;
+	} else {
+		/* Check all defaults */
+		/* Sounds */
+		VM_TEST_STRING_EQUAL(default_sound_vm_password, vm_config->sound_config->vm_password);
+		VM_TEST_STRING_EQUAL(default_sound_vm_newpassword, vm_config->sound_config->vm_newpassword);
+		VM_TEST_STRING_EQUAL(default_sound_vm_password_changed, vm_config->sound_config->vm_password_changed);
+		VM_TEST_STRING_EQUAL(default_sound_vm_reenter_password, vm_config->sound_config->vm_reenter_password);
+		VM_TEST_STRING_EQUAL(default_sound_vm_mismatch, vm_config->sound_config->vm_mismatch);
+		VM_TEST_STRING_EQUAL(default_sound_vm_invalid_password, vm_config->sound_config->vm_invalid_password);
+		VM_TEST_STRING_EQUAL(default_sound_vm_pls_try_again, vm_config->sound_config->vm_pls_try_again);
+
+		/* Listen control */
+		VM_TEST_STRING_EQUAL(default_listen_control_forward_key, vm_config->listen_control_config->listen_control_forward_key);
+		VM_TEST_STRING_EQUAL(default_listen_control_reverse_key, vm_config->listen_control_config->listen_control_reverse_key);
+		VM_TEST_STRING_EQUAL(default_listen_control_pause_key, vm_config->listen_control_config->listen_control_pause_key);
+		VM_TEST_STRING_EQUAL(default_listen_control_restart_key, vm_config->listen_control_config->listen_control_restart_key);
+		VM_TEST_STRING_EQUAL(default_listen_control_stop_key, vm_config->listen_control_config->listen_control_stop_key);
+
+		/* ADSI Settings */
+		VM_TEST_MEM_EQUAL(default_adsifdn, vm_config->adsi_config->adsifdn, 4);
+		VM_TEST_MEM_EQUAL(default_adsisec, vm_config->adsi_config->adsisec, 4);
+		VM_TEST_NUMERIC_EQUAL(default_adsiver, vm_config->adsi_config->adsiver);
+
+		/* SMDI */
+		VM_TEST_NUMERIC_EQUAL(0, vm_config->smdi_config->enabled);
+		/* SMDI interface should not be set if it is not enabled */
+		VM_TEST_STRING_NOT_EQUAL(default_smdi_interface, vm_config->smdi_config->smdi_interface);
+
+		/* General settings */
+		VM_TEST_STRING_EQUAL(default_format_string, vm_config->format);
+		VM_TEST_STRING_EQUAL(default_users_context, vm_config->default_users_context);
+		VM_TEST_STRING_EQUAL(default_email_date_format, vm_config->email_date_format);
+		VM_TEST_STRING_EQUAL(default_pager_date_format, vm_config->pager_date_format);
+		VM_TEST_STRING_EQUAL(default_character_set, vm_config->charset);
+		VM_TEST_NUMERIC_EQUAL(default_skip_ms, vm_config->skip_ms);
+		VM_TEST_NUMERIC_EQUAL(default_max_logins, vm_config->max_logins);
+		VM_TEST_NUMERIC_EQUAL(default_min_say_duration, vm_config->min_say_duration);
+		VM_TEST_NUMERIC_EQUAL(default_poll_frequency, vm_config->poll_frequency);
+		VM_TEST_NUMERIC_EQUAL(default_min_password_length, vm_config->min_password_length);
+		VM_TEST_NUMERIC_EQUAL(default_max_messages, vm_config->max_messages);
+	}
+
+	/* Check that SMDI is set properly if enabled */
+	tmp_category = ast_category_get(cfg, "general");
+	tmp_variable = ast_variable_new("smdienable", "1", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+
+
+	/* Test loading the ast_config object */
+	if (vm_load_config(0, &cfg, &vm_config)) {
+		ast_test_status_update(test, "Failed to load vm_config using ast_config object with smdienabled flag\n");
+		result = AST_TEST_FAIL;
+	} else {
+		/* SMDI */
+		VM_TEST_NUMERIC_NOT_EQUAL(0, vm_config->smdi_config->enabled);
+		VM_TEST_STRING_EQUAL(default_smdi_interface, vm_config->smdi_config->smdi_interface);
+	}
+
+	ast_config_destroy(cfg);
+	ao2_ref(vm_config, -1);
+
+	return result;
+}
+
+AST_TEST_DEFINE(test_vm_parse_config)
+{
+	int result = AST_TEST_PASS;
+	struct ast_config * cfg = make_populated_config();
+	struct vm_config * vm_config;
+	unsigned char test_adsifdn[4] = "\xAB\xAB\xAB\xAB";
+	unsigned char test_adsisec[4] = "\xCD\xCD\xCD\xCD";
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "test_vm_parse_config";
+		info->category = "/apps/app_voicemail/";
+		info->summary = "VoiceMail Config Parser unit test";
+		info->description =
+			"This tests the parsing of an ast_config object and the populating of all possible field values";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	/* Load the ast_config object and check the values */
+	if (vm_load_config(0, &cfg, &vm_config)) {
+		ast_test_status_update(test, "Failed to load vm_config using populated ast_config object\n");
+		result = AST_TEST_FAIL;
+	} else {
+		VM_TEST_MEM_EQUAL(test_adsifdn,vm_config->adsi_config->adsifdn, 4);
+		VM_TEST_MEM_EQUAL(test_adsisec, vm_config->adsi_config->adsisec, 4);
+		VM_TEST_NUMERIC_EQUAL(9, vm_config->adsi_config->adsiver);
+
+		VM_TEST_STRING_EQUAL("gsm", vm_config->attach_format);
+		VM_TEST_STRING_EQUAL("fromvm", vm_config->callback_context);
+		VM_TEST_STRING_EQUAL("UTF-8", vm_config->charset);
+		VM_TEST_STRING_EQUAL("default", vm_config->cid_internal_contexts[0]);
+		VM_TEST_STRING_EQUAL("internal", vm_config->cid_internal_contexts[1]);
+		VM_TEST_STRING_EQUAL("not_default", vm_config->default_users_context);
+		VM_TEST_STRING_EQUAL("fromvm", vm_config->dial_out_context);
+		VM_TEST_STRING_EQUAL("dir-intro", vm_config->directory_intro_path);
+
+		VM_TEST_STRING_EQUAL("%A, %B, %Y",vm_config->email_date_format);
+		VM_TEST_STRING_EQUAL("[PBX]: New message ${VM_MSGNUM} in mailbox ${VM_MAILBOX}", vm_config->email_subject);
+		VM_TEST_STRING_EQUAL("Dear ${VM_NAME}:\n\n\tjust wanted to let you know you were just ${IF($[\"${VM_CIDNUM}\" = \"${ORIG_VM_CIDNUM}\"]?left:forwarded)} a ${VM_DUR} long message (number ${VM_MSGNUM})\nin mailbox ${VM_MAILBOX} from ${VM_CALLERID}, on ${VM_DATE},\n${IF($[\"${VM_CIDNUM}\" = \"${ORIG_VM_CIDNUM}\"]?so:(originally sent by ${ORIG_VM_CALLERID} on ${ORIG_VM_DATE})\nso)} you might want to check it when you get a chance.  Thanks!\n\n\t\t\t\t--Asterisk\n", vm_config->email_body);
+		VM_TEST_STRING_EQUAL("asterisk", vm_config->email_server);
+		VM_TEST_STRING_EQUAL("The Asterisk PBX", vm_config->email_from_string);
+		VM_TEST_STRING_EQUAL("/usr/bin/myapp", vm_config->extern_notify_cmd);
+		VM_TEST_STRING_EQUAL("/usr/local/bin/voicemailpwcheck.py", vm_config->extern_pass_check_cmd);
+		VM_TEST_STRING_EQUAL("/usr/bin/myapp", vm_config->extern_pass_cmd);
+		VM_TEST_STRING_EQUAL("/var/spool/test/", vm_config->folder_path);
+		VM_TEST_STRING_EQUAL("wav49|gsm|wav", vm_config->format);
+		VM_TEST_NUMERIC_EQUAL(VM_ATTACH, ast_test_flag((&vm_config->globalflags), VM_ATTACH));
+		VM_TEST_NUMERIC_EQUAL(VM_MOVEHEARD, ast_test_flag((&vm_config->globalflags), VM_MOVEHEARD));
+		VM_TEST_NUMERIC_EQUAL(VM_FWDURGAUTO, ast_test_flag((&vm_config->globalflags), VM_FWDURGAUTO));
+		VM_TEST_NUMERIC_EQUAL(VM_PBXSKIP, ast_test_flag((&vm_config->globalflags), VM_PBXSKIP));
+		VM_TEST_NUMERIC_EQUAL(VM_DIRECFORWARD, ast_test_flag((&vm_config->globalflags), VM_DIRECFORWARD));
+		VM_TEST_NUMERIC_EQUAL(VM_POLLMAILBOXES, ast_test_flag((&vm_config->globalflags), VM_POLLMAILBOXES));
+		VM_TEST_NUMERIC_EQUAL(VM_MESSAGEWRAP, ast_test_flag((&vm_config->globalflags), VM_MESSAGEWRAP));
+		VM_TEST_NUMERIC_EQUAL(VM_SAYCID, ast_test_flag((&vm_config->globalflags), VM_SAYCID));
+		VM_TEST_NUMERIC_EQUAL(0, ast_test_flag((&vm_config->globalflags), VM_SAYDURATION));
+		VM_TEST_NUMERIC_EQUAL(VM_SVMAIL, ast_test_flag((&vm_config->globalflags), VM_SVMAIL));
+		VM_TEST_NUMERIC_EQUAL(VM_REVIEW, ast_test_flag((&vm_config->globalflags), VM_REVIEW));
+		VM_TEST_NUMERIC_EQUAL(VM_OPERATOR, ast_test_flag((&vm_config->globalflags), VM_OPERATOR));
+		VM_TEST_NUMERIC_EQUAL(0, ast_test_flag((&vm_config->globalflags), VM_ENVELOPE));
+		VM_TEST_NUMERIC_EQUAL(VM_SKIPAFTERCMD, ast_test_flag((&vm_config->globalflags), VM_SKIPAFTERCMD));
+		VM_TEST_NUMERIC_EQUAL(VM_FORCEGREET, ast_test_flag((&vm_config->globalflags), VM_FORCEGREET));
+		VM_TEST_NUMERIC_EQUAL(VM_FORCENAME, ast_test_flag((&vm_config->globalflags), VM_FORCENAME));
+		VM_TEST_NUMERIC_EQUAL(VM_TEMPGREETWARN, ast_test_flag((&vm_config->globalflags), VM_TEMPGREETWARN));
+
+		VM_TEST_STRING_EQUAL("*", vm_config->listen_control_config->listen_control_forward_key);
+		VM_TEST_STRING_EQUAL("1", vm_config->listen_control_config->listen_control_pause_key);
+		VM_TEST_STRING_EQUAL("0", vm_config->listen_control_config->listen_control_restart_key);
+		VM_TEST_STRING_EQUAL("#", vm_config->listen_control_config->listen_control_reverse_key);
+		VM_TEST_STRING_EQUAL("23456789", vm_config->listen_control_config->listen_control_stop_key);
+
+		VM_TEST_STRING_EQUAL("de_DE.UTF-8", vm_config->locale);
+		VM_TEST_STRING_EQUAL("/usr/sbin/fakemail", vm_config->mail_command);
+		VM_TEST_NUMERIC_EQUAL(1000, vm_config->max_deleted_messages);
+		VM_TEST_NUMERIC_EQUAL(5, vm_config->max_logins);
+		VM_TEST_NUMERIC_EQUAL(180, vm_config->max_message_duration);
+		VM_TEST_NUMERIC_EQUAL(60, vm_config->max_message_greeting_length);
+		VM_TEST_NUMERIC_EQUAL(0, vm_config->max_messages);
+		VM_TEST_NUMERIC_EQUAL(10000, vm_config->max_silence);
+		VM_TEST_NUMERIC_EQUAL(3, vm_config->min_message_duration);
+		VM_TEST_NUMERIC_EQUAL(4, vm_config->min_password_length);
+		VM_TEST_NUMERIC_EQUAL(5, vm_config->min_say_duration);
+		VM_TEST_STRING_EQUAL("fromvm", vm_config->op_exit_context);
+		VM_TEST_STRING_EQUAL("%T %D", vm_config->pager_date_format);
+		VM_TEST_STRING_EQUAL("New ${VM_DUR} long msg in box ${VM_MAILBOX}\nfrom ${VM_CALLERID}, on ${VM_DATE}", vm_config->pager_body);
+		VM_TEST_STRING_EQUAL("The Asterisk PBX", vm_config->pager_from_string);
+		VM_TEST_STRING_EQUAL("New VM", vm_config->pager_subject);
+		VM_TEST_NUMERIC_EQUAL(OPT_PWLOC_SPOOLDIR, vm_config->password_location);
+		VM_TEST_NUMERIC_EQUAL(VM_PWD_CHANGE_EXTERNAL, ast_test_flag((&vm_config->passwordflags), VM_PWD_CHANGE_EXTERNAL));
+		VM_TEST_NUMERIC_EQUAL(180, vm_config->poll_frequency);
+		VM_TEST_NUMERIC_EQUAL(128, vm_config->silence_threshold);
+		VM_TEST_NUMERIC_EQUAL(4000, vm_config->skip_ms);
+
+		VM_TEST_NUMERIC_NOT_EQUAL(0, vm_config->smdi_config->enabled);
+		VM_TEST_STRING_EQUAL("/dev/ttyS1", vm_config->smdi_config->smdi_interface);
+
+		VM_TEST_STRING_EQUAL("custom-vm-invalid-password", vm_config->sound_config->vm_invalid_password);
+		VM_TEST_STRING_EQUAL("custom-vm-mismatch", vm_config->sound_config->vm_mismatch);
+		VM_TEST_STRING_EQUAL("custom-vm-newpassword", vm_config->sound_config->vm_newpassword);
+		VM_TEST_STRING_EQUAL("custom-vm-password", vm_config->sound_config->vm_password);
+		VM_TEST_STRING_EQUAL("custom-vm-passchanged", vm_config->sound_config->vm_password_changed);
+		VM_TEST_STRING_EQUAL("custom-vm-pls-try-again", vm_config->sound_config->vm_pls_try_again);
+		VM_TEST_STRING_EQUAL("custom-vm-reenterpassword", vm_config->sound_config->vm_reenter_password);
+
+		VM_TEST_NUMERIC_EQUAL(1.0, vm_config->volgain);
+		VM_TEST_STRING_EQUAL("central", vm_config->zonetag);
+
+		ao2_ref(vm_config, -1);
+	}
+
+	ast_config_destroy(cfg);
+
+	return result;
+}
+
+AST_TEST_DEFINE(test_vm_reload_config)
+{
+	int result = AST_TEST_PASS;
+	struct ast_config * cfg = make_empty_config();
+	struct vm_config * vm_config;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "test_vm_reload_config";
+		info->category = "/apps/app_voicemail/";
+		info->summary = "VoiceMail Config Parser reload unit test";
+		info->description =
+			"This tests the reloading of ast_config object";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	/* Test loading the empty object */
+	if (vm_load_config(0, &cfg, &vm_config)) {
+		ast_test_status_update(test, "Failed to load vm_config using empty ast_config object\n");
+		result = AST_TEST_FAIL;
+	} else {
+		/* Check that the folder path is set to the default */
+		VM_TEST_STRING_EQUAL("/var/spool/asterisk/voicemail/", vm_config->folder_path);
+	}
+
+	ast_config_destroy(cfg);
+
+	/* Reload using the current voicemail.conf. */
+	if (vm_load_config(1, &cfg, &vm_config)) {
+		ast_test_status_update(test, "Failed to execute reload using voicemail.conf\n");
+		result = AST_TEST_FAIL;
+	}
+
+	ast_config_destroy(cfg);
+	ao2_ref(vm_config, -1);
+
+	return result;
+}
+
+AST_TEST_DEFINE(test_vm_user_default)
+{
+	int result = AST_TEST_PASS;
+	struct ast_config * cfg = make_populated_config();
+	struct ast_vm_user * vmu = NULL;
+	struct vm_config * vm_config;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "test_vm_default_user";
+		info->category = "/apps/app_voicemail/";
+		info->summary = "VoiceMail Config Parser default user test";
+		info->description =
+			"This tests the creation of a voicemail user and the population of their values using the defaults from the voicemail config";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	if (vm_load_config(0, &cfg, &vm_config)) {
+		ast_test_status_update(test, "Failed to load vm_config using empty ast_config object\n");
+		result = AST_TEST_FAIL;
+	} else {
+
+		/* Extract the basic user */
+		if (!(vmu = vm_find_user("default", "1234"))) {
+			ast_test_status_update(test, "Failed to find user default, 1234\n");
+			result = AST_TEST_FAIL;
+		} else {
+			/* Check the properties to make sure the defaults are populated either from the config or from presets */
+			VM_TEST_STRING_EQUAL("", vmu->attachfmt);
+			VM_TEST_STRING_EQUAL("fromvm", vmu->callback);
+			VM_TEST_STRING_EQUAL("default", vmu->context);
+			VM_TEST_STRING_EQUAL("fromvm", vmu->dialout);
+			VM_TEST_STRING_EQUAL("root at localhost", vmu->email);
+			VM_TEST_STRING_EQUAL("fromvm",vmu->exit);
+			VM_TEST_STRING_EQUAL("Example Mailbox", vmu->fullname);
+			VM_TEST_STRING_EQUAL(vm_config->locale, vmu->locale);
+			VM_TEST_STRING_EQUAL("1234", vmu->mailbox);
+			VM_TEST_NUMERIC_EQUAL(vm_config->max_deleted_messages, vmu->maxdeletedmsg);
+			VM_TEST_NUMERIC_EQUAL(vm_config->max_messages, vmu->maxmsg);
+			VM_TEST_NUMERIC_EQUAL(vm_config->max_message_duration, vmu->maxsecs);
+			VM_TEST_NUMERIC_EQUAL(vm_config->min_message_duration, vmu->minsecs);
+			VM_TEST_STRING_EQUAL("", vmu->pager);
+			VM_TEST_STRING_EQUAL("4242", vmu->password);
+			VM_TEST_NUMERIC_EQUAL(OPT_PWLOC_SPOOLDIR, vmu->passwordlocation);
+			VM_TEST_NUMERIC_EQUAL(5, vmu->saydurationm);
+			VM_TEST_STRING_EQUAL("", vmu->serveremail);
+			VM_TEST_NUMERIC_EQUAL(1.0, vmu->volgain);
+			VM_TEST_STRING_EQUAL("central", vmu->zonetag);
+
+			ao2_ref(vmu, -1);
+		}
+	}
+
+	ast_config_destroy(cfg);
+	ao2_ref(vm_config, -1);
+
+	return result;
+}
+
+AST_TEST_DEFINE(test_vm_user_overrides)
+{
+	int result = AST_TEST_PASS;
+	struct ast_config * cfg = make_populated_config();
+	struct ast_vm_user * vmu = NULL;
+	struct vm_config * vm_config;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "test_vm_user_overrides";
+		info->category = "/apps/app_voicemail/";
+		info->summary = "VoiceMail Config Parser default user test";
+		info->description =
+			"This tests the creation of a voicemail user and the population of their values using the overrides from their configuration";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	if (vm_load_config(0, &cfg, &vm_config)) {
+		ast_test_status_update(test, "Failed to load vm_config using empty ast_config object\n");
+		result = AST_TEST_FAIL;
+	} else {
+
+		/* Extract a user */
+		if (!(vmu = vm_find_user("default", "7200"))) {
+			ast_test_status_update(test, "Failed to find user default, 7200\n");
+			result = AST_TEST_FAIL;
+		} else {
+			/* Check the properties to make sure the defaults are populated either from the config or from presets */
+			VM_TEST_STRING_EQUAL("", vmu->attachfmt);
+			VM_TEST_STRING_EQUAL("fromvm", vmu->callback);
+			VM_TEST_STRING_EQUAL("default", vmu->context);
+			VM_TEST_STRING_EQUAL("fromvm", vmu->dialout);
+			VM_TEST_STRING_EQUAL("", vmu->email);
+			VM_TEST_STRING_EQUAL("fromvm",vmu->exit);
+			VM_TEST_NUMERIC_EQUAL(VM_DELETE, ast_test_flag(vmu, VM_DELETE));
+			VM_TEST_STRING_EQUAL("Matt Jordan", vmu->fullname);
+			VM_TEST_STRING_EQUAL(vm_config->locale, vmu->locale);
+			VM_TEST_STRING_EQUAL("7200", vmu->mailbox);
+			VM_TEST_STRING_EQUAL("You have a new voicemail.", vmu->emailsubject);
+			VM_TEST_STRING_EQUAL("Click on the attachment to listen.\n\nThanks-\tAsterisk!\n", vmu->emailbody);
+			VM_TEST_NUMERIC_EQUAL(vm_config->max_deleted_messages, vmu->maxdeletedmsg);
+			VM_TEST_NUMERIC_EQUAL(vm_config->max_messages, vmu->maxmsg);
+			VM_TEST_NUMERIC_EQUAL(vm_config->max_message_duration, vmu->maxsecs);
+			VM_TEST_NUMERIC_EQUAL(vm_config->min_message_duration, vmu->minsecs);
+			VM_TEST_STRING_EQUAL("", vmu->pager);
+			VM_TEST_STRING_EQUAL("6522", vmu->password);
+			VM_TEST_NUMERIC_EQUAL(OPT_PWLOC_SPOOLDIR, vmu->passwordlocation);
+			VM_TEST_NUMERIC_EQUAL(5, vmu->saydurationm);
+			VM_TEST_STRING_EQUAL("", vmu->serveremail);
+			VM_TEST_NUMERIC_EQUAL(1.0, vmu->volgain);
+			VM_TEST_STRING_EQUAL("central", vmu->zonetag);
+
+			ao2_ref(vmu, -1);
+		}
+	}
+
+	ast_config_destroy(cfg);
+	ao2_ref(vm_config, -1);
+
+	return result;
+}
+
+void vm_register_config_tests(void)
+{
+	AST_TEST_REGISTER(test_vm_default_config);
+	AST_TEST_REGISTER(test_vm_parse_config);
+	AST_TEST_REGISTER(test_vm_reload_config);
+	AST_TEST_REGISTER(test_vm_user_default);
+	AST_TEST_REGISTER(test_vm_user_overrides);
+}
+
+void vm_unregister_config_tests(void)
+{
+	AST_TEST_UNREGISTER(test_vm_default_config);
+	AST_TEST_UNREGISTER(test_vm_parse_config);
+	AST_TEST_UNREGISTER(test_vm_reload_config);
+	AST_TEST_UNREGISTER(test_vm_user_default);
+	AST_TEST_UNREGISTER(test_vm_user_overrides);
+}

Propchange: team/mjordan/voicemail_refactor_01_08_11/apps/voicemail/test_vm_config_parser.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/mjordan/voicemail_refactor_01_08_11/apps/voicemail/test_vm_config_parser.c
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/mjordan/voicemail_refactor_01_08_11/apps/voicemail/test_vm_config_parser.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: team/mjordan/voicemail_refactor_01_08_11/apps/voicemail/test_vm_filesystem.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/voicemail_refactor_01_08_11/apps/voicemail/test_vm_filesystem.c?view=auto&rev=330573
==============================================================================
--- team/mjordan/voicemail_refactor_01_08_11/apps/voicemail/test_vm_filesystem.c (added)
+++ team/mjordan/voicemail_refactor_01_08_11/apps/voicemail/test_vm_filesystem.c Tue Aug  2 09:48:02 2011
@@ -1,0 +1,1666 @@
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include <dirent.h>
+#include <sys/stat.h>
+
+#include "asterisk/test.h"
+#include "asterisk/app.h"
+
+#include "include/voicemail.h"
+#include "include/test_voicemail.h"
+
+static const char * MSG_INFO_CATEGORY = "message";
+
+static const char * MSG_INFO_FLD_ORIGMAILBOX = "origmailbox";
+
+static const char * MSG_INFO_FLD_CONTEXT = "context";
+
+static const char * MSG_INFO_FLD_MACROCONTEXT = "macrocontext";
+
+static const char * MSG_INFO_FLD_EXTEN = "exten";
+
+static const char * MSG_INFO_FLD_RDNIS = "rdnis";
+
+static const char * MSG_INFO_FLD_PRIORITY = "priority";
+
+static const char * MSG_INFO_FLD_CALLERCHAN = "callerchan";
+
+static const char * MSG_INFO_FLD_CALLERID = "callerid";
+
+static const char * MSG_INFO_FLD_ORIGDATE = "origdate";
+
+static const char * MSG_INFO_FLD_ORIGTIME = "origtime";
+
+static const char * MSG_INFO_FLD_CATEGORY = "category";
+
+static const char * MSG_INFO_FLD_FLAG = "flag";
+
+static const char * MSG_INFO_FLD_DURATION = "duration";
+
+/* Basic test definition block */
+/*
+AST_TEST_DEFINE(test_vm_fs_METHOD_NAME)
+{
+	int result = AST_TEST_FAIL;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "vm_fs_METHOD_NAME";
+		info->category = "/apps/app_voicemail/";
+		info->summary = "VoiceMail FileSystem METHOD_NAME unit test";
+		info->description =
+			"This tests ... using the file system backend driver";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	return result;
+}
+*/
+
+/* Test helper functions */
+
+/*!
+ * \internal
+ * \brief Make an empty test configuration
+ *
+ * \return An ast_config structure that is empty (potentially invalid)
+ */
+static struct ast_config * make_empty_ast_config(void)
+{
+	struct ast_config * cfg;
+
+	cfg = ast_config_new();
+
+	return cfg;
+}
+
+/*!
+ * \internal
+ * \brief Make an empty vm test configuration
+ *
+ * \return A vm_config structure that is empty (potentially invalid)
+ */
+static struct vm_config * make_empty_vm_config(void)
+{
+	struct vm_config * cfg;
+
+	if ((cfg = ao2_alloc(sizeof(*cfg), vm_config_destroy))) {
+		if (   !(cfg->sound_config = ast_calloc(1, sizeof(*(cfg->sound_config))))
+			|| !(cfg->smdi_config = ast_calloc(1, sizeof(*(cfg->smdi_config))))
+			|| !(cfg->listen_control_config = ast_calloc(1, sizeof(*(cfg->listen_control_config))))
+			|| !(cfg->adsi_config = ast_calloc(1, sizeof(*(cfg->adsi_config)))))
+		{
+			ao2_ref(cfg, -1);
+			cfg = NULL;
+		} else {
+			if (   ast_string_field_init(cfg->sound_config, 512)
+			    || ast_string_field_init(cfg->smdi_config, 512)
+		        || ast_string_field_init(cfg, 512)) {
+				ao2_ref(cfg, -1);
+				cfg = NULL;
+			}
+		}
+	}
+
+	return cfg;
+}
+
+/*!
+ * \internal
+ * \brief Make a valid test configuration to use for any of the tests
+ *
+ * \details
+ * The test configuration returned has the following:
+ * [general]
+ * format = wav49|wav
+ *
+ * [zonemessages]
+ * eastern = America/New_York|'vm-received' Q 'digits/at' IMp
+ * central = America/Chicago|'vm-received' Q 'digits/at' IMp
+ * central24 = America/Chicago|'vm-received' q 'digits/at' H N 'hours'
+ * military = Zulu|'vm-received' q 'digits/at' H N 'hours' 'phonetic/z_p'
+ * european = Europe/Copenhagen|'vm-received' a d b 'digits/at' HM
+
+ * \return An ast_config structure with populated categories and variables
+ *
+ */
+static struct ast_config * make_ast_config(void)
+{
+	struct ast_config * cfg;
+	struct ast_category * tmp_category;
+	struct ast_variable * tmp_variable;
+
+	cfg = ast_config_new();
+
+	/* Add the [general] category and its variables */
+	tmp_category = ast_category_new("general", "voicemail.conf", 1);
+
+	tmp_variable = ast_variable_new("format", "wav49|wav", "voicemail.conf");
+	ast_variable_append(tmp_category, tmp_variable);
+
+	ast_category_append(cfg, tmp_category);
+
+	/* Add the [zonemessages] category and its variables.  Note that this shouldn't be used

[... 8110 lines stripped ...]



More information about the svn-commits mailing list