[asterisk-commits] tilghman: branch tilghman/realtime_update2 r148506 - in /team/tilghman/realti...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Oct 13 11:32:04 CDT 2008
Author: tilghman
Date: Mon Oct 13 11:32:03 2008
New Revision: 148506
URL: http://svn.digium.com/view/asterisk?view=rev&rev=148506
Log:
Add a new testing method... setting up voicemail multiple times is for the birds...
Modified:
team/tilghman/realtime_update2/apps/app_voicemail.c
team/tilghman/realtime_update2/res/res_realtime.c
Modified: team/tilghman/realtime_update2/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/realtime_update2/apps/app_voicemail.c?view=diff&rev=148506&r1=148505&r2=148506
==============================================================================
--- team/tilghman/realtime_update2/apps/app_voicemail.c (original)
+++ team/tilghman/realtime_update2/apps/app_voicemail.c Mon Oct 13 11:32:03 2008
@@ -4638,7 +4638,6 @@
int ausemacro = 0;
int ousemacro = 0;
int ouseexten = 0;
- char tmpid[16];
char tmpdur[16];
char priority[16];
char origtime[16];
Modified: team/tilghman/realtime_update2/res/res_realtime.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/realtime_update2/res/res_realtime.c?view=diff&rev=148506&r1=148505&r2=148506
==============================================================================
--- team/tilghman/realtime_update2/res/res_realtime.c (original)
+++ team/tilghman/realtime_update2/res/res_realtime.c Mon Oct 13 11:32:03 2008
@@ -76,7 +76,8 @@
return CLI_SUCCESS;
}
-static char *cli_realtime_update(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) {
+static char *cli_realtime_update(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
int res = 0;
switch (cmd) {
@@ -93,18 +94,60 @@
return NULL;
}
-
if (a->argc < 7)
return CLI_SHOWUSAGE;
res = ast_update_realtime(a->argv[2], a->argv[3], a->argv[4], a->argv[5], a->argv[6], SENTINEL);
- if(res < 0) {
+ if (res < 0) {
ast_cli(a->fd, "Failed to update. Check the debug log for possible SQL related entries.\n");
return CLI_FAILURE;
}
- ast_cli(a->fd, "Updated %d RealTime record%s.\n", res, ESS(res));
+ ast_cli(a->fd, "Updated %d RealTime record%s.\n", res, ESS(res));
+
+ return CLI_SUCCESS;
+}
+
+static char *cli_realtime_update2(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ int res = -1;
+
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "realtime update2";
+ e->usage =
+ "Usage: realtime update2 <family> <colupdate> <newvalue> <colmatch> <valuematch> [... <colmatchN> <valuematchN>]\n"
+ " Update a single variable using the RealTime driver.\n"
+ " You must supply a family name, a column to update on, a new value, column to match, and value to match.\n"
+ " Ex: realtime update sipfriends name bobsphone port 4343\n"
+ " will execute SQL as UPDATE sipfriends SET port = 4343 WHERE name = bobsphone\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc < 7)
+ return CLI_SHOWUSAGE;
+
+ if (a->argc == 7) {
+ res = ast_update2_realtime(a->argv[2], a->argv[5], a->argv[6], SENTINEL, a->argv[3], a->argv[4], SENTINEL);
+ } else if (a->argc == 9) {
+ res = ast_update2_realtime(a->argv[2], a->argv[5], a->argv[6], a->argv[7], a->argv[8], SENTINEL, a->argv[3], a->argv[4], SENTINEL);
+ } else if (a->argc == 11) {
+ res = ast_update2_realtime(a->argv[2], a->argv[5], a->argv[6], a->argv[7], a->argv[8], a->argv[9], a->argv[10], SENTINEL, a->argv[3], a->argv[4], SENTINEL);
+ } else if (a->argc == 13) {
+ res = ast_update2_realtime(a->argv[2], a->argv[5], a->argv[6], a->argv[7], a->argv[8], a->argv[9], a->argv[10], a->argv[11], a->argv[12], SENTINEL, a->argv[3], a->argv[4], SENTINEL);
+ } else {
+ return CLI_SHOWUSAGE;
+ }
+
+ if (res < 0) {
+ ast_cli(a->fd, "Failed to update. Check the debug log for possible SQL related entries.\n");
+ return CLI_FAILURE;
+ }
+
+ ast_cli(a->fd, "Updated %d RealTime record%s.\n", res, ESS(res));
return CLI_SUCCESS;
}
@@ -112,6 +155,7 @@
static struct ast_cli_entry cli_realtime[] = {
AST_CLI_DEFINE(cli_realtime_load, "Used to print out RealTime variables."),
AST_CLI_DEFINE(cli_realtime_update, "Used to update RealTime variables."),
+ AST_CLI_DEFINE(cli_realtime_update2, "Used to test the RealTime update2 method"),
};
static int unload_module(void)
More information about the asterisk-commits
mailing list