diff options
author | eliel <eliel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-07-08 14:48:42 +0000 |
---|---|---|
committer | eliel <eliel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-07-08 14:48:42 +0000 |
commit | 7a61a43adbc1ef91229e7757f6ac88619adff202 (patch) | |
tree | 80476efaba3fcc99c7526182d9ad935264c099eb /apps | |
parent | f28601a4b00a7b39fd8d3826b02c98e4b868e476 (diff) |
Implement AstData API data providers as part of the GSOC 2010 project,
midterm evaluation.
Review: https://reviewboard.asterisk.org/r/757/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@274727 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_meetme.c | 180 | ||||
-rw-r--r-- | apps/app_queue.c | 89 | ||||
-rw-r--r-- | apps/app_voicemail.c | 107 |
3 files changed, 244 insertions, 132 deletions
diff --git a/apps/app_meetme.c b/apps/app_meetme.c index 36c29cfe4..be1d36375 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -59,6 +59,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/dial.h" #include "asterisk/causes.h" #include "asterisk/paths.h" +#include "asterisk/data.h" +#include "asterisk/test.h" #include "enter.h" #include "leave.h" @@ -1775,6 +1777,7 @@ static int conf_free(struct ast_conference *conf) } ast_mutex_destroy(&conf->announcelistlock); } + if (conf->origframe) ast_frfree(conf->origframe); if (conf->lchan) @@ -1786,6 +1789,7 @@ static int conf_free(struct ast_conference *conf) if (conf->recordingfilename) { ast_free(conf->recordingfilename); } + if (conf->recordingformat) { ast_free(conf->recordingformat); } @@ -6723,6 +6727,170 @@ static int load_config(int reload) return sla_load_config(0); } +#define MEETME_DATA_EXPORT(MEMBER) \ + MEMBER(ast_conference, confno, AST_DATA_STRING) \ + MEMBER(ast_conference, dahdiconf, AST_DATA_INTEGER) \ + MEMBER(ast_conference, users, AST_DATA_INTEGER) \ + MEMBER(ast_conference, markedusers, AST_DATA_INTEGER) \ + MEMBER(ast_conference, maxusers, AST_DATA_INTEGER) \ + MEMBER(ast_conference, isdynamic, AST_DATA_BOOLEAN) \ + MEMBER(ast_conference, locked, AST_DATA_BOOLEAN) \ + MEMBER(ast_conference, recordingfilename, AST_DATA_STRING) \ + MEMBER(ast_conference, recordingformat, AST_DATA_STRING) \ + MEMBER(ast_conference, pin, AST_DATA_PASSWORD) \ + MEMBER(ast_conference, pinadmin, AST_DATA_PASSWORD) \ + MEMBER(ast_conference, start, AST_DATA_TIMESTAMP) \ + MEMBER(ast_conference, endtime, AST_DATA_TIMESTAMP) + +AST_DATA_STRUCTURE(ast_conference, MEETME_DATA_EXPORT); + +#define MEETME_USER_DATA_EXPORT(MEMBER) \ + MEMBER(ast_conf_user, user_no, AST_DATA_INTEGER) \ + MEMBER(ast_conf_user, talking, AST_DATA_BOOLEAN) \ + MEMBER(ast_conf_user, dahdichannel, AST_DATA_BOOLEAN) \ + MEMBER(ast_conf_user, jointime, AST_DATA_TIMESTAMP) \ + MEMBER(ast_conf_user, kicktime, AST_DATA_TIMESTAMP) \ + MEMBER(ast_conf_user, timelimit, AST_DATA_MILLISECONDS) \ + MEMBER(ast_conf_user, play_warning, AST_DATA_MILLISECONDS) \ + MEMBER(ast_conf_user, warning_freq, AST_DATA_MILLISECONDS) + +AST_DATA_STRUCTURE(ast_conf_user, MEETME_USER_DATA_EXPORT); + +/*! + * \internal + * \brief Implements the meetme data provider. + */ +static int meetme_data_provider_get(const struct ast_data_search *search, + struct ast_data *data_root) +{ + struct ast_conference *cnf; + struct ast_conf_user *user; + struct ast_data *data_meetme, *data_meetme_users, *data_meetme_user; + struct ast_data *data_meetme_user_channel, *data_meetme_user_volume; + + AST_LIST_LOCK(&confs); + AST_LIST_TRAVERSE(&confs, cnf, list) { + data_meetme = ast_data_add_node(data_root, "meetme"); + if (!data_meetme) { + continue; + } + + ast_data_add_structure(ast_conference, data_meetme, cnf); + + if (!AST_LIST_EMPTY(&cnf->userlist)) { + data_meetme_users = ast_data_add_node(data_meetme, "users"); + if (!data_meetme_users) { + ast_data_remove_node(data_root, data_meetme); + continue; + } + + AST_LIST_TRAVERSE(&cnf->userlist, user, list) { + data_meetme_user = ast_data_add_node(data_meetme_users, "user"); + if (!data_meetme_user) { + continue; + } + /* user structure. */ + ast_data_add_structure(ast_conf_user, data_meetme_user, user); + + /* user's channel */ + data_meetme_user_channel = ast_data_add_node(data_meetme_user, "channel"); + if (!data_meetme_user_channel) { + continue; + } + + ast_channel_data_add_structure(data_meetme_user_channel, user->chan, 1); + + /* volume structure */ + data_meetme_user_volume = ast_data_add_node(data_meetme_user, "listen-volume"); + if (!data_meetme_user_volume) { + continue; + } + ast_data_add_int(data_meetme_user_volume, "desired", user->listen.desired); + ast_data_add_int(data_meetme_user_volume, "actual", user->listen.actual); + + data_meetme_user_volume = ast_data_add_node(data_meetme_user, "talk-volume"); + if (!data_meetme_user_volume) { + continue; + } + ast_data_add_int(data_meetme_user_volume, "desired", user->talk.desired); + ast_data_add_int(data_meetme_user_volume, "actual", user->talk.actual); + } + } + + if (!ast_data_search_match(search, data_meetme)) { + ast_data_remove_node(data_root, data_meetme); + } + } + AST_LIST_UNLOCK(&confs); + + return 0; +} + +static const struct ast_data_handler meetme_data_provider = { + .version = AST_DATA_HANDLER_VERSION, + .get = meetme_data_provider_get +}; + +static const struct ast_data_entry meetme_data_providers[] = { + AST_DATA_ENTRY("asterisk/application/meetme/list", &meetme_data_provider), +}; + +#ifdef TEST_FRAMEWORK +AST_TEST_DEFINE(test_meetme_data_provider) +{ + struct ast_channel *chan; + struct ast_conference *cnf; + struct ast_data *node; + struct ast_data_query query = { + .path = "/asterisk/application/meetme/list", + .search = "list/meetme/confno=9898" + }; + + switch (cmd) { + case TEST_INIT: + info->name = "meetme_get_data_test"; + info->category = "main/data/app_meetme/list"; + info->summary = "Meetme data provider unit test"; + info->description = + "Tests whether the Meetme data provider implementation works as expected."; + return AST_TEST_NOT_RUN; + case TEST_EXECUTE: + break; + } + + chan = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, NULL, NULL, NULL, 0, 0, "MeetMeTest"); + if (!chan) { + return AST_TEST_FAIL; + } + + cnf = build_conf("9898", "", "1234", 1, 1, 1, chan); + if (!cnf) { + ast_hangup(chan); + return AST_TEST_FAIL; + } + + node = ast_data_get(&query); + if (!node) { + dispose_conf(cnf); + ast_hangup(chan); + return AST_TEST_FAIL; + } + + if (strcmp(ast_data_retrieve_string(node, "meetme/confno"), "9898")) { + dispose_conf(cnf); + ast_hangup(chan); + ast_data_free(node); + return AST_TEST_FAIL; + } + + ast_data_free(node); + dispose_conf(cnf); + ast_hangup(chan); + + return AST_TEST_PASS; +} +#endif + static int unload_module(void) { int res = 0; @@ -6738,6 +6906,11 @@ static int unload_module(void) res |= ast_unregister_application(slastation_app); res |= ast_unregister_application(slatrunk_app); +#ifdef TEST_FRAMEWORK + AST_TEST_UNREGISTER(test_meetme_data_provider); +#endif + ast_data_unregister(NULL); + ast_devstate_prov_del("Meetme"); ast_devstate_prov_del("SLA"); @@ -6749,6 +6922,8 @@ static int unload_module(void) return res; } + + static int load_module(void) { int res = 0; @@ -6766,6 +6941,11 @@ static int load_module(void) res |= ast_register_application_xml(slastation_app, sla_station_exec); res |= ast_register_application_xml(slatrunk_app, sla_trunk_exec); +#ifdef TEST_FRAMEWORK + AST_TEST_REGISTER(test_meetme_data_provider); +#endif + ast_data_register_multiple(meetme_data_providers, ARRAY_LEN(meetme_data_providers)); + res |= ast_devstate_prov_add("Meetme", meetmestate); res |= ast_devstate_prov_add("SLA", sla_state); diff --git a/apps/app_queue.c b/apps/app_queue.c index 4c7c42212..e91e13a06 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -7762,7 +7762,7 @@ static struct ast_cli_entry cli_queue[] = { MEMBER(call_queue, sound_reporthold, AST_DATA_STRING) \ MEMBER(call_queue, dead, AST_DATA_BOOLEAN) \ MEMBER(call_queue, eventwhencalled, AST_DATA_BOOLEAN) \ - MEMBER(call_queue, ringinuse, AST_DATA_INTEGER) \ + MEMBER(call_queue, ringinuse, AST_DATA_BOOLEAN) \ MEMBER(call_queue, setinterfacevar, AST_DATA_BOOLEAN) \ MEMBER(call_queue, setqueuevar, AST_DATA_BOOLEAN) \ MEMBER(call_queue, setqueueentryvar, AST_DATA_BOOLEAN) \ @@ -7770,20 +7770,18 @@ static struct ast_cli_entry cli_queue[] = { MEMBER(call_queue, wrapped, AST_DATA_BOOLEAN) \ MEMBER(call_queue, timeoutrestart, AST_DATA_BOOLEAN) \ MEMBER(call_queue, announceholdtime, AST_DATA_INTEGER) \ - MEMBER(call_queue, announceposition, AST_DATA_INTEGER) \ - MEMBER(call_queue, strategy, AST_DATA_INTEGER) \ MEMBER(call_queue, maskmemberstatus, AST_DATA_BOOLEAN) \ MEMBER(call_queue, realtime, AST_DATA_BOOLEAN) \ MEMBER(call_queue, found, AST_DATA_BOOLEAN) \ MEMBER(call_queue, announcepositionlimit, AST_DATA_INTEGER) \ - MEMBER(call_queue, announcefrequency, AST_DATA_INTEGER) \ - MEMBER(call_queue, minannouncefrequency, AST_DATA_INTEGER) \ - MEMBER(call_queue, periodicannouncefrequency, AST_DATA_INTEGER) \ + MEMBER(call_queue, announcefrequency, AST_DATA_SECONDS) \ + MEMBER(call_queue, minannouncefrequency, AST_DATA_SECONDS) \ + MEMBER(call_queue, periodicannouncefrequency, AST_DATA_SECONDS) \ MEMBER(call_queue, numperiodicannounce, AST_DATA_INTEGER) \ MEMBER(call_queue, randomperiodicannounce, AST_DATA_INTEGER) \ - MEMBER(call_queue, roundingseconds, AST_DATA_INTEGER) \ - MEMBER(call_queue, holdtime, AST_DATA_INTEGER) \ - MEMBER(call_queue, talktime, AST_DATA_INTEGER) \ + MEMBER(call_queue, roundingseconds, AST_DATA_SECONDS) \ + MEMBER(call_queue, holdtime, AST_DATA_SECONDS) \ + MEMBER(call_queue, talktime, AST_DATA_SECONDS) \ MEMBER(call_queue, callscompleted, AST_DATA_INTEGER) \ MEMBER(call_queue, callsabandoned, AST_DATA_INTEGER) \ MEMBER(call_queue, servicelevel, AST_DATA_INTEGER) \ @@ -7792,9 +7790,9 @@ static struct ast_cli_entry cli_queue[] = { MEMBER(call_queue, montype, AST_DATA_INTEGER) \ MEMBER(call_queue, count, AST_DATA_INTEGER) \ MEMBER(call_queue, maxlen, AST_DATA_INTEGER) \ - MEMBER(call_queue, wrapuptime, AST_DATA_INTEGER) \ - MEMBER(call_queue, retry, AST_DATA_INTEGER) \ - MEMBER(call_queue, timeout, AST_DATA_INTEGER) \ + MEMBER(call_queue, wrapuptime, AST_DATA_SECONDS) \ + MEMBER(call_queue, retry, AST_DATA_SECONDS) \ + MEMBER(call_queue, timeout, AST_DATA_SECONDS) \ MEMBER(call_queue, weight, AST_DATA_INTEGER) \ MEMBER(call_queue, autopause, AST_DATA_INTEGER) \ MEMBER(call_queue, timeoutpriority, AST_DATA_INTEGER) \ @@ -7856,19 +7854,12 @@ AST_DATA_STRUCTURE(queue_ent, DATA_EXPORT_QUEUE_ENT); static void queues_data_provider_get_helper(const struct ast_data_search *search, struct ast_data *data_root, struct call_queue *queue) { - int member_notmatch, caller_notmatch, caller_channel_notmatch; struct ao2_iterator im; struct member *member; struct queue_ent *qe; - struct ast_data *data_queue, *data_members = NULL; + struct ast_data *data_queue, *data_members = NULL, *enum_node; struct ast_data *data_member, *data_callers = NULL, *data_caller, *data_caller_channel; - /* compare the search pattern. */ - if (ast_data_search_cmp_structure(search, call_queue, queue, "queue")) { - /* this doesn't match! continue! */ - return; - } - data_queue = ast_data_add_node(data_root, "queue"); if (!data_queue) { return; @@ -7876,16 +7867,35 @@ static void queues_data_provider_get_helper(const struct ast_data_search *search ast_data_add_structure(call_queue, data_queue, queue); - member_notmatch = ast_data_search_has_condition(search, "queue/members/member"); + ast_data_add_str(data_queue, "strategy", int2strat(queue->strategy)); + + /* announce position */ + enum_node = ast_data_add_node(data_queue, "announceposition"); + if (!enum_node) { + return; + } + switch (queue->announceposition) { + case ANNOUNCEPOSITION_LIMIT: + ast_data_add_str(enum_node, "text", "limit"); + break; + case ANNOUNCEPOSITION_MORE_THAN: + ast_data_add_str(enum_node, "text", "more"); + break; + case ANNOUNCEPOSITION_YES: + ast_data_add_str(enum_node, "text", "yes"); + break; + case ANNOUNCEPOSITION_NO: + ast_data_add_str(enum_node, "text", "no"); + break; + default: + ast_data_add_str(enum_node, "text", "unknown"); + break; + } + ast_data_add_int(enum_node, "value", queue->announceposition); + /* add queue members */ im = ao2_iterator_init(queue->members, 0); while ((member = ao2_iterator_next(&im))) { - /* compare the member structure. */ - if (!ast_data_search_cmp_structure(search, member, member, - "queue/members/member")) { - member_notmatch = 0; - } - if (!data_members) { data_members = ast_data_add_node(data_queue, "members"); if (!data_members) { @@ -7905,28 +7915,9 @@ static void queues_data_provider_get_helper(const struct ast_data_search *search ao2_ref(member, -1); } - if (member_notmatch) { - ast_data_remove_node(data_root, data_queue); - return; - } - - caller_notmatch = ast_data_search_has_condition(search, "queue/callers/caller"); - caller_channel_notmatch = ast_data_search_has_condition(search, - "queue/callers/caller/channel"); /* include the callers inside the result. */ if (queue->head) { for (qe = queue->head; qe; qe = qe->next) { - /* compare the member structure. */ - if (!ast_data_search_cmp_structure(search, queue_ent, qe, - "queue/callers/caller")) { - caller_notmatch = 0; - } - - if (!ast_channel_data_cmp_structure(search, qe->chan, - "queue/callers/caller/channel")) { - caller_channel_notmatch = 0; - } - if (!data_callers) { data_callers = ast_data_add_node(data_queue, "callers"); if (!data_callers) { @@ -7947,12 +7938,12 @@ static void queues_data_provider_get_helper(const struct ast_data_search *search continue; } - ast_channel_data_add_structure(data_caller_channel, qe->chan); + ast_channel_data_add_structure(data_caller_channel, qe->chan, 1); } } /* if this queue doesn't match remove the added queue. */ - if (caller_notmatch || caller_channel_notmatch) { + if (!ast_data_search_match(search, data_queue)) { ast_data_remove_node(data_root, data_queue); } } @@ -8011,7 +8002,7 @@ static const struct ast_data_handler queues_data_provider = { }; static const struct ast_data_entry queue_data_providers[] = { - AST_DATA_ENTRY("asterisk/application/app_queue/queues", &queues_data_provider), + AST_DATA_ENTRY("asterisk/application/queue/list", &queues_data_provider), }; static int unload_module(void) diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 892c865a9..4e7a26e79 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -10815,7 +10815,7 @@ static struct ast_cli_entry cli_voicemail[] = { #define DATA_EXPORT_VM_USERS(USER) \ USER(ast_vm_user, context, AST_DATA_STRING) \ USER(ast_vm_user, mailbox, AST_DATA_STRING) \ - USER(ast_vm_user, password, AST_DATA_STRING) \ + USER(ast_vm_user, password, AST_DATA_PASSWORD) \ USER(ast_vm_user, fullname, AST_DATA_STRING) \ USER(ast_vm_user, email, AST_DATA_STRING) \ USER(ast_vm_user, emailsubject, AST_DATA_STRING) \ @@ -10843,7 +10843,7 @@ static struct ast_cli_entry cli_voicemail[] = { #define DATA_EXPORT_VM_USERS(USER) \ USER(ast_vm_user, context, AST_DATA_STRING) \ USER(ast_vm_user, mailbox, AST_DATA_STRING) \ - USER(ast_vm_user, password, AST_DATA_STRING) \ + USER(ast_vm_user, password, AST_DATA_PASSWORD) \ USER(ast_vm_user, fullname, AST_DATA_STRING) \ USER(ast_vm_user, email, AST_DATA_STRING) \ USER(ast_vm_user, emailsubject, AST_DATA_STRING) \ @@ -10875,50 +10875,6 @@ AST_DATA_STRUCTURE(ast_vm_user, DATA_EXPORT_VM_USERS); AST_DATA_STRUCTURE(vm_zone, DATA_EXPORT_VM_ZONES); -#ifdef IMAP_STORAGE - #define DATA_EXPORT_VM_STATES(STATE) \ - STATE(vm_state, curbox, AST_DATA_STRING) \ - STATE(vm_state, username, AST_DATA_STRING) \ - STATE(vm_state, context, AST_DATA_STRING) \ - STATE(vm_state, curdir, AST_DATA_STRING) \ - STATE(vm_state, vmbox, AST_DATA_STRING) \ - STATE(vm_state, fn, AST_DATA_STRING) \ - STATE(vm_state, intro, AST_DATA_STRING) \ - STATE(vm_state, curmsg, AST_DATA_INTEGER) \ - STATE(vm_state, lastmsg, AST_DATA_INTEGER) \ - STATE(vm_state, newmessages, AST_DATA_INTEGER) \ - STATE(vm_state, oldmessages, AST_DATA_INTEGER) \ - STATE(vm_state, urgentmessages, AST_DATA_INTEGER) \ - STATE(vm_state, starting, AST_DATA_INTEGER) \ - STATE(vm_state, repeats, AST_DATA_INTEGER) \ - STATE(vm_state, updated, AST_DATA_INTEGER) \ - STATE(vm_state, msgArray, AST_DATA_CONTAINER) \ - STATE(vm_state, vmArrayIndex, AST_DATA_INTEGER) \ - STATE(vm_state, imapuser, AST_DATA_STRING) \ - STATE(vm_state, interactive, AST_DATA_INTEGER) \ - STATE(vm_state, introfn, AST_DATA_STRING) \ - STATE(vm_state, quota_limit, AST_DATA_UNSIGNED_INTEGER) \ - STATE(vm_state, quota_usage, AST_DATA_UNSIGNED_INTEGER) -#else - #define DATA_EXPORT_VM_STATES(STATE) \ - STATE(vm_state, curbox, AST_DATA_STRING) \ - STATE(vm_state, username, AST_DATA_STRING) \ - STATE(vm_state, context, AST_DATA_STRING) \ - STATE(vm_state, curdir, AST_DATA_STRING) \ - STATE(vm_state, vmbox, AST_DATA_STRING) \ - STATE(vm_state, fn, AST_DATA_STRING) \ - STATE(vm_state, intro, AST_DATA_STRING) \ - STATE(vm_state, curmsg, AST_DATA_INTEGER) \ - STATE(vm_state, lastmsg, AST_DATA_INTEGER) \ - STATE(vm_state, newmessages, AST_DATA_INTEGER) \ - STATE(vm_state, oldmessages, AST_DATA_INTEGER) \ - STATE(vm_state, urgentmessages, AST_DATA_INTEGER) \ - STATE(vm_state, starting, AST_DATA_INTEGER) \ - STATE(vm_state, repeats, AST_DATA_INTEGER) -#endif - -AST_DATA_STRUCTURE(vm_state, DATA_EXPORT_VM_STATES); - /*! * \internal * \brief Add voicemail user to the data_root. @@ -10926,32 +10882,22 @@ AST_DATA_STRUCTURE(vm_state, DATA_EXPORT_VM_STATES); * \param[in] data_root The main result node. * \param[in] user The voicemail user. */ -static void vm_users_data_provider_get_helper(const struct ast_data_search *search, +static int vm_users_data_provider_get_helper(const struct ast_data_search *search, struct ast_data *data_root, struct ast_vm_user *user) { struct ast_data *data_user, *data_zone; -#ifdef IMAP_STORAGE struct ast_data *data_state; - struct vm_state *state; -#endif struct vm_zone *zone = NULL; - - /* check the search pattern to make sure it's valid to add it */ - if (ast_data_search_cmp_structure(search, ast_vm_user, user, "user")) { - return; - } + int urgentmsg = 0, newmsg = 0, oldmsg = 0; + char ext_context[256] = ""; data_user = ast_data_add_node(data_root, "user"); if (!data_user) { - return; + return -1; } ast_data_add_structure(ast_vm_user, data_user, user); -#ifdef IMAP_STORAGE - state = get_vm_state_by_mailbox(user->mailbox, user->context, 0); -#endif - AST_LIST_LOCK(&zones); AST_LIST_TRAVERSE(&zones, zone, list) { if (!strcmp(zone->name, user->zonetag)) { @@ -10960,35 +10906,30 @@ static void vm_users_data_provider_get_helper(const struct ast_data_search *sear } AST_LIST_UNLOCK(&zones); - /* TODO: Should a user's vm state be accessible without compiling in - * IMAP support? */ - - if ( -#ifdef IMAP_STORAGE - !ast_data_search_cmp_structure(search, vm_state, state, "user/state") || -#endif - (zone && !ast_data_search_cmp_structure(search, vm_zone, - zone, "user/zone"))) { - ast_data_remove_node(data_root, data_user); - return; - } - -#ifdef IMAP_STORAGE + /* state */ data_state = ast_data_add_node(data_user, "state"); - ast_data_add_structure(vm_state, data_state, state); - ast_data_add_int(data_state, "deleted", *(state->deleted)); - ast_data_add_int(data_state, "heard", *(state->heard)); -#endif + if (!data_state) { + return -1; + } + snprintf(ext_context, sizeof(ext_context), "%s@%s", user->mailbox, user->context); + inboxcount2(ext_context, &urgentmsg, &newmsg, &oldmsg); + ast_data_add_int(data_state, "urgentmsg", urgentmsg); + ast_data_add_int(data_state, "newmsg", newmsg); + ast_data_add_int(data_state, "oldmsg", oldmsg); if (zone) { data_zone = ast_data_add_node(data_user, "zone"); ast_data_add_structure(vm_zone, data_zone, zone); } - return; + if (!ast_data_search_match(search, data_user)) { + ast_data_remove_node(data_root, data_user); + } + + return 0; } -static int vm_data_provider_get(const struct ast_data_search *search, +static int vm_users_data_provider_get(const struct ast_data_search *search, struct ast_data *data_root) { struct ast_vm_user *user; @@ -11002,13 +10943,13 @@ static int vm_data_provider_get(const struct ast_data_search *search, return 0; } -static const struct ast_data_handler vm_data_provider = { +static const struct ast_data_handler vm_users_data_provider = { .version = AST_DATA_HANDLER_VERSION, - .get = vm_data_provider_get + .get = vm_users_data_provider_get }; static const struct ast_data_entry vm_data_providers[] = { - AST_DATA_ENTRY("asterisk/application/app_voicemail/voicemail", &vm_data_provider) + AST_DATA_ENTRY("asterisk/application/voicemail/list", &vm_users_data_provider) }; static void poll_subscribed_mailbox(struct mwi_sub *mwi_sub) |