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" 
 
  545    snprintf(folder_path, 
sizeof(folder_path), 
"%s/voicemail/%s/%s/%s",
 
  548    snprintf(msg_path, 
sizeof(msg_path), 
"%s/msg%04u.txt",
 
  550    snprintf(snd_path, 
sizeof(snd_path), 
"%s/msg%04u.gsm",
 
 
  575    for (i = 0; i < 12; ++i) {
 
 
  598        ast_log(
AST_LOG_WARNING, 
"Failed to create mailbox snapshot - could not remove test messages for test_vm_api_1234\n");
 
  604        ast_log(
AST_LOG_WARNING, 
"Failed to create mailbox snapshot - could not remove test messages for test_vm_api_2345\n");
 
 
  646    if (ast_vm_test_create_user(
"default", 
"test_vm_api_1234")
 
  647        || ast_vm_test_create_user(
"default", 
"test_vm_api_2345")) {
 
 
  728    ast_vm_test_destroy_user(
"default", 
"test_vm_api_1234");
 
  729    ast_vm_test_destroy_user(
"default", 
"test_vm_api_2345");
 
 
  744        for (j = 0; j < 12; ++j) {
 
 
  821    if (!(mock_channel = 
ast_channel_alloc(0, 
AST_STATE_DOWN, 
NULL, 
NULL, 
NULL, 
NULL, 
NULL, 
NULL, 
NULL, 0, 
"TestChannel"))) {
 
 
  844        info->name = 
"nominal_snapshot";
 
  845        info->category = 
"/main/voicemail_api/";
 
  846        info->summary = 
"Nominal mailbox snapshot tests";
 
  848            "Test retrieving mailbox snapshots";
 
  910    ast_test_status_update(
test, 
"Test retrieving message 0, 1 from all folders of test_vm_1234, default context ordered by time\n");
 
 
  928        info->name = 
"off_nominal_snapshot";
 
  929        info->category = 
"/main/voicemail_api/";
 
  930        info->summary = 
"Off nominal mailbox snapshot tests";
 
  932            "Test off nominal requests for mailbox snapshots.  This includes" 
  933            " testing the following:\n" 
  934            " * Access to non-exisstent mailbox\n" 
  935            " * Access to NULL mailbox\n" 
  936            " * Access to non-existent context\n" 
  937            " * Access to non-existent folder\n" 
  938            " * Access to NULL folder\n" 
  939            " * Invalid sort identifier";
 
 
  967    const char *inbox_msg_id;
 
  968    const char *old_msg_id;
 
  969    const char *multi_msg_ids[2];
 
  973        info->name = 
"nominal_move";
 
  974        info->category = 
"/main/voicemail_api/";
 
  975        info->summary = 
"Nominal move voicemail tests";
 
  977            "Test nominal requests to move a voicemail to a different" 
  978            " folder.  This includes moving messages given a context," 
  979            " given a NULL context, and moving multiple messages";
 
 
 1037    const char *inbox_msg_id;
 
 1038    const char *multi_msg_ids[4];
 
 1042        info->name = 
"off_nominal_move";
 
 1043        info->category = 
"/main/voicemail_api/";
 
 1044        info->summary = 
"Off nominal mailbox message move tests";
 
 1046            "Test nominal requests to move a voicemail to a different" 
 1047            " folder.  This includes testing the following:\n" 
 1048            " * Moving to a non-existent mailbox\n" 
 1049            " * Moving to a NULL mailbox\n" 
 1050            " * Moving to a non-existent context\n" 
 1051            " * Moving to/from non-existent folder\n" 
 1052            " * Moving to/from NULL folder\n" 
 1053            " * Invalid message identifier(s)";
 
 
 1114    const char *inbox_msg_id;
 
 1115    const char *old_msg_id;
 
 1116    const char *multi_msg_ids[2];
 
 1120        info->name = 
"nominal_remove";
 
 1121        info->category = 
"/main/voicemail_api/";
 
 1122        info->summary = 
"Nominal mailbox remove message tests";
 
 1124            "Tests removing messages from voicemail folders.  Includes" 
 1125            " both removing messages one at a time, and in a set";
 
 
 1155    const char *inbox_msg_id;
 
 1156    const char *multi_msg_ids[2];
 
 1157    const char *empty_msg_ids = 
"";
 
 1161        info->name = 
"off_nominal_remove";
 
 1162        info->category = 
"/main/voicemail_api/";
 
 1163        info->summary = 
"Off nominal mailbox message removal tests";
 
 1165            "Test off nominal requests for removing messages from " 
 1166            "a mailbox.  This includes:\n" 
 1167            " * Removing messages with an invalid mailbox\n" 
 1168            " * Removing messages from a NULL mailbox\n" 
 1169            " * Removing messages from an invalid context\n" 
 1170            " * Removing messages from an invalid folder\n" 
 1171            " * Removing messages from a NULL folder\n" 
 1172            " * Removing messages with bad identifiers";
 
 1200    inbox_msg_id = 
"POOPOO";
 
 1204    multi_msg_ids[1] = 
"POOPOO";
 
 
 1221    const char *inbox_msg_id;
 
 1222    const char *multi_msg_ids[2];
 
 1226        info->name = 
"nominal_forward";
 
 1227        info->category = 
"/main/voicemail_api/";
 
 1228        info->summary = 
"Nominal message forward tests";
 
 1230            "Tests the nominal cases of forwarding messages" 
 1231            " between mailboxes";
 
 1245    VM_API_FORWARD_MESSAGE(
"test_vm_api_1234", 
"default", 
"INBOX", 
"test_vm_api_2345", 
"default", 
"INBOX", 1, &inbox_msg_id, 0);
 
 1257    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");
 
 1270    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");
 
 1283    ast_test_status_update(
test, 
"Test forwarding message 0 from test_vm_api_1234 INBOX to test_vm_api_2345 INBOX, deleting original\n");
 
 1297    VM_API_FORWARD_MESSAGE(
"test_vm_api_2345", 
"default", 
"INBOX", 
"test_vm_api_1234", 
"default", 
"INBOX", 2, multi_msg_ids, 0);
 
 1309    ast_test_status_update(
test, 
"Test forwarding 2 messages from test_vm_api_2345 INBOX to test_vm_api_1234 Family, deleting original\n");
 
 1310    VM_API_FORWARD_MESSAGE(
"test_vm_api_2345", 
"default", 
"INBOX", 
"test_vm_api_1234", 
"default", 
"Family", 2, multi_msg_ids, 1);
 
 
 1328    const char *inbox_msg_id;
 
 1329    const char *multi_msg_ids[4];
 
 1331    const char *empty_msg_ids = 
"";
 
 1335        info->name = 
"off_nominal_forward";
 
 1336        info->category = 
"/main/voicemail_api/";
 
 1337        info->summary = 
"Off nominal message forwarding tests";
 
 1339            "Test off nominal forwarding of messages.  This includes:\n" 
 1340            " * Invalid/NULL from mailbox\n" 
 1341            " * Invalid from context\n" 
 1342            " * Invalid/NULL from folder\n" 
 1343            " * Invalid/NULL to mailbox\n" 
 1344            " * Invalid to context\n" 
 1345            " * Invalid/NULL to folder\n" 
 1346            " * Invalid message numbers\n" 
 1347            " * Invalid number of messages";
 
 1397    inbox_msg_id = 
"POOPOO";
 
 
 1415    const char *message_id_1234;
 
 1416    const char *message_id_2345[2];
 
 1420        info->name = 
"nominal_msg_playback";
 
 1421        info->category = 
"/main/voicemail_api/";
 
 1422        info->summary = 
"Nominal message playback";
 
 1424            "Tests playing back a message on a provided" 
 1425            " channel or callback function";
 
 
 1474    const char *invalid_msg_id = 
"POOPOO";
 
 1478        info->name = 
"off_nominal_msg_playback";
 
 1479        info->category = 
"/main/voicemail_api/";
 
 1480        info->summary = 
"Off nominal message playback";
 
 1482            "Tests off nominal conditions in playing back a " 
 1483            "message.  This includes:\n" 
 1484            " * Invalid/NULL mailbox\n" 
 1485            " * Invalid context\n" 
 1486            " * Invalid/NULL folder\n" 
 1487            " * Invalid message identifiers";
 
 
Asterisk main include file. File version handling, generic pbx functions.
#define ast_calloc(num, len)
A wrapper for calloc()
General Asterisk PBX channel definitions.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag,...)
Create a channel structure.
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
#define ast_channel_unlock(chan)
#define AST_MAX_EXTENSION
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
@ AST_VM_SNAPSHOT_SORT_BY_ID
@ AST_VM_SNAPSHOT_SORT_BY_TIME
enum AST_LOCK_RESULT ast_lock_path(const char *path)
Lock a filesystem path.
struct ast_vm_mailbox_snapshot * ast_vm_mailbox_snapshot_destroy(struct ast_vm_mailbox_snapshot *mailbox_snapshot)
destroy a snapshot
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.
int ast_unlock_path(const char *path)
Unlock a path.
struct ast_frame ast_null_frame
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
Asterisk file paths, configured in asterisk.conf.
const char * ast_config_AST_DATA_DIR
const char * ast_config_AST_SPOOL_DIR
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Structure to describe a channel "technology", ie a channel driver See for examples:
int(*const write)(struct ast_channel *chan, struct ast_frame *frame)
Write a frame, in standard format (see frame.h)
Main Channel structure associated with a channel.
Data structure associated with a single frame of data.
struct ast_vm_mailbox_snapshot::@196 * snapshots
const ast_string_field folder_name
struct ast_vm_msg_snapshot::@195 msg
const ast_string_field callerid
const ast_string_field origtime
const ast_string_field msg_id
const ast_string_field exten
const ast_string_field callerchan
const ast_string_field duration
const ast_string_field origdate
const ast_string_field flag
#define AST_TEST_REGISTER(cb)
#define ast_test_status_update(a, b, c...)
#define AST_TEST_UNREGISTER(cb)
#define AST_TEST_DEFINE(hdr)
#define VM_API_STRING_FIELD_VERIFY(expected, actual)
#define VM_API_INT_VERIFY(expected, actual)
#define VM_API_SNAPSHOT_MSG_VERIFY(expected, actual, expected_folder, expected_index)
#define VOICEMAIL_DIR_MODE
static int test_vm_api_mock_channel_write(struct ast_channel *chan, struct ast_frame *frame)
static void test_vm_api_destroy_mailbox_voicemails(const char *mailbox, struct ast_vm_mailbox_snapshot *mailbox_snapshot)
static int test_vm_api_test_setup(void)
#define VM_API_MOVE_MESSAGE_OFF_NOMINAL(mailbox, context, number_of_messages, source, message_numbers_in, dest)
static struct ast_frame * test_vm_api_mock_channel_read(struct ast_channel *chan)
static void test_vm_api_test_teardown(void)
static struct ast_vm_msg_snapshot * test_snapshots[TOTAL_SNAPSHOTS]
static void test_vm_api_destroy_mock_snapshot(struct ast_vm_msg_snapshot *snapshot)
#define VM_API_SNAPSHOT_CREATE(mailbox, context, folder, desc, sort, old_and_inbox)
#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)
#define VM_API_TEST_CLEANUP
static void test_vm_api_remove_all_messages(void)
#define VM_API_MOVE_MESSAGE(mailbox, context, number_of_messages, source, message_numbers_in, dest)
static struct ast_vm_msg_snapshot * test_vm_api_create_mock_snapshot(const char *context, const char *exten, const char *callerid)
#define VM_API_PLAYBACK_MESSAGE_OFF_NOMINAL(channel, mailbox, context, folder, message, callback_fn)
static void test_vm_api_remove_voicemail(struct ast_vm_msg_snapshot *snapshot)
#define VM_API_REMOVE_MESSAGE_OFF_NOMINAL(mailbox, context, number_of_messages, folder, message_numbers_in)
static void message_playback_callback_fn(struct ast_channel *chan, const char *file, int duration)
static struct ast_channel * test_vm_api_create_mock_channel(void)
static const struct ast_channel_tech mock_channel_tech
#define VM_API_PLAYBACK_MESSAGE(channel, mailbox, context, folder, message, callback_fn)
static int load_module(void)
static int global_entered_playback_callback
#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)
static int unload_module(void)
static int test_vm_api_create_voicemail_files(const char *context, const char *mailbox, struct ast_vm_msg_snapshot *snapshot)
#define VOICEMAIL_FILE_MODE
static int get_folder_by_name(const char *folder)
#define VM_API_TEST_SETUP
#define VM_API_SNAPSHOT_OFF_NOMINAL_TEST(mailbox, context, folder, desc, sort, old_and_inbox)
static int test_vm_api_create_voicemail_folder(const char *folder_path)
static void test_vm_api_update_test_snapshots(struct ast_vm_mailbox_snapshot *mailbox_snapshot)
static const char *const mailbox_folders[]
#define VM_API_REMOVE_MESSAGE(mailbox, context, number_of_messages, folder, message_numbers_in)
int ast_mkdir(const char *path, int mode)
Recursively create directory path.