[asterisk-commits] russell: trunk r85460 - in /trunk: apps/ channels/ main/ pbx/ res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 11 14:03:07 CDT 2007


Author: russell
Date: Thu Oct 11 14:03:06 2007
New Revision: 85460

URL: http://svn.digium.com/view/asterisk?view=rev&rev=85460
Log:
Merge a ton of NEW_CLI conversions.  Thanks to everyone that helped out!  :)

(closes issue #10724)
Reported by: eliel
Patches: 
      chan_skinny.c.patch uploaded by eliel (license 64)
      chan_oss.c.patch uploaded by eliel (license 64)
      chan_mgcp.c.patch2 uploaded by eliel (license 64)
      pbx_config.c.patch uploaded by seanbright (license 71)
      iax2-provision.c.patch uploaded by eliel (license 64)
      chan_gtalk.c.patch uploaded by eliel (license 64)
      pbx_ael.c.patch uploaded by seanbright (license 71)
      file.c.patch uploaded by seanbright (license 71)
      image.c.patch uploaded by seanbright (license 71)
      cli.c.patch uploaded by moy (license 222)
      astobj2.c.patch uploaded by moy (license 222)
      asterisk.c.patch uploaded by moy (license 222)
      res_limit.c.patch uploaded by seanbright (license 71)
      res_convert.c.patch uploaded by seanbright (license 71)
      res_crypto.c.patch uploaded by seanbright (license 71)
      app_osplookup.c.patch uploaded by seanbright (license 71)
      app_rpt.c.patch uploaded by seanbright (license 71)
      app_mixmonitor.c.patch uploaded by seanbright (license 71)
      channel.c.patch uploaded by seanbright (license 71)
      translate.c.patch uploaded by seanbright (license 71)
      udptl.c.patch uploaded by seanbright (license 71)
      threadstorage.c.patch uploaded by seanbright (license 71)
      db.c.patch uploaded by seanbright (license 71)
      cdr.c.patch uploaded by moy (license 222)
      pbd_dundi.c.patch uploaded by moy (license 222)
      app_osplookup-rev83558.patch uploaded by moy (license 222)
      res_clioriginate.c.patch uploaded by moy (license 222)

Modified:
    trunk/apps/app_mixmonitor.c
    trunk/apps/app_osplookup.c
    trunk/apps/app_rpt.c
    trunk/channels/chan_gtalk.c
    trunk/channels/chan_mgcp.c
    trunk/channels/chan_oss.c
    trunk/channels/chan_skinny.c
    trunk/channels/iax2-provision.c
    trunk/main/asterisk.c
    trunk/main/astobj2.c
    trunk/main/cdr.c
    trunk/main/channel.c
    trunk/main/cli.c
    trunk/main/db.c
    trunk/main/file.c
    trunk/main/image.c
    trunk/main/threadstorage.c
    trunk/main/translate.c
    trunk/main/udptl.c
    trunk/pbx/pbx_ael.c
    trunk/pbx/pbx_config.c
    trunk/pbx/pbx_dundi.c
    trunk/res/res_clioriginate.c
    trunk/res/res_convert.c
    trunk/res/res_crypto.c
    trunk/res/res_limit.c

Modified: trunk/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_mixmonitor.c?view=diff&rev=85460&r1=85459&r2=85460
==============================================================================
--- trunk/apps/app_mixmonitor.c (original)
+++ trunk/apps/app_mixmonitor.c Thu Oct 11 14:03:06 2007
@@ -362,46 +362,44 @@
 	return 0;
 }
 
-static int mixmonitor_cli(int fd, int argc, char **argv) 
+static char *handle_cli_mixmonitor(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct ast_channel *chan;
 
-	if (argc < 3)
-		return RESULT_SHOWUSAGE;
-
-	if (!(chan = ast_get_channel_by_name_prefix_locked(argv[2], strlen(argv[2])))) {
-		ast_cli(fd, "No channel matching '%s' found.\n", argv[2]);
-		return RESULT_SUCCESS;
-	}
-
-	if (!strcasecmp(argv[1], "start")) {
-		mixmonitor_exec(chan, argv[3]);
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "mixmonitor [start|stop]";
+		e->usage =
+			"Usage: mixmonitor <start|stop> <chan_name> [args]\n"
+			"       The optional arguments are passed to the MixMonitor\n"
+			"       application when the 'start' command is used.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return ast_complete_channels(a->line, a->word, a->pos, a->n, 2);
+	}
+
+	if (a->argc < 3)
+		return CLI_SHOWUSAGE;
+
+	if (!(chan = ast_get_channel_by_name_prefix_locked(a->argv[2], strlen(a->argv[2])))) {
+		ast_cli(a->fd, "No channel matching '%s' found.\n", a->argv[2]);
+		/* Technically this is a failure, but we don't want 2 errors printing out */
+		return CLI_SUCCESS;
+	}
+
+	if (!strcasecmp(a->argv[1], "start")) {
+		mixmonitor_exec(chan, a->argv[3]);
 		ast_channel_unlock(chan);
 	} else {
 		ast_channel_unlock(chan);
 		ast_audiohook_detach_source(chan, mixmonitor_spy_type);
 	}
 
-	return RESULT_SUCCESS;
-}
-
-static char *complete_mixmonitor_cli(const char *line, const char *word, int pos, int state)
-{
-	char *options[] = {"start", "stop", NULL};
-
-	if (pos == 1)
-		return ast_cli_complete (word, options, state);
-
-	return ast_complete_channels(line, word, pos, state, 2);
+	return CLI_SUCCESS;
 }
 
 static struct ast_cli_entry cli_mixmonitor[] = {
-	{ { "mixmonitor", NULL, NULL },
-	mixmonitor_cli, "Execute a MixMonitor command.",
-	"mixmonitor <start|stop> <chan_name> [args]\n\n"
-	"The optional arguments are passed to the\n"
-	"MixMonitor application when the 'start' command is used.\n",
-	complete_mixmonitor_cli },
+	NEW_CLI(handle_cli_mixmonitor, "Execute a MixMonitor command")
 };
 
 static int unload_module(void)

Modified: trunk/apps/app_osplookup.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_osplookup.c?view=diff&rev=85460&r1=85459&r2=85460
==============================================================================
--- trunk/apps/app_osplookup.c (original)
+++ trunk/apps/app_osplookup.c Thu Oct 11 14:03:06 2007
@@ -1861,10 +1861,7 @@
 	return 0;
 }
 
-static int osp_show(
-	int fd,
-	int argc,
-	char* argv[])
+static char *handle_cli_osp_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	int i;
 	int found = 0;
@@ -1872,12 +1869,21 @@
 	const char* provider = NULL;
 	const char* tokenalgo;
 
-	if ((argc < 2) || (argc > 3)) {
-		return RESULT_SHOWUSAGE;
-	}
-	if (argc > 2) {
-		provider = argv[2];
-	}
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "osp show";
+		e->usage =
+			"Usage: osp show\n"
+			"       Displays information on Open Settlement Protocol support\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if ((a->argc < 2) || (a->argc > 3))
+		return CLI_SHOWUSAGE;
+	if (a->argc > 2) 
+		provider = a->argv[2];
 	if (!provider) {
 		switch (osp_tokenformat) {
 			case TOKEN_ALGO_BOTH:
@@ -1891,7 +1897,7 @@
 				tokenalgo = "Signed";
 				break;
 		}
-		ast_cli(fd, "OSP: %s %s %s\n",
+		ast_cli(a->fd, "OSP: %s %s %s\n",
 			osp_initialized ? "Initialized" : "Uninitialized", osp_hardware ? "Accelerated" : "Normal", tokenalgo);
 	}
 
@@ -1900,25 +1906,25 @@
 	while(p) {
 		if (!provider || !strcasecmp(p->name, provider)) {
 			if (found) {
-				ast_cli(fd, "\n");
-			}
-			ast_cli(fd, " == OSP Provider '%s' == \n", p->name);
-			ast_cli(fd, "Local Private Key: %s\n", p->privatekey);
-			ast_cli(fd, "Local Certificate: %s\n", p->localcert);
+				ast_cli(a->fd, "\n");
+			}
+			ast_cli(a->fd, " == OSP Provider '%s' == \n", p->name);
+			ast_cli(a->fd, "Local Private Key: %s\n", p->privatekey);
+			ast_cli(a->fd, "Local Certificate: %s\n", p->localcert);
 			for (i = 0; i < p->cacount; i++) {
-				ast_cli(fd, "CA Certificate %d:  %s\n", i + 1, p->cacerts[i]);
+				ast_cli(a->fd, "CA Certificate %d:  %s\n", i + 1, p->cacerts[i]);
 			}
 			for (i = 0; i < p->spcount; i++) {
-				ast_cli(fd, "Service Point %d:   %s\n", i + 1, p->srvpoints[i]);
-			}
-			ast_cli(fd, "Max Connections:   %d\n", p->maxconnections);
-			ast_cli(fd, "Retry Delay:       %d seconds\n", p->retrydelay);
-			ast_cli(fd, "Retry Limit:       %d\n", p->retrylimit);
-			ast_cli(fd, "Timeout:           %d milliseconds\n", p->timeout);
-			ast_cli(fd, "Source:            %s\n", strlen(p->source) ? p->source : "<unspecified>");
-			ast_cli(fd, "Auth Policy        %d\n", p->authpolicy);
-			ast_cli(fd, "Default protocol   %s\n", p->defaultprotocol);
-			ast_cli(fd, "OSP Handle:        %d\n", p->handle);
+				ast_cli(a->fd, "Service Point %d:   %s\n", i + 1, p->srvpoints[i]);
+			}
+			ast_cli(a->fd, "Max Connections:   %d\n", p->maxconnections);
+			ast_cli(a->fd, "Retry Delay:       %d seconds\n", p->retrydelay);
+			ast_cli(a->fd, "Retry Limit:       %d\n", p->retrylimit);
+			ast_cli(a->fd, "Timeout:           %d milliseconds\n", p->timeout);
+			ast_cli(a->fd, "Source:            %s\n", strlen(p->source) ? p->source : "<unspecified>");
+			ast_cli(a->fd, "Auth Policy        %d\n", p->authpolicy);
+			ast_cli(a->fd, "Default protocol   %s\n", p->defaultprotocol);
+			ast_cli(a->fd, "OSP Handle:        %d\n", p->handle);
 			found++;
 		}
 		p = p->next;
@@ -1927,12 +1933,12 @@
 
 	if (!found) {
 		if (provider) {
-			ast_cli(fd, "Unable to find OSP provider '%s'\n", provider);
+			ast_cli(a->fd, "Unable to find OSP provider '%s'\n", provider);
 		} else {
-			ast_cli(fd, "No OSP providers configured\n");
-		}
-	}
-	return RESULT_SUCCESS;
+			ast_cli(a->fd, "No OSP providers configured\n");
+		}	
+	}
+	return CLI_SUCCESS;
 }
 
 static const char* app1= "OSPAuth";
@@ -1993,14 +1999,8 @@
 "	OSPFINISHSTATUS The status of the OSP Finish attempt as a text string, one of\n"
 "		SUCCESS | FAILED | ERROR \n";
 
-static const char osp_usage[] =
-"Usage: osp show\n"
-"       Displays information on Open Settlement Protocol support\n";
-
 static struct ast_cli_entry cli_osp[] = {
-	{ {"osp", "show", NULL},
-	osp_show, "Displays OSP information",
-	osp_usage },
+	NEW_CLI(handle_cli_osp_show, "Displays OSF information")
 };
 
 static int load_module(void)

Modified: trunk/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_rpt.c?view=diff&rev=85460&r1=85459&r2=85460
==============================================================================
--- trunk/apps/app_rpt.c (original)
+++ trunk/apps/app_rpt.c Thu Oct 11 14:03:06 2007
@@ -299,7 +299,6 @@
 #ifdef	OLD_ASTERISK
 STANDARD_LOCAL_USER;
 #endif
-
 
 #define	MSWAIT 200
 #define	HANGTIME 5000
@@ -699,60 +698,20 @@
 */
 
 /* Debug mode */
-static int rpt_do_debug(int fd, int argc, char *argv[]);
-static int rpt_do_dump(int fd, int argc, char *argv[]);
-static int rpt_do_stats(int fd, int argc, char *argv[]);
-static int rpt_do_lstats(int fd, int argc, char *argv[]);
-static int rpt_do_reload(int fd, int argc, char *argv[]);
-static int rpt_do_restart(int fd, int argc, char *argv[]);
-
-static char debug_usage[] =
-"Usage: rpt debug level {0-7}\n"
-"       Enables debug messages in app_rpt\n";
-
-static char dump_usage[] =
-"Usage: rpt dump <nodename>\n"
-"       Dumps struct debug info to log\n";
-
-static char dump_stats[] =
-"Usage: rpt stats <nodename>\n"
-"       Dumps node statistics to console\n";
-
-static char dump_lstats[] =
-"Usage: rpt lstats <nodename>\n"
-"       Dumps link statistics to console\n";
-
-static char reload_usage[] =
-"Usage: rpt reload\n"
-"       Reloads app_rpt running config parameters\n";
-
-static char restart_usage[] =
-"Usage: rpt restart\n"
-"       Restarts app_rpt\n";
+static char *handle_cli_rpt_debug_level(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
+static char *handle_cli_rpt_dump(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
+static char *handle_cli_rpt_stats(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
+static char *handle_cli_rpt_lstats(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
+static char *handle_cli_rpt_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
+static char *handle_cli_rpt_restart(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 
 static struct ast_cli_entry cli_rpt[] = {
-	{ { "rpt", "debug", "level" },
-		rpt_do_debug, "Enable app_rpt debugging",
-		debug_usage },
-
-	{ { "rpt", "dump" },
-		rpt_do_dump, "Dump app_rpt structs for debugging",
-		dump_usage },
-
-	{ { "rpt", "stats" },
-		rpt_do_stats, "Dump node statistics",
-		dump_stats },
-	{ { "rpt", "lstats" },
-		rpt_do_lstats, "Dump link statistics",
-		dump_lstats },
-
-	{ { "rpt", "reload" },
-		rpt_do_reload, "Reload app_rpt config",
-		reload_usage },
-
-	{ { "rpt", "restart" },
-		rpt_do_restart, "Restart app_rpt",
-		restart_usage },
+	NEW_CLI(handle_cli_rpt_debug_level, "Enable app_rpt debuggin"),
+	NEW_CLI(handle_cli_rpt_dump,        "Dump app_rpt structs for debugging"),
+	NEW_CLI(handle_cli_rpt_stats,       "Dump node statistics"),
+	NEW_CLI(handle_cli_rpt_lstats,      "Dump link statistics"),
+	NEW_CLI(handle_cli_rpt_reload,      "Reload app_rpt config"),
+	NEW_CLI(handle_cli_rpt_restart,     "Restart app_rpt")
 };
 
 /*
@@ -1130,48 +1089,70 @@
 /*
 * Enable or disable debug output at a given level at the console
 */
-static int rpt_do_debug(int fd, int argc, char *argv[])
+static char *handle_cli_rpt_debug_level(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	int newlevel;
 
-	if (argc != 4)
-		return RESULT_SHOWUSAGE;
-	newlevel = myatoi(argv[3]);
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "rpt debug level";
+		e->usage =
+			"Usage: rpt debug level {0-7}\n"
+			"       Enables debug messages in app_rpt\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+	if (a->argc != 4)
+		return CLI_SHOWUSAGE;
+	newlevel = myatoi(a->argv[3]);
 	if ((newlevel < 0) || (newlevel > 7))
-		return RESULT_SHOWUSAGE;
+		return CLI_SHOWUSAGE;
 	if (newlevel)
-		ast_cli(fd, "app_rpt Debugging enabled, previous level: %d, new level: %d\n", debug, newlevel);
+		ast_cli(a->fd, "app_rpt Debugging enabled, previous level: %d, new level: %d\n", debug, newlevel);
 	else
-		ast_cli(fd, "app_rpt Debugging disabled\n");
-
-	debug = newlevel;                                                                                                                          
-	return RESULT_SUCCESS;
+		ast_cli(a->fd, "app_rpt Debugging disabled\n");
+
+	debug = newlevel;
+
+	return CLI_SUCCESS;
 }
 
 /*
 * Dump rpt struct debugging onto console
 */
-static int rpt_do_dump(int fd, int argc, char *argv[])
+static char *handle_cli_rpt_dump(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	int i;
 
-	if (argc != 3)
-		return RESULT_SHOWUSAGE;
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "rpt dump";
+		e->usage =
+			"Usage: rpt dump <nodename>\n"
+			"       Dumps struct debug info to log\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc != 3)
+		return CLI_SHOWUSAGE;
 
 	for (i = 0; i < nrpts; i++) {
-		if (!strcmp(argv[2], rpt_vars[i].name)) {
+		if (!strcmp(a->argv[2], rpt_vars[i].name)) {
 			rpt_vars[i].disgorgetime = time(NULL) + 10; /* Do it 10 seconds later */
-			ast_cli(fd, "app_rpt struct dump requested for node %s\n", argv[2]);
-			return RESULT_SUCCESS;
-		}
-	}
-	return RESULT_FAILURE;
+			ast_cli(a->fd, "app_rpt struct dump requested for node %s\n", a->argv[2]);
+			return CLI_SUCCESS;
+		}
+	}
+	return CLI_FAILURE;
 }
 
 /*
 * Dump statistics onto console
 */
-static int rpt_do_stats(int fd, int argc, char *argv[])
+static char *handle_cli_rpt_stats(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	int i, j;
 	int dailytxtime, dailykerchunks;
@@ -1187,8 +1168,19 @@
 
 	static char *not_applicable = "N/A";
 
-	if (argc != 3)
-		return RESULT_SHOWUSAGE;
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "rpt stats";
+		e->usage =
+			"Usage: rpt stats <nodename>\n"
+			"       Dumps node statistics to console\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc != 3)
+		return CLI_SHOWUSAGE;
 
 	for (i = 0 ; i <= MAX_STAT_LINKS; i++)
 		listoflinks[i] = NULL;
@@ -1199,7 +1191,7 @@
 	lastdtmfcommand = not_applicable;
 
 	for (i = 0; i < nrpts; i++) {
-		if (!strcmp(argv[2], rpt_vars[i].name)) {
+		if (!strcmp(a->argv[2], rpt_vars[i].name)) {
 			/* Make a copy of all stat variables while locked */
 			myrpt = &rpt_vars[i];
 			rpt_mutex_lock(&myrpt->lock); /* LOCK */
@@ -1283,19 +1275,19 @@
 
 			rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */
 
-			ast_cli(fd, "************************ NODE %s STATISTICS *************************\n\n", myrpt->name);
-			ast_cli(fd, "Signal on input..................................: %s\n", input_signal);
-			ast_cli(fd, "Transmitter enabled..............................: %s\n", enable_state);
-			ast_cli(fd, "Time out timer state.............................: %s\n", tot_state);
-			ast_cli(fd, "Time outs since system initialization............: %d\n", timeouts);
-			ast_cli(fd, "Identifier state.................................: %s\n", ider_state);
-			ast_cli(fd, "Kerchunks today..................................: %d\n", dailykerchunks);
-			ast_cli(fd, "Kerchunks since system initialization............: %d\n", totalkerchunks);
-			ast_cli(fd, "Keyups today.....................................: %d\n", dailykeyups);
-			ast_cli(fd, "Keyups since system initialization...............: %d\n", totalkeyups);
-			ast_cli(fd, "DTMF commands today..............................: %d\n", dailyexecdcommands);
-			ast_cli(fd, "DTMF commands since system initialization........: %d\n", totalexecdcommands);
-			ast_cli(fd, "Last DTMF command executed.......................: %s\n", lastdtmfcommand);
+			ast_cli(a->fd, "************************ NODE %s STATISTICS *************************\n\n", myrpt->name);
+			ast_cli(a->fd, "Signal on input..................................: %s\n", input_signal);
+			ast_cli(a->fd, "Transmitter enabled..............................: %s\n", enable_state);
+			ast_cli(a->fd, "Time out timer state.............................: %s\n", tot_state);
+			ast_cli(a->fd, "Time outs since system initialization............: %d\n", timeouts);
+			ast_cli(a->fd, "Identifier state.................................: %s\n", ider_state);
+			ast_cli(a->fd, "Kerchunks today..................................: %d\n", dailykerchunks);
+			ast_cli(a->fd, "Kerchunks since system initialization............: %d\n", totalkerchunks);
+			ast_cli(a->fd, "Keyups today.....................................: %d\n", dailykeyups);
+			ast_cli(a->fd, "Keyups since system initialization...............: %d\n", totalkeyups);
+			ast_cli(a->fd, "DTMF commands today..............................: %d\n", dailyexecdcommands);
+			ast_cli(a->fd, "DTMF commands since system initialization........: %d\n", totalexecdcommands);
+			ast_cli(a->fd, "Last DTMF command executed.......................: %s\n", lastdtmfcommand);
 
 			hours = dailytxtime / 3600000;
 			dailytxtime %= 3600000;
@@ -1304,7 +1296,7 @@
 			seconds = dailytxtime / 1000;
 			dailytxtime %= 1000;
 
-			ast_cli(fd, "TX time today ...................................: %02d:%02d:%02d.%d\n",
+			ast_cli(a->fd, "TX time today ...................................: %02d:%02d:%02d.%d\n",
 				hours, minutes, seconds, dailytxtime);
 
 			hours = (int) totaltxtime / 3600000;
@@ -1314,57 +1306,69 @@
 			seconds = (int)  totaltxtime / 1000;
 			totaltxtime %= 1000;
 
-			ast_cli(fd, "TX time since system initialization..............: %02d:%02d:%02d.%d\n",
+			ast_cli(a->fd, "TX time since system initialization..............: %02d:%02d:%02d.%d\n",
 				 hours, minutes, seconds, (int) totaltxtime);
-			ast_cli(fd, "Nodes currently connected to us..................: ");
+			ast_cli(a->fd, "Nodes currently connected to us..................: ");
 			for (j = 0;; j++) {
 				if (!listoflinks[j]) {
 					if (!j) {
-						ast_cli(fd, "<NONE>");
+						ast_cli(a->fd, "<NONE>");
 					}
 					break;
 				}
-				ast_cli(fd, "%s", listoflinks[j]);
+				ast_cli(a->fd, "%s", listoflinks[j]);
 				if (j % 4 == 3) {
-					ast_cli(fd, "\n");
-					ast_cli(fd, "                                                 : ");
+					ast_cli(a->fd, "\n");
+					ast_cli(a->fd, "                                                 : ");
 				} else {
 					if (listoflinks[j + 1])
-						ast_cli(fd, ", ");
+						ast_cli(a->fd, ", ");
 				}
 			}
-			ast_cli(fd, "\n");
-
-			ast_cli(fd, "Last node which transmitted to us................: %s\n", lastnodewhichkeyedusup);
-			ast_cli(fd, "Autopatch state..................................: %s\n", patch_state);
-			ast_cli(fd, "Autopatch called number..........................: %s\n", called_number);
-			ast_cli(fd, "Reverse patch/IAXRPT connected...................: %s\n\n", reverse_patch_state);
-
-			return RESULT_SUCCESS;
-		}
-	}
-	return RESULT_FAILURE;
+			ast_cli(a->fd, "\n");
+
+			ast_cli(a->fd, "Last node which transmitted to us................: %s\n", lastnodewhichkeyedusup);
+			ast_cli(a->fd, "Autopatch state..................................: %s\n", patch_state);
+			ast_cli(a->fd, "Autopatch called number..........................: %s\n", called_number);
+			ast_cli(a->fd, "Reverse patch/IAXRPT connected...................: %s\n\n", reverse_patch_state);
+
+			return CLI_SUCCESS;
+		}
+	}
+	return CLI_FAILURE;
 }
 
 /*
 * Link stats function
 */
-static int rpt_do_lstats(int fd, int argc, char *argv[])
+static char *handle_cli_rpt_lstats(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	int i, j;
 	struct rpt *myrpt;
 	struct rpt_link *l;
 	struct rpt_lstat *s, *t;
 	struct rpt_lstat s_head;
-	if (argc != 3)
-		return RESULT_SHOWUSAGE;
+
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "rpt lstats";
+		e->usage =
+			"Usage: rpt lstats <nodename>\n"
+			"       Dumps link statistics to console\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc != 3)
+		return CLI_SHOWUSAGE;
 
 	s = NULL;
 	s_head.next = &s_head;
 	s_head.prev = &s_head;
 
 	for (i = 0; i < nrpts; i++) {
-		if (!strcmp(argv[2], rpt_vars[i].name)) {
+		if (!strcmp(a->argv[2], rpt_vars[i].name)) {
 			/* Make a copy of all stat variables while locked */
 			myrpt = &rpt_vars[i];
 			rpt_mutex_lock(&myrpt->lock); /* LOCK */
@@ -1379,7 +1383,7 @@
 				if ((s = ast_calloc(1, sizeof(*s))) == NULL) {
 					ast_log(LOG_ERROR, "Malloc failed in rpt_do_lstats\n");
 					rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */
-					return RESULT_FAILURE;
+					return CLI_FAILURE;
 				}
 				ast_copy_string(s->name, l->name, MAXREMSTR);
 				pbx_substitute_variables_helper(l->chan, "${IAXPEER(CURRENTCHANNEL)}", s->peer, MAXPEERSTR - 1);
@@ -1391,8 +1395,8 @@
 				l = l->next;
 			}
 			rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */
-			ast_cli(fd, "NODE      PEER                RECONNECTS  DIRECTION  CONNECT TIME\n");
-			ast_cli(fd, "----      ----                ----------  ---------  ------------\n");
+			ast_cli(a->fd, "NODE      PEER                RECONNECTS  DIRECTION  CONNECT TIME\n");
+			ast_cli(a->fd, "----      ----                ----------  ---------  ------------\n");
 
 			for (s = s_head.next; s != &s_head; s = s->next) {
 				int hours, minutes, seconds;
@@ -1406,7 +1410,7 @@
 				connecttime %= 1000;
 				snprintf(conntime, sizeof(conntime), "%02d:%02d:%02d.%d",
 					hours, minutes, seconds, (int) connecttime);
-				ast_cli(fd, "%-10s%-20s%-12d%-11s%-30s\n",
+				ast_cli(a->fd, "%-10s%-20s%-12d%-11s%-30s\n",
 					s->name, s->peer, s->reconnects, (s->outbound)? "OUT":"IN", conntime);
 			}	
 			/* destroy our local link queue */
@@ -1417,42 +1421,65 @@
 				remque((struct qelem *)t);
 				ast_free(t);
 			}			
-			return RESULT_SUCCESS;
-		}
-	}
-	return RESULT_FAILURE;
+			return CLI_SUCCESS;
+		}
+	}
+
+	return CLI_FAILURE;
 }
 
 /*
 * reload vars 
 */
-static int rpt_do_reload(int fd, int argc, char *argv[])
+static char *handle_cli_rpt_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	int	n;
 
-	if (argc > 2)
-		return RESULT_SHOWUSAGE;
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "rpt reload";
+		e->usage =
+			"Usage: rpt reload\n"
+			"       Reloads app_rpt running config parameters\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc > 2)
+		return CLI_SHOWUSAGE;
 
 	for (n = 0; n < nrpts; n++)
 		rpt_vars[n].reload = 1;
 
-	return RESULT_FAILURE;
+	return CLI_SUCCESS;
 }
 
 /*
 * restart app_rpt
 */
-static int rpt_do_restart(int fd, int argc, char *argv[])
+static char *handle_cli_rpt_restart(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	int	i;
 
-	if (argc > 2)
-		return RESULT_SHOWUSAGE;
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "rpt restart";
+		e->usage =
+			"Usage: rpt restart\n"
+			"       Restarts app_rpt\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc > 2)
+		return CLI_SHOWUSAGE;
 	for (i = 0; i < nrpts; i++) {
 		if (rpt_vars[i].rxchannel)
 			ast_softhangup(rpt_vars[i].rxchannel, AST_SOFTHANGUP_DEV);
 	}
-	return RESULT_FAILURE;
+	return CLI_SUCCESS;
 }
 
 static int play_tone_pair(struct ast_channel *chan, int f1, int f2, int duration, int amplitude)
@@ -4627,7 +4654,7 @@
 	char multimode = 0;
 	char oc;
 	char tmp[20], freq[20] = "", savestr[20] = "";
-	int mhz, decimals;
+	int mhz = 0, decimals = 0;
 	struct ast_channel *mychannel;
 	AST_DECLARE_APP_ARGS(args1,
 		AST_APP_ARG(freq);
@@ -6800,7 +6827,7 @@
 {
 	int res = -1, i, rem_totx, n, phone_mode = 0;
 	char *tmp, keyed = 0;
-	char *options, *tele, c;
+	char *options = NULL, *tele, c;
 	struct rpt *myrpt;
 	struct ast_frame *f;
 	struct ast_channel *who;

Modified: trunk/channels/chan_gtalk.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_gtalk.c?view=diff&rev=85460&r1=85459&r2=85460
==============================================================================
--- trunk/channels/chan_gtalk.c (original)
+++ trunk/channels/chan_gtalk.c Thu Oct 11 14:03:06 2007
@@ -191,8 +191,8 @@
 static int gtalk_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
 static int gtalk_sendhtml(struct ast_channel *ast, int subclass, const char *data, int datalen);
 static struct gtalk_pvt *gtalk_alloc(struct gtalk *client, const char *us, const char *them, const char *sid);
-static int gtalk_do_reload(int fd, int argc, char **argv);
-static int gtalk_show_channels(int fd, int argc, char **argv);
+static char *gtalk_do_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
+static char *gtalk_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 /*----- RTP interface functions */
 static int gtalk_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp,
 							   struct ast_rtp *vrtp, struct ast_rtp *trtp, int codecs, int nat_active);
@@ -226,7 +226,6 @@
 static struct io_context *io;	/*!< The IO context */
 static struct in_addr __ourip;
 
-
 /*! \brief RTP driver interface */
 static struct ast_rtp_protocol gtalk_rtp = {
 	type: "Gtalk",
@@ -235,21 +234,10 @@
 	get_codec: gtalk_get_codec,
 };
 
-static const char debug_usage[] = 
-"Usage: gtalk show channels\n" 
-"       Shows current state of the Gtalk channels.\n";
-
-static const char reload_usage[] = 
-"Usage: gtalk reload\n" 
-"       Reload gtalk channel driver.\n";
-
-
 static struct ast_cli_entry gtalk_cli[] = {
-	{{ "gtalk", "reload", NULL}, gtalk_do_reload, "Enable Jabber debugging", reload_usage },
-	{{ "gtalk", "show", "channels", NULL}, gtalk_show_channels, "Show GoogleTalk Channels", debug_usage },
- };
-
-
+	NEW_CLI(gtalk_do_reload, "Enable Jabber debugging"),
+	NEW_CLI(gtalk_show_channels, "Show GoogleTalk Channels"),
+};
 
 static char externip[16];
 
@@ -265,7 +253,7 @@
 	struct gtalk *gtalk = NULL;
 	char *domain = NULL , *s = NULL;
 
-	if(strchr(connection, '@')) {
+	if (strchr(connection, '@')) {
 		s = ast_strdupa(connection);
 		domain = strsep(&s, "@");
 		ast_verbose("OOOOH domain = %s\n", domain);
@@ -1581,7 +1569,7 @@
 }
 
 /*! \brief CLI command "gtalk show channels" */
-static int gtalk_show_channels(int fd, int argc, char **argv)
+static char *gtalk_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 #define FORMAT  "%-30.30s  %-30.30s  %-15.15s  %-5.5s %-5.5s \n"
 	struct gtalk_pvt *p;
@@ -1591,11 +1579,22 @@
 	char *jid = NULL;
 	char *resource = NULL;
 
-	if (argc != 3)
-		return RESULT_SHOWUSAGE;
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "gtalk show channels";
+		e->usage =
+			"Usage: gtalk show channels\n"
+			"       Shows current state of the Gtalk channels.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc != 3)
+		return CLI_SHOWUSAGE;
 
 	ast_mutex_lock(&gtalklock);
-	ast_cli(fd, FORMAT, "Channel", "Jabber ID", "Resource", "Read", "Write");
+	ast_cli(a->fd, FORMAT, "Channel", "Jabber ID", "Resource", "Read", "Write");
 	ASTOBJ_CONTAINER_TRAVERSE(&gtalk_list, 1, {
 		ASTOBJ_WRLOCK(iterator);
 		p = iterator->p;
@@ -1611,7 +1610,7 @@
 				resource ++;
 			}
 			if (chan)
-				ast_cli(fd, FORMAT, 
+				ast_cli(a->fd, FORMAT, 
 					chan->name,
 					jid,
 					resource,
@@ -1628,16 +1627,27 @@
 
 	ast_mutex_unlock(&gtalklock);
 
-	ast_cli(fd, "%d active gtalk channel%s\n", numchans, (numchans != 1) ? "s" : "");
-	return RESULT_SUCCESS;
+	ast_cli(a->fd, "%d active gtalk channel%s\n", numchans, (numchans != 1) ? "s" : "");
+	return CLI_SUCCESS;
 #undef FORMAT
 }
 
-/*! \brief CLI command "gtalk show channels" */
-static int gtalk_do_reload(int fd, int argc, char **argv)
-{
+/*! \brief CLI command "gtalk reload" */
+static char *gtalk_do_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "gtalk reload";
+		e->usage =
+			"Usage: gtalk reload\n"
+			"       Reload gtalk channel driver.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}	
+	
 	ast_verbose("IT DOES WORK!\n");
-	return RESULT_SUCCESS;
+	return CLI_SUCCESS;
 }
 
 static int gtalk_parser(void *data, ikspak *pak)

Modified: trunk/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_mgcp.c?view=diff&rev=85460&r1=85459&r2=85460
==============================================================================
--- trunk/channels/chan_mgcp.c (original)
+++ trunk/channels/chan_mgcp.c Thu Oct 11 14:03:06 2007
@@ -422,7 +422,7 @@
 static void handle_response(struct mgcp_endpoint *p, struct mgcp_subchannel *sub,  
                             int result, unsigned int ident, struct mgcp_request *resp);
 static void dump_cmd_queues(struct mgcp_endpoint *p, struct mgcp_subchannel *sub);
-static int mgcp_reload(int fd, int argc, char *argv[]);
+static char *mgcp_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 static int reload_config(int reload);
 
 static struct ast_channel *mgcp_request(const char *type, int format, void *data, int *cause);
@@ -1041,71 +1041,72 @@
 	return 0;
 }
 
-static int mgcp_show_endpoints(int fd, int argc, char *argv[])
-{
-	struct mgcp_gateway  *g;
-	struct mgcp_endpoint *e;
+static char *handle_mgcp_show_endpoints(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	struct mgcp_gateway  *mg;
+	struct mgcp_endpoint *me;
 	int hasendpoints = 0;
 
-	if (argc != 3) 
-		return RESULT_SHOWUSAGE;
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "mgcp show endpoints";
+		e->usage =
+			"Usage: mgcp show endpoints\n"
+			"       Lists all endpoints known to the MGCP (Media Gateway Control Protocol) subsystem.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc != 3) 
+		return CLI_SHOWUSAGE;
 	ast_mutex_lock(&gatelock);
-	g = gateways;
-	while(g) {
-		e = g->endpoints;
-		ast_cli(fd, "Gateway '%s' at %s (%s)\n", g->name, g->addr.sin_addr.s_addr ? ast_inet_ntoa(g->addr.sin_addr) : ast_inet_ntoa(g->defaddr.sin_addr), g->dynamic ? "Dynamic" : "Static");
-		while(e) {
+	mg = gateways;
+	while(mg) {
+		me = mg->endpoints;
+		ast_cli(a->fd, "Gateway '%s' at %s (%s)\n", mg->name, mg->addr.sin_addr.s_addr ? ast_inet_ntoa(mg->addr.sin_addr) : ast_inet_ntoa(mg->defaddr.sin_addr), mg->dynamic ? "Dynamic" : "Static");
+		while(me) {
 			/* Don't show wilcard endpoint */
-			if (strcmp(e->name, g->wcardep) !=0)
-				ast_cli(fd, "   -- '%s@%s in '%s' is %s\n", e->name, g->name, e->context, e->sub->owner ? "active" : "idle");
+			if (strcmp(me->name, mg->wcardep) != 0)
+				ast_cli(a->fd, "   -- '%s@%s in '%s' is %s\n", me->name, mg->name, me->context, me->sub->owner ? "active" : "idle");
 			hasendpoints = 1;
-			e = e->next;
+			me = me->next;
 		}
 		if (!hasendpoints) {
-			ast_cli(fd, "   << No Endpoints Defined >>     ");
-		}
-		g = g->next;
+			ast_cli(a->fd, "   << No Endpoints Defined >>     ");
+		}
+		mg = mg->next;
 	}
 	ast_mutex_unlock(&gatelock);
-	return RESULT_SUCCESS;
-}
-
-static const char show_endpoints_usage[] = 
-"Usage: mgcp show endpoints\n"
-"       Lists all endpoints known to the MGCP (Media Gateway Control Protocol) subsystem.\n";
-
-static const char audit_endpoint_usage[] = 
-"Usage: mgcp audit endpoint <endpointid>\n"
-"       Lists the capabilities of an endpoint in the MGCP (Media Gateway Control Protocol) subsystem.\n"
-"       mgcp debug MUST be on to see the results of this command.\n";
-
-static const char debug_usage[] = 
-"Usage: mgcp set debug\n"
-"       Enables dumping of MGCP packets for debugging purposes\n";
-
-static const char no_debug_usage[] = 
-"Usage: mgcp set debug off\n"
-"       Disables dumping of MGCP packets for debugging purposes\n";
-
-static const char mgcp_reload_usage[] =
-"Usage: mgcp reload\n"
-"       Reloads MGCP configuration from mgcp.conf\n"
-"       Deprecated:  please use 'reload chan_mgcp.so' instead.\n";
-
-static int mgcp_audit_endpoint(int fd, int argc, char *argv[])
-{
-	struct mgcp_gateway  *g;
-	struct mgcp_endpoint *e;
+	return CLI_SUCCESS;
+}
+
+static char *handle_mgcp_audit_endpoint(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	struct mgcp_gateway  *mg;
+	struct mgcp_endpoint *me;
 	int found = 0;
 	char *ename,*gname, *c;
 
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "mgcp audit endpoint";
+		e->usage =
+			"Usage: mgcp audit endpoint <endpointid>\n"
+			"       Lists the capabilities of an endpoint in the MGCP (Media Gateway Control Protocol) subsystem.\n"
+			"       mgcp debug MUST be on to see the results of this command.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
 	if (!mgcpdebug) {
-		return RESULT_SHOWUSAGE;
-	}
-	if (argc != 4) 
-		return RESULT_SHOWUSAGE;
+		return CLI_SHOWUSAGE;
+	}
+	if (a->argc != 4)
+		return CLI_SHOWUSAGE;
 	/* split the name into parts by null */
-	ename = argv[3];
+	ename = a->argv[3];
 	gname = ename;
 	while (*gname) {
 		if (*gname == '@') {
@@ -1120,69 +1121,77 @@
 	if ((c = strrchr(gname, ']')))
 		*c = '\0';
 	ast_mutex_lock(&gatelock);
-	g = gateways;
-	while(g) {
-		if (!strcasecmp(g->name, gname)) {
-			e = g->endpoints;
-			while(e) {
-				if (!strcasecmp(e->name, ename)) {
+	mg = gateways;
+	while(mg) {
+		if (!strcasecmp(mg->name, gname)) {
+			me = mg->endpoints;
+			while(me) {
+				if (!strcasecmp(me->name, ename)) {
 					found = 1;
-					transmit_audit_endpoint(e);
+					transmit_audit_endpoint(me);
 					break;
 				}
-				e = e->next;
+				me = me->next;
 			}
 			if (found) {
 				break;
 			}
 		}
-		g = g->next;
+		mg = mg->next;
 	}
 	if (!found) {
-		ast_cli(fd, "   << Could not find endpoint >>     ");
+		ast_cli(a->fd, "   << Could not find endpoint >>     ");
 	}
 	ast_mutex_unlock(&gatelock);
-	return RESULT_SUCCESS;
-}
-
-static int mgcp_do_debug(int fd, int argc, char *argv[])
-{
-	if (argc != 3)
-		return RESULT_SHOWUSAGE;
+	return CLI_SUCCESS;
+}
+
+static char *handle_mgcp_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "mgcp set debug";
+		e->usage =
+			"Usage: mgcp set debug\n"
+			"       Enables dumping of MGCP packets for debugging purposes\n";	
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc != 3)
+		return CLI_SHOWUSAGE;
 	mgcpdebug = 1;
-	ast_cli(fd, "MGCP Debugging Enabled\n");
-	return RESULT_SUCCESS;
-}
-
-static int mgcp_no_debug(int fd, int argc, char *argv[])
-{
-	if (argc != 4)
-		return RESULT_SHOWUSAGE;
+	ast_cli(a->fd, "MGCP Debugging Enabled\n");
+	return CLI_SUCCESS;
+}
+
+static char *handle_mgcp_set_debug_off(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "mgcp set debug off";
+		e->usage =
+			"Usage: mgcp set debug off\n"
+			"       Disables dumping of MGCP packets for debugging purposes\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc != 4)
+		return CLI_SHOWUSAGE;
 	mgcpdebug = 0;
-	ast_cli(fd, "MGCP Debugging Disabled\n");
-	return RESULT_SUCCESS;
+	ast_cli(a->fd, "MGCP Debugging Disabled\n");
+	return CLI_SUCCESS;
 }
 
 static struct ast_cli_entry cli_mgcp[] = {
-	{ { "mgcp", "audit", "endpoint", NULL },
-	mgcp_audit_endpoint, "Audit specified MGCP endpoint",
-	audit_endpoint_usage },
-
-	{ { "mgcp", "show", "endpoints", NULL },
-	mgcp_show_endpoints, "List defined MGCP endpoints",
-	show_endpoints_usage },
-
-	{ { "mgcp", "set", "debug", NULL },
-	mgcp_do_debug, "Enable MGCP debugging",
-	debug_usage },
-
-	{ { "mgcp", "set", "debug", "off", NULL },
-	mgcp_no_debug, "Disable MGCP debugging",
-	no_debug_usage },
-
-	{ { "mgcp", "reload", NULL },
-	mgcp_reload, "Reload MGCP configuration",
-	mgcp_reload_usage },
+	NEW_CLI(handle_mgcp_audit_endpoint, "Audit specified MGCP endpoint"),
+	NEW_CLI(handle_mgcp_show_endpoints, "List defined MGCP endpoints"),
+	NEW_CLI(handle_mgcp_set_debug, "Enable MGCP debugging"),
+	NEW_CLI(handle_mgcp_set_debug_off, "Disable MGCP debugging"),
+	NEW_CLI(mgcp_reload, "Reload MGCP configuration"),
 };
 
 static int mgcp_answer(struct ast_channel *ast)
@@ -4242,10 +4251,24 @@
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
-static int mgcp_reload(int fd, int argc, char *argv[])
+static char *mgcp_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	static int deprecated = 0;
-	if (!deprecated && argc > 0) {
+
+	if (e) {
+		switch (cmd) {
+		case CLI_INIT:
+			e->command = "mgcp reload";
+			e->usage =
+				"Usage: mgcp reload\n"
+				"       'mgcp reload' is deprecated.  Please use 'reload chan_mgcp.so' instead.\n";
+			return NULL;
+		case CLI_GENERATE:
+			return NULL;
+		}
+	}
+
+	if (!deprecated && a && a->argc > 0) {
 		ast_log(LOG_WARNING, "'mgcp reload' is deprecated.  Please use 'reload chan_mgcp.so' instead.\n");
 		deprecated = 1;
 	}
@@ -4257,12 +4280,12 @@
 		mgcp_reloading = 1;
 	ast_mutex_unlock(&mgcp_reload_lock);
 	restart_monitor();
-	return 0;
+	return CLI_SUCCESS;
 }
 
 static int reload(void)
 {
-	mgcp_reload(0, 0, NULL);
+	mgcp_reload(NULL, 0, NULL);
 	return 0;
 }
 
@@ -4297,7 +4320,7 @@
 		/* We always want to leave this in a consistent state */
 		ast_channel_register(&mgcp_tech);
 		mgcp_reloading = 0;
-		mgcp_reload(0, 0, NULL);
+		mgcp_reload(NULL, 0, NULL);
 		return -1;
 	}
 
@@ -4317,7 +4340,7 @@
 		/* Allow the monitor to restart */
 		monitor_thread = AST_PTHREADT_NULL;
 		mgcp_reloading = 0;
-		mgcp_reload(0, 0, NULL);
+		mgcp_reload(NULL, 0, NULL);
 		return -1;
 	}
 

Modified: trunk/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_oss.c?view=diff&rev=85460&r1=85459&r2=85460
==============================================================================
--- trunk/channels/chan_oss.c (original)
+++ trunk/channels/chan_oss.c Thu Oct 11 14:03:06 2007
@@ -1333,68 +1333,82 @@
 	return CLI_SUCCESS;
 }
 
-static int console_transfer(int fd, int argc, char *argv[])
+static char *console_transfer(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct chan_oss_pvt *o = find_desc(oss_active);
 	struct ast_channel *b = NULL;
 	char *tmp, *ext, *ctx;
 
-	if (argc != 3)
-		return RESULT_SHOWUSAGE;
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "console transfer";
+		e->usage =
+			"Usage: console transfer <extension>[@context]\n"
+			"       Transfers the currently connected call to the given extension (and\n"
+			"       context if specified)\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc != 3)
+		return CLI_SHOWUSAGE;
 	if (o == NULL)
-		return RESULT_FAILURE;
+		return CLI_FAILURE;
 	if (o->owner == NULL || (b = ast_bridged_channel(o->owner)) == NULL) {
-		ast_cli(fd, "There is no call to transfer\n");
-		return RESULT_SUCCESS;
-	}
-
-	tmp = ast_ext_ctx(argv[2], &ext, &ctx);
+		ast_cli(a->fd, "There is no call to transfer\n");
+		return CLI_SUCCESS;
+	}
+
+	tmp = ast_ext_ctx(a->argv[2], &ext, &ctx);

[... 6322 lines stripped ...]



More information about the asterisk-commits mailing list