[asterisk-commits] branch oej/sipdiversion r9515 - in
/team/oej/sipdiversion: ./ apps/ channels/...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sat Feb 11 06:17:46 MST 2006
Author: oej
Date: Sat Feb 11 07:17:28 2006
New Revision: 9515
URL: http://svn.digium.com/view/asterisk?rev=9515&view=rev
Log:
Manual update since automerge failed
Removed:
team/oej/sipdiversion/funcs/pbx_functions.c
Modified:
team/oej/sipdiversion/ (props changed)
team/oej/sipdiversion/UPGRADE.txt
team/oej/sipdiversion/apps/app_osplookup.c
team/oej/sipdiversion/channel.c
team/oej/sipdiversion/channels/chan_iax2.c
team/oej/sipdiversion/channels/chan_sip.c
team/oej/sipdiversion/channels/misdn/ (props changed)
team/oej/sipdiversion/dnsmgr.c
team/oej/sipdiversion/funcs/Makefile
team/oej/sipdiversion/funcs/func_base64.c (contents, props changed)
team/oej/sipdiversion/funcs/func_callerid.c
team/oej/sipdiversion/funcs/func_cdr.c
team/oej/sipdiversion/funcs/func_cut.c
team/oej/sipdiversion/funcs/func_db.c
team/oej/sipdiversion/funcs/func_enum.c
team/oej/sipdiversion/funcs/func_env.c
team/oej/sipdiversion/funcs/func_groupcount.c
team/oej/sipdiversion/funcs/func_language.c
team/oej/sipdiversion/funcs/func_logic.c
team/oej/sipdiversion/funcs/func_math.c
team/oej/sipdiversion/funcs/func_md5.c
team/oej/sipdiversion/funcs/func_moh.c
team/oej/sipdiversion/funcs/func_odbc.c
team/oej/sipdiversion/funcs/func_rand.c
team/oej/sipdiversion/funcs/func_sha1.c (contents, props changed)
team/oej/sipdiversion/funcs/func_strings.c
team/oej/sipdiversion/funcs/func_timeout.c
team/oej/sipdiversion/funcs/func_uri.c
team/oej/sipdiversion/include/asterisk/channel.h
team/oej/sipdiversion/res/res_smdi.c
Propchange: team/oej/sipdiversion/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Feb 11 07:17:28 2006
@@ -1,1 +1,1 @@
-/trunk:1-9461
+/trunk:1-9514
Modified: team/oej/sipdiversion/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/UPGRADE.txt?rev=9515&r1=9514&r2=9515&view=diff
==============================================================================
--- team/oej/sipdiversion/UPGRADE.txt (original)
+++ team/oej/sipdiversion/UPGRADE.txt Sat Feb 11 07:17:28 2006
@@ -35,6 +35,11 @@
* The function ${CHECK_MD5()} has been deprecated in favor of using an
expression: $[${MD5(<string>)} = ${saved_md5}].
+* The 'builtin' functions that used to be combined in pbx_functions.so are
+ now built as separate modules. If you are not using 'autoload=yes' in your
+ modules.conf file then you will need to explicitly load the modules that
+ contain the functions you want to use.
+
The SIP channel:
* The "incominglimit" setting is replaced by the "call-limit" setting in sip.conf.
Modified: team/oej/sipdiversion/apps/app_osplookup.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/apps/app_osplookup.c?rev=9515&r1=9514&r2=9515&view=diff
==============================================================================
--- team/oej/sipdiversion/apps/app_osplookup.c (original)
+++ team/oej/sipdiversion/apps/app_osplookup.c Sat Feb 11 07:17:28 2006
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
*
@@ -184,6 +184,7 @@
int res=0;
struct localuser *u;
char *temp;
+ const char *val;
int cause;
struct ast_osp_result result;
int priority_jump = 0;
@@ -212,11 +213,11 @@
}
cause = str2cause(args.cause);
- temp = pbx_builtin_getvar_helper(chan, "OSPHANDLE");
+ val = pbx_builtin_getvar_helper(chan, "OSPHANDLE");
result.handle = -1;
- if (!ast_strlen_zero(temp) && (sscanf(temp, "%d", &result.handle) == 1) && (result.handle > -1)) {
- temp = pbx_builtin_getvar_helper(chan, "OSPRESULTS");
- if (ast_strlen_zero(temp) || (sscanf(temp, "%d", &result.numresults) != 1)) {
+ if (!ast_strlen_zero(val) && (sscanf(val, "%d", &result.handle) == 1) && (result.handle > -1)) {
+ val = pbx_builtin_getvar_helper(chan, "OSPRESULTS");
+ if (ast_strlen_zero(val) || (sscanf(val, "%d", &result.numresults) != 1)) {
result.numresults = 0;
}
if ((res = ast_osp_next(&result, cause)) > 0) {
@@ -255,6 +256,7 @@
int res=0;
struct localuser *u;
char *temp;
+ const char *val;
int cause;
time_t start=0, duration=0;
struct ast_osp_result result;
@@ -293,9 +295,9 @@
ast_log(LOG_WARNING, "OSPFinish called on channel '%s' with no CDR!\n", chan->name);
cause = str2cause(args.status);
- temp = pbx_builtin_getvar_helper(chan, "OSPHANDLE");
+ val = pbx_builtin_getvar_helper(chan, "OSPHANDLE");
result.handle = -1;
- if (!ast_strlen_zero(temp) && (sscanf(temp, "%d", &result.handle) == 1) && (result.handle > -1)) {
+ if (!ast_strlen_zero(val) && (sscanf(val, "%d", &result.handle) == 1) && (result.handle > -1)) {
if (!ast_osp_terminate(result.handle, cause, start, duration)) {
pbx_builtin_setvar_helper(chan, "_OSPHANDLE", "");
pbx_builtin_setvar_helper(chan, "OSPFINISHSTATUS", "SUCCESS");
Modified: team/oej/sipdiversion/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/channel.c?rev=9515&r1=9514&r2=9515&view=diff
==============================================================================
--- team/oej/sipdiversion/channel.c (original)
+++ team/oej/sipdiversion/channel.c Sat Feb 11 07:17:28 2006
@@ -164,6 +164,22 @@
{ AST_CAUSE_INTERWORKING, "Interworking, unspecified" },
};
+
+struct ast_variable *ast_channeltype_list(void)
+{
+ struct chanlist *cl;
+ struct ast_variable *var=NULL, *prev = NULL;
+ AST_LIST_TRAVERSE(&backends, cl, list) {
+ if (prev) {
+ if ((prev->next = ast_variable_new(cl->tech->type, cl->tech->description)))
+ prev = prev->next;
+ } else {
+ var = ast_variable_new(cl->tech->type, cl->tech->description);
+ prev = var;
+ }
+ }
+ return var;
+}
static int show_channeltypes(int fd, int argc, char *argv[])
{
Modified: team/oej/sipdiversion/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/channels/chan_iax2.c?rev=9515&r1=9514&r2=9515&view=diff
==============================================================================
--- team/oej/sipdiversion/channels/chan_iax2.c (original)
+++ team/oej/sipdiversion/channels/chan_iax2.c Sat Feb 11 07:17:28 2006
@@ -234,7 +234,8 @@
enum {
IAX_STATE_STARTED = (1 << 0),
IAX_STATE_AUTHENTICATED = (1 << 1),
- IAX_STATE_TBD = (1 << 2)
+ IAX_STATE_TBD = (1 << 2),
+ IAX_STATE_UNCHANGED = (1 << 3),
} iax2_state;
struct iax2_context {
@@ -5011,7 +5012,7 @@
int x;
int expire = 0;
- ast_clear_flag(&iaxs[callno]->state, IAX_STATE_AUTHENTICATED);
+ ast_clear_flag(&iaxs[callno]->state, IAX_STATE_AUTHENTICATED | IAX_STATE_UNCHANGED);
iaxs[callno]->peer[0] = '\0';
if (ies->username)
ast_copy_string(peer, ies->username, sizeof(peer));
@@ -5056,6 +5057,8 @@
destroy_peer(p);
return -1;
}
+ if (!inaddrcmp(&p->addr, sin))
+ ast_set_flag(&iaxs[callno]->state, IAX_STATE_UNCHANGED);
ast_copy_string(iaxs[callno]->secret, p->secret, sizeof(iaxs[callno]->secret));
ast_copy_string(iaxs[callno]->inkeys, p->inkeys, sizeof(iaxs[callno]->inkeys));
/* Check secret against what we have on file */
@@ -7362,7 +7365,8 @@
auth_fail(fr.callno, IAX_COMMAND_REGREJ);
break;
}
- if ((ast_strlen_zero(iaxs[fr.callno]->secret) && ast_strlen_zero(iaxs[fr.callno]->inkeys)) || ast_test_flag(&iaxs[fr.callno]->state, IAX_STATE_AUTHENTICATED)) {
+ if ((ast_strlen_zero(iaxs[fr.callno]->secret) && ast_strlen_zero(iaxs[fr.callno]->inkeys)) ||
+ ast_test_flag(&iaxs[fr.callno]->state, IAX_STATE_AUTHENTICATED | IAX_STATE_UNCHANGED)) {
if (f.subclass == IAX_COMMAND_REGREL)
memset(&sin, 0, sizeof(sin));
if (update_registry(iaxs[fr.callno]->peer, &sin, fr.callno, ies.devicetype, fd, ies.refresh))
Modified: team/oej/sipdiversion/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/channels/chan_sip.c?rev=9515&r1=9514&r2=9515&view=diff
==============================================================================
--- team/oej/sipdiversion/channels/chan_sip.c (original)
+++ team/oej/sipdiversion/channels/chan_sip.c Sat Feb 11 07:17:28 2006
@@ -11516,7 +11516,6 @@
/*! \brief Start the channel monitor thread */
static int restart_monitor(void)
{
- pthread_attr_t attr;
/* If we're supposed to be stopped -- stay stopped */
if (monitor_thread == AST_PTHREADT_STOP)
return 0;
@@ -11534,7 +11533,7 @@
pthread_kill(monitor_thread, SIGURG);
} else {
/* Start a new monitor */
- if (ast_pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) {
+ if (ast_pthread_create(&monitor_thread, NULL, do_monitor, NULL) < 0) {
ast_mutex_unlock(&monlock);
ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
return -1;
Propchange: team/oej/sipdiversion/channels/misdn/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Feb 11 07:17:28 2006
@@ -1,0 +1,1 @@
+*.a
Modified: team/oej/sipdiversion/dnsmgr.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/dnsmgr.c?rev=9515&r1=9514&r2=9515&view=diff
==============================================================================
--- team/oej/sipdiversion/dnsmgr.c (original)
+++ team/oej/sipdiversion/dnsmgr.c Sat Feb 11 07:17:28 2006
@@ -303,7 +303,6 @@
const char *enabled_value;
int interval;
int was_enabled;
- pthread_attr_t attr;
int res = -1;
/* ensure that no refresh cycles run while the reload is in progress */
Modified: team/oej/sipdiversion/funcs/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/funcs/Makefile?rev=9515&r1=9514&r2=9515&view=diff
==============================================================================
--- team/oej/sipdiversion/funcs/Makefile (original)
+++ team/oej/sipdiversion/funcs/Makefile Sat Feb 11 07:17:28 2006
@@ -3,7 +3,7 @@
#
# Makefile for dialplan functions
#
-# Copyright (C) 2005, Digium
+# Copyright (C) 2005 - 2006, Digium
#
# Kevin P. Fleming <kpfleming at digium.com>
#
@@ -11,23 +11,7 @@
# the GNU General Public License
#
-FUNCS=pbx_functions.so
-
-BUILTINS=func_md5.o \
- func_math.o \
- func_groupcount.o \
- func_strings.o \
- func_cdr.o \
- func_logic.o \
- func_env.o \
- func_db.o \
- func_timeout.o \
- func_language.o \
- func_moh.o \
- func_base64.o \
- func_sha1.o
-
-AVAILABLE_FUNCS=$(filter-out $(BUILTINS),$(patsubst %.c,%.o,$(wildcard func*.c)))
+AVAILABLE_FUNCS=$(patsubst %.c,%.o,$(wildcard func*.c))
ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/odbcinst.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/odbcinst.h),)
STANDALONE_FUNCS=$(filter-out func_odbc.o,$(AVAILABLE_FUNCS))
@@ -35,11 +19,7 @@
STANDALONE_FUNCS=$(AVAILABLE_FUNCS)
endif
-FUNCS+=$(STANDALONE_FUNCS:.o=.so)
-
-FUNC_SOURCES=$(BUILTINS:.o=.c)
-
-FUNC_STRUCTS=$(shell grep 'struct ast_custom_function' $(FUNC_SOURCES) | awk '{print $$3};' | sort)
+FUNCS=$(STANDALONE_FUNCS:.o=.so)
ifeq (${OSARCH},CYGWIN)
CYGSOLINK=-Wl,--out-implib=lib$@.a -Wl,--export-all-symbols
@@ -51,23 +31,9 @@
all: $(FUNCS)
clean:
- rm -f *.so *.o .depend pbx_functions.h
+ rm -f *.so *.o .depend
%.so : %.o
- $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB}
-
-#$(BUILTINS) : CFLAGS += -DBUILTIN_FUNC
-
-pbx_functions.h: $(FUNC_SOURCES)
- @echo "/* Automatically generated - do not edit */" > $@
- @for f in $(FUNC_SOURCES); do echo "#include \"$$f\"" >> $@; done
- @echo "static struct ast_custom_function *builtins[] = {" >> $@
- @for f in $(FUNC_STRUCTS); do echo "&$$f," >> $@; done
- @echo "};" >> $@
-
-pbx_functions.o: pbx_functions.h
-
-pbx_functions.so: pbx_functions.o #$(BUILTINS)
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB}
func_odbc.so: func_odbc.o
@@ -84,7 +50,7 @@
depend: .depend
-.depend: pbx_functions.h
+.depend:
../build_tools/mkdep $(CFLAGS) `ls *.c`
env:
Modified: team/oej/sipdiversion/funcs/func_base64.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/funcs/func_base64.c?rev=9515&r1=9514&r2=9515&view=diff
==============================================================================
--- team/oej/sipdiversion/funcs/func_base64.c (original)
+++ team/oej/sipdiversion/funcs/func_base64.c Sat Feb 11 07:17:28 2006
@@ -1,85 +1,117 @@
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 2005, Digium, Inc.
- * Copyright (C) 2005, Claude Patry
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
-
-/*! \file
- *
- * \brief Use the base64 as functions
- *
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-
-#include "asterisk.h"
-
-/* ASTERISK_FILE_VERSION(__FILE__, "Revision: 7221 ") */
-
-#include "asterisk/channel.h"
-#include "asterisk/pbx.h"
-#include "asterisk/logger.h"
-#include "asterisk/utils.h"
-#include "asterisk/app.h"
-
-static char *builtin_function_base64_encode(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
-{
- int res = 0;
-
- if (ast_strlen_zero(data) ) {
- ast_log(LOG_WARNING, "Syntax: BASE64_ENCODE(<data>) - missing argument!\n");
- return NULL;
- }
-
- ast_log(LOG_DEBUG, "data=%s\n",data);
- res = ast_base64encode(buf, data, strlen(data), len);
- ast_log(LOG_DEBUG, "res=%d\n", res);
- return buf;
-}
-
-static char *builtin_function_base64_decode(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
-{
- if (ast_strlen_zero(data) ) {
- ast_log(LOG_WARNING, "Syntax: BASE64_DECODE(<base_64 string>) - missing argument!\n");
- return NULL;
- }
-
- ast_log(LOG_DEBUG, "data=%s\n", data);
- ast_base64decode(buf, data, len);
- return buf;
-}
-
-#ifndef BUILTIN_FUNC
-static
-#endif
-struct ast_custom_function base64_encode_function = {
- .name = "BASE64_ENCODE",
- .synopsis = "Encode a string in base64",
- .desc = "Returns the base64 string\n",
- .syntax = "BASE64_ENCODE(<string>)",
- .read = builtin_function_base64_encode,
-};
-
-#ifndef BUILTIN_FUNC
-static
-#endif
-struct ast_custom_function base64_decode_function = {
- .name = "BASE64_DECODE",
- .synopsis = "Decode a base64 string",
- .desc = "Returns the plain text string\n",
- .syntax = "BASE64_DECODE(<base64_string>)",
- .read = builtin_function_base64_decode,
-};
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2005 - 2006, Digium, Inc.
+ * Copyright (C) 2005, Claude Patry
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief Use the base64 as functions
+ *
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/module.h"
+#include "asterisk/channel.h"
+#include "asterisk/pbx.h"
+#include "asterisk/logger.h"
+#include "asterisk/utils.h"
+#include "asterisk/app.h"
+
+static char *base64_encode(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+{
+ int res = 0;
+
+ if (ast_strlen_zero(data) ) {
+ ast_log(LOG_WARNING, "Syntax: BASE64_ENCODE(<data>) - missing argument!\n");
+ return NULL;
+ }
+
+ ast_log(LOG_DEBUG, "data=%s\n",data);
+ res = ast_base64encode(buf, data, strlen(data), len);
+ ast_log(LOG_DEBUG, "res=%d\n", res);
+ return buf;
+}
+
+static char *base64_decode(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+{
+ if (ast_strlen_zero(data) ) {
+ ast_log(LOG_WARNING, "Syntax: BASE64_DECODE(<base_64 string>) - missing argument!\n");
+ return NULL;
+ }
+
+ ast_log(LOG_DEBUG, "data=%s\n", data);
+ ast_base64decode(buf, data, len);
+ return buf;
+}
+
+static struct ast_custom_function base64_encode_function = {
+ .name = "BASE64_ENCODE",
+ .synopsis = "Encode a string in base64",
+ .desc = "Returns the base64 string\n",
+ .syntax = "BASE64_ENCODE(<string>)",
+ .read = base64_encode,
+};
+
+static struct ast_custom_function base64_decode_function = {
+ .name = "BASE64_DECODE",
+ .synopsis = "Decode a base64 string",
+ .desc = "Returns the plain text string\n",
+ .syntax = "BASE64_DECODE(<base64_string>)",
+ .read = base64_decode,
+};
+
+static char *tdesc = "base64 encode/decode dialplan functions";
+
+int unload_module(void)
+{
+ return ast_custom_function_unregister(&base64_encode_function) ||
+ ast_custom_function_unregister(&base64_decode_function);
+}
+
+int load_module(void)
+{
+ return ast_custom_function_register(&base64_encode_function) ||
+ ast_custom_function_register(&base64_decode_function);
+}
+
+char *description(void)
+{
+ return tdesc;
+}
+
+int usecount(void)
+{
+ return 0;
+}
+
+char *key()
+{
+ return ASTERISK_GPL_KEY;
+}
+
+/*
+Local Variables:
+mode: C
+c-file-style: "linux"
+indent-tabs-mode: nil
+End:
+*/
Propchange: team/oej/sipdiversion/funcs/func_base64.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/oej/sipdiversion/funcs/func_base64.c
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: team/oej/sipdiversion/funcs/func_callerid.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/funcs/func_callerid.c?rev=9515&r1=9514&r2=9515&view=diff
==============================================================================
--- team/oej/sipdiversion/funcs/func_callerid.c (original)
+++ team/oej/sipdiversion/funcs/func_callerid.c Sat Feb 11 07:17:28 2006
@@ -29,9 +29,7 @@
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-#ifndef BUILTIN_FUNC
#include "asterisk/module.h"
-#endif /* BUILTIN_FUNC */
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/logger.h"
@@ -120,10 +118,7 @@
}
}
-#ifndef BUILTIN_FUNC
-static
-#endif /* BUILTIN_FUNC */
-struct ast_custom_function callerid_function = {
+static struct ast_custom_function callerid_function = {
.name = "CALLERID",
.synopsis = "Gets or sets Caller*ID data on the channel.",
.syntax = "CALLERID(datatype[,<optional-CID>])",
@@ -134,7 +129,6 @@
.write = callerid_write,
};
-#ifndef BUILTIN_FUNC
static char *tdesc = "Caller ID related dialplan function";
int unload_module(void)
@@ -161,7 +155,6 @@
{
return ASTERISK_GPL_KEY;
}
-#endif /* BUILTIN_FUNC */
/*
Local Variables:
Modified: team/oej/sipdiversion/funcs/func_cdr.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/funcs/func_cdr.c?rev=9515&r1=9514&r2=9515&view=diff
==============================================================================
--- team/oej/sipdiversion/funcs/func_cdr.c (original)
+++ team/oej/sipdiversion/funcs/func_cdr.c Sat Feb 11 07:17:28 2006
@@ -29,8 +29,9 @@
#include "asterisk.h"
-/* ASTERISK_FILE_VERSION(__FILE__, "$Revision$") */
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/logger.h"
@@ -46,7 +47,7 @@
AST_APP_OPTION('r', OPT_RECURSIVE),
});
-static char *builtin_function_cdr_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static char *cdr_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
{
char *ret;
char *parse;
@@ -76,7 +77,7 @@
return ret;
}
-static void builtin_function_cdr_write(struct ast_channel *chan, char *cmd, char *data, const char *value)
+static void cdr_write(struct ast_channel *chan, char *cmd, char *data, const char *value)
{
char *parse;
struct ast_flags flags = {0};
@@ -107,15 +108,46 @@
ast_cdr_setvar(chan->cdr, args.variable, value, (ast_test_flag(&flags,OPT_RECURSIVE) ) ? 1 : 0 );
}
-#ifndef BUILTIN_FUNC
-static
-#endif
-struct ast_custom_function cdr_function = {
+static struct ast_custom_function cdr_function = {
.name = "CDR",
.synopsis = "Gets or sets a CDR variable",
.desc= "Option 'r' searches the entire stack of CDRs on the channel\n",
.syntax = "CDR(<name>[|options])",
- .read = builtin_function_cdr_read,
- .write = builtin_function_cdr_write,
+ .read = cdr_read,
+ .write = cdr_write,
};
+static char *tdesc = "CDR dialplan function";
+
+int unload_module(void)
+{
+ return ast_custom_function_unregister(&cdr_function);
+}
+
+int load_module(void)
+{
+ return ast_custom_function_register(&cdr_function);
+}
+
+char *description(void)
+{
+ return tdesc;
+}
+
+int usecount(void)
+{
+ return 0;
+}
+
+char *key()
+{
+ return ASTERISK_GPL_KEY;
+}
+
+/*
+Local Variables:
+mode: C
+c-file-style: "linux"
+indent-tabs-mode: nil
+End:
+*/
Modified: team/oej/sipdiversion/funcs/func_cut.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/funcs/func_cut.c?rev=9515&r1=9514&r2=9515&view=diff
==============================================================================
--- team/oej/sipdiversion/funcs/func_cut.c (original)
+++ team/oej/sipdiversion/funcs/func_cut.c Sat Feb 11 07:17:28 2006
@@ -301,9 +301,9 @@
int unload_module(void)
{
- int res;
-
- res = ast_custom_function_unregister(&acf_cut);
+ int res = 0;
+
+ res |= ast_custom_function_unregister(&acf_cut);
res |= ast_custom_function_unregister(&acf_sort);
STANDARD_HANGUP_LOCALUSERS;
@@ -313,9 +313,9 @@
int load_module(void)
{
- int res;
-
- res = ast_custom_function_register(&acf_cut);
+ int res = 0;
+
+ res |= ast_custom_function_register(&acf_cut);
res |= ast_custom_function_register(&acf_sort);
return res;
Modified: team/oej/sipdiversion/funcs/func_db.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/funcs/func_db.c?rev=9515&r1=9514&r2=9515&view=diff
==============================================================================
--- team/oej/sipdiversion/funcs/func_db.c (original)
+++ team/oej/sipdiversion/funcs/func_db.c Sat Feb 11 07:17:28 2006
@@ -32,8 +32,9 @@
#include "asterisk.h"
-/* ASTERISK_FILE_VERSION(__FILE__, "$Revision$") */
-
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/logger.h"
@@ -111,10 +112,7 @@
}
}
-#ifndef BUILTIN_FUNC
-static
-#endif
-struct ast_custom_function db_function = {
+static struct ast_custom_function db_function = {
.name = "DB",
.synopsis = "Read or Write from/to the Asterisk database",
.syntax = "DB(<family>/<key>)",
@@ -167,10 +165,7 @@
return buf;
}
-#ifndef BUILTIN_FUNC
-static
-#endif
-struct ast_custom_function db_exists_function = {
+static struct ast_custom_function db_exists_function = {
.name = "DB_EXISTS",
.synopsis = "Check to see if a key exists in the Asterisk database",
.syntax = "DB_EXISTS(<family>/<key>)",
@@ -180,3 +175,41 @@
"also set the variable DB_RESULT to the key's value if it exists.\n",
.read = function_db_exists,
};
+
+static char *tdesc = "Database (astdb) related dialplan functions";
+
+int unload_module(void)
+{
+ int res = 0;
+
+ res |= ast_custom_function_unregister(&db_function);
+ res |= ast_custom_function_unregister(&db_exists_function);
+
+ return res;
+}
+
+int load_module(void)
+{
+ int res = 0;
+
+ res |= ast_custom_function_register(&db_function);
+ res |= ast_custom_function_register(&db_exists_function);
+
+ return res;
+}
+
+char *description(void)
+{
+ return tdesc;
+}
+
+int usecount(void)
+{
+ return 0;
+}
+
+char *key()
+{
+ return ASTERISK_GPL_KEY;
+}
+
Modified: team/oej/sipdiversion/funcs/func_enum.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/funcs/func_enum.c?rev=9515&r1=9514&r2=9515&view=diff
==============================================================================
--- team/oej/sipdiversion/funcs/func_enum.c (original)
+++ team/oej/sipdiversion/funcs/func_enum.c Sat Feb 11 07:17:28 2006
@@ -34,9 +34,9 @@
#include "asterisk.h"
-#ifndef BUILTIN_FUNC
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
#include "asterisk/module.h"
-#endif /* BUILTIN_FUNC */
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/utils.h"
@@ -145,10 +145,7 @@
return buf;
}
-#ifndef BUILTIN_FUNC
-static
-#endif
-struct ast_custom_function enum_function = {
+static struct ast_custom_function enum_function = {
.name = "ENUMLOOKUP",
.synopsis = "ENUMLOOKUP allows for general or specific querying of NAPTR records"
" or counts of NAPTR types for ENUM or ENUM-like DNS pointers",
@@ -188,10 +185,7 @@
return buf;
}
-#ifndef BUILTIN_FUNC
-static
-#endif
-struct ast_custom_function txtcidname_function = {
+static struct ast_custom_function txtcidname_function = {
.name = "TXTCIDNAME",
.synopsis = "TXTCIDNAME looks up a caller name via DNS",
.syntax = "TXTCIDNAME(<number>)",
@@ -201,48 +195,46 @@
.read = function_txtcidname,
};
-#ifndef BUILTIN_FUNC
-
-static char *tdesc = "ENUM Related Functions";
+static char *tdesc = "ENUM related dialplan functions";
int unload_module(void)
{
- ast_custom_function_unregister(&enum_function);
- ast_custom_function_unregister(&txtcidname_function);
+ int res = 0;
+
+ res |= ast_custom_function_unregister(&enum_function);
+ res |= ast_custom_function_unregister(&txtcidname_function);
STANDARD_HANGUP_LOCALUSERS;
- return 0;
+ return res;
}
int load_module(void)
{
+ int res = 0;
+
+ res |= ast_custom_function_register(&enum_function);
+ res |= ast_custom_function_register(&txtcidname_function);
+
+ return res;
+}
+
+char *description(void)
+{
+ return tdesc;
+}
+
+int usecount(void)
+{
int res;
- res = ast_custom_function_register(&enum_function);
- if (!res)
- ast_custom_function_register(&txtcidname_function);
+ STANDARD_USECOUNT(res);
return res;
}
-char *description(void)
-{
- return tdesc;
-}
-
-int usecount(void)
-{
- int res;
-
- STANDARD_USECOUNT(res);
-
- return res;
-}
-
char *key()
{
return ASTERISK_GPL_KEY;
}
-#endif /* BUILTIN_FUNC */
-
+
Modified: team/oej/sipdiversion/funcs/func_env.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/funcs/func_env.c?rev=9515&r1=9514&r2=9515&view=diff
==============================================================================
--- team/oej/sipdiversion/funcs/func_env.c (original)
+++ team/oej/sipdiversion/funcs/func_env.c Sat Feb 11 07:17:28 2006
@@ -27,15 +27,16 @@
#include "asterisk.h"
-/* ASTERISK_FILE_VERSION(__FILE__, "$Revision$") */
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/logger.h"
#include "asterisk/utils.h"
#include "asterisk/app.h"
-static char *builtin_function_env_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static char *env_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
{
char *ret = "";
@@ -49,7 +50,7 @@
return buf;
}
-static void builtin_function_env_write(struct ast_channel *chan, char *cmd, char *data, const char *value)
+static void env_write(struct ast_channel *chan, char *cmd, char *data, const char *value)
{
if (!ast_strlen_zero(data)) {
if (!ast_strlen_zero(value)) {
@@ -60,7 +61,7 @@
}
}
-static char *builtin_function_stat_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static char *stat_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
{
char *action;
struct stat s;
@@ -105,25 +106,19 @@
return buf;
}
-#ifndef BUILTIN_FUNC
-static
-#endif
-struct ast_custom_function env_function = {
+static struct ast_custom_function env_function = {
.name = "ENV",
.synopsis = "Gets or sets the environment variable specified",
.syntax = "ENV(<envname>)",
- .read = builtin_function_env_read,
- .write = builtin_function_env_write,
+ .read = env_read,
+ .write = env_write,
};
-#ifndef BUILTIN_FUNC
-static
-#endif
-struct ast_custom_function stat_function = {
+static struct ast_custom_function stat_function = {
.name = "STAT",
.synopsis = "Does a check on the specified file",
.syntax = "STAT(<flag>,<filename>)",
- .read = builtin_function_stat_read,
+ .read = stat_read,
.desc =
"flag may be one of the following:\n"
" d - Checks if the file is a directory\n"
@@ -136,3 +131,48 @@
" M - Returns the epoch at which the file was last modified\n",
};
+
+static char *tdesc = "Environment/filesystem dialplan functions";
+
+int unload_module(void)
+{
+ int res = 0;
+
+ res |= ast_custom_function_unregister(&env_function);
+ res |= ast_custom_function_unregister(&stat_function);
+
+ return res;
+}
+
+int load_module(void)
+{
+ int res = 0;
+
+ res |= ast_custom_function_register(&env_function);
+ res |= ast_custom_function_register(&stat_function);
+
+ return res;
+}
+
+char *description(void)
+{
+ return tdesc;
+}
+
+int usecount(void)
+{
+ return 0;
+}
+
+char *key()
+{
+ return ASTERISK_GPL_KEY;
+}
+
+/*
+Local Variables:
+mode: C
+c-file-style: "linux"
+indent-tabs-mode: nil
+End:
+*/
Modified: team/oej/sipdiversion/funcs/func_groupcount.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/funcs/func_groupcount.c?rev=9515&r1=9514&r2=9515&view=diff
==============================================================================
--- team/oej/sipdiversion/funcs/func_groupcount.c (original)
+++ team/oej/sipdiversion/funcs/func_groupcount.c Sat Feb 11 07:17:28 2006
@@ -27,8 +27,9 @@
#include "asterisk.h"
-/* ASTERISK_FILE_VERSION(__FILE__, "$Revision$") */
-
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/logger.h"
@@ -57,10 +58,7 @@
return buf;
}
-#ifndef BUILTIN_FUNC
-static
-#endif
-struct ast_custom_function group_count_function = {
+static struct ast_custom_function group_count_function = {
.name = "GROUP_COUNT",
.syntax = "GROUP_COUNT([groupname][@category])",
.synopsis = "Counts the number of channels in the specified group",
@@ -85,10 +83,7 @@
return buf;
}
-#ifndef BUILTIN_FUNC
-static
-#endif
-struct ast_custom_function group_match_count_function = {
+static struct ast_custom_function group_match_count_function = {
.name = "GROUP_MATCH_COUNT",
.syntax = "GROUP_MATCH_COUNT(groupmatch[@category])",
.synopsis = "Counts the number of channels in the groups matching the specified pattern",
@@ -130,10 +125,7 @@
ast_log(LOG_WARNING, "Setting a group requires an argument (group name)\n");
}
-#ifndef BUILTIN_FUNC
-static
-#endif
-struct ast_custom_function group_function = {
+static struct ast_custom_function group_function = {
.name = "GROUP",
.syntax = "GROUP([category])",
.synopsis = "Gets or sets the channel group.",
@@ -171,10 +163,7 @@
return buf;
}
-#ifndef BUILTIN_FUNC
-static
-#endif
-struct ast_custom_function group_list_function = {
+static struct ast_custom_function group_list_function = {
.name = "GROUP_LIST",
.syntax = "GROUP_LIST()",
.synopsis = "Gets a list of the groups set on a channel.",
@@ -182,6 +171,47 @@
.read = group_list_function_read,
.write = NULL,
};
+
+static char *tdesc = "Channel group dialplan functions";
+
+int unload_module(void)
+{
+ int res = 0;
+
+ res |= ast_custom_function_unregister(&group_count_function);
+ res |= ast_custom_function_unregister(&group_match_count_function);
+ res |= ast_custom_function_unregister(&group_list_function);
+ res |= ast_custom_function_unregister(&group_function);
+
+ return res;
+}
+
+int load_module(void)
+{
+ int res = 0;
+
+ res |= ast_custom_function_register(&group_count_function);
+ res |= ast_custom_function_register(&group_match_count_function);
+ res |= ast_custom_function_register(&group_list_function);
+ res |= ast_custom_function_register(&group_function);
+
+ return res;
+}
+
+char *description(void)
+{
+ return tdesc;
+}
+
+int usecount(void)
+{
+ return 0;
+}
+
+char *key()
+{
+ return ASTERISK_GPL_KEY;
+}
/*
Local Variables:
Modified: team/oej/sipdiversion/funcs/func_language.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/funcs/func_language.c?rev=9515&r1=9514&r2=9515&view=diff
==============================================================================
--- team/oej/sipdiversion/funcs/func_language.c (original)
+++ team/oej/sipdiversion/funcs/func_language.c Sat Feb 11 07:17:28 2006
@@ -26,8 +26,9 @@
#include "asterisk.h"
-/* ASTERISK_FILE_VERSION(__FILE__, "$Revision$") */
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/logger.h"
@@ -35,23 +36,20 @@
#include "asterisk/app.h"
#include "asterisk/stringfields.h"
-static char *builtin_function_language_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static char *language_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
{
ast_copy_string(buf, chan->language, len);
return buf;
}
-static void builtin_function_language_write(struct ast_channel *chan, char *cmd, char *data, const char *value)
+static void language_write(struct ast_channel *chan, char *cmd, char *data, const char *value)
{
if (value)
ast_string_field_set(chan, language, value);
}
-#ifndef BUILTIN_FUNC
-static
-#endif
-struct ast_custom_function language_function = {
+static struct ast_custom_function language_function = {
.name = "LANGUAGE",
.synopsis = "Gets or sets the channel's language.",
.syntax = "LANGUAGE()",
@@ -63,9 +61,36 @@
"will play the normal 'demo-congrats'. For some language codes,\n"
"changing the language also changes the syntax of some Asterisk\n"
"functions, like SayNumber.\n",
- .read = builtin_function_language_read,
- .write = builtin_function_language_write,
+ .read = language_read,
+ .write = language_write,
};
+
+static char *tdesc = "Channel language dialplan function";
+
+int unload_module(void)
+{
+ return ast_custom_function_unregister(&language_function);
+}
+
+int load_module(void)
+{
+ return ast_custom_function_register(&language_function);
+}
+
+char *description(void)
+{
+ return tdesc;
+}
+
+int usecount(void)
+{
+ return 0;
+}
+
+char *key()
+{
+ return ASTERISK_GPL_KEY;
+}
/*
Local Variables:
Modified: team/oej/sipdiversion/funcs/func_logic.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/funcs/func_logic.c?rev=9515&r1=9514&r2=9515&view=diff
==============================================================================
--- team/oej/sipdiversion/funcs/func_logic.c (original)
+++ team/oej/sipdiversion/funcs/func_logic.c Sat Feb 11 07:17:28 2006
@@ -28,26 +28,26 @@
#include "asterisk.h"
-/* ASTERISK_FILE_VERSION(__FILE__, "$Revision$") */
-
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/logger.h"
#include "asterisk/utils.h"
#include "asterisk/app.h"
-#include "asterisk/config.h" /* for ast_true */
-
-static char *builtin_function_isnull(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+
+static char *isnull(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
{
return data && *data ? "0" : "1";
}
-static char *builtin_function_exists(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static char *exists(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
{
return data && *data ? "1" : "0";
}
-static char *builtin_function_iftime(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static char *iftime(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
{
struct ast_timing timing;
char *ret;
@@ -86,7 +86,7 @@
return ret;
}
-static char *builtin_function_if(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static char *acf_if(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
{
char *ret;
char *expr;
@@ -120,7 +120,7 @@
return ret;
}
-static char *builtin_function_set(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static char *set(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
{
char *varname;
char *val;
@@ -144,53 +144,80 @@
return buf;
}
-#ifndef BUILTIN_FUNC
-static
-#endif
-struct ast_custom_function isnull_function = {
+static struct ast_custom_function isnull_function = {
.name = "ISNULL",
.synopsis = "NULL Test: Returns 1 if NULL or 0 otherwise",
.syntax = "ISNULL(<data>)",
- .read = builtin_function_isnull,
-};
-
-#ifndef BUILTIN_FUNC
-static
-#endif
-struct ast_custom_function set_function = {
+ .read = isnull,
+};
+
+static struct ast_custom_function set_function = {
.name = "SET",
.synopsis = "SET assigns a value to a channel variable",
.syntax = "SET(<varname>=[<value>])",
- .read = builtin_function_set,
-};
-
-#ifndef BUILTIN_FUNC
-static
-#endif
-struct ast_custom_function exists_function = {
+ .read = set,
+};
+
+static struct ast_custom_function exists_function = {
.name = "EXISTS",
.synopsis = "Existence Test: Returns 1 if exists, 0 otherwise",
.syntax = "EXISTS(<data>)",
- .read = builtin_function_exists,
-};
-
-#ifndef BUILTIN_FUNC
-static
-#endif
-struct ast_custom_function if_function = {
+ .read = exists,
+};
+
+static struct ast_custom_function if_function = {
.name = "IF",
.synopsis = "Conditional: Returns the data following '?' if true else the data following ':'",
.syntax = "IF(<expr>?[<true>][:<false>])",
- .read = builtin_function_if,
-};
-
-
-#ifndef BUILTIN_FUNC
-static
-#endif
-struct ast_custom_function if_time_function = {
+ .read = acf_if,
+};
+
+static struct ast_custom_function if_time_function = {
.name = "IFTIME",
.synopsis = "Temporal Conditional: Returns the data following '?' if true else the data following ':'",
.syntax = "IFTIME(<timespec>?[<true>][:<false>])",
- .read = builtin_function_iftime,
-};
+ .read = iftime,
+};
+
+static char *tdesc = "Logical dialplan functions";
+
+int unload_module(void)
+{
+ int res = 0;
+
+ res |= ast_custom_function_unregister(&isnull_function);
+ res |= ast_custom_function_unregister(&set_function);
+ res |= ast_custom_function_unregister(&exists_function);
+ res |= ast_custom_function_unregister(&if_function);
+ res |= ast_custom_function_unregister(&if_time_function);
+
+ return res;
+}
+
+int load_module(void)
+{
+ int res = 0;
+
+ res |= ast_custom_function_register(&isnull_function);
+ res |= ast_custom_function_register(&set_function);
+ res |= ast_custom_function_register(&exists_function);
+ res |= ast_custom_function_register(&if_function);
+ res |= ast_custom_function_register(&if_time_function);
+
+ return res;
+}
+
+char *description(void)
+{
+ return tdesc;
+}
+
+int usecount(void)
+{
+ return 0;
+}
+
+char *key()
+{
+ return ASTERISK_GPL_KEY;
+}
Modified: team/oej/sipdiversion/funcs/func_math.c
[... 1010 lines stripped ...]
More information about the asterisk-commits
mailing list