[asterisk-commits] qwell: trunk r82930 - in /trunk: channels/ main/ res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 18 17:43:46 CDT 2007


Author: qwell
Date: Tue Sep 18 17:43:45 2007
New Revision: 82930

URL: http://svn.digium.com/view/asterisk?view=rev&rev=82930
Log:
(issue #10724)
Reported by: eliel
Patches:
      res_features.c.patch uploaded by eliel (license 64)
      res_agi.c.patch uploaded by seanbright (license 71)
      res_musiconhold.c.patch uploaded by seanbright (license 71)
      pbx.c.patch uploaded by moy (license 222)
      logger.c.patch uploaded by moy (license 222)
      frame.c.patch uploaded by moy (license 222)
      manager.c.patch uploaded by moy (license 222)
      http.c.patch uploaded by moy (license 222)
      dnsmgr.c.patch uploaded by moy (license 222)
      res_realtime.c.patch uploaded by eliel (license 64)
      res_odbc.c.patch uploaded by seanbright (license 71)
      res_jabber.c.patch uploaded by eliel (license 64)
      chan_local.c.patch uploaded by eliel (license 64)
      chan_agent.c.patch uploaded by eliel (license 64)
      chan_alsa.c.patch uploaded by eliel (license 64)
      chan_features.c.patch uploaded by eliel (license 64)
      chan_sip.c.patch uploaded by eliel (license 64)
      RollUp.1.patch (includes all of the above patches) uploaded by seanbright (license 71)

Convert many CLI commands to the NEW_CLI format.

Modified:
    trunk/channels/chan_agent.c
    trunk/channels/chan_alsa.c
    trunk/channels/chan_features.c
    trunk/channels/chan_local.c
    trunk/channels/chan_sip.c
    trunk/main/dnsmgr.c
    trunk/main/frame.c
    trunk/main/http.c
    trunk/main/logger.c
    trunk/main/manager.c
    trunk/main/pbx.c
    trunk/res/res_agi.c
    trunk/res/res_features.c
    trunk/res/res_jabber.c
    trunk/res/res_musiconhold.c
    trunk/res/res_odbc.c
    trunk/res/res_realtime.c

Modified: trunk/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_agent.c?view=diff&rev=82930&r1=82929&r2=82930
==============================================================================
--- trunk/channels/chan_agent.c (original)
+++ trunk/channels/chan_agent.c Tue Sep 18 17:43:45 2007
@@ -230,6 +230,7 @@
 static int agent_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
 static struct ast_channel *agent_bridgedchannel(struct ast_channel *chan, struct ast_channel *bridge);
 static void set_agentbycallerid(const char *callerid, const char *agent);
+static char *complete_agent_logoff_cmd(const char *line, const char *word, int pos, int state);
 
 /*! \brief Channel interface description for PBX integration */
 static const struct ast_channel_tech agent_tech = {
@@ -1496,22 +1497,34 @@
 	return ret;
 }
 
-static int agent_logoff_cmd(int fd, int argc, char **argv)
+static char *agent_logoff_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	int ret;
 	char *agent;
 
-	if (argc < 3 || argc > 4)
-		return RESULT_SHOWUSAGE;
-	if (argc == 4 && strcasecmp(argv[3], "soft"))
-		return RESULT_SHOWUSAGE;
-
-	agent = argv[2] + 6;
-	ret = agent_logoff(agent, argc == 4);
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "agent logoff";
+		e->usage =
+			"Usage: agent logoff <channel> [soft]\n"
+			"       Sets an agent as no longer logged in.\n"
+			"       If 'soft' is specified, do not hangup existing calls.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return complete_agent_logoff_cmd(a->line, a->word, a->pos, a->n); 
+	}
+
+	if (a->argc < 3 || a->argc > 4)
+		return CLI_SHOWUSAGE;
+	if (a->argc == 4 && strcasecmp(a->argv[3], "soft"))
+		return CLI_SHOWUSAGE;
+
+	agent = a->argv[2] + 6;
+	ret = agent_logoff(agent, a->argc == 4);
 	if (ret == 0)
-		ast_cli(fd, "Logging out %s\n", agent);
-
-	return RESULT_SUCCESS;
+		ast_cli(a->fd, "Logging out %s\n", agent);
+
+	return CLI_SUCCESS;
 }
 
 /*!
@@ -1565,7 +1578,7 @@
 /*!
  * Show agents in cli.
  */
-static int agents_show(int fd, int argc, char **argv)
+static char *agents_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct agent_pvt *p;
 	char username[AST_MAX_BUF];
@@ -1575,16 +1588,29 @@
 	int count_agents = 0;		/*!< Number of agents configured */
 	int online_agents = 0;		/*!< Number of online agents */
 	int offline_agents = 0;		/*!< Number of offline agents */
-	if (argc != 2)
-		return RESULT_SHOWUSAGE;
+
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "agent show";
+		e->usage =
+			"Usage: agent show\n"
+			"       Provides summary information on agents.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc != 2)
+		return CLI_SHOWUSAGE;
+
 	AST_LIST_LOCK(&agents);
 	AST_LIST_TRAVERSE(&agents, p, list) {
 		ast_mutex_lock(&p->lock);
 		if (p->pending) {
 			if (p->group)
-				ast_cli(fd, "-- Pending call to group %d\n", powerof(p->group));
+				ast_cli(a->fd, "-- Pending call to group %d\n", powerof(p->group));
 			else
-				ast_cli(fd, "-- Pending call to agent %s\n", p->agent);
+				ast_cli(a->fd, "-- Pending call to agent %s\n", p->agent);
 		} else {
 			if (!ast_strlen_zero(p->name))
 				snprintf(username, sizeof(username), "(%s) ", p->name);
@@ -1613,7 +1639,7 @@
 			}
 			if (!ast_strlen_zero(p->moh))
 				snprintf(moh, sizeof(moh), " (musiconhold is '%s')", p->moh);
-			ast_cli(fd, "%-12.12s %s%s%s%s\n", p->agent, 
+			ast_cli(a->fd, "%-12.12s %s%s%s%s\n", p->agent, 
 				username, location, talkingto, moh);
 			count_agents++;
 		}
@@ -1621,16 +1647,16 @@
 	}
 	AST_LIST_UNLOCK(&agents);
 	if ( !count_agents ) 
-		ast_cli(fd, "No Agents are configured in %s\n",config);
+		ast_cli(a->fd, "No Agents are configured in %s\n",config);
 	else 
-		ast_cli(fd, "%d agents configured [%d online , %d offline]\n",count_agents, online_agents, offline_agents);
-	ast_cli(fd, "\n");
+		ast_cli(a->fd, "%d agents configured [%d online , %d offline]\n",count_agents, online_agents, offline_agents);
+	ast_cli(a->fd, "\n");
 	                
-	return RESULT_SUCCESS;
-}
-
-
-static int agents_show_online(int fd, int argc, char **argv)
+	return CLI_SUCCESS;
+}
+
+
+static char *agents_show_online(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct agent_pvt *p;
 	char username[AST_MAX_BUF];
@@ -1640,8 +1666,21 @@
 	int count_agents = 0;           /* Number of agents configured */
 	int online_agents = 0;          /* Number of online agents */
 	int agent_status = 0;           /* 0 means offline, 1 means online */
-	if (argc != 3)
-		return RESULT_SHOWUSAGE;
+
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "agent show online";
+		e->usage =
+			"Usage: agent show online\n"
+			"       Provides a list of all online agents.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc != 3)
+		return CLI_SHOWUSAGE;
+
 	AST_LIST_LOCK(&agents);
 	AST_LIST_TRAVERSE(&agents, p, list) {
 		agent_status = 0;       /* reset it to offline */
@@ -1669,28 +1708,18 @@
 		if (!ast_strlen_zero(p->moh))
 			snprintf(moh, sizeof(moh), " (musiconhold is '%s')", p->moh);
 		if (agent_status)
-			ast_cli(fd, "%-12.12s %s%s%s%s\n", p->agent, username, location, talkingto, moh);
+			ast_cli(a->fd, "%-12.12s %s%s%s%s\n", p->agent, username, location, talkingto, moh);
 		count_agents++;
 		ast_mutex_unlock(&p->lock);
 	}
 	AST_LIST_UNLOCK(&agents);
 	if (!count_agents) 
-		ast_cli(fd, "No Agents are configured in %s\n", config);
+		ast_cli(a->fd, "No Agents are configured in %s\n", config);
 	else
-		ast_cli(fd, "%d agents online\n", online_agents);
-	ast_cli(fd, "\n");
-	return RESULT_SUCCESS;
-}
-
-
-
-static const char show_agents_usage[] = 
-"Usage: agent show\n"
-"       Provides summary information on agents.\n";
-
-static const char show_agents_online_usage[] =
-"Usage: agent show online\n"
-"	Provides a list of all online agents.\n";
+		ast_cli(a->fd, "%d agents online\n", online_agents);
+	ast_cli(a->fd, "\n");
+	return CLI_SUCCESS;
+}
 
 static const char agent_logoff_usage[] =
 "Usage: agent logoff <channel> [soft]\n"
@@ -1698,17 +1727,9 @@
 "       If 'soft' is specified, do not hangup existing calls.\n";
 
 static struct ast_cli_entry cli_agents[] = {
-	{ { "agent", "show", NULL },
-	agents_show, "Show status of agents",
-	show_agents_usage },
-
-	{ { "agent", "show", "online" },
-	agents_show_online, "Show all online agents",
-	show_agents_online_usage },
-
-	{ { "agent", "logoff", NULL },
-	agent_logoff_cmd, "Sets an agent offline",
-	agent_logoff_usage, complete_agent_logoff_cmd },
+	NEW_CLI(agents_show, "Show status of agents"),
+	NEW_CLI(agents_show_online, "Show all online agents"),
+	NEW_CLI(agent_logoff_cmd, "Sets an agent offline"),
 };
 
 /*!

Modified: trunk/channels/chan_alsa.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_alsa.c?view=diff&rev=82930&r1=82929&r2=82930
==============================================================================
--- trunk/channels/chan_alsa.c (original)
+++ trunk/channels/chan_alsa.c Tue Sep 18 17:43:45 2007
@@ -838,26 +838,6 @@
 	return tmp;
 }
 
-static int console_autoanswer(int fd, int argc, char *argv[])
-{
-	int res = RESULT_SUCCESS;;
-	if ((argc != 2) && (argc != 3))
-		return RESULT_SHOWUSAGE;
-	ast_mutex_lock(&alsalock);
-	if (argc == 2) {
-		ast_cli(fd, "Auto answer is %s.\n", autoanswer ? "on" : "off");
-	} else {
-		if (!strcasecmp(argv[2], "on"))
-			autoanswer = -1;
-		else if (!strcasecmp(argv[2], "off"))
-			autoanswer = 0;
-		else
-			res = RESULT_SHOWUSAGE;
-	}
-	ast_mutex_unlock(&alsalock);
-	return res;
-}
-
 static char *autoanswer_complete(const char *line, const char *word, int pos, int state)
 {
 #ifndef MIN
@@ -876,24 +856,65 @@
 	return NULL;
 }
 
-static const char autoanswer_usage[] =
-	"Usage: console autoanswer [on|off]\n"
-	"       Enables or disables autoanswer feature.  If used without\n"
-	"       argument, displays the current on/off status of autoanswer.\n"
-	"       The default value of autoanswer is in 'alsa.conf'.\n";
-
-static int console_answer(int fd, int argc, char *argv[])
-{
-	int res = RESULT_SUCCESS;
-
-	if (argc != 2)
-		return RESULT_SHOWUSAGE;
+static char *console_autoanswer(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	char *res = CLI_SUCCESS;
+
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "console autoanswer";
+		e->usage =
+			"Usage: console autoanswer [on|off]\n"
+			"       Enables or disables autoanswer feature.  If used without\n"
+			"       argument, displays the current on/off status of autoanswer.\n"
+			"       The default value of autoanswer is in 'alsa.conf'.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return autoanswer_complete(a->line, a->word, a->pos, a->n);
+	}
+
+	if ((a->argc != 2) && (a->argc != 3))
+		return CLI_SHOWUSAGE;
+	ast_mutex_lock(&alsalock);
+	if (a->argc == 2) {
+		ast_cli(a->fd, "Auto answer is %s.\n", autoanswer ? "on" : "off");
+	} else {
+		if (!strcasecmp(a->argv[2], "on"))
+			autoanswer = -1;
+		else if (!strcasecmp(a->argv[2], "off"))
+			autoanswer = 0;
+		else
+			res = CLI_SHOWUSAGE;
+	}
+	ast_mutex_unlock(&alsalock);
+	return res;
+}
+
+static char *console_answer(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	char *res = CLI_SUCCESS;
+
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "console answer";
+		e->usage =
+			"Usage: console answer\n"
+			"       Answers an incoming call on the console (ALSA) channel.\n";
+
+		return NULL;
+	case CLI_GENERATE:
+		return NULL; 
+	}
+ 
+
+	if (a->argc != 2)
+		return CLI_SHOWUSAGE;
 
 	ast_mutex_lock(&alsalock);
 
 	if (!alsa.owner) {
-		ast_cli(fd, "No one is calling us\n");
-		res = RESULT_FAILURE;
+		ast_cli(a->fd, "No one is calling us\n");
+		res = CLI_FAILURE;
 	} else {
 		hookstate = 1;
 		cursound = -1;
@@ -911,32 +932,39 @@
 
 	ast_mutex_unlock(&alsalock);
 
-	return RESULT_SUCCESS;
-}
-
-static const char sendtext_usage[] =
-	"Usage: console send text <message>\n"
-	"       Sends a text message for display on the remote terminal.\n";
-
-static int console_sendtext(int fd, int argc, char *argv[])
+	return res;
+}
+
+static char *console_sendtext(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	int tmparg = 3;
-	int res = RESULT_SUCCESS;
-
-	if (argc < 3)
-		return RESULT_SHOWUSAGE;
+	char *res = CLI_SUCCESS;
+
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "console send text";
+		e->usage =
+			"Usage: console send text <message>\n"
+			"       Sends a text message for display on the remote terminal.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL; 
+	}
+
+	if (a->argc < 3)
+		return CLI_SHOWUSAGE;
 
 	ast_mutex_lock(&alsalock);
 
 	if (!alsa.owner) {
-		ast_cli(fd, "No one is calling us\n");
-		res = RESULT_FAILURE;
+		ast_cli(a->fd, "No one is calling us\n");
+		res = CLI_FAILURE;
 	} else {
 		struct ast_frame f = { AST_FRAME_TEXT, 0 };
 		char text2send[256] = "";
 		text2send[0] = '\0';
-		while (tmparg < argc) {
-			strncat(text2send, argv[tmparg++], sizeof(text2send) - strlen(text2send) - 1);
+		while (tmparg < a->argc) {
+			strncat(text2send, a->argv[tmparg++], sizeof(text2send) - strlen(text2send) - 1);
 			strncat(text2send, " ", sizeof(text2send) - strlen(text2send) - 1);
 		}
 		text2send[strlen(text2send) - 1] = '\n';
@@ -959,24 +987,32 @@
 	return res;
 }
 
-static const char answer_usage[] =
-	"Usage: console answer\n"
-	"       Answers an incoming call on the console (ALSA) channel.\n";
-
-static int console_hangup(int fd, int argc, char *argv[])
-{
-	int res = RESULT_SUCCESS;
-
-	if (argc != 2)
-		return RESULT_SHOWUSAGE;
+static char *console_hangup(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	char *res = CLI_SUCCESS;
+
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "console hangup";
+		e->usage =
+			"Usage: console hangup\n"
+			"       Hangs up any call currently placed on the console.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL; 
+	}
+ 
+
+	if (a->argc != 2)
+		return CLI_SHOWUSAGE;
 
 	cursound = -1;
 
 	ast_mutex_lock(&alsalock);
 
 	if (!alsa.owner && !hookstate) {
-		ast_cli(fd, "No call to hangup up\n");
-		res = RESULT_FAILURE;
+		ast_cli(a->fd, "No call to hangup up\n");
+		res = CLI_FAILURE;
 	} else {
 		hookstate = 0;
 		grab_owner();
@@ -991,25 +1027,32 @@
 	return res;
 }
 
-static const char hangup_usage[] =
-	"Usage: console hangup\n"
-	"       Hangs up any call currently placed on the console.\n";
-
-static int console_dial(int fd, int argc, char *argv[])
+static char *console_dial(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	char tmp[256], *tmp2;
 	char *mye, *myc;
 	char *d;
-	int res = RESULT_SUCCESS;
-
-	if ((argc != 2) && (argc != 3))
-		return RESULT_SHOWUSAGE;
+	char *res = CLI_SUCCESS;
+
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "console dial";
+		e->usage =
+			"Usage: console dial [extension[@context]]\n"
+			"       Dials a given extension (and context if specified)\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if ((a->argc != 2) && (a->argc != 3))
+		return CLI_SHOWUSAGE;
 
 	ast_mutex_lock(&alsalock);
 
 	if (alsa.owner) {
-		if (argc == 3) {
-			d = argv[2];
+		if (a->argc == 3) {
+			d = a->argv[2];
 			if (alsa.owner) {
 				struct ast_frame f = { AST_FRAME_DTMF };
 				while (*d) {
@@ -1019,15 +1062,15 @@
 				}
 			}
 		} else {
-			ast_cli(fd, "You're already in a call.  You can use this only to dial digits until you hangup\n");
-			res = RESULT_FAILURE;
+			ast_cli(a->fd, "You're already in a call.  You can use this only to dial digits until you hangup\n");
+			res = CLI_FAILURE;
 		}
 	} else {
 		mye = exten;
 		myc = context;
-		if (argc == 3) {
+		if (a->argc == 3) {
 			char *stringp = NULL;
-			ast_copy_string(tmp, argv[2], sizeof(tmp));
+			ast_copy_string(tmp, a->argv[2], sizeof(tmp));
 			stringp = tmp;
 			strsep(&stringp, "@");
 			tmp2 = strsep(&stringp, "@");
@@ -1042,7 +1085,7 @@
 			hookstate = 1;
 			alsa_new(&alsa, AST_STATE_RINGING);
 		} else
-			ast_cli(fd, "No such extension '%s' in context '%s'\n", mye, myc);
+			ast_cli(a->fd, "No such extension '%s' in context '%s'\n", mye, myc);
 	}
 
 	ast_mutex_unlock(&alsalock);
@@ -1050,30 +1093,12 @@
 	return res;
 }
 
-static const char dial_usage[] =
-	"Usage: console dial [extension[@context]]\n"
-	"       Dials a given extension (and context if specified)\n";
-
 static struct ast_cli_entry cli_alsa[] = {
-	{ { "console", "answer", NULL },
-	console_answer, "Answer an incoming console call",
-	answer_usage },
-
-	{ { "console", "hangup", NULL },
-	console_hangup, "Hangup a call on the console",
-	hangup_usage },
-
-	{ { "console", "dial", NULL },
-	console_dial, "Dial an extension on the console",
-	dial_usage },
-
-	{ { "console", "send", "text", NULL },
-	console_sendtext, "Send text to the remote device",
-	sendtext_usage },
-
-	{ { "console", "autoanswer", NULL },
-	console_autoanswer, "Sets/displays autoanswer",
-	autoanswer_usage, autoanswer_complete },
+	NEW_CLI(console_answer, "Answer an incoming console call"),
+	NEW_CLI(console_hangup, "Hangup a call on the console"),
+	NEW_CLI(console_dial, "Dial an extension on the console"),
+	NEW_CLI(console_sendtext, "Send text to the remote device"),
+	NEW_CLI(console_autoanswer, "Sets/displays autoanswer"),
 };
 
 static int load_module(void)

Modified: trunk/channels/chan_features.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_features.c?view=diff&rev=82930&r1=82929&r2=82930
==============================================================================
--- trunk/channels/chan_features.c (original)
+++ trunk/channels/chan_features.c Tue Sep 18 17:43:45 2007
@@ -509,36 +509,41 @@
 	return chan;
 }
 
-static int features_show(int fd, int argc, char **argv)
+static char *features_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct feature_pvt *p;
 
-	if (argc != 3)
-		return RESULT_SHOWUSAGE;
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "feature show channels";
+		e->usage =
+			"Usage: feature show channels\n"
+			"       Provides summary information on feature channels.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc != 3)
+		return CLI_SHOWUSAGE;
 
 	if (AST_LIST_EMPTY(&features)) {
-		ast_cli(fd, "No feature channels in use\n");
-		return RESULT_SUCCESS;
+		ast_cli(a->fd, "No feature channels in use\n");
+		return CLI_SUCCESS;
 	}
 
 	AST_LIST_LOCK(&features);
 	AST_LIST_TRAVERSE(&features, p, list) {
 		ast_mutex_lock(&p->lock);
-		ast_cli(fd, "%s -- %s/%s\n", p->owner ? p->owner->name : "<unowned>", p->tech, p->dest);
+		ast_cli(a->fd, "%s -- %s/%s\n", p->owner ? p->owner->name : "<unowned>", p->tech, p->dest);
 		ast_mutex_unlock(&p->lock);
 	}
 	AST_LIST_UNLOCK(&features);
-	return RESULT_SUCCESS;
-}
-
-static const char show_features_usage[] = 
-"Usage: feature show channels\n"
-"       Provides summary information on feature channels.\n";
+	return CLI_SUCCESS;
+}
 
 static struct ast_cli_entry cli_features[] = {
-	{ { "feature", "show", "channels", NULL },
-	features_show, "List status of feature channels",
-	show_features_usage },
+	NEW_CLI(features_show, "List status of feature channels"),
 };
 
 static int load_module(void)

Modified: trunk/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_local.c?view=diff&rev=82930&r1=82929&r2=82930
==============================================================================
--- trunk/channels/chan_local.c (original)
+++ trunk/channels/chan_local.c Tue Sep 18 17:43:45 2007
@@ -670,35 +670,40 @@
 }
 
 /*! \brief CLI command "local show channels" */
-static int locals_show(int fd, int argc, char **argv)
+static char *locals_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct local_pvt *p = NULL;
 
-	if (argc != 3)
-		return RESULT_SHOWUSAGE;
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "local show channels";
+		e->usage =
+			"Usage: local show channels\n"
+			"       Provides summary information on active local proxy channels.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc != 3)
+		return CLI_SHOWUSAGE;
 
 	AST_LIST_LOCK(&locals);
 	if (!AST_LIST_EMPTY(&locals)) {
 		AST_LIST_TRAVERSE(&locals, p, list) {
 			ast_mutex_lock(&p->lock);
-			ast_cli(fd, "%s -- %s@%s\n", p->owner ? p->owner->name : "<unowned>", p->exten, p->context);
+			ast_cli(a->fd, "%s -- %s@%s\n", p->owner ? p->owner->name : "<unowned>", p->exten, p->context);
 			ast_mutex_unlock(&p->lock);
 		}
 	} else
-		ast_cli(fd, "No local channels in use\n");
+		ast_cli(a->fd, "No local channels in use\n");
 	AST_LIST_UNLOCK(&locals);
 
-	return RESULT_SUCCESS;
-}
-
-static const char show_locals_usage[] = 
-"Usage: local show channels\n"
-"       Provides summary information on active local proxy channels.\n";
+	return CLI_SUCCESS;
+}
 
 static struct ast_cli_entry cli_local[] = {
-	{ { "local", "show", "channels", NULL },
-	locals_show, "List status of local channels",
-	show_locals_usage },
+	NEW_CLI(locals_show, "List status of local channels"),
 };
 
 /*! \brief Load module into PBX, register channel */

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=82930&r1=82929&r2=82930
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Sep 18 17:43:45 2007
@@ -1598,14 +1598,14 @@
 
 /*--- Applications, functions, CLI and manager command helpers */
 static const char *sip_nat_mode(const struct sip_pvt *p);
-static int sip_show_inuse(int fd, int argc, char *argv[]);
+static char *sip_show_inuse(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 static char *transfermode2str(enum transfermodes mode) attribute_const;
 static const char *nat2str(int nat) attribute_const;
 static int peer_status(struct sip_peer *peer, char *status, int statuslen);
-static int sip_show_users(int fd, int argc, char *argv[]);
-static int _sip_show_peers(int fd, int *total, struct mansession *s, const struct message *m, int argc, const char *argv[]);
-static int sip_show_peers(int fd, int argc, char *argv[]);
-static int sip_show_objects(int fd, int argc, char *argv[]);
+static char *sip_show_users(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
+static char * _sip_show_peers(int fd, int *total, struct mansession *s, const struct message *m, int argc, const char *argv[]);
+static char *sip_show_peers(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
+static char *sip_show_objects(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 static void  print_group(int fd, ast_group_t group, int crlf);
 static const char *dtmfmode2str(int mode) attribute_const;
 static int str2dtmfmode(const char *str) attribute_unused;
@@ -1613,13 +1613,13 @@
 static void cleanup_stale_contexts(char *new, char *old);
 static void print_codec_to_cli(int fd, struct ast_codec_pref *pref);
 static const char *domain_mode_to_text(const enum domain_mode mode);
-static int sip_show_domains(int fd, int argc, char *argv[]);
-static int _sip_show_peer(int type, int fd, struct mansession *s, const struct message *m, int argc, const char *argv[]);
-static int sip_show_peer(int fd, int argc, char *argv[]);
-static int sip_show_user(int fd, int argc, char *argv[]);
-static int sip_show_registry(int fd, int argc, char *argv[]);
-static int sip_unregister(int fd, int argc, char *argv[]);
-static int sip_show_settings(int fd, int argc, char *argv[]);
+static char *sip_show_domains(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
+static char *_sip_show_peer(int type, int fd, struct mansession *s, const struct message *m, int argc, const char *argv[]);
+static char *sip_show_peer(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
+static char *sip_show_user(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
+static char *sip_show_registry(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
+static char *sip_unregister(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
+static char *sip_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 static const char *subscription_type2str(enum subscriptiontype subtype) attribute_pure;
 static const struct cfsubscription_types *find_subscription_type(enum subscriptiontype subtype);
 static char *complete_sip_peer(const char *word, int state, int flags2);
@@ -1630,18 +1630,18 @@
 static char *complete_sip_user(const char *word, int state, int flags2);
 static char *complete_sip_show_user(const char *line, const char *word, int pos, int state);
 static char *complete_sipnotify(const char *line, const char *word, int pos, int state);
-static int sip_show_channel(int fd, int argc, char *argv[]);
-static int sip_show_history(int fd, int argc, char *argv[]);
+static char *sip_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
+static char *sip_show_history(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 static char *sip_do_debug_ip(int fd, char *arg);
 static char *sip_do_debug_peer(int fd, char *arg);
 static char *sip_do_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
-static int sip_notify(int fd, int argc, char *argv[]);
-static int sip_do_history(int fd, int argc, char *argv[]);
-static int sip_no_history(int fd, int argc, char *argv[]);
+static char *sip_notify(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
+static char *sip_do_history(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
+static char *sip_no_history(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 static int sip_dtmfmode(struct ast_channel *chan, void *data);
 static int sip_addheader(struct ast_channel *chan, void *data);
 static int sip_do_reload(enum channelreloadreason reason);
-static int sip_reload(int fd, int argc, char *argv[]);
+static char *sip_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 static int acf_channel_read(struct ast_channel *chan, const char *funcname, char *preparse, char *buf, size_t buflen);
 
 /*--- Debugging 
@@ -10481,7 +10481,7 @@
 }
 
 /*! \brief  CLI Command to show calls within limits set by call_limit */
-static int sip_show_inuse(int fd, int argc, char *argv[])
+static char *sip_show_inuse(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 #define FORMAT  "%-25.25s %-15.15s %-15.15s \n"
 #define FORMAT2 "%-25.25s %-15.15s %-15.15s \n"
@@ -10489,13 +10489,25 @@
 	char iused[40];
 	int showall = FALSE;
 
-	if (argc < 3) 
-		return RESULT_SHOWUSAGE;
-
-	if (argc == 4 && !strcmp(argv[3],"all")) 
-			showall = TRUE;
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "sip show inuse";
+		e->usage =
+			"Usage: sip show inuse [all]\n"
+			"       List all SIP users and peers usage counters and limits.\n"
+			"       Add option \"all\" to show all devices, not only those with a limit.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc < 3) 
+		return CLI_SHOWUSAGE;
+
+	if (a->argc == 4 && !strcmp(a->argv[3],"all")) 
+		showall = TRUE;
 	
-	ast_cli(fd, FORMAT, "* User name", "In use", "Limit");
+	ast_cli(a->fd, FORMAT, "* User name", "In use", "Limit");
 	ASTOBJ_CONTAINER_TRAVERSE(&userl, 1, do {
 		ASTOBJ_RDLOCK(iterator);
 		if (iterator->call_limit)
@@ -10504,11 +10516,11 @@
 			ast_copy_string(ilimits, "N/A", sizeof(ilimits));
 		snprintf(iused, sizeof(iused), "%d", iterator->inUse);
 		if (showall || iterator->call_limit)
-			ast_cli(fd, FORMAT2, iterator->name, iused, ilimits);
+			ast_cli(a->fd, FORMAT2, iterator->name, iused, ilimits);
 		ASTOBJ_UNLOCK(iterator);
 	} while (0) );
 
-	ast_cli(fd, FORMAT, "* Peer name", "In use", "Limit");
+	ast_cli(a->fd, FORMAT, "* Peer name", "In use", "Limit");
 
 	ASTOBJ_CONTAINER_TRAVERSE(&peerl, 1, do {
 		ASTOBJ_RDLOCK(iterator);
@@ -10518,11 +10530,11 @@
 			ast_copy_string(ilimits, "N/A", sizeof(ilimits));
 		snprintf(iused, sizeof(iused), "%d/%d/%d", iterator->inUse, iterator->inRinging, iterator->onHold);
 		if (showall || iterator->call_limit)
-			ast_cli(fd, FORMAT2, iterator->name, iused, ilimits);
+			ast_cli(a->fd, FORMAT2, iterator->name, iused, ilimits);
 		ASTOBJ_UNLOCK(iterator);
 	} while (0) );
 
-	return RESULT_SUCCESS;
+	return CLI_SUCCESS;
 #undef FORMAT
 #undef FORMAT2
 }
@@ -10588,28 +10600,40 @@
 }
 
 /*! \brief  CLI Command 'SIP Show Users' */
-static int sip_show_users(int fd, int argc, char *argv[])
+static char *sip_show_users(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	regex_t regexbuf;
 	int havepattern = FALSE;
 
 #define FORMAT  "%-25.25s  %-15.15s  %-15.15s  %-15.15s  %-5.5s%-10.10s\n"
 
-	switch (argc) {
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "sip show users";
+		e->usage =
+			"Usage: sip show users [like <pattern>]\n"
+			"       Lists all known SIP users.\n"
+			"       Optional regular expression pattern is used to filter the user list.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	switch (a->argc) {
 	case 5:
-		if (!strcasecmp(argv[3], "like")) {
-			if (regcomp(&regexbuf, argv[4], REG_EXTENDED | REG_NOSUB))
-				return RESULT_SHOWUSAGE;
+		if (!strcasecmp(a->argv[3], "like")) {
+			if (regcomp(&regexbuf, a->argv[4], REG_EXTENDED | REG_NOSUB))
+				return CLI_SHOWUSAGE;
 			havepattern = TRUE;
 		} else
-			return RESULT_SHOWUSAGE;
+			return CLI_SHOWUSAGE;
 	case 3:
 		break;
 	default:
-		return RESULT_SHOWUSAGE;
-	}
-
-	ast_cli(fd, FORMAT, "Username", "Secret", "Accountcode", "Def.Context", "ACL", "NAT");
+		return CLI_SHOWUSAGE;
+	}
+
+	ast_cli(a->fd, FORMAT, "Username", "Secret", "Accountcode", "Def.Context", "ACL", "NAT");
 	ASTOBJ_CONTAINER_TRAVERSE(&userl, 1, do {
 		ASTOBJ_RDLOCK(iterator);
 
@@ -10618,7 +10642,7 @@
 			continue;
 		}
 
-		ast_cli(fd, FORMAT, iterator->name, 
+		ast_cli(a->fd, FORMAT, iterator->name, 
 			iterator->secret, 
 			iterator->accountcode,
 			iterator->context,
@@ -10631,7 +10655,7 @@
 	if (havepattern)
 		regfree(&regexbuf);
 
-	return RESULT_SUCCESS;
+	return CLI_SUCCESS;
 #undef FORMAT
 }
 
@@ -10668,13 +10692,25 @@
 }
 
 /*! \brief  CLI Show Peers command */
-static int sip_show_peers(int fd, int argc, char *argv[])
-{
-	return _sip_show_peers(fd, NULL, NULL, NULL, argc, (const char **) argv);
+static char *sip_show_peers(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "sip show peers";
+		e->usage =
+			"Usage: sip show peers [like <pattern>]\n"
+			"       Lists all known SIP peers.\n"
+			"       Optional regular expression pattern is used to filter the peer list.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	return _sip_show_peers(a->fd, NULL, NULL, NULL, a->argc, (const char **) a->argv);
 }
 
 /*! \brief  _sip_show_peers: Execute sip show peers command */
-static int _sip_show_peers(int fd, int *total, struct mansession *s, const struct message *m, int argc, const char *argv[])
+static char *_sip_show_peers(int fd, int *total, struct mansession *s, const struct message *m, int argc, const char *argv[])
 {
 	regex_t regexbuf;
 	int havepattern = FALSE;
@@ -10705,14 +10741,14 @@
 	case 5:
 		if (!strcasecmp(argv[3], "like")) {
 			if (regcomp(&regexbuf, argv[4], REG_EXTENDED | REG_NOSUB))
-				return RESULT_SHOWUSAGE;
+				return CLI_SHOWUSAGE;
 			havepattern = TRUE;
 		} else
-			return RESULT_SHOWUSAGE;
+			return CLI_SHOWUSAGE;
 	case 3:
 		break;
 	default:
-		return RESULT_SHOWUSAGE;
+		return CLI_SHOWUSAGE;
 	}
 
 	if (!s) /* Normal list */
@@ -10809,24 +10845,36 @@
 		*total = total_peers;
 	
 
-	return RESULT_SUCCESS;
+	return CLI_SUCCESS;
 #undef FORMAT
 #undef FORMAT2
 }
 
 /*! \brief List all allocated SIP Objects (realtime or static) */
-static int sip_show_objects(int fd, int argc, char *argv[])
+static char *sip_show_objects(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	char tmp[256];
-	if (argc != 3)
-		return RESULT_SHOWUSAGE;
-	ast_cli(fd, "-= User objects: %d static, %d realtime =-\n\n", suserobjs, ruserobjs);
-	ASTOBJ_CONTAINER_DUMP(fd, tmp, sizeof(tmp), &userl);
-	ast_cli(fd, "-= Peer objects: %d static, %d realtime, %d autocreate =-\n\n", speerobjs, rpeerobjs, apeerobjs);
-	ASTOBJ_CONTAINER_DUMP(fd, tmp, sizeof(tmp), &peerl);
-	ast_cli(fd, "-= Registry objects: %d =-\n\n", regobjs);
-	ASTOBJ_CONTAINER_DUMP(fd, tmp, sizeof(tmp), &regl);
-	return RESULT_SUCCESS;
+	
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "sip show objects";
+		e->usage =
+			"Usage: sip show objects\n"
+			"       Lists status of known SIP objects\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}	
+
+	if (a->argc != 3)
+		return CLI_SHOWUSAGE;
+	ast_cli(a->fd, "-= User objects: %d static, %d realtime =-\n\n", suserobjs, ruserobjs);
+	ASTOBJ_CONTAINER_DUMP(a->fd, tmp, sizeof(tmp), &userl);
+	ast_cli(a->fd, "-= Peer objects: %d static, %d realtime, %d autocreate =-\n\n", speerobjs, rpeerobjs, apeerobjs);
+	ASTOBJ_CONTAINER_DUMP(a->fd, tmp, sizeof(tmp), &peerl);
+	ast_cli(a->fd, "-= Registry objects: %d =-\n\n", regobjs);
+	ASTOBJ_CONTAINER_DUMP(a->fd, tmp, sizeof(tmp), &regl);
+	return CLI_SUCCESS;
 }
 /*! \brief Print call group and pickup group */
 static void  print_group(int fd, ast_group_t group, int crlf)
@@ -11085,23 +11133,35 @@
 }
 
 /*! \brief CLI command to list local domains */
-static int sip_show_domains(int fd, int argc, char *argv[])
+static char *sip_show_domains(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct domain *d;
 #define FORMAT "%-40.40s %-20.20s %-16.16s\n"
 
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "sip show domains";
+		e->usage =
+			"Usage: sip show domains\n"
+			"       Lists all configured SIP local domains.\n"
+			"       Asterisk only responds to SIP messages to local domains.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
 	if (AST_LIST_EMPTY(&domain_list)) {
-		ast_cli(fd, "SIP Domain support not enabled.\n\n");
-		return RESULT_SUCCESS;
+		ast_cli(a->fd, "SIP Domain support not enabled.\n\n");
+		return CLI_SUCCESS;
 	} else {
-		ast_cli(fd, FORMAT, "Our local SIP domains:", "Context", "Set by");
+		ast_cli(a->fd, FORMAT, "Our local SIP domains:", "Context", "Set by");
 		AST_LIST_LOCK(&domain_list);
 		AST_LIST_TRAVERSE(&domain_list, d, list)
-			ast_cli(fd, FORMAT, d->domain, S_OR(d->context, "(default)"),
+			ast_cli(a->fd, FORMAT, d->domain, S_OR(d->context, "(default)"),
 				domain_mode_to_text(d->mode));
 		AST_LIST_UNLOCK(&domain_list);
-		ast_cli(fd, "\n");
-		return RESULT_SUCCESS;
+		ast_cli(a->fd, "\n");
+		return CLI_SUCCESS;
 	}
 }
 #undef FORMAT
@@ -11117,7 +11177,6 @@
 {
 	const char *a[4];
 	const char *peer;
-	int ret;
 
 	peer = astman_get_header(m,"Peer");
 	if (ast_strlen_zero(peer)) {
@@ -11129,17 +11188,28 @@
 	a[2] = "peer";
 	a[3] = peer;
 
-	ret = _sip_show_peer(1, -1, s, m, 4, a);
+	_sip_show_peer(1, -1, s, m, 4, a);
 	astman_append(s, "\r\n\r\n" );
-	return ret;
+	return 0;
 }
 
 
 
 /*! \brief Show one peer in detail */
-static int sip_show_peer(int fd, int argc, char *argv[])
-{
-	return _sip_show_peer(0, fd, NULL, NULL, argc, (const char **) argv);
+static char *sip_show_peer(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "sip show peer";
+		e->usage =
+			"Usage: sip show peer <name> [load]\n"
+			"       Shows all details on one SIP peer and the current status.\n"
+			"       Option \"load\" forces lookup of peer in realtime storage.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return complete_sip_show_peer(a->line, a->word, a->pos, a->n);
+	}
+	return _sip_show_peer(0, a->fd, NULL, NULL, a->argc, (const char **) a->argv);
 }
 
 static void peer_mailboxes_to_str(struct ast_str **mailbox_str, struct sip_peer *peer)
@@ -11156,7 +11226,7 @@
 }
 
 /*! \brief Show one peer in detail (main function) */
-static int _sip_show_peer(int type, int fd, struct mansession *s, const struct message *m, int argc, const char *argv[])
+static char *_sip_show_peer(int type, int fd, struct mansession *s, const struct message *m, int argc, const char *argv[])
 {
 	char status[30] = "";
 	char cbuf[256];
@@ -11171,7 +11241,7 @@
 	realtimepeers = ast_check_realtime("sippeers");
 
 	if (argc < 4)
-		return RESULT_SHOWUSAGE;
+		return CLI_SHOWUSAGE;
 
 	load_realtime = (argc == 5 && !strcmp(argv[4], "load")) ? TRUE : FALSE;
 	peer = find_peer(argv[3], NULL, load_realtime);
@@ -11185,7 +11255,7 @@
 		} else {
 			snprintf (cbuf, sizeof(cbuf), "Peer %s not found.\n", argv[3]);
 			astman_send_error(s, m, cbuf);
-			return 0;
+			return CLI_SUCCESS;
 		}
 	}
 	if (peer && type==0 ) { /* Normal listing */
@@ -11375,66 +11445,78 @@
 		ast_cli(fd,"\n");
 	}
 
-	return RESULT_SUCCESS;
+	return CLI_SUCCESS;
 }
 
 /*! \brief Show one user in detail */
-static int sip_show_user(int fd, int argc, char *argv[])
+static char *sip_show_user(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	char cbuf[256];
 	struct sip_user *user;
 	struct ast_variable *v;
 	int load_realtime;
 
-	if (argc < 4)
-		return RESULT_SHOWUSAGE;
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "sip show user";
+		e->usage =
+			"Usage: sip show user <name> [load]\n"
+			"       Shows all details on one SIP user and the current status.\n"
+			"       Option \"load\" forces lookup of peer in realtime storage.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return complete_sip_show_user(a->line, a->word, a->pos, a->n);
+	}
+
+	if (a->argc < 4)
+		return CLI_SHOWUSAGE;
 
 	/* Load from realtime storage? */
-	load_realtime = (argc == 5 && !strcmp(argv[4], "load")) ? TRUE : FALSE;
-
-	user = find_user(argv[3], load_realtime);
+	load_realtime = (a->argc == 5 && !strcmp(a->argv[4], "load")) ? TRUE : FALSE;
+
+	user = find_user(a->argv[3], load_realtime);
 	if (user) {
-		ast_cli(fd,"\n\n");
-		ast_cli(fd, "  * Name       : %s\n", user->name);
-		ast_cli(fd, "  Secret       : %s\n", ast_strlen_zero(user->secret)?"<Not set>":"<Set>");
-		ast_cli(fd, "  MD5Secret    : %s\n", ast_strlen_zero(user->md5secret)?"<Not set>":"<Set>");
-		ast_cli(fd, "  Context      : %s\n", user->context);
-		ast_cli(fd, "  Language     : %s\n", user->language);
+		ast_cli(a->fd,"\n\n");
+		ast_cli(a->fd, "  * Name       : %s\n", user->name);
+		ast_cli(a->fd, "  Secret       : %s\n", ast_strlen_zero(user->secret)?"<Not set>":"<Set>");
+		ast_cli(a->fd, "  MD5Secret    : %s\n", ast_strlen_zero(user->md5secret)?"<Not set>":"<Set>");
+		ast_cli(a->fd, "  Context      : %s\n", user->context);
+		ast_cli(a->fd, "  Language     : %s\n", user->language);
 		if (!ast_strlen_zero(user->accountcode))
-			ast_cli(fd, "  Accountcode  : %s\n", user->accountcode);
-		ast_cli(fd, "  AMA flags    : %s\n", ast_cdr_flags2str(user->amaflags));
-		ast_cli(fd, "  Transfer mode: %s\n", transfermode2str(user->allowtransfer));
-		ast_cli(fd, "  MaxCallBR    : %d kbps\n", user->maxcallbitrate);
-		ast_cli(fd, "  CallingPres  : %s\n", ast_describe_caller_presentation(user->callingpres));
-		ast_cli(fd, "  Call limit   : %d\n", user->call_limit);
-		ast_cli(fd, "  Callgroup    : ");
-		print_group(fd, user->callgroup, 0);
-		ast_cli(fd, "  Pickupgroup  : ");
-		print_group(fd, user->pickupgroup, 0);
-		ast_cli(fd, "  Callerid     : %s\n", ast_callerid_merge(cbuf, sizeof(cbuf), user->cid_name, user->cid_num, "<unspecified>"));
-		ast_cli(fd, "  ACL          : %s\n", cli_yesno(user->ha != NULL));
-		ast_cli(fd, "  Codec Order  : (");
-		print_codec_to_cli(fd, &user->prefs);
-		ast_cli(fd, ")\n");
-
-		ast_cli(fd, "  Auto-Framing:  %s \n", cli_yesno(user->autoframing));
+			ast_cli(a->fd, "  Accountcode  : %s\n", user->accountcode);
+		ast_cli(a->fd, "  AMA flags    : %s\n", ast_cdr_flags2str(user->amaflags));
+		ast_cli(a->fd, "  Transfer mode: %s\n", transfermode2str(user->allowtransfer));
+		ast_cli(a->fd, "  MaxCallBR    : %d kbps\n", user->maxcallbitrate);
+		ast_cli(a->fd, "  CallingPres  : %s\n", ast_describe_caller_presentation(user->callingpres));
+		ast_cli(a->fd, "  Call limit   : %d\n", user->call_limit);
+		ast_cli(a->fd, "  Callgroup    : ");
+		print_group(a->fd, user->callgroup, 0);
+		ast_cli(a->fd, "  Pickupgroup  : ");

[... 3866 lines stripped ...]



More information about the asterisk-commits mailing list