[asterisk-commits] branch crichter/0.3.0 - r7390 in /team/crichter/0.3.0: ./ apps/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Dec 8 04:10:03 CST 2005


Author: crichter
Date: Thu Dec  8 04:09:56 2005
New Revision: 7390

URL: http://svn.digium.com/view/asterisk?rev=7390&view=rev
Log:
Merged revisions 7379-7380,7383,7387 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r7379 | russell | 2005-12-07 16:36:55 +0100 (Mi, 07 Dez 2005) | 14 lines

This is the first round of removing applications that were marked as deprecated
in the 1.2 release. They are being removed from the trunk and will not be in
the next major release.  The following is a list of the applications that are
being removed in this commit:

Curl, Cut, Sort, DBPut, DBGet, ENUMLookup, Eval
GetGroupCount, SetGroup, CheckGroup, GetGroupMatchCount
MD5, MD5Check, Math, SetCIDName, SetCIDNum, SetRDNIS, SetCallerID
TXTCIDName, AbsoluteTimeout, DigitTimeout, ResponseTimeout, SetAccount
SetLanguage, SetVar (renamed to Set)

These changes also include moving the "group show channels" cli command from 
app_groupcount.c to cli.c.

................
r7380 | russell | 2005-12-07 17:41:26 +0100 (Mi, 07 Dez 2005) | 2 lines

re-add app_setcallerid since it was not actually marked deprecated in 1.2

................
r7383 | kpfleming | 2005-12-07 21:47:59 +0100 (Mi, 07 Dez 2005) | 10 lines

Merged revisions 7382 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r7382 | kpfleming | 2005-12-07 14:46:55 -0600 (Wed, 07 Dec 2005) | 2 lines

ensure that hints are allowed to use global variable references

........

................
r7387 | kpfleming | 2005-12-08 02:06:09 +0100 (Do, 08 Dez 2005) | 10 lines

Merged revisions 7386 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r7386 | kpfleming | 2005-12-07 19:05:43 -0600 (Wed, 07 Dec 2005) | 2 lines

initialize the buffer before using it...

........

................

Added:
    team/crichter/0.3.0/apps/app_setcallerid.c
      - copied unchanged from r7387, trunk/apps/app_setcallerid.c
Removed:
    team/crichter/0.3.0/apps/app_enumlookup.c
    team/crichter/0.3.0/apps/app_eval.c
    team/crichter/0.3.0/apps/app_groupcount.c
    team/crichter/0.3.0/apps/app_math.c
    team/crichter/0.3.0/apps/app_md5.c
    team/crichter/0.3.0/apps/app_setcidname.c
    team/crichter/0.3.0/apps/app_setcidnum.c
    team/crichter/0.3.0/apps/app_setrdnis.c
    team/crichter/0.3.0/apps/app_txtcidname.c
Modified:
    team/crichter/0.3.0/   (props changed)
    team/crichter/0.3.0/apps/Makefile
    team/crichter/0.3.0/apps/app_curl.c
    team/crichter/0.3.0/apps/app_cut.c
    team/crichter/0.3.0/apps/app_db.c
    team/crichter/0.3.0/cli.c
    team/crichter/0.3.0/pbx.c

Propchange: team/crichter/0.3.0/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Dec  8 04:09:56 2005
@@ -1,1 +1,1 @@
-/trunk:1-7357
+/trunk:1-7389

Modified: team/crichter/0.3.0/apps/Makefile
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/apps/Makefile?rev=7390&r1=7389&r2=7390&view=diff
==============================================================================
--- team/crichter/0.3.0/apps/Makefile (original)
+++ team/crichter/0.3.0/apps/Makefile Thu Dec  8 04:09:56 2005
@@ -11,26 +11,21 @@
 # the GNU General Public License
 #
 
-APPS=app_dial.so app_playback.so app_voicemail.so app_directory.so app_mp3.so\
-     app_system.so app_echo.so app_record.so app_image.so app_url.so app_disa.so \
-     app_adsiprog.so app_getcpeid.so app_milliwatt.so \
-     app_zapateller.so app_setcallerid.so app_festival.so \
-     app_queue.so app_senddtmf.so app_parkandannounce.so \
-     app_setcidname.so app_lookupcidname.so app_macro.so \
-     app_authenticate.so app_softhangup.so app_lookupblacklist.so \
-     app_waitforring.so app_privacy.so app_db.so app_chanisavail.so \
-     app_enumlookup.so app_transfer.so app_setcidnum.so app_cdr.so \
-     app_hasnewvoicemail.so app_sayunixtime.so app_cut.so app_read.so \
-     app_setcdruserfield.so app_random.so app_ices.so app_eval.so \
-     app_nbscat.so app_sendtext.so app_exec.so \
-     app_groupcount.so app_txtcidname.so app_controlplayback.so \
-     app_talkdetect.so app_alarmreceiver.so app_userevent.so app_verbose.so \
-     app_test.so app_forkcdr.so app_math.so app_realtime.so \
-     app_dumpchan.so app_waitforsilence.so app_while.so app_setrdnis.so \
-     app_md5.so app_readfile.so app_chanspy.so app_settransfercapability.so \
-     app_dictate.so app_externalivr.so app_directed_pickup.so \
-     app_mixmonitor.so app_stack.so
-
+APPS=app_adsiprog.so app_alarmreceiver.so app_authenticate.so app_cdr.so       \
+     app_chanisavail.so app_chanspy.so app_controlplayback.so app_db.so        \
+     app_dial.so app_dictate.so app_directed_pickup.so app_directory.so        \
+     app_disa.so app_dumpchan.so app_echo.so app_exec.so app_externalivr.so    \
+     app_festival.so app_forkcdr.so app_getcpeid.so app_hasnewvoicemail.so     \
+     app_ices.so app_image.so app_lookupblacklist.so app_lookupcidname.so      \
+     app_macro.so app_milliwatt.so app_mixmonitor.so app_mp3.so app_nbscat.so  \
+     app_parkandannounce.so app_playback.so app_privacy.so app_queue.so        \
+     app_random.so app_read.so app_readfile.so app_realtime.so app_record.so   \
+     app_sayunixtime.so app_senddtmf.so app_sendtext.so app_setcallerid.so     \
+     app_setcdruserfield.so app_settransfercapability.so app_softhangup.so     \
+     app_stack.so app_system.so app_talkdetect.so app_test.so app_transfer.so  \
+     app_userevent.so app_url.so app_verbose.so app_voicemail.so               \
+     app_waitforring.so app_waitforsilence.so app_while.so app_zapateller.so
+     
 #
 # Obsolete things...
 #

Modified: team/crichter/0.3.0/apps/app_curl.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/apps/app_curl.c?rev=7390&r1=7389&r2=7390&view=diff
==============================================================================
--- team/crichter/0.3.0/apps/app_curl.c (original)
+++ team/crichter/0.3.0/apps/app_curl.c Thu Dec  8 04:09:56 2005
@@ -43,20 +43,6 @@
 #include "asterisk/app.h"
 
 static char *tdesc = "Load external URL";
-
-static char *app = "Curl";
-
-static char *synopsis = "Load an external URL";
-
-static char *descrip = 
-"  Curl(URL[|postdata]): This application will request the specified URL.\n"
-"It is mainly used for signalling external applications of an event.\n"
-"Parameters:\n"
-"  URL      - This is the external URL to request.\n"
-"  postdata - This information will be treated as POST data.\n"
-"This application will set the following variable:\n"
-"  CURL - This variable will contain the resulting page.\n"
-"This application has been deprecated in favor of the CURL function.\n";
 
 STANDARD_LOCAL_USER;
 
@@ -115,57 +101,6 @@
 	curl_easy_perform(curl);
 	curl_easy_cleanup(curl);
 	return 0;
-}
-
-static int curl_exec(struct ast_channel *chan, void *data)
-{
-	int res = 0;
-	struct localuser *u;
-	char *info;
-	struct MemoryStruct chunk = { NULL, 0 };
-	static int dep_warning = 0;
-	AST_DECLARE_APP_ARGS(args,
-		AST_APP_ARG(url);
-		AST_APP_ARG(postdata);
-	);
-	
-	if (!dep_warning) {
-		ast_log(LOG_WARNING, "The application Curl is deprecated.  Please use the CURL() function instead.\n");
-		dep_warning = 1;
-	}
-
-	if (ast_strlen_zero(data)) {
-		ast_log(LOG_WARNING, "Curl requires an argument (URL)\n");
-		return -1;
-	}
-	
-	LOCAL_USER_ADD(u);
-	
-	if ((info = ast_strdupa(data))) {
-		AST_STANDARD_APP_ARGS(args, info);
-	} else {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
-
-	if (! curl_internal(&chunk, args.url, args.postdata)) {
-		if (chunk.memory) {
-			chunk.memory[chunk.size] = '\0';
-			if (chunk.memory[chunk.size - 1] == 10)
-				chunk.memory[chunk.size - 1] = '\0';
-
-			pbx_builtin_setvar_helper(chan, "CURL", chunk.memory);
-
-			free(chunk.memory);
-		}
-	} else {
-		ast_log(LOG_ERROR, "Cannot allocate curl structure\n");
-		res = -1;
-	}
-
-	LOCAL_USER_REMOVE(u);
-	return res;
 }
 
 static char *acf_curl_exec(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
@@ -228,7 +163,6 @@
 	int res;
 
 	res = ast_custom_function_unregister(&acf_curl);
-	res |= ast_unregister_application(app);
 
 	STANDARD_HANGUP_LOCALUSERS;
 	
@@ -240,7 +174,6 @@
 	int res;
 
 	res = ast_custom_function_register(&acf_curl);
-	res |= ast_register_application(app, curl_exec, synopsis, descrip);
 
 	return res;
 }

Modified: team/crichter/0.3.0/apps/app_cut.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/apps/app_cut.c?rev=7390&r1=7389&r2=7390&view=diff
==============================================================================
--- team/crichter/0.3.0/apps/app_cut.c (original)
+++ team/crichter/0.3.0/apps/app_cut.c Thu Dec  8 04:09:56 2005
@@ -42,31 +42,6 @@
 #define MAXRESULT	1024
 
 static char *tdesc = "Cut out information from a string";
-
-static char *app_cut = "Cut";
-
-static char *cut_synopsis = "Splits a variable's contents using the specified delimiter";
-
-static char *cut_descrip =
-"  Cut(newvar=varname,delimiter,fieldspec): This applicaiton will split the\n"
-"contents of a variable based on the given delimeter and store the result in\n"
-"a new variable.\n"
-"Parameters:\n"
-"  newvar    - new variable created from result string\n"
-"  varname   - variable you want cut\n"
-"  delimiter - defaults to '-'\n"
-"  fieldspec - number of the field you want (1-based offset)\n"
-"              may also be specified as a range (with -)\n"
-"              or group of ranges and fields (with &)\n"
-"This application has been deprecated in favor of the CUT function.\n";
-
-static char *app_sort = "Sort";
-static char *app_sort_synopsis = "Sorts a list of keywords and values";
-static char *app_sort_descrip =
-"  Sort(newvar=key1:val1[,key2:val2[[...],keyN:valN]]): This application will\n"
-"sort the list provided in ascending order. The result will be stored in the\n"
-"specified variable name.\n"
-"  This applicaiton has been deprecated in favor of the SORT function.\n";
 
 STANDARD_LOCAL_USER;
 
@@ -258,105 +233,6 @@
 	return 0;
 }
 
-static int sort_exec(struct ast_channel *chan, void *data)
-{
-	int res=0;
-	struct localuser *u;
-	char *varname, *strings, result[512] = "";
-	static int dep_warning=0;
-
-	if (!dep_warning) {
-		ast_log(LOG_WARNING, "The application Sort is deprecated.  Please use the SORT() function instead.\n");
-		dep_warning=1;
-	}
-
-	if (!data) {
-		ast_log(LOG_ERROR, "Sort() requires an argument\n");
-		return 0;
-	}
-
-	LOCAL_USER_ADD(u);
-
-	strings = ast_strdupa((char *)data);
-	if (!strings) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		LOCAL_USER_REMOVE(u);
-		return 0;
-	}
-
-	varname = strsep(&strings, "=");
-	switch (sort_internal(chan, strings, result, sizeof(result))) {
-	case ERROR_NOARG:
-		ast_log(LOG_ERROR, "Sort() requires an argument\n");
-		res = 0;
-		break;
-	case ERROR_NOMEM:
-		ast_log(LOG_ERROR, "Out of memory\n");
-		res = -1;
-		break;
-	case 0:
-		pbx_builtin_setvar_helper(chan, varname, result);
-		res = 0;
-		break;
-	default:
-		ast_log(LOG_ERROR, "Unknown internal error\n");
-		res = -1;
-	}
-	LOCAL_USER_REMOVE(u);
-	return res;
-}
-
-static int cut_exec(struct ast_channel *chan, void *data)
-{
-	int res=0;
-	struct localuser *u;
-	char *s, *newvar=NULL, result[512];
-	static int dep_warning = 0;
-
-	LOCAL_USER_ADD(u);
-
-	if (!dep_warning) {
-		ast_log(LOG_WARNING, "The application Cut is deprecated.  Please use the CUT() function instead.\n");
-		dep_warning=1;
-	}
-
-	/* Check and parse arguments */
-	if (data) {
-		s = ast_strdupa((char *)data);
-		if (s) {
-			newvar = strsep(&s, "=");
-		} else {
-			ast_log(LOG_ERROR, "Out of memory\n");
-			LOCAL_USER_REMOVE(u);
-			return -1;
-		}
-	}
-
-	switch (cut_internal(chan, s, result, sizeof(result))) {
-	case ERROR_NOARG:
-		ast_log(LOG_ERROR, "Cut() requires an argument\n");
-		res = 0;
-		break;
-	case ERROR_NOMEM:
-		ast_log(LOG_ERROR, "Out of memory\n");
-		res = -1;
-		break;
-	case ERROR_USAGE:
-		ast_log(LOG_ERROR, "Usage: %s\n", cut_synopsis);
-		res = 0;
-		break;
-	case 0:
-		pbx_builtin_setvar_helper(chan, newvar, result);
-		res = 0;
-		break;
-	default:
-		ast_log(LOG_ERROR, "Unknown internal error\n");
-		res = -1;
-	}
-	LOCAL_USER_REMOVE(u);
-	return res;
-}
-
 static char *acf_sort_exec(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
 {
 	struct localuser *u;
@@ -434,8 +310,6 @@
 
 	res = ast_custom_function_unregister(&acf_cut);
 	res |= ast_custom_function_unregister(&acf_sort);
-	res |= ast_unregister_application(app_sort);
-	res |= ast_unregister_application(app_cut);
 
 	STANDARD_HANGUP_LOCALUSERS;
 
@@ -448,8 +322,6 @@
 
 	res = ast_custom_function_register(&acf_cut);
 	res |= ast_custom_function_register(&acf_sort);
-	res |= ast_register_application(app_sort, sort_exec, app_sort_synopsis, app_sort_descrip);
-	res |= ast_register_application(app_cut, cut_exec, cut_synopsis, cut_descrip);
 
 	return res;
 }

Modified: team/crichter/0.3.0/apps/app_db.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/apps/app_db.c?rev=7390&r1=7389&r2=7390&view=diff
==============================================================================
--- team/crichter/0.3.0/apps/app_db.c (original)
+++ team/crichter/0.3.0/apps/app_db.c Thu Dec  8 04:09:56 2005
@@ -47,21 +47,6 @@
 
 static char *tdesc = "Database Access Functions";
 
-static char *g_descrip =
-"  DBget(varname=family/key[|options]): This application will retrieve a value\n"
-"from the Asterisk database and store it in the given variable.\n"
-"  Options:\n"
-"    j - Jump to priority n+101 if the requested family/key isn't found.\n"
-"  This application sets the following channel variable upon completion:\n"
-"    DBGETSTATUS - This variable will contain the status of the attempt\n"
-"                  FOUND | NOTFOUND \n"
-"  This application has been deprecated in favor of the DB function.\n";
-
-static char *p_descrip =
-"  DBput(family/key=value): This application will store the given value in the\n"
-"specified location in the Asterisk database.\n"
-"  This application has been deprecated in favor of the DB function.\n";
-
 static char *d_descrip =
 "  DBdel(family/key): This applicaiton will delete a key from the Asterisk\n"
 "database.\n";
@@ -70,13 +55,9 @@
 "  DBdeltree(family[/keytree]): This application will delete a family or keytree\n"
 "from the Asterisk database\n";
 
-static char *g_app = "DBget";
-static char *p_app = "DBput";
 static char *d_app = "DBdel";
 static char *dt_app = "DBdeltree";
 
-static char *g_synopsis = "Retrieve a value from the database";
-static char *p_synopsis = "Store a value in the database";
 static char *d_synopsis = "Delete a key from the database";
 static char *dt_synopsis = "Delete a family or keytree from the database";
 
@@ -167,126 +148,12 @@
 	return 0;
 }
 
-static int put_exec(struct ast_channel *chan, void *data)
-{
-	char *argv, *value, *family, *key;
-	static int dep_warning = 0;
-	struct localuser *u;
-
-	LOCAL_USER_ADD(u);
-
-	if (!dep_warning) {
-		ast_log(LOG_WARNING, "This application has been deprecated, please use the ${DB(family/key)} function instead.\n");
-		dep_warning = 1;
-	}
-	
-	argv = ast_strdupa(data);
-	if (!argv) {
-		ast_log(LOG_ERROR, "Memory allocation failed\n");
-		LOCAL_USER_REMOVE(u);
-		return 0;
-	}
-
-	if (strchr(argv, '/') && strchr(argv, '=')) {
-		family = strsep(&argv, "/");
-		key = strsep(&argv, "=");
-		value = strsep(&argv, "\0");
-		if (!value || !family || !key) {
-			ast_log(LOG_DEBUG, "Ignoring; Syntax error in argument\n");
-			LOCAL_USER_REMOVE(u);
-			return 0;
-		}
-		if (option_verbose > 2)
-			ast_verbose(VERBOSE_PREFIX_3 "DBput: family=%s, key=%s, value=%s\n", family, key, value);
-		if (ast_db_put(family, key, value)) {
-			if (option_verbose > 2)
-				ast_verbose(VERBOSE_PREFIX_3 "DBput: Error writing value to database.\n");
-		}
-
-	} else	{
-		ast_log (LOG_DEBUG, "Ignoring, no parameters\n");
-	}
-
-	LOCAL_USER_REMOVE(u);
-
-	return 0;
-}
-
-static int get_exec(struct ast_channel *chan, void *data)
-{
-	char *argv, *varname, *family, *key, *options = NULL;
-	char dbresult[256];
-	static int dep_warning = 0;
-	int priority_jump = 0;
-	struct localuser *u;
-
-	LOCAL_USER_ADD(u);
-
-	if (!dep_warning) {
-		ast_log(LOG_WARNING, "This application has been deprecated, please use the ${DB(family/key)} function instead.\n");
-		dep_warning = 1;
-	}
-	
-	argv = ast_strdupa(data);
-	if (!argv) {
-		ast_log(LOG_ERROR, "Memory allocation failed\n");
-		LOCAL_USER_REMOVE(u);
-		return 0;
-	}
-
-	if (strchr(argv, '=') && strchr(argv, '/')) {
-		varname = strsep(&argv, "=");
-		family = strsep(&argv, "/");
-		if (strchr((void *)&argv, '|')) {
-			key = strsep(&argv, "|");
-			options = strsep(&argv, "\0");
-		} else
-			key = strsep(&argv, "\0");
-			
-		if (!varname || !family || !key) {
-			ast_log(LOG_DEBUG, "Ignoring; Syntax error in argument\n");
-			LOCAL_USER_REMOVE(u);
-			return 0;
-		}
-
-		if (options) {
-			if (strchr(options, 'j'))
-				priority_jump = 1;
-		}
-			
-		if (option_verbose > 2)
-			ast_verbose(VERBOSE_PREFIX_3 "DBget: varname=%s, family=%s, key=%s\n", varname, family, key);
-		if (!ast_db_get(family, key, dbresult, sizeof (dbresult) - 1)) {
-			pbx_builtin_setvar_helper(chan, varname, dbresult);
-			if (option_verbose > 2)
-				ast_verbose(VERBOSE_PREFIX_3 "DBget: set variable %s to %s\n", varname, dbresult);
-			pbx_builtin_setvar_helper(chan, "DBGETSTATUS", "FOUND");
-		} else {
-			if (option_verbose > 2)
-			ast_verbose(VERBOSE_PREFIX_3 "DBget: Value not found in database.\n");
-			if (priority_jump || ast_opt_priority_jumping) {
-				/* Send the call to n+101 priority, where n is the current priority */
-				ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
-			}
-			pbx_builtin_setvar_helper(chan, "DBGETSTATUS", "NOTFOUND");
-		}
-	} else {
-		ast_log(LOG_DEBUG, "Ignoring, no parameters\n");
-	}
-
-	LOCAL_USER_REMOVE(u);
-
-	return 0;
-}
-
 int unload_module(void)
 {
 	int retval;
 
 	retval = ast_unregister_application(dt_app);
 	retval |= ast_unregister_application(d_app);
-	retval |= ast_unregister_application(p_app);
-	retval |= ast_unregister_application(g_app);
 
 	STANDARD_HANGUP_LOCALUSERS;
 
@@ -297,8 +164,6 @@
 {
 	int retval;
 
-	retval = ast_register_application(g_app, get_exec, g_synopsis, g_descrip);
-	retval |= ast_register_application(p_app, put_exec, p_synopsis, p_descrip);
 	retval |= ast_register_application(d_app, del_exec, d_synopsis, d_descrip);
 	retval |= ast_register_application(dt_app, deltree_exec, dt_synopsis, dt_descrip);
 	

Modified: team/crichter/0.3.0/cli.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/cli.c?rev=7390&r1=7389&r2=7390&view=diff
==============================================================================
--- team/crichter/0.3.0/cli.c (original)
+++ team/crichter/0.3.0/cli.c Thu Dec  8 04:09:56 2005
@@ -29,6 +29,7 @@
 #include <signal.h>
 #include <string.h>
 #include <ctype.h>
+#include <regex.h>
 
 #include "asterisk.h"
 
@@ -42,6 +43,7 @@
 #include "asterisk/channel.h"
 #include "asterisk/manager.h"
 #include "asterisk/utils.h"
+#include "asterisk/app.h"
 #include "asterisk/lock.h"
 /* For rl_filename_completion */
 #include "editline/readline/readline.h"
@@ -124,6 +126,12 @@
 "Usage: soft hangup <channel>\n"
 "       Request that a channel be hung up. The hangup takes effect\n"
 "       the next time the driver reads or writes from the channel\n";
+
+static char group_show_channels_help[] = 
+"Usage: group show channels [pattern]\n"
+"       Lists all currently active channels with channel group(s) specified.\n"
+"       Optional regular expression pattern is matched to group names for each\n"
+"       channel.\n";
 
 static int handle_load(int fd, int argc, char *argv[])
 {
@@ -887,6 +895,55 @@
 	return c ? strdup(c) : c;
 }
 
+static int group_show_channels(int fd, int argc, char *argv[])
+{
+#define FORMAT_STRING  "%-25s  %-20s  %-20s\n"
+
+	struct ast_channel *c = NULL;
+	int numchans = 0;
+	struct ast_var_t *current;
+	struct varshead *headp;
+	regex_t regexbuf;
+	int havepattern = 0;
+
+	if (argc < 3 || argc > 4)
+		return RESULT_SHOWUSAGE;
+	
+	if (argc == 4) {
+		if (regcomp(&regexbuf, argv[3], REG_EXTENDED | REG_NOSUB))
+			return RESULT_SHOWUSAGE;
+		havepattern = 1;
+	}
+
+	ast_cli(fd, FORMAT_STRING, "Channel", "Group", "Category");
+	while ( (c = ast_channel_walk_locked(c)) != NULL) {
+		headp=&c->varshead;
+		AST_LIST_TRAVERSE(headp,current,entries) {
+			if (!strncmp(ast_var_name(current), GROUP_CATEGORY_PREFIX "_", strlen(GROUP_CATEGORY_PREFIX) + 1)) {
+				if (!havepattern || !regexec(&regexbuf, ast_var_value(current), 0, NULL, 0)) {
+					ast_cli(fd, FORMAT_STRING, c->name, ast_var_value(current),
+						(ast_var_name(current) + strlen(GROUP_CATEGORY_PREFIX) + 1));
+					numchans++;
+				}
+			} else if (!strcmp(ast_var_name(current), GROUP_CATEGORY_PREFIX)) {
+				if (!havepattern || !regexec(&regexbuf, ast_var_value(current), 0, NULL, 0)) {
+					ast_cli(fd, FORMAT_STRING, c->name, ast_var_value(current), "(default)");
+					numchans++;
+				}
+			}
+		}
+		numchans++;
+		ast_mutex_unlock(&c->lock);
+	}
+
+	if (havepattern)
+		regfree(&regexbuf);
+
+	ast_cli(fd, "%d active channel%s\n", numchans, (numchans != 1) ? "s" : "");
+	return RESULT_SUCCESS;
+#undef FORMAT_STRING
+}
+
 static int handle_help(int fd, int argc, char *argv[]);
 
 static struct ast_cli_entry builtins[] = {
@@ -910,6 +967,7 @@
 	{ { "show", "version", NULL }, handle_version, "Display version info", version_help },
 	{ { "soft", "hangup", NULL }, handle_softhangup, "Request a hangup on a given channel", softhangup_help, complete_ch_3 },
 	{ { "unload", NULL }, handle_unload, "Unload a dynamic module by name", unload_help, complete_fn },
+	{ { "group", "show", "channels", NULL }, group_show_channels, "Show active channels with group(s)", group_show_channels_help},
 	{ { NULL }, NULL, NULL, NULL }
 };
 

Modified: team/crichter/0.3.0/pbx.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/pbx.c?rev=7390&r1=7389&r2=7390&view=diff
==============================================================================
--- team/crichter/0.3.0/pbx.c (original)
+++ team/crichter/0.3.0/pbx.c Thu Dec  8 04:09:56 2005
@@ -199,14 +199,9 @@
 static int pbx_builtin_goto(struct ast_channel *, void *);
 static int pbx_builtin_hangup(struct ast_channel *, void *);
 static int pbx_builtin_background(struct ast_channel *, void *);
-static int pbx_builtin_dtimeout(struct ast_channel *, void *);
-static int pbx_builtin_rtimeout(struct ast_channel *, void *);
-static int pbx_builtin_atimeout(struct ast_channel *, void *);
 static int pbx_builtin_wait(struct ast_channel *, void *);
 static int pbx_builtin_waitexten(struct ast_channel *, void *);
-static int pbx_builtin_setlanguage(struct ast_channel *, void *);
 static int pbx_builtin_resetcdr(struct ast_channel *, void *);
-static int pbx_builtin_setaccount(struct ast_channel *, void *);
 static int pbx_builtin_setamaflags(struct ast_channel *, void *);
 static int pbx_builtin_ringing(struct ast_channel *, void *);
 static int pbx_builtin_progress(struct ast_channel *, void *);
@@ -221,7 +216,6 @@
 static int pbx_builtin_saydigits(struct ast_channel *, void *);
 static int pbx_builtin_saycharacters(struct ast_channel *, void *);
 static int pbx_builtin_sayphonetic(struct ast_channel *, void *);
-static int pbx_builtin_setvar_old(struct ast_channel *, void *);
 int pbx_builtin_setvar(struct ast_channel *, void *);
 static int pbx_builtin_importvar(struct ast_channel *, void *);
 
@@ -245,13 +239,6 @@
 {
 	/* These applications are built into the PBX core and do not
 	   need separate modules */
-
-	{ "AbsoluteTimeout", pbx_builtin_atimeout,
-	"Set absolute maximum time of call",
-	"  AbsoluteTimeout(seconds): This application will set the absolute maximum\n"
-	"amount of time permitted for a call. A setting of 0 disables the timeout.\n"
-	"  AbsoluteTimeout has been deprecated in favor of Set(TIMEOUT(absolute)=timeout)\n"
-	},
 
 	{ "Answer", pbx_builtin_answer, 
 	"Answer a channel if ringing", 
@@ -298,19 +285,6 @@
 	"Otherwise, this application will wait until the calling channel hangs up.\n"
 	},
 
-	{ "DigitTimeout", pbx_builtin_dtimeout,
-	"Set maximum timeout between digits",
-	"  DigitTimeout(seconds): Set the maximum amount of time permitted between\n"
-	"digits when the user is typing in an extension. When this timeout expires,\n"
-	"after the user has started to type in an extension, the extension will be\n"
-	"considered complete, and will be interpreted. Note that if an extension\n"
-	"typed in is valid, it will not have to timeout to be tested, so typically\n"
-	"at the expiry of this timeout, the extension will be considered invalid\n"
-	"(and thus control would be passed to the 'i' extension, or if it doesn't\n"
-	"exist the call would be terminated). The default timeout is 5 seconds.\n"
-	"  DigitTimeout has been deprecated in favor of Set(TIMEOUT(digit)=timeout)\n"
-	},
-
 	{ "Goto", pbx_builtin_goto, 
 	"Jump to a particular priority, extension, or context",
 	"  Goto([[context|]extension|]priority): This application will cause the\n"
@@ -377,15 +351,6 @@
 	"    v -- Save CDR variables.\n"
 	},
 
-	{ "ResponseTimeout", pbx_builtin_rtimeout,
-	"Set maximum timeout awaiting response",
-	"  ResponseTimeout(seconds): This will set the maximum amount of time permitted\n"
-	"to wait for an extension to dialed (see the WaitExten application), before the\n"
-	"timeout occurs. If this timeout is reached, dialplan execution will continue at\n"
-	"the 't' extension, if it exists.\n"
-	"  ResponseTimeout has been deprecated in favor of Set(TIMEOUT(response)=timeout)\n"
-	},
-
 	{ "Ringing", pbx_builtin_ringing,
 	"Indicate ringing tone",
 	"  Ringing(): This application will request that the channel indicate a ringing\n"
@@ -420,13 +385,6 @@
 	"alphabet that correspond to the letters in the given string.\n"
 	},
 
-	{ "SetAccount", pbx_builtin_setaccount,
-	"Set the CDR Account Code",
-	"  SetAccount([account]): This application will set the channel account code for\n"
-	"billing purposes.\n"
-	"  SetAccount has been deprecated in favor of the Set(CDR(accountcode)=account).\n"
-	},
-
 	{ "SetAMAFlags", pbx_builtin_setamaflags,
 	"Set the AMA Flags",
 	"  SetAMAFlags([flag]): This channel will set the channel's AMA Flags for billing\n"
@@ -437,19 +395,6 @@
 	"Set a global variable to a given value",
 	"  SetGlobalVar(variable=value): This application sets a given global variable to\n"
 	"the specified value.\n"
-	},
-
-	{ "SetLanguage", pbx_builtin_setlanguage,
-	"Set the channel's preferred language",
-	"  SetLanguage(language): This will set the channel language to the given value.\n"
-	"This information is used for the syntax in generation of numbers, and to choose\n"
-	"a sound file in the given language, when it is available.\n"
-	"  For example, if language is set to 'fr' and the file 'demo-congrats' is \n"
-	"requested to be played, if the file 'fr/demo-congrats' exists, then\n"
-	"it will play that file. If not, it will play the normal 'demo-congrats'.\n"
-	"For some language codes, SetLanguage also changes the syntax of some\n"
-	"Asterisk functions, like SayNumber.\n"
-	"  SetLanguage has been deprecated in favor of Set(LANGUAGE()=language)\n"
 	},
 
 	{ "Set", pbx_builtin_setvar,
@@ -464,12 +409,6 @@
 	"  Options:\n" 
 	"    g - Set variable globally instead of on the channel\n"
 	"        (applies only to variables, not functions)\n"
-	},
-
-	{ "SetVar", pbx_builtin_setvar_old,
-	"Set channel variable(s)",
-	"  SetVar(name1=value1|name2=value2|..[|options]): This application has been\n"
-	"deprecated in favor of using the Set application.\n"
 	},
 
 	{ "ImportVar", pbx_builtin_importvar,
@@ -4675,6 +4614,16 @@
 	int res;
 	int length;
 	char *p;
+	char expand_buf[VAR_BUF_SIZE] = { 0, };
+
+	/* if we are adding a hint, and there are global variables, and the hint
+	   contains variable references, then expand them
+	*/
+	if ((priority == PRIORITY_HINT) && AST_LIST_FIRST(&globals) && strstr(application, "${")) {
+		pbx_substitute_variables_varshead(&globals, application, expand_buf, sizeof(expand_buf));
+		application = expand_buf;
+	}
+
 	length = sizeof(struct ast_exten);
 	length += strlen(extension) + 1;
 	length += strlen(application) + 1;
@@ -5447,25 +5396,6 @@
 	return res;
 }
 
-/*!
- * \ingroup applications
- */
-static int pbx_builtin_setlanguage(struct ast_channel *chan, void *data)
-{
-	static int deprecation_warning = 0;
-
-	if (!deprecation_warning) {
-		ast_log(LOG_WARNING, "SetLanguage is deprecated, please use Set(LANGUAGE()=language) instead.\n");
-		deprecation_warning = 1;
-	}
-
-	/* Copy the language as specified */
-	if (!ast_strlen_zero(data))
-		ast_copy_string(chan->language, data, sizeof(chan->language));
-
-	return 0;
-}
-
 AST_APP_OPTIONS(resetcdr_opts, {
 	AST_APP_OPTION('w', AST_CDR_FLAG_POSTED),
 	AST_APP_OPTION('a', AST_CDR_FLAG_LOCKED),
@@ -5491,19 +5421,6 @@
 
 	ast_cdr_reset(chan->cdr, &flags);
 
-	return 0;
-}
-
-/*!
- * \ingroup applications
- */
-static int pbx_builtin_setaccount(struct ast_channel *chan, void *data)
-{
-	/* Copy the account code  as specified */
-	if (data)
-		ast_cdr_setaccount(chan, (char *)data);
-	else
-		ast_cdr_setaccount(chan, "");
 	return 0;
 }
 
@@ -5784,75 +5701,6 @@
 	}
 }
 
-/*! AbsoluteTimeout
- * \ingroup applications
- * \todo Remove in 1.3 dev
- */
-static int pbx_builtin_atimeout(struct ast_channel *chan, void *data)
-{
-	static int deprecation_warning = 0;
-	int x = atoi((char *) data);
-
-	if (!deprecation_warning) {
-		ast_log(LOG_WARNING, "AbsoluteTimeout is deprecated, please use Set(TIMEOUT(absolute)=timeout) instead.\n");
-		deprecation_warning = 1;
-	}
-			
-	/* Set the absolute maximum time how long a call can be connected */
-	ast_channel_setwhentohangup(chan,x);
-	if (option_verbose > 2)
-		ast_verbose( VERBOSE_PREFIX_3 "Set Absolute Timeout to %d\n", x);
-	return 0;
-}
-
-/*! ResponseTimeout
- * \ingroup applications
- * \todo Remove in 1.3 dev
- */
-static int pbx_builtin_rtimeout(struct ast_channel *chan, void *data)
-{
-	static int deprecation_warning = 0;
-
-	if (!deprecation_warning) {
-		ast_log(LOG_WARNING, "ResponseTimeout is deprecated, please use Set(TIMEOUT(response)=timeout) instead.\n");
-		deprecation_warning = 1;
-	}
-
-	/* If the channel is not in a PBX, return now */
-	if (!chan->pbx)
-		return 0;
-
-	/* Set the timeout for how long to wait between digits */
-	chan->pbx->rtimeout = atoi((char *)data);
-	if (option_verbose > 2)
-		ast_verbose( VERBOSE_PREFIX_3 "Set Response Timeout to %d\n", chan->pbx->rtimeout);
-	return 0;
-}
-
-/*! DigitTimeout
- * \ingroup applications
- * \todo Remove in 1.3 dev
- */
-static int pbx_builtin_dtimeout(struct ast_channel *chan, void *data)
-{
-	static int deprecation_warning = 0;
-
-	if (!deprecation_warning) {
-		ast_log(LOG_WARNING, "DigitTimeout is deprecated, please use Set(TIMEOUT(digit)=timeout) instead.\n");
-		deprecation_warning = 1;
-	}
-
-	/* If the channel is not in a PBX, return now */
-	if (!chan->pbx)
-		return 0;
-
-	/* Set the timeout for how long to wait between digits */
-	chan->pbx->dtimeout = atoi((char *)data);
-	if (option_verbose > 2)
-		ast_verbose( VERBOSE_PREFIX_3 "Set Digit Timeout to %d\n", chan->pbx->dtimeout);
-	return 0;
-}
-
 /*! Goto
  * \ingroup applications
  */
@@ -5973,18 +5821,6 @@
 		newvariable = ast_var_assign(name, value);	
 		AST_LIST_INSERT_HEAD(headp, newvariable, entries);
 	}
-}
-
-int pbx_builtin_setvar_old(struct ast_channel *chan, void *data)
-{
-	static int deprecation_warning = 0;
-
-	if (!deprecation_warning) {
-		ast_log(LOG_WARNING, "SetVar is deprecated, please use Set instead.\n");
-		deprecation_warning = 1;
-	}
-
-	return pbx_builtin_setvar(chan, data);
 }
 
 int pbx_builtin_setvar(struct ast_channel *chan, void *data)



More information about the asterisk-commits mailing list