summaryrefslogtreecommitdiff
path: root/apps/app_voicemail.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2008-10-14 00:08:52 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2008-10-14 00:08:52 +0000
commitc1351ad2370f179e439adf9faf9c49cf34a9b4d6 (patch)
treedefa29805f9479efc7793b15f9e31a97dfe89603 /apps/app_voicemail.c
parentdb7299f4bc0dd35fb08038a368c6d8700a8ce4d4 (diff)
Merge realtime_update2 branch, which adds a new realtime API call named
'update2', which permits updates which match across multiple columns, instead of requiring all tables to have a single unique identifier. All of the other API calls with the exception of 'update' already had the ability to match on multiple fields, so it was a missing and very desireable feature that an API call implementing an update should have this, too. This does not change any outward performance of Asterisk, but it should make life easier for application developers who use the RealTime framework. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@148570 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_voicemail.c')
-rw-r--r--apps/app_voicemail.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 4134f19bf..0ddcf3b15 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -943,7 +943,7 @@ static int change_password_realtime(struct ast_vm_user *vmu, const char *passwor
if (strlen(password) > 10) {
ast_realtime_require_field("voicemail", "password", RQ_CHAR, strlen(password), SENTINEL);
}
- res = ast_update_realtime("voicemail", "uniqueid", vmu->uniqueid, "password", password, SENTINEL);
+ res = ast_update2_realtime("voicemail", "context", vmu->context, "mailbox", vmu->mailbox, SENTINEL, "password", password, SENTINEL);
if (res > 0) {
ast_copy_string(vmu->password, password, sizeof(vmu->password));
res = 0;
@@ -4638,8 +4638,6 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
int ausemacro = 0;
int ousemacro = 0;
int ouseexten = 0;
- int rtmsgid = 0;
- char tmpid[16];
char tmpdur[16];
char priority[16];
char origtime[16];
@@ -4932,7 +4930,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
snprintf(priority, sizeof(priority), "%d", chan->priority);
snprintf(origtime, sizeof(origtime), "%ld", (long)time(NULL));
get_date(date, sizeof(date));
- rtmsgid = ast_store_realtime("voicemail_data", "origmailbox", ext, "context", chan->context, "macrocontext", chan->macrocontext, "exten", chan->exten, "priority", priority, "callerchan", chan->name, "callerid", ast_callerid_merge(callerid, sizeof(callerid), chan->cid.cid_name, chan->cid.cid_num, "Unknown"), "origdate", date, "origtime", origtime, "category", S_OR(category,""), SENTINEL);
+ ast_store_realtime("voicemail_data", "origmailbox", ext, "context", chan->context, "macrocontext", chan->macrocontext, "exten", chan->exten, "priority", priority, "callerchan", chan->name, "callerid", ast_callerid_merge(callerid, sizeof(callerid), chan->cid.cid_name, chan->cid.cid_num, "Unknown"), "origdate", date, "origtime", origtime, "category", S_OR(category,""), "filename", tmptxtfile, SENTINEL);
}
/* Store information */
@@ -4976,8 +4974,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
ast_filedelete(tmptxtfile, NULL);
unlink(tmptxtfile);
if (ast_check_realtime("voicemail_data")) {
- snprintf(tmpid, sizeof(tmpid), "%d", rtmsgid);
- ast_destroy_realtime("voicemail_data", "id", tmpid, SENTINEL);
+ ast_destroy_realtime("voicemail_data", "filename", tmptxtfile, SENTINEL);
}
} else {
fprintf(txt, "duration=%d\n", duration);
@@ -4992,8 +4989,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
unlink(tmptxtfile);
ast_unlock_path(dir);
if (ast_check_realtime("voicemail_data")) {
- snprintf(tmpid, sizeof(tmpid), "%d", rtmsgid);
- ast_destroy_realtime("voicemail_data", "id", tmpid, SENTINEL);
+ ast_destroy_realtime("voicemail_data", "filename", tmptxtfile, SENTINEL);
}
} else {
#ifndef IMAP_STORAGE
@@ -5019,9 +5015,8 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
ast_unlock_path(dir);
if (ast_check_realtime("voicemail_data")) {
- snprintf(tmpid, sizeof(tmpid), "%d", rtmsgid);
snprintf(tmpdur, sizeof(tmpdur), "%d", duration);
- ast_update_realtime("voicemail_data", "id", tmpid, "filename", fn, "duration", tmpdur, SENTINEL);
+ ast_update_realtime("voicemail_data", "filename", tmptxtfile, "filename", fn, "duration", tmpdur, SENTINEL);
}
/* We must store the file first, before copying the message, because
* ODBC storage does the entire copy with SQL.