Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv19282/apps

Modified Files:
        app_cut.c app_groupcount.c 
Log Message:
major re-work of dialplan functions, including:

 - locking of functions list during registration/unregistration/searching
 - rename of function description structure to be consistent with the rest of 
the API
 - addition of 'desc' element to description structure, for detailed 
description (like applications)
 - addition of 'show function' CLI command to show function details
 - conversion of existing functions to use uppercase names to match policy
 - creation of new 'pbx_functions.so' module to contain standard 'builtin' 
functions
 - removal of all builtin functions from pbx.c and apps and placement into new 
'funcs' directory



Index: app_cut.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_cut.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- app_cut.c   27 Apr 2005 01:50:53 -0000      1.9
+++ app_cut.c   5 May 2005 05:39:33 -0000       1.10
@@ -169,44 +169,14 @@
        return res;
 }
 
-static char *function_fieldqty(struct ast_channel *chan, char *cmd, char 
*data, char *buf, size_t len)
-{
-       char *varname, *varval="", workspace[256];
-       char *delim = ast_strdupa(data);
-       int fieldcount=0;
-
-       if (delim) {
-               varname = strsep(&delim, "|");
-               pbx_retrieve_variable(chan, varname, &varval, workspace, 
sizeof(workspace), NULL);
-               while (strsep(&varval, delim)) {
-                       fieldcount++;
-               }
-               snprintf(buf, len, "%d", fieldcount);
-       } else {
-               ast_log(LOG_ERROR, "Out of memory\n");
-               strncpy(buf, "1", len);
-       }
-       return buf;
-}
-
-static struct ast_custom_function_obj fieldqty_function = {
-       .name = "FIELDQTY",
-       .desc = "Count the fields, with an arbitrary delimiter",
-       .syntax = "FIELDQTY(<varname>,<delim>)",
-       .read = function_fieldqty,
-       .write = NULL,
-};
-
 int unload_module(void)
 {
        STANDARD_HANGUP_LOCALUSERS;
-       ast_custom_function_unregister(&fieldqty_function);
        return ast_unregister_application(app_cut);
 }
 
 int load_module(void)
 {
-       ast_custom_function_register(&fieldqty_function);
        return ast_register_application(app_cut, cut_exec, cut_synopsis, 
cut_descrip);
 }
 

Index: app_groupcount.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_groupcount.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- app_groupcount.c    4 May 2005 04:13:31 -0000       1.12
+++ app_groupcount.c    5 May 2005 05:39:33 -0000       1.13
@@ -34,68 +34,6 @@
 
 static int deprecation_warning = 0;
 
-static char *group_count_function_read(struct ast_channel *chan, char *cmd, 
char *data, char *buf, size_t len) 
-{
-       int count;
-       struct localuser *u;
-       char group[80] = "";
-       char category[80] = "";
-       char *grp;
-
-       LOCAL_USER_ADD(u);
-
-       ast_app_group_split_group(data, group, sizeof(group), category, 
sizeof(category));
-
-       if (ast_strlen_zero(group)) {
-               grp = pbx_builtin_getvar_helper(chan, category);
-               strncpy(group, grp, sizeof(group) - 1);
-       }
-
-       count = ast_app_group_get_count(group, category);
-       snprintf(buf, len, "%d", count);
-
-       LOCAL_USER_REMOVE(u);
-
-       return buf;
-}
-
-static struct ast_custom_function_obj group_count_function_obj = {
-       .name = "GROUP_COUNT",
-       .desc = "Calculates the group count for the specified group, or uses 
the current channel's group if not specifed (and non-empty).",
-       .syntax = "GROUP_COUNT([EMAIL PROTECTED])",
-       .read = group_count_function_read,
-       .write = NULL,
-};
-
-static char *group_match_count_function_read(struct ast_channel *chan, char 
*cmd, char *data, char *buf, size_t len) 
-{
-       int count;
-       struct localuser *u;
-       char group[80] = "";
-       char category[80] = "";
-
-       LOCAL_USER_ADD(u);
-
-       ast_app_group_split_group(data, group, sizeof(group), category, 
sizeof(category));
-
-       if (!ast_strlen_zero(group)) {
-               count = ast_app_group_match_get_count(group, category);
-               snprintf(buf, len, "%d", count);
-       }
-
-       LOCAL_USER_REMOVE(u);
-
-       return buf;
-}
-
-static struct ast_custom_function_obj group_match_count_function_obj = {
-       .name = "GROUP_MATCH_COUNT",
-       .desc = "Calculates the group count for all groups that match the 
specified pattern. Uses standard regular expression matching (see regex(7)).",
-       .syntax = "GROUP_MATCH_COUNT([EMAIL PROTECTED])",
-       .read = group_match_count_function_read,
-       .write = NULL,
-};
-
 static int group_count_exec(struct ast_channel *chan, void *data)
 {
        int res = 0;
@@ -311,8 +249,6 @@
        res |= ast_unregister_application(app_group_set);
        res |= ast_unregister_application(app_group_check);
        res |= ast_unregister_application(app_group_match_count);
-       res |= ast_custom_function_unregister(&group_count_function_obj);
-       res |= ast_custom_function_unregister(&group_match_count_function_obj);
        return res;
 }
 
@@ -323,8 +259,6 @@
        res |= ast_register_application(app_group_set, group_set_exec, 
group_set_synopsis, group_set_descrip);
        res |= ast_register_application(app_group_check, group_check_exec, 
group_check_synopsis, group_check_descrip);
        res |= ast_register_application(app_group_match_count, 
group_match_count_exec, group_match_count_synopsis, group_match_count_descrip);
-       res |= ast_custom_function_register(&group_count_function_obj);
-       res |= ast_custom_function_register(&group_match_count_function_obj);
        ast_cli_register(&cli_show_channels);
        return res;
 }

_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs

Reply via email to