OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall Root: /v/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-src Date: 23-Mar-2008 11:41:01 Branch: HEAD Handle: 2008032310410001 Modified files: openpkg-src/asterisk asterisk.patch asterisk.spec asterisk.txt Log: unify the AstDB filenames and regen the patch to be in sort order Summary: Revision Changes Path 1.37 +155 -143 openpkg-src/asterisk/asterisk.patch 1.67 +6 -7 openpkg-src/asterisk/asterisk.spec 1.40 +2 -0 openpkg-src/asterisk/asterisk.txt ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-src/asterisk/asterisk.patch ============================================================================ $ cvs diff -u -r1.36 -r1.37 asterisk.patch --- openpkg-src/asterisk/asterisk.patch 22 Mar 2008 18:37:24 -0000 1.36 +++ openpkg-src/asterisk/asterisk.patch 23 Mar 2008 10:41:00 -0000 1.37 @@ -1,6 +1,6 @@ Index: Makefile --- Makefile.orig 2008-03-18 16:58:50 +0100 -+++ Makefile 2008-03-22 17:34:52 +0100 ++++ Makefile 2008-03-23 11:34:24 +0100 @@ -121,42 +121,20 @@ # Define standard directories for various platforms @@ -71,9 +71,154 @@ mkdir -p $(DESTDIR)$(ASTDATADIR)/keys mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax +Index: apps/app_backticks.c +--- /dev/null 2008-03-23 11:34:42 +0100 ++++ apps/app_backticks.c 2008-03-23 11:34:24 +0100 +@@ -0,0 +1,129 @@ ++ ++#include "asterisk.h" ++ ++ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.37 $") ++ ++#include <stdio.h> ++#include <asterisk/file.h> ++#include <asterisk/logger.h> ++#include <asterisk/channel.h> ++#include <asterisk/pbx.h> ++#include <asterisk/module.h> ++#include <asterisk/lock.h> ++#include <asterisk/app.h> ++#include <stdlib.h> ++#include <unistd.h> ++#include <string.h> ++ ++static char *app = "BackTicks"; ++static char *synopsis = "Execute a shell command and save the result as a variable."; ++static char *desc = " Backticks(<VARNAME>|<command>)\n\n" ++ "Be sure to include a full path to the command!\n"; ++ ++static char *do_backticks(char *command, char *buf, size_t len) ++{ ++ int fds[2], pid = 0; ++ char *ret = NULL; ++ ++ memset(buf, 0, len); ++ if (pipe(fds)) { ++ ast_log(LOG_WARNING, "Pipe/Exec failed\n"); ++ } else { ++ pid = fork(); ++ if (pid < 0) { ++ ast_log(LOG_WARNING, "Fork failed\n"); ++ close(fds[0]); ++ close(fds[1]); ++ } else if (pid) { ++ /* parent */ ++ close(fds[1]); ++ read(fds[0], buf, len); ++ close(fds[0]); ++ ret = buf; ++ } else { ++ /* child */ ++ char *argv[255] = {0}; ++ int argc = 0; ++ char *p; ++ char *mycmd = ast_strdupa(command); ++ close(fds[0]); ++ dup2(fds[1], STDOUT_FILENO); ++ argv[argc++] = mycmd; ++ do { ++ if ((p = strchr(mycmd, ' '))) { ++ *p = '\0'; ++ mycmd = ++p; ++ argv[argc++] = mycmd; ++ } ++ } while (p != NULL); ++ close(fds[1]); ++ execv(argv[0], argv); ++ ast_log(LOG_ERROR, "exec of %s failed\n", argv[0]); ++ exit(0); ++ } ++ } ++ return ret; ++} ++ ++static int backticks_exec(struct ast_channel *chan, void *data) ++{ ++ int res = 0; ++ const char *usage = "Usage: Backticks(<VARNAME>|<command>)"; ++ char buf[1024], *argv[2], *mydata; ++ int argc = 0; ++ ++ if (!data) { ++ ast_log(LOG_WARNING, "%s\n", usage); ++ return -1; ++ } ++ ast_autoservice_start(chan); ++ if (!(mydata = ast_strdupa(data))) { ++ ast_log(LOG_ERROR, "Memory Error!\n"); ++ res = -1; ++ } else { ++ if((argc = ast_app_separate_args(mydata, '|', argv, sizeof(argv) / sizeof(argv[0]))) < 2) { ++ ast_log(LOG_WARNING, "%s\n", usage); ++ res = -1; ++ } ++ if (do_backticks(argv[1], buf, sizeof(buf))) ++ pbx_builtin_setvar_helper(chan, argv[0], buf); ++ else { ++ ast_log(LOG_WARNING, "No Data!\n"); ++ res = -1; ++ } ++ } ++ ast_autoservice_stop(chan); ++ return res; ++} ++ ++static int function_backticks(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) ++{ ++ if (!do_backticks(data, buf, len)) { ++ ast_log(LOG_WARNING, "No Data!\n"); ++ return -1; ++ } ++ return 0; ++} ++ ++static struct ast_custom_function backticks_function = { ++ .name = "BACKTICKS", ++ .desc = "Executes a shell command and evaluates to the result.", ++ .syntax = "BACKTICKS(<command>)", ++ .synopsis = "Executes a shell command.", ++ .read = function_backticks ++}; ++ ++static int unload_module(void) ++{ ++ ast_custom_function_unregister(&backticks_function); ++ return ast_unregister_application(app); ++} ++ ++static int load_module(void) ++{ ++ ast_custom_function_register(&backticks_function); ++ return ast_register_application(app, backticks_exec, synopsis, desc); ++} ++ ++AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "BACKTICKS() dialplan function"); ++ +Index: build_tools/make_defaults_h +--- build_tools/make_defaults_h.orig 2008-01-24 23:58:10 +0100 ++++ build_tools/make_defaults_h 2008-03-23 11:35:27 +0100 +@@ -17,7 +17,7 @@ + #define DEFAULT_PID "${INSTALL_PATH}${ASTVARRUNDIR}/asterisk.pid" + + #define DEFAULT_VAR_DIR "${INSTALL_PATH}${ASTVARLIBDIR}" +-#define DEFAULT_DB "${INSTALL_PATH}${ASTDBDIR}/astdb" ++#define DEFAULT_DB "${INSTALL_PATH}${ASTDBDIR}/asterisk.db" + + #define DEFAULT_DATA_DIR "${INSTALL_PATH}${ASTDATADIR}" + #define DEFAULT_KEY_DIR "${INSTALL_PATH}${ASTDATADIR}/keys" Index: cdr/cdr_custom.c --- cdr/cdr_custom.c.orig 2007-11-21 00:16:15 +0100 -+++ cdr/cdr_custom.c 2008-03-22 17:34:52 +0100 ++++ cdr/cdr_custom.c 2008-03-23 11:34:24 +0100 @@ -78,7 +78,7 @@ ast_log(LOG_WARNING, "Format string too long, will be truncated, at line %d\n", var->lineno); ast_copy_string(format, var->value, sizeof(format) - 1); @@ -85,7 +230,7 @@ break; Index: cdr/cdr_sqlite3_custom.c --- cdr/cdr_sqlite3_custom.c.orig 2008-03-18 16:58:50 +0100 -+++ cdr/cdr_sqlite3_custom.c 2008-03-22 17:34:52 +0100 ++++ cdr/cdr_sqlite3_custom.c 2008-03-23 11:34:24 +0100 @@ -317,7 +317,7 @@ return AST_MODULE_LOAD_DECLINE; @@ -97,7 +242,7 @@ ast_log(LOG_ERROR, "Could not open database %s.\n", filename); Index: channels/console_video.h --- channels/console_video.h.orig 2008-01-09 19:03:40 +0100 -+++ channels/console_video.h 2008-03-22 17:34:52 +0100 ++++ channels/console_video.h 2008-03-23 11:34:24 +0100 @@ -28,10 +28,7 @@ "console {device}" #else @@ -112,7 +257,7 @@ "console {videodevice|videocodec" \ Index: configure --- configure.orig 2008-03-18 16:50:53 +0100 -+++ configure 2008-03-22 17:34:52 +0100 ++++ configure 2008-03-23 11:34:24 +0100 @@ -4026,12 +4026,6 @@ # note- does not work on FreeBSD @@ -128,7 +273,7 @@ if test ${sysconfdir} = '${prefix}/etc'; then Index: include/asterisk/module.h --- include/asterisk/module.h.orig 2008-02-27 09:20:15 +0100 -+++ include/asterisk/module.h 2008-03-22 17:34:52 +0100 ++++ include/asterisk/module.h 2008-03-23 11:34:24 +0100 @@ -271,7 +271,7 @@ /* forward declare this pointer in modules, so that macro/function calls that need it can get it, since it will actually be declared @@ -140,7 +285,7 @@ #define __MODULE_INFO_SECTION Index: main/Makefile --- main/Makefile.orig 2008-03-17 23:24:46 +0100 -+++ main/Makefile 2008-03-22 17:34:52 +0100 ++++ main/Makefile 2008-03-23 11:34:24 +0100 @@ -82,10 +82,7 @@ endif @@ -155,7 +300,7 @@ ifneq ($(findstring $(OSARCH), mingw32 cygwin ),) Index: main/tcptls.c --- main/tcptls.c.orig 2008-03-12 23:50:14 +0100 -+++ main/tcptls.c 2008-03-22 17:34:52 +0100 ++++ main/tcptls.c 2008-03-23 11:34:24 +0100 @@ -189,6 +189,7 @@ if (!ast_strlen_zero(cfg->cafile) || !ast_strlen_zero(cfg->capath)) { if (SSL_CTX_load_verify_locations(cfg->ssl_ctx, S_OR(cfg->cafile, NULL), S_OR(cfg->capath,NULL)) == 0) @@ -166,7 +311,7 @@ ast_verb(0, "SSL certificate ok\n"); Index: menuselect-tree --- menuselect-tree.orig 2008-03-18 18:05:36 +0100 -+++ menuselect-tree 2008-03-22 17:35:02 +0100 ++++ menuselect-tree 2008-03-23 11:34:24 +0100 @@ -134,6 +134,8 @@ </member> <member name="app_system" displayname="Generic System() application" remove_on_change="apps/app_system.o apps/app_system.so"> @@ -205,7 +350,7 @@ </member> Index: sounds/sounds.xml --- sounds/sounds.xml.orig 2008-03-06 05:46:17 +0100 -+++ sounds/sounds.xml 2008-03-22 17:34:52 +0100 ++++ sounds/sounds.xml 2008-03-23 11:34:24 +0100 @@ -4,9 +4,9 @@ <member name="CORE-SOUNDS-EN-ULAW" displayname="English, mu-Law format"> </member> @@ -225,136 +370,3 @@ </member> <member name="EXTRA-SOUNDS-EN-GSM" displayname="English, GSM format" > </member> -Index: apps/app_backticks.c ---- apps/app_backticks.c.orig 2008-03-22 19:24:28 +0100 -+++ apps/app_backticks.c 2008-03-22 19:29:01 +0100 -@@ -0,0 +1,129 @@ -+ -+#include "asterisk.h" -+ -+ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.36 $") -+ -+#include <stdio.h> -+#include <asterisk/file.h> -+#include <asterisk/logger.h> -+#include <asterisk/channel.h> -+#include <asterisk/pbx.h> -+#include <asterisk/module.h> -+#include <asterisk/lock.h> -+#include <asterisk/app.h> -+#include <stdlib.h> -+#include <unistd.h> -+#include <string.h> -+ -+static char *app = "BackTicks"; -+static char *synopsis = "Execute a shell command and save the result as a variable."; -+static char *desc = " Backticks(<VARNAME>|<command>)\n\n" -+ "Be sure to include a full path to the command!\n"; -+ -+static char *do_backticks(char *command, char *buf, size_t len) -+{ -+ int fds[2], pid = 0; -+ char *ret = NULL; -+ -+ memset(buf, 0, len); -+ if (pipe(fds)) { -+ ast_log(LOG_WARNING, "Pipe/Exec failed\n"); -+ } else { -+ pid = fork(); -+ if (pid < 0) { -+ ast_log(LOG_WARNING, "Fork failed\n"); -+ close(fds[0]); -+ close(fds[1]); -+ } else if (pid) { -+ /* parent */ -+ close(fds[1]); -+ read(fds[0], buf, len); -+ close(fds[0]); -+ ret = buf; -+ } else { -+ /* child */ -+ char *argv[255] = {0}; -+ int argc = 0; -+ char *p; -+ char *mycmd = ast_strdupa(command); -+ close(fds[0]); -+ dup2(fds[1], STDOUT_FILENO); -+ argv[argc++] = mycmd; -+ do { -+ if ((p = strchr(mycmd, ' '))) { -+ *p = '\0'; -+ mycmd = ++p; -+ argv[argc++] = mycmd; -+ } -+ } while (p != NULL); -+ close(fds[1]); -+ execv(argv[0], argv); -+ ast_log(LOG_ERROR, "exec of %s failed\n", argv[0]); -+ exit(0); -+ } -+ } -+ return ret; -+} -+ -+static int backticks_exec(struct ast_channel *chan, void *data) -+{ -+ int res = 0; -+ const char *usage = "Usage: Backticks(<VARNAME>|<command>)"; -+ char buf[1024], *argv[2], *mydata; -+ int argc = 0; -+ -+ if (!data) { -+ ast_log(LOG_WARNING, "%s\n", usage); -+ return -1; -+ } -+ ast_autoservice_start(chan); -+ if (!(mydata = ast_strdupa(data))) { -+ ast_log(LOG_ERROR, "Memory Error!\n"); -+ res = -1; -+ } else { -+ if((argc = ast_app_separate_args(mydata, '|', argv, sizeof(argv) / sizeof(argv[0]))) < 2) { -+ ast_log(LOG_WARNING, "%s\n", usage); -+ res = -1; -+ } -+ if (do_backticks(argv[1], buf, sizeof(buf))) -+ pbx_builtin_setvar_helper(chan, argv[0], buf); -+ else { -+ ast_log(LOG_WARNING, "No Data!\n"); -+ res = -1; -+ } -+ } -+ ast_autoservice_stop(chan); -+ return res; -+} -+ -+static int function_backticks(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) -+{ -+ if (!do_backticks(data, buf, len)) { -+ ast_log(LOG_WARNING, "No Data!\n"); -+ return -1; -+ } -+ return 0; -+} -+ -+static struct ast_custom_function backticks_function = { -+ .name = "BACKTICKS", -+ .desc = "Executes a shell command and evaluates to the result.", -+ .syntax = "BACKTICKS(<command>)", -+ .synopsis = "Executes a shell command.", -+ .read = function_backticks -+}; -+ -+static int unload_module(void) -+{ -+ ast_custom_function_unregister(&backticks_function); -+ return ast_unregister_application(app); -+} -+ -+static int load_module(void) -+{ -+ ast_custom_function_register(&backticks_function); -+ return ast_register_application(app, backticks_exec, synopsis, desc); -+} -+ -+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "BACKTICKS() dialplan function"); -+ @@ . patch -p0 <<'@@ .' Index: openpkg-src/asterisk/asterisk.spec ============================================================================ $ cvs diff -u -r1.66 -r1.67 asterisk.spec --- openpkg-src/asterisk/asterisk.spec 23 Mar 2008 10:30:33 -0000 1.66 +++ openpkg-src/asterisk/asterisk.spec 23 Mar 2008 10:41:00 -0000 1.67 @@ -458,14 +458,14 @@ ( echo "[asterisk-sqlite]" echo "Description = Asterisk SQLite Database" echo "Driver = SQLite3" - echo "Database = $RPM_INSTALL_PREFIX/var/asterisk/db/astdb.sqlite" + echo "Database = $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite" echo "Timeout = 2000" ) | $RPM_INSTALL_PREFIX/bin/odbcinst -i -s -l -n "asterisk-sqlite" -r >/dev/null 2>&1 || true fi if [ ! -f $RPM_INSTALL_PREFIX/var/asterisk/run/asterisk.db ]; then ( umask 007 echo "CREATE TABLE map (key TEXT, val TEXT);" | $RPM_INSTALL_PREFIX/bin/isql "asterisk-sqlite" -b - chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/asterisk/db/astdb.sqlite >/dev/null 2>&1 || true + chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite >/dev/null 2>&1 || true ) || exit $? fi %endif @@ -476,11 +476,6 @@ exit 0 %preun -%if "%{with_odbc}" == "yes" - # before erase, optionally unlink from ODBC and destroy database - $RPM_INSTALL_PREFIX/bin/odbcinst -u -s -l -n "asterisk-sqlite" >/dev/null 2>&1 || true - rm -f $RPM_INSTALL_PREFIX/var/asterisk/db/astdb.sqlite >/dev/null 2>&1 || true -%endif # before erase, stop service and remove log files [ $1 -eq 0 ] || exit 0 %{l_rc} asterisk stop 2>/dev/null @@ -489,5 +484,9 @@ rm -f $RPM_INSTALL_PREFIX/var/asterisk/run/* >/dev/null 2>&1 || true rm -f $RPM_INSTALL_PREFIX/var/asterisk/spool/*/* >/dev/null 2>&1 || true rm -f $RPM_INSTALL_PREFIX/var/asterisk/db/* >/dev/null 2>&1 || true +%if "%{with_odbc}" == "yes" + # before erase, optionally unlink from ODBC and destroy database + $RPM_INSTALL_PREFIX/bin/odbcinst -u -s -l -n "asterisk-sqlite" >/dev/null 2>&1 || true +%endif exit 0 @@ . patch -p0 <<'@@ .' Index: openpkg-src/asterisk/asterisk.txt ============================================================================ $ cvs diff -u -r1.39 -r1.40 asterisk.txt --- openpkg-src/asterisk/asterisk.txt 23 Mar 2008 10:30:33 -0000 1.39 +++ openpkg-src/asterisk/asterisk.txt 23 Mar 2008 10:41:01 -0000 1.40 @@ -710,6 +710,7 @@ ;; func_odbc.conf -- Asterisk ODBC dialplan function configuration ;; +; SQLite-based Asterisk Database Access (random SQL access) ; Set(<variable_name>=${ASTDB_SQL(SELECT [...])}) ; Set(ASTDB_SQL(UPDATE [...])) [SQL] @@ -718,6 +719,7 @@ readsql = ${ARG1} writesql = ${ARG1} +; SQLite-based Asterisk Database Access (fixed key/value access) ; Set(<variable_name>=${ASTDB_MAP(<key>)}) ; Set(ASTDB_MAP(<key>)=<value>) [MAP] @@ . ______________________________________________________________________ OpenPKG http://openpkg.org CVS Repository Commit List openpkg-cvs@openpkg.org