52 #define VOICEMAIL_DIR_MODE 0777 60 #define VOICEMAIL_FILE_MODE 0666 66 #define TOTAL_SNAPSHOTS 4 73 #define VM_API_TEST_SETUP do { \ 74 if (!ast_vm_is_registered()) { \ 75 ast_test_status_update(test, "No voicemail provider registered.\n"); \ 76 return AST_TEST_FAIL; \ 77 } else if (test_vm_api_test_setup()) { \ 78 VM_API_TEST_CLEANUP; \ 79 ast_test_status_update(test, "Failed to set up necessary mock objects for voicemail API test\n"); \ 80 return AST_TEST_FAIL; \ 83 for (; i < TOTAL_SNAPSHOTS; i++) { \ 84 ast_test_status_update(test, "Created message in %s/%s with ID %s\n", \ 85 test_snapshots[i]->exten, test_snapshots[i]->folder_name, test_snapshots[i]->msg_id); \ 95 #define VM_API_TEST_CLEANUP test_vm_api_test_teardown() 103 #define VM_API_SNAPSHOT_TEST_CLEANUP \ 104 if (test_mbox_snapshot) { \ 105 test_mbox_snapshot = ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot); \ 107 VM_API_TEST_CLEANUP; \ 116 #define VM_API_STRING_FIELD_VERIFY(expected, actual) do { \ 117 if (strcmp((expected), (actual))) { \ 118 ast_test_status_update(test, "Test failed for parameter %s: Expected [%s], Actual [%s]\n", #actual, expected, actual); \ 119 VM_API_SNAPSHOT_TEST_CLEANUP; \ 120 return AST_TEST_FAIL; \ 129 #define VM_API_INT_VERIFY(expected, actual) do { \ 130 if ((expected) != (actual)) { \ 131 ast_test_status_update(test, "Test failed for parameter %s: Expected [%d], Actual [%d]\n", #actual, (int)expected, (int)actual); \ 132 VM_API_SNAPSHOT_TEST_CLEANUP; \ 133 return AST_TEST_FAIL; \ 143 #define VM_API_SNAPSHOT_MSG_VERIFY(expected, actual, expected_folder, expected_index) do { \ 144 struct ast_vm_msg_snapshot *msg; \ 147 AST_LIST_TRAVERSE(&((actual)->snapshots[get_folder_by_name(expected_folder)]), msg, msg) { \ 148 if (!(strcmp(msg->msg_id, (expected)->msg_id))) { \ 149 ast_test_status_update(test, "Found message %s in snapshot\n", msg->msg_id); \ 151 if ((expected_index) != counter) { \ 152 ast_test_status_update(test, "Expected message %s at index %d; Actual [%d]\n", \ 153 (expected)->msg_id, (expected_index), counter); \ 154 VM_API_SNAPSHOT_TEST_CLEANUP; \ 155 return AST_TEST_FAIL; \ 157 VM_API_STRING_FIELD_VERIFY((expected)->callerid, msg->callerid); \ 158 VM_API_STRING_FIELD_VERIFY((expected)->callerchan, msg->callerchan); \ 159 VM_API_STRING_FIELD_VERIFY((expected)->exten, msg->exten); \ 160 VM_API_STRING_FIELD_VERIFY((expected)->origdate, msg->origdate); \ 161 VM_API_STRING_FIELD_VERIFY((expected)->origtime, msg->origtime); \ 162 VM_API_STRING_FIELD_VERIFY((expected)->duration, msg->duration); \ 163 VM_API_STRING_FIELD_VERIFY((expected)->folder_name, msg->folder_name); \ 164 VM_API_STRING_FIELD_VERIFY((expected)->flag, msg->flag); \ 165 VM_API_INT_VERIFY((expected)->msg_number, msg->msg_number); \ 171 ast_test_status_update(test, "Test failed for message snapshot %s: not found in mailbox snapshot\n", (expected)->msg_id); \ 172 VM_API_SNAPSHOT_TEST_CLEANUP; \ 173 return AST_TEST_FAIL; \ 183 #define VM_API_SNAPSHOT_CREATE(mailbox, context, folder, desc, sort, old_and_inbox) do { \ 184 if (!(test_mbox_snapshot = ast_vm_mailbox_snapshot_create( \ 185 (mailbox), (context), (folder), (desc), (sort), (old_and_inbox)))) { \ 186 ast_test_status_update(test, "Failed to create voicemail mailbox snapshot\n"); \ 187 VM_API_TEST_CLEANUP; \ 188 return AST_TEST_FAIL; \ 198 #define VM_API_SNAPSHOT_OFF_NOMINAL_TEST(mailbox, context, folder, desc, sort, old_and_inbox) do { \ 199 if ((test_mbox_snapshot = ast_vm_mailbox_snapshot_create( \ 200 (mailbox), (context), (folder), (desc), (sort), (old_and_inbox)))) { \ 201 ast_test_status_update(test, "Created mailbox snapshot when none was expected\n"); \ 202 test_mbox_snapshot = ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot); \ 203 VM_API_TEST_CLEANUP; \ 204 return AST_TEST_FAIL; \ 211 #define VM_API_MOVE_MESSAGE(mailbox, context, number_of_messages, source, message_numbers_in, dest) do { \ 212 if (ast_vm_msg_move((mailbox), (context), (number_of_messages), (source), (message_numbers_in), (dest))) { \ 213 ast_test_status_update(test, "Failed to move message %s@%s from %s to %s\n", \ 214 (mailbox) ? (mailbox): "(NULL)", (context) ? (context) : "(NULL)", (source) ? (source) : "(NULL)", (dest) ? (dest) : "(NULL)"); \ 215 VM_API_TEST_CLEANUP; \ 216 return AST_TEST_FAIL; \ 223 #define VM_API_MOVE_MESSAGE_OFF_NOMINAL(mailbox, context, number_of_messages, source, message_numbers_in, dest) do { \ 224 if (!ast_vm_msg_move((mailbox), (context), (number_of_messages), (source), (message_numbers_in), (dest))) { \ 225 ast_test_status_update(test, "Succeeded to move message %s@%s from %s to %s when we really shouldn't\n", \ 226 (mailbox) ? (mailbox): "(NULL)", (context) ? (context) : "(NULL)", (source) ? (source) : "(NULL)", (dest) ? (dest) : "(NULL)"); \ 227 VM_API_TEST_CLEANUP; \ 228 return AST_TEST_FAIL; \ 235 #define VM_API_REMOVE_MESSAGE(mailbox, context, number_of_messages, folder, message_numbers_in) do { \ 236 if (ast_vm_msg_remove((mailbox), (context), (number_of_messages), (folder), (message_numbers_in))) { \ 237 ast_test_status_update(test, "Failed to remove message from mailbox %s@%s, folder %s", \ 238 (mailbox) ? (mailbox): "(NULL)", (context) ? (context) : "(NULL)", (folder) ? (folder) : "(NULL)"); \ 239 VM_API_TEST_CLEANUP; \ 240 return AST_TEST_FAIL; \ 242 VM_API_SNAPSHOT_CREATE((mailbox), (context), (folder), 0, AST_VM_SNAPSHOT_SORT_BY_TIME, 0); \ 243 VM_API_INT_VERIFY(0, test_mbox_snapshot->total_msg_num); \ 244 test_mbox_snapshot = ast_vm_mailbox_snapshot_destroy(test_mbox_snapshot); \ 251 #define VM_API_REMOVE_MESSAGE_OFF_NOMINAL(mailbox, context, number_of_messages, folder, message_numbers_in) do { \ 252 if (!ast_vm_msg_remove((mailbox), (context), (number_of_messages), (folder), (message_numbers_in))) { \ 253 ast_test_status_update(test, "Succeeded in removing message from mailbox %s@%s, folder %s, when expected result was failure\n", \ 254 (mailbox) ? (mailbox): "(NULL)", (context) ? (context) : "(NULL)", (folder) ? (folder) : "(NULL)"); \ 255 VM_API_TEST_CLEANUP; \ 256 return AST_TEST_FAIL; \ 263 # define VM_API_FORWARD_MESSAGE(from_mailbox, from_context, from_folder, to_mailbox, to_context, to_folder, number_of_messages, message_numbers_in, delete_old) do { \ 264 if (ast_vm_msg_forward((from_mailbox), (from_context), (from_folder), (to_mailbox), (to_context), (to_folder), (number_of_messages), (message_numbers_in), (delete_old))) { \ 265 ast_test_status_update(test, "Failed to forward message from %s@%s [%s] to %s@%s [%s]\n", \ 266 (from_mailbox) ? (from_mailbox) : "(NULL)", (from_context) ? (from_context) : "(NULL)", (from_folder) ? (from_folder) : "(NULL)", \ 267 (to_mailbox) ? (to_mailbox) : "(NULL)", (to_context) ? (to_context) : "(NULL)", (to_folder) ? (to_folder) : "(NULL)"); \ 268 VM_API_TEST_CLEANUP; \ 269 return AST_TEST_FAIL; \ 276 #define VM_API_FORWARD_MESSAGE_OFF_NOMINAL(from_mailbox, from_context, from_folder, to_mailbox, to_context, to_folder, number_of_messages, message_numbers_in, delete_old) do { \ 277 if (!ast_vm_msg_forward((from_mailbox), (from_context), (from_folder), (to_mailbox), (to_context), (to_folder), (number_of_messages), (message_numbers_in), (delete_old))) { \ 278 ast_test_status_update(test, "Succeeded in forwarding message from %s@%s [%s] to %s@%s [%s] when expected result was fail\n", \ 279 (from_mailbox) ? (from_mailbox) : "(NULL)", (from_context) ? (from_context) : "(NULL)", (from_folder) ? (from_folder) : "(NULL)", \ 280 (to_mailbox) ? (to_mailbox) : "(NULL)", (to_context) ? (to_context) : "(NULL)", (to_folder) ? (to_folder) : "(NULL)"); \ 281 VM_API_TEST_CLEANUP; \ 282 return AST_TEST_FAIL; \ 292 #define VM_API_PLAYBACK_MESSAGE(channel, mailbox, context, folder, message, callback_fn) do { \ 293 if (ast_vm_msg_play((channel), (mailbox), (context), (folder), (message), (callback_fn))) { \ 294 ast_test_status_update(test, "Failed nominal playback message test\n"); \ 295 ast_hangup(test_channel); \ 296 VM_API_TEST_CLEANUP; \ 297 return AST_TEST_FAIL; \ 307 #define VM_API_PLAYBACK_MESSAGE_OFF_NOMINAL(channel, mailbox, context, folder, message, callback_fn) do { \ 308 if (!ast_vm_msg_play((channel), (mailbox), (context), (folder), (message), (callback_fn))) { \ 309 ast_test_status_update(test, "Succeeded in playing back of message when expected result was to fail\n"); \ 310 ast_hangup(test_channel); \ 311 VM_API_TEST_CLEANUP; \ 312 return AST_TEST_FAIL; \ 380 char msg_id_buf[256];
383 snprintf(msg_id_hash,
sizeof(msg_id_hash),
"%s%s%s", exten, context, callerid);
384 snprintf(msg_id_buf,
sizeof(msg_id_buf),
"%ld-%d", (
long)time(
NULL),
ast_str_hash(msg_id_hash));
386 if ((snapshot =
ast_calloc(1,
sizeof(*snapshot)))) {
424 if ((res =
ast_mkdir(folder_path, mode))) {
457 snprintf(folder_path,
sizeof(folder_path),
"%s/voicemail/%s/%s/%s",
459 snprintf(msg_path,
sizeof(msg_path),
"%s/msg%04u.txt",
461 snprintf(snd_path,
sizeof(snd_path),
"%s/msg%04u.gsm",
474 if (symlink(beep_path, snd_path)) {
477 beep_path, snd_path, strerror(
errno));
481 if (!(msg_file = fopen(msg_path,
"w"))) {
489 fprintf(msg_file,
";\n; Message Information file\n;\n" 547 snprintf(folder_path,
sizeof(folder_path),
"%s/voicemail/%s/%s/%s",
550 snprintf(msg_path,
sizeof(msg_path),
"%s/msg%04u.txt",
552 snprintf(snd_path,
sizeof(snd_path),
"%s/msg%04u.gsm",
577 for (i = 0; i < 12; ++i) {
600 ast_log(
AST_LOG_WARNING,
"Failed to create mailbox snapshot - could not remove test messages for test_vm_api_1234\n");
606 ast_log(
AST_LOG_WARNING,
"Failed to create mailbox snapshot - could not remove test messages for test_vm_api_2345\n");
673 test_snapshots[0] = msg_one;
681 test_snapshots[1] = msg_two;
689 test_snapshots[2] = msg_three;
697 test_snapshots[3] = msg_four;
706 "default", test_snapshots[i]->
exten);
708 test_snapshots[i] =
NULL;
724 test_snapshots[i] =
NULL;
746 for (j = 0; j < 12; ++j) {
823 if (!(mock_channel =
ast_channel_alloc(0,
AST_STATE_DOWN,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL, 0,
"TestChannel"))) {
846 info->name =
"nominal_snapshot";
847 info->category =
"/main/voicemail_api/";
848 info->summary =
"Nominal mailbox snapshot tests";
850 "Test retrieving mailbox snapshots";
912 ast_test_status_update(
test,
"Test retrieving message 0, 1 from all folders of test_vm_1234, default context ordered by time\n");
930 info->name =
"off_nominal_snapshot";
931 info->category =
"/main/voicemail_api/";
932 info->summary =
"Off nominal mailbox snapshot tests";
934 "Test off nominal requests for mailbox snapshots. This includes" 935 " testing the following:\n" 936 " * Access to non-exisstent mailbox\n" 937 " * Access to NULL mailbox\n" 938 " * Access to non-existent context\n" 939 " * Access to non-existent folder\n" 940 " * Access to NULL folder\n" 941 " * Invalid sort identifier";
969 const char *inbox_msg_id;
970 const char *old_msg_id;
971 const char *multi_msg_ids[2];
975 info->name =
"nominal_move";
976 info->category =
"/main/voicemail_api/";
977 info->summary =
"Nominal move voicemail tests";
979 "Test nominal requests to move a voicemail to a different" 980 " folder. This includes moving messages given a context," 981 " given a NULL context, and moving multiple messages";
988 old_msg_id = test_snapshots[0]->
msg_id;
989 inbox_msg_id = test_snapshots[1]->
msg_id;
991 multi_msg_ids[0] = test_snapshots[2]->
msg_id;
992 multi_msg_ids[1] = test_snapshots[3]->
msg_id;
1039 const char *inbox_msg_id;
1040 const char *multi_msg_ids[4];
1044 info->name =
"off_nominal_move";
1045 info->category =
"/main/voicemail_api/";
1046 info->summary =
"Off nominal mailbox message move tests";
1048 "Test nominal requests to move a voicemail to a different" 1049 " folder. This includes testing the following:\n" 1050 " * Moving to a non-existent mailbox\n" 1051 " * Moving to a NULL mailbox\n" 1052 " * Moving to a non-existent context\n" 1053 " * Moving to/from non-existent folder\n" 1054 " * Moving to/from NULL folder\n" 1055 " * Invalid message identifier(s)";
1063 inbox_msg_id = test_snapshots[1]->
msg_id;
1065 multi_msg_ids[0] = test_snapshots[0]->
msg_id;
1066 multi_msg_ids[1] = test_snapshots[1]->
msg_id;
1067 multi_msg_ids[2] = test_snapshots[2]->
msg_id;
1068 multi_msg_ids[3] = test_snapshots[3]->
msg_id;
1099 inbox_msg_id = test_snapshots[1]->
msg_id;
1116 const char *inbox_msg_id;
1117 const char *old_msg_id;
1118 const char *multi_msg_ids[2];
1122 info->name =
"nominal_remove";
1123 info->category =
"/main/voicemail_api/";
1124 info->summary =
"Nominal mailbox remove message tests";
1126 "Tests removing messages from voicemail folders. Includes" 1127 " both removing messages one at a time, and in a set";
1135 old_msg_id = test_snapshots[0]->
msg_id;
1136 inbox_msg_id = test_snapshots[1]->
msg_id;
1138 multi_msg_ids[0] = test_snapshots[2]->
msg_id;
1139 multi_msg_ids[1] = test_snapshots[3]->
msg_id;
1157 const char *inbox_msg_id;
1158 const char *multi_msg_ids[2];
1159 const char *empty_msg_ids[] = { };
1163 info->name =
"off_nominal_remove";
1164 info->category =
"/main/voicemail_api/";
1165 info->summary =
"Off nominal mailbox message removal tests";
1167 "Test off nominal requests for removing messages from " 1168 "a mailbox. This includes:\n" 1169 " * Removing messages with an invalid mailbox\n" 1170 " * Removing messages from a NULL mailbox\n" 1171 " * Removing messages from an invalid context\n" 1172 " * Removing messages from an invalid folder\n" 1173 " * Removing messages from a NULL folder\n" 1174 " * Removing messages with bad identifiers";
1182 inbox_msg_id = test_snapshots[1]->
msg_id;
1183 multi_msg_ids[0] = test_snapshots[2]->
msg_id;
1184 multi_msg_ids[1] = test_snapshots[3]->
msg_id;
1202 inbox_msg_id =
"POOPOO";
1206 multi_msg_ids[1] =
"POOPOO";
1223 const char *inbox_msg_id;
1224 const char *multi_msg_ids[2];
1228 info->name =
"nominal_forward";
1229 info->category =
"/main/voicemail_api/";
1230 info->summary =
"Nominal message forward tests";
1232 "Tests the nominal cases of forwarding messages" 1233 " between mailboxes";
1241 inbox_msg_id = test_snapshots[1]->
msg_id;
1243 multi_msg_ids[0] = test_snapshots[2]->
msg_id;
1244 multi_msg_ids[1] = test_snapshots[3]->
msg_id;
1247 VM_API_FORWARD_MESSAGE(
"test_vm_api_1234",
"default",
"INBOX",
"test_vm_api_2345",
"default",
"INBOX", 1, &inbox_msg_id, 0);
1259 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");
1272 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");
1285 ast_test_status_update(
test,
"Test forwarding message 0 from test_vm_api_1234 INBOX to test_vm_api_2345 INBOX, deleting original\n");
1299 VM_API_FORWARD_MESSAGE(
"test_vm_api_2345",
"default",
"INBOX",
"test_vm_api_1234",
"default",
"INBOX", 2, multi_msg_ids, 0);
1311 ast_test_status_update(
test,
"Test forwarding 2 messages from test_vm_api_2345 INBOX to test_vm_api_1234 Family, deleting original\n");
1312 VM_API_FORWARD_MESSAGE(
"test_vm_api_2345",
"default",
"INBOX",
"test_vm_api_1234",
"default",
"Family", 2, multi_msg_ids, 1);
1330 const char *inbox_msg_id;
1331 const char *multi_msg_ids[4];
1333 const char *empty_msg_ids[] = { };
1337 info->name =
"off_nominal_forward";
1338 info->category =
"/main/voicemail_api/";
1339 info->summary =
"Off nominal message forwarding tests";
1341 "Test off nominal forwarding of messages. This includes:\n" 1342 " * Invalid/NULL from mailbox\n" 1343 " * Invalid from context\n" 1344 " * Invalid/NULL from folder\n" 1345 " * Invalid/NULL to mailbox\n" 1346 " * Invalid to context\n" 1347 " * Invalid/NULL to folder\n" 1348 " * Invalid message numbers\n" 1349 " * Invalid number of messages";
1357 inbox_msg_id = test_snapshots[1]->
msg_id;
1359 multi_msg_ids[0] = test_snapshots[0]->
msg_id;
1360 multi_msg_ids[1] = test_snapshots[1]->
msg_id;
1361 multi_msg_ids[2] = test_snapshots[2]->
msg_id;
1362 multi_msg_ids[3] = test_snapshots[3]->
msg_id;
1399 inbox_msg_id =
"POOPOO";
1417 const char *message_id_1234;
1418 const char *message_id_2345[2];
1422 info->name =
"nominal_msg_playback";
1423 info->category =
"/main/voicemail_api/";
1424 info->summary =
"Nominal message playback";
1426 "Tests playing back a message on a provided" 1427 " channel or callback function";
1435 message_id_1234 = test_snapshots[1]->
msg_id;
1436 message_id_2345[0] = test_snapshots[2]->
msg_id;
1437 message_id_2345[1] = test_snapshots[3]->
msg_id;
1476 const char *invalid_msg_id =
"POOPOO";
1480 info->name =
"off_nominal_msg_playback";
1481 info->category =
"/main/voicemail_api/";
1482 info->summary =
"Off nominal message playback";
1484 "Tests off nominal conditions in playing back a " 1485 "message. This includes:\n" 1486 " * Invalid/NULL mailbox\n" 1487 " * Invalid context\n" 1488 " * Invalid/NULL folder\n" 1489 " * Invalid message identifiers";
1496 msg_id = test_snapshots[0]->
msg_id;
#define VM_API_REMOVE_MESSAGE_OFF_NOMINAL(mailbox, context, number_of_messages, folder, message_numbers_in)
static void test_vm_api_test_teardown(void)
static const struct ast_channel_tech mock_channel_tech
static void test_vm_api_destroy_mailbox_voicemails(const char *mailbox, struct ast_vm_mailbox_snapshot *mailbox_snapshot)
static char exten[AST_MAX_EXTENSION]
const ast_string_field msg_id
struct ast_vm_msg_snapshot::@222 msg
Main Channel structure associated with a channel.
const ast_string_field origdate
#define AST_MODULE_INFO_STANDARD(keystr, desc)
const ast_string_field duration
const ast_string_field folder_name
#define VM_API_TEST_CLEANUP
Asterisk main include file. File version handling, generic pbx functions.
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
int(*const write)(struct ast_channel *chan, struct ast_frame *frame)
Write a frame, in standard format (see frame.h)
#define VOICEMAIL_DIR_MODE
#define VM_API_SNAPSHOT_OFF_NOMINAL_TEST(mailbox, context, folder, desc, sort, old_and_inbox)
static void test_vm_api_remove_all_messages(void)
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
static int test_vm_api_test_setup(void)
static int get_folder_by_name(const char *folder)
#define AST_TEST_REGISTER(cb)
static int unload_module(void)
int ast_vm_test_destroy_user(const char *context, const char *mailbox)
const ast_string_field callerchan
int ast_unlock_path(const char *path)
Unlock a path.
#define VM_API_FORWARD_MESSAGE_OFF_NOMINAL(from_mailbox, from_context, from_folder, to_mailbox, to_context, to_folder, number_of_messages, message_numbers_in, delete_old)
static void test_vm_api_destroy_mock_snapshot(struct ast_vm_msg_snapshot *snapshot)
static int test_vm_api_create_voicemail_files(const char *context, const char *mailbox, struct ast_vm_msg_snapshot *snapshot)
#define VM_API_PLAYBACK_MESSAGE(channel, mailbox, context, folder, message, callback_fn)
static struct ast_channel * test_vm_api_create_mock_channel(void)
static int test_vm_api_mock_channel_write(struct ast_channel *chan, struct ast_frame *frame)
#define ast_strlen_zero(foo)
#define VM_API_INT_VERIFY(expected, actual)
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
#define VM_API_FORWARD_MESSAGE(from_mailbox, from_context, from_folder, to_mailbox, to_context, to_folder, number_of_messages, message_numbers_in, delete_old)
enum AST_LOCK_RESULT ast_lock_path(const char *path)
Lock a filesystem path.
static char mailbox[AST_MAX_MAILBOX_UNIQUEID]
static int load_module(void)
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
const ast_string_field exten
General Asterisk PBX channel definitions.
Asterisk file paths, configured in asterisk.conf.
AST_TEST_DEFINE(voicemail_api_nominal_snapshot)
#define ast_test_status_update(a, b, c...)
#define VM_API_TEST_SETUP
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
static void message_playback_callback_fn(struct ast_channel *chan, const char *file, int duration)
#define AST_MAX_EXTENSION
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
#define VM_API_MOVE_MESSAGE(mailbox, context, number_of_messages, source, message_numbers_in, dest)
#define VM_API_REMOVE_MESSAGE(mailbox, context, number_of_messages, folder, message_numbers_in)
const ast_string_field origtime
static int test_vm_api_create_voicemail_folder(const char *folder_path)
struct ast_vm_mailbox_snapshot * ast_vm_mailbox_snapshot_destroy(struct ast_vm_mailbox_snapshot *mailbox_snapshot)
destroy a snapshot
Structure to describe a channel "technology", ie a channel driver See for examples: ...
#define VM_API_SNAPSHOT_MSG_VERIFY(expected, actual, expected_folder, expected_index)
static int global_entered_playback_callback
static struct ast_frame * test_vm_api_mock_channel_read(struct ast_channel *chan)
const char * ast_config_AST_DATA_DIR
static struct ast_vm_msg_snapshot * test_snapshots[TOTAL_SNAPSHOTS]
#define VM_API_STRING_FIELD_VERIFY(expected, actual)
#define VM_API_SNAPSHOT_CREATE(mailbox, context, folder, desc, sort, old_and_inbox)
struct ast_vm_mailbox_snapshot * ast_vm_mailbox_snapshot_create(const char *mailbox, const char *context, const char *folder, int descending, enum ast_vm_snapshot_sort_val sort_val, int combine_INBOX_and_OLD)
Create a snapshot of a mailbox which contains information about every msg.
struct ast_vm_mailbox_snapshot::@223 * snapshots
#define AST_TEST_UNREGISTER(cb)
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define ast_channel_unlock(chan)
#define ast_calloc(num, len)
A wrapper for calloc()
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
const char * ast_config_AST_SPOOL_DIR
static void test_vm_api_update_test_snapshots(struct ast_vm_mailbox_snapshot *mailbox_snapshot)
const ast_string_field flag
#define VM_API_PLAYBACK_MESSAGE_OFF_NOMINAL(channel, mailbox, context, folder, message, callback_fn)
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
struct ast_frame ast_null_frame
#define VM_API_MOVE_MESSAGE_OFF_NOMINAL(mailbox, context, number_of_messages, source, message_numbers_in, dest)
#define VOICEMAIL_FILE_MODE
Data structure associated with a single frame of data.
const ast_string_field callerid
static struct ast_vm_msg_snapshot * test_vm_api_create_mock_snapshot(const char *context, const char *exten, const char *callerid)
int ast_vm_test_create_user(const char *context, const char *mailbox)
static char context[AST_MAX_CONTEXT]
#define ASTERISK_GPL_KEY
The text the key() function should return.
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag,...)
Create a channel structure.
Asterisk module definitions.
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
static void test_vm_api_remove_voicemail(struct ast_vm_msg_snapshot *snapshot)
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
int ast_mkdir(const char *path, int mode)
Recursively create directory path.
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
static const char *const mailbox_folders[]