[svn-commits] russell: branch russell/data_retrieval r115543 - in /team/russell/data_retrie...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed May 7 22:27:45 CDT 2008


Author: russell
Date: Wed May  7 22:27:44 2008
New Revision: 115543

URL: http://svn.digium.com/view/asterisk?view=rev&rev=115543
Log:
resolve, reset

Added:
    team/russell/data_retrieval/include/asterisk/taskprocessor.h
      - copied unchanged from r115537, trunk/include/asterisk/taskprocessor.h
    team/russell/data_retrieval/main/taskprocessor.c
      - copied unchanged from r115537, trunk/main/taskprocessor.c
Modified:
    team/russell/data_retrieval/   (props changed)
    team/russell/data_retrieval/CHANGES
    team/russell/data_retrieval/Makefile
    team/russell/data_retrieval/UPGRADE.txt
    team/russell/data_retrieval/acinclude.m4
    team/russell/data_retrieval/apps/app_chanspy.c
    team/russell/data_retrieval/apps/app_queue.c
    team/russell/data_retrieval/apps/app_voicemail.c
    team/russell/data_retrieval/build_tools/menuselect-deps.in
    team/russell/data_retrieval/channels/chan_h323.c
    team/russell/data_retrieval/channels/chan_iax2.c
    team/russell/data_retrieval/channels/chan_sip.c
    team/russell/data_retrieval/codecs/codec_speex.c
    team/russell/data_retrieval/configure
    team/russell/data_retrieval/configure.ac
    team/russell/data_retrieval/contrib/init.d/rc.debian.asterisk
    team/russell/data_retrieval/contrib/init.d/rc.gentoo.asterisk
    team/russell/data_retrieval/contrib/init.d/rc.mandrake.asterisk
    team/russell/data_retrieval/contrib/init.d/rc.redhat.asterisk
    team/russell/data_retrieval/contrib/init.d/rc.slackware.asterisk
    team/russell/data_retrieval/contrib/init.d/rc.suse.asterisk
    team/russell/data_retrieval/contrib/scripts/asterisk.ldap-schema
    team/russell/data_retrieval/contrib/scripts/asterisk.ldif
    team/russell/data_retrieval/contrib/scripts/get_ilbc_source.sh
    team/russell/data_retrieval/contrib/scripts/safe_asterisk
    team/russell/data_retrieval/funcs/func_speex.c
    team/russell/data_retrieval/include/asterisk/_private.h
    team/russell/data_retrieval/include/asterisk/autoconfig.h.in
    team/russell/data_retrieval/include/asterisk/compiler.h
    team/russell/data_retrieval/include/asterisk/dlinkedlists.h   (props changed)
    team/russell/data_retrieval/include/asterisk/res_odbc.h
    team/russell/data_retrieval/main/Makefile
    team/russell/data_retrieval/main/asterisk.c
    team/russell/data_retrieval/main/config.c
    team/russell/data_retrieval/main/event.c
    team/russell/data_retrieval/main/logger.c
    team/russell/data_retrieval/main/manager.c
    team/russell/data_retrieval/main/pbx.c
    team/russell/data_retrieval/main/sched.c
    team/russell/data_retrieval/res/res_config_ldap.c
    team/russell/data_retrieval/res/res_musiconhold.c
    team/russell/data_retrieval/res/res_odbc.c
    team/russell/data_retrieval/sounds/Makefile
    team/russell/data_retrieval/utils/refcounter.c

Propchange: team/russell/data_retrieval/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/russell/data_retrieval/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/russell/data_retrieval/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/russell/data_retrieval/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed May  7 22:27:44 2008
@@ -1,1 +1,1 @@
-/trunk:1-115242
+/trunk:1-115542

Modified: team/russell/data_retrieval/CHANGES
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/CHANGES?view=diff&rev=115543&r1=115542&r2=115543
==============================================================================
--- team/russell/data_retrieval/CHANGES (original)
+++ team/russell/data_retrieval/CHANGES Wed May  7 22:27:44 2008
@@ -96,6 +96,11 @@
 Dialplan function changes
 -------------------------
  * TIMEOUT() has been modified to be accurate down to the millisecond.
+
+AMI - The manager (TCP/TLS/HTTP)
+--------------------------------
+  * The Status command now takes an optional list of variables to display
+    along with channel status.
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 1.4.X to Asterisk 1.6.0  -------------

Modified: team/russell/data_retrieval/Makefile
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/Makefile?view=diff&rev=115543&r1=115542&r2=115543
==============================================================================
--- team/russell/data_retrieval/Makefile (original)
+++ team/russell/data_retrieval/Makefile Wed May  7 22:27:44 2008
@@ -351,7 +351,7 @@
 	@exit 1
 
 menuselect.makeopts: menuselect/menuselect menuselect-tree makeopts
-	menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
+	menuselect/menuselect --check-deps menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS)
 
 $(MOD_SUBDIRS_EMBED_LDSCRIPT):
 	@echo "EMBED_LDSCRIPTS+="`$(SILENTMAKE) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
@@ -821,16 +821,16 @@
 nmenuconfig: nmenuselect
 
 menuselect: menuselect/menuselect menuselect-tree
-	- at menuselect/menuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
+	- at menuselect/menuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
 
 cmenuselect: menuselect/cmenuselect menuselect-tree
-	- at menuselect/cmenuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
+	- at menuselect/cmenuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
 
 gmenuselect: menuselect/gmenuselect menuselect-tree
-	- at menuselect/gmenuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
+	- at menuselect/gmenuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
 
 nmenuselect: menuselect/nmenuselect menuselect-tree
-	- at menuselect/nmenuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
+	- at menuselect/nmenuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
 
 # options for make in menuselect/
 MAKE_MENUSELECT=CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
@@ -869,4 +869,4 @@
 asterisk.pdf:
 	$(MAKE) -C doc/tex asterisk.pdf
 
-.PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all pdf dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_DIST_CLEAN) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) badshell main/version.c include/asterisk/version.h installdirs
+.PHONY: menuselect menuselect.makeopts main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all pdf dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_DIST_CLEAN) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) badshell main/version.c include/asterisk/version.h installdirs

Modified: team/russell/data_retrieval/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/UPGRADE.txt?view=diff&rev=115543&r1=115542&r2=115543
==============================================================================
--- team/russell/data_retrieval/UPGRADE.txt (original)
+++ team/russell/data_retrieval/UPGRADE.txt Wed May  7 22:27:44 2008
@@ -94,8 +94,8 @@
   these functions in any location where you desire to ensure that only one
   channel is executing that path at any one time.  The Macro() applications
   are deprecated for performance reasons.  However, since Macro() has been
-  around for a long time and so many dialplans depend heavily on it, it will
-  not be removed for the sake of backwards compatibility.  It is also worth
+  around for a long time and so many dialplans depend heavily on it, for the
+  sake of backwards compatibility it will not be removed .  It is also worth
   noting that using both Macro() and GoSub() at the same time is _heavily_
   discouraged.
 * Read() now sets a READSTATUS variable on exit.  It does NOT automatically
@@ -110,6 +110,8 @@
   instead.
 * While app_directory has always relied on having a voicemail.conf or users.conf file
   correctly set up, it now is dependent on app_voicemail being compiled as well.
+* The arguments in ExecIf changed a bit, to be more like other applications.
+  The syntax is now ExecIf(<cond>?appiftrue(args):appiffalse(args)).
 
 Dialplan Functions:
 

Modified: team/russell/data_retrieval/acinclude.m4
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/acinclude.m4?view=diff&rev=115543&r1=115542&r2=115543
==============================================================================
--- team/russell/data_retrieval/acinclude.m4 (original)
+++ team/russell/data_retrieval/acinclude.m4 Wed May  7 22:27:44 2008
@@ -7,13 +7,17 @@
 AC_DEFUN([AST_GCC_ATTRIBUTE],
 [
 AC_MSG_CHECKING(for compiler 'attribute $1' support)
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Werror"
 AC_COMPILE_IFELSE(
-	AC_LANG_PROGRAM([static int __attribute__(($1)) test(void) {}],
+	AC_LANG_PROGRAM([static void __attribute__(($1)) *test(void *muffin, ...) {}],
 			[]),
 	AC_MSG_RESULT(yes)
 	AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),
 	AC_MSG_RESULT(no))
-])
+]
+CFLAGS="$saved_CFLAGS"
+)
 
 # Helper function to setup variables for a package.
 # $1 -> the package name. Used in configure.ac and also as a prefix

Modified: team/russell/data_retrieval/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/apps/app_chanspy.c?view=diff&rev=115543&r1=115542&r2=115543
==============================================================================
--- team/russell/data_retrieval/apps/app_chanspy.c (original)
+++ team/russell/data_retrieval/apps/app_chanspy.c Wed May  7 22:27:44 2008
@@ -71,6 +71,8 @@
 "        and a digit sequence.\n"
 "  Options:\n"
 "    b                      - Only spy on channels involved in a bridged call.\n"
+"    B                      - Instead of whispering on a single channel barge in on both\n"
+"                             channels involved in the call.\n"
 "    g(grp)                 - Only spy on channels in which one or more of the groups \n"
 "                             listed in 'grp' matches one or more groups from the\n"
 "                             SPYGROUP variable set on the channel to be spied upon.\n"

Modified: team/russell/data_retrieval/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/apps/app_queue.c?view=diff&rev=115543&r1=115542&r2=115543
==============================================================================
--- team/russell/data_retrieval/apps/app_queue.c (original)
+++ team/russell/data_retrieval/apps/app_queue.c Wed May  7 22:27:44 2008
@@ -92,6 +92,7 @@
 #include "asterisk/astobj2.h"
 #include "asterisk/strings.h"
 #include "asterisk/global_datastores.h"
+#include "asterisk/taskprocessor.h"
 
 /*!
  * \par Please read before modifying this file.
@@ -130,6 +131,8 @@
 	{ QUEUE_STRATEGY_LINEAR, "linear" },
 	{ QUEUE_STRATEGY_WRANDOM, "wrandom"},
 };
+
+static struct ast_taskprocessor *devicestate_tps;
 
 #define DEFAULT_RETRY		5
 #define DEFAULT_TIMEOUT		15
@@ -739,18 +742,20 @@
 }
 
 /*! \brief set a member's status based on device state of that member's interface*/
-static void *handle_statechange(struct statechange *sc)
+static int handle_statechange(void *datap)
 {
 	struct member_interface *curint;
 	char *loc;
 	char *technology;
+	struct statechange *sc = datap;
 
 	technology = ast_strdupa(sc->dev);
 	loc = strchr(technology, '/');
 	if (loc) {
 		*loc++ = '\0';
 	} else {
-		return NULL;
+		ast_free(sc);
+		return 0;
 	}
 
 	AST_LIST_LOCK(&interfaces);
@@ -770,84 +775,14 @@
 	if (!curint) {
 		if (option_debug > 2)
 			ast_log(LOG_DEBUG, "Device '%s/%s' changed to state '%d' (%s) but we don't care because they're not a member of any queue.\n", technology, loc, sc->state, devstate2str(sc->state));
-		return NULL;
+		return 0;
 	}
 
 	if (option_debug)
 		ast_log(LOG_DEBUG, "Device '%s/%s' changed to state '%d' (%s)\n", technology, loc, sc->state, devstate2str(sc->state));
 
 	update_status(sc->dev, sc->state);
-
-	return NULL;
-}
-
-/*! \brief Data used by the device state thread */
-static struct {
-	/*! Set to 1 to stop the thread */
-	unsigned int stop:1;
-	/*! The device state monitoring thread */
-	pthread_t thread;
-	/*! Lock for the state change queue */
-	ast_mutex_t lock;
-	/*! Condition for the state change queue */
-	ast_cond_t cond;
-	/*! Queue of state changes */
-	AST_LIST_HEAD_NOLOCK(, statechange) state_change_q;
-} device_state = {
-	.thread = AST_PTHREADT_NULL,
-};
-
-/*! \brief Consumer of the statechange queue */
-static void *device_state_thread(void *data)
-{
-	struct statechange *sc = NULL;
-
-	while (!device_state.stop) {
-		ast_mutex_lock(&device_state.lock);
-		if (!(sc = AST_LIST_REMOVE_HEAD(&device_state.state_change_q, entry))) {
-			ast_cond_wait(&device_state.cond, &device_state.lock);
-			sc = AST_LIST_REMOVE_HEAD(&device_state.state_change_q, entry);
-		}
-		ast_mutex_unlock(&device_state.lock);
-
-		/* Check to see if we were woken up to see the request to stop */
-		if (device_state.stop)
-			break;
-
-		if (!sc)
-			continue;
-
-		handle_statechange(sc);
-
-		ast_free(sc);
-		sc = NULL;
-	}
-
-	if (sc)
-		ast_free(sc);
-
-	while ((sc = AST_LIST_REMOVE_HEAD(&device_state.state_change_q, entry)))
-		ast_free(sc);
-
-	return NULL;
-}
-
-/*! \brief Producer of the statechange queue */
-static int statechange_queue(const char *dev, enum ast_device_state state)
-{
-	struct statechange *sc;
-
-	if (!(sc = ast_calloc(1, sizeof(*sc) + strlen(dev) + 1)))
-		return 0;
-
-	sc->state = state;
-	strcpy(sc->dev, dev);
-
-	ast_mutex_lock(&device_state.lock);
-	AST_LIST_INSERT_TAIL(&device_state.state_change_q, sc, entry);
-	ast_cond_signal(&device_state.cond);
-	ast_mutex_unlock(&device_state.lock);
-
+	ast_free(sc);
 	return 0;
 }
 
@@ -855,6 +790,8 @@
 {
 	enum ast_device_state state;
 	const char *device;
+	struct statechange *sc;
+	size_t datapsize;
 
 	state = ast_event_get_ie_uint(event, AST_EVENT_IE_STATE);
 	device = ast_event_get_ie_str(event, AST_EVENT_IE_DEVICE);
@@ -863,8 +800,16 @@
 		ast_log(LOG_ERROR, "Received invalid event that had no device IE\n");
 		return;
 	}
-
-	statechange_queue(device, state);
+	datapsize = sizeof(*sc) + strlen(device) + 1;
+	if (!(sc = ast_calloc(1, datapsize))) {
+		ast_log(LOG_ERROR, "failed to calloc a state change struct\n");
+		return;
+	}
+	sc->state = state;
+	strcpy(sc->dev, device);
+	if (ast_taskprocessor_push(devicestate_tps, handle_statechange, sc) < 0) {
+		ast_free(sc);
+	}
 }
 
 /*! \brief allocate space for new queue member and set fields based on parameters passed */
@@ -3349,7 +3294,6 @@
 		/* Ah ha!  Someone answered within the desired timeframe.  Of course after this
 		   we will always return with -1 so that it is hung up properly after the
 		   conversation.  */
-		qe->handled++;
 		if (!strcmp(qe->chan->tech->type, "Zap"))
 			ast_channel_setoption(qe->chan, AST_OPTION_TONE_VERIFY, &nondataquality, sizeof(nondataquality), 0);
 		if (!strcmp(peer->tech->type, "Zap"))
@@ -3403,7 +3347,6 @@
 				/* Agent must have hung up */
 				ast_log(LOG_WARNING, "Agent on %s hungup on the customer.\n", peer->name);
 				ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "AGENTDUMP", "%s", "");
-				record_abandoned(qe);
 				if (qe->parent->eventwhencalled)
 					manager_event(EVENT_FLAG_AGENT, "AgentDump",
 							"Queue: %s\r\n"
@@ -3683,6 +3626,7 @@
 			} else
 				ast_log(LOG_WARNING, "Asked to execute an AGI on this channel, but could not find application (agi)!\n");
 		}
+		qe->handled++;
 		ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "CONNECT", "%ld|%s|%ld", (long) time(NULL) - qe->start, peer->uniqueid,
 													(long)(orig - to > 0 ? (orig - to) / 1000 : 0));
 		if (update_cdr && qe->chan->cdr) 
@@ -6249,14 +6193,6 @@
 	struct ao2_iterator q_iter;
 	struct call_queue *q = NULL;
 
-	if (device_state.thread != AST_PTHREADT_NULL) {
-		device_state.stop = 1;
-		ast_mutex_lock(&device_state.lock);
-		ast_cond_signal(&device_state.cond);
-		ast_mutex_unlock(&device_state.lock);
-		pthread_join(device_state.thread, NULL);
-	}
-
 	ast_cli_unregister_multiple(cli_queue, sizeof(cli_queue) / sizeof(struct ast_cli_entry));
 	res = ast_manager_unregister("QueueStatus");
 	res |= ast_manager_unregister("Queues");
@@ -6296,7 +6232,7 @@
 		queue_unref(q);
 	}
 	ao2_ref(queues, -1);
-
+	devicestate_tps = ast_taskprocessor_unreference(devicestate_tps);
 	return res;
 }
 
@@ -6318,10 +6254,6 @@
 
 	if (queue_persistent_members)
 		reload_queue_members();
-
-	ast_mutex_init(&device_state.lock);
-	ast_cond_init(&device_state.cond, NULL);
-	ast_pthread_create(&device_state.thread, NULL, device_state_thread, NULL);
 
 	ast_cli_register_multiple(cli_queue, sizeof(cli_queue) / sizeof(struct ast_cli_entry));
 	res = ast_register_application(app, queue_exec, synopsis, descrip);
@@ -6345,6 +6277,11 @@
 	res |= ast_custom_function_register(&queuememberlist_function);
 	res |= ast_custom_function_register(&queuewaitingcount_function);
 	res |= ast_custom_function_register(&queuememberpenalty_function);
+
+	if (!(devicestate_tps = ast_taskprocessor_get("app_queue", 0))) {
+		ast_log(LOG_WARNING, "devicestate taskprocessor reference failed - devicestate notifications will not occur\n");
+	}
+
 	if (!(device_state_sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE, device_state_cb, NULL, AST_EVENT_IE_END)))
 		res = -1;
 

Modified: team/russell/data_retrieval/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/apps/app_voicemail.c?view=diff&rev=115543&r1=115542&r2=115543
==============================================================================
--- team/russell/data_retrieval/apps/app_voicemail.c (original)
+++ team/russell/data_retrieval/apps/app_voicemail.c Wed May  7 22:27:44 2008
@@ -114,6 +114,7 @@
 #include "asterisk/stringfields.h"
 #include "asterisk/smdi.h"
 #include "asterisk/event.h"
+#include "asterisk/taskprocessor.h"
 
 #ifdef ODBC_STORAGE
 #include "asterisk/res_odbc.h"
@@ -620,6 +621,14 @@
 	uint32_t uniqueid;
 	char mailbox[1];
 };
+
+struct mwi_sub_task {
+	const char *mailbox;
+	const char *context;
+	uint32_t uniqueid;
+};
+
+static struct ast_taskprocessor *mwi_subscription_tps;
 
 static AST_RWLIST_HEAD_STATIC(mwi_subs, mwi_sub);
 
@@ -8716,22 +8725,14 @@
 	ast_free(mwi_sub);
 }
 
-static void mwi_unsub_event_cb(const struct ast_event *event, void *userdata)
-{
-	uint32_t uniqueid;
+static int handle_unsubscribe(void *datap)
+{
 	struct mwi_sub *mwi_sub;
-
-	if (ast_event_get_type(event) != AST_EVENT_UNSUB)
-		return;
-
-	if (ast_event_get_ie_uint(event, AST_EVENT_IE_EVENTTYPE) != AST_EVENT_MWI)
-		return;
-
-	uniqueid = ast_event_get_ie_uint(event, AST_EVENT_IE_UNIQUEID);
-
+	uint32_t *uniqueid = datap;
+	
 	AST_RWLIST_WRLOCK(&mwi_subs);
 	AST_RWLIST_TRAVERSE_SAFE_BEGIN(&mwi_subs, mwi_sub, entry) {
-		if (mwi_sub->uniqueid == uniqueid) {
+		if (mwi_sub->uniqueid == *uniqueid) {
 			AST_LIST_REMOVE_CURRENT(entry);
 			break;
 		}
@@ -8741,48 +8742,80 @@
 
 	if (mwi_sub)
 		mwi_sub_destroy(mwi_sub);
-}
-
-static void mwi_sub_event_cb(const struct ast_event *event, void *userdata)
-{
-	const char *mailbox;
-	const char *context;
-	uint32_t uniqueid;
+
+	ast_free(uniqueid);	
+	return 0;
+}
+
+static int handle_subscribe(void *datap)
+{
 	unsigned int len;
 	struct mwi_sub *mwi_sub;
-
-	if (ast_event_get_type(event) != AST_EVENT_SUB)
-		return;
-
-	if (ast_event_get_ie_uint(event, AST_EVENT_IE_EVENTTYPE) != AST_EVENT_MWI)
-		return;
-
-	mailbox = ast_event_get_ie_str(event, AST_EVENT_IE_MAILBOX);
-	context = ast_event_get_ie_str(event, AST_EVENT_IE_CONTEXT);
-	uniqueid = ast_event_get_ie_uint(event, AST_EVENT_IE_UNIQUEID);
+	struct mwi_sub_task *p = datap;
 
 	len = sizeof(*mwi_sub);
-	if (!ast_strlen_zero(mailbox))
-		len += strlen(mailbox);
-
-	if (!ast_strlen_zero(context))
-		len += strlen(context) + 1; /* Allow for seperator */
+	if (!ast_strlen_zero(p->mailbox))
+		len += strlen(p->mailbox);
+
+	if (!ast_strlen_zero(p->context))
+		len += strlen(p->context) + 1; /* Allow for seperator */
 
 	if (!(mwi_sub = ast_calloc(1, len)))
-		return;
-
-	mwi_sub->uniqueid = uniqueid;
-	if (!ast_strlen_zero(mailbox))
-		strcpy(mwi_sub->mailbox, mailbox);
-
-	if (!ast_strlen_zero(context)) {
+		return -1;
+
+	mwi_sub->uniqueid = p->uniqueid;
+	if (!ast_strlen_zero(p->mailbox))
+		strcpy(mwi_sub->mailbox, p->mailbox);
+
+	if (!ast_strlen_zero(p->context)) {
 		strcat(mwi_sub->mailbox, "@");
-		strcat(mwi_sub->mailbox, context);
+		strcat(mwi_sub->mailbox, p->context);
 	}
 
 	AST_RWLIST_WRLOCK(&mwi_subs);
 	AST_RWLIST_INSERT_TAIL(&mwi_subs, mwi_sub, entry);
 	AST_RWLIST_UNLOCK(&mwi_subs);
+	ast_free(p);	
+	return 0;
+}
+
+static void mwi_unsub_event_cb(const struct ast_event *event, void *userdata)
+{
+	uint32_t u, *uniqueid = ast_calloc(1, sizeof(*uniqueid));
+	if (ast_event_get_type(event) != AST_EVENT_UNSUB)
+		return;
+
+	if (ast_event_get_ie_uint(event, AST_EVENT_IE_EVENTTYPE) != AST_EVENT_MWI)
+		return;
+
+	u = ast_event_get_ie_uint(event, AST_EVENT_IE_UNIQUEID);
+	*uniqueid = u;
+	if (ast_taskprocessor_push(mwi_subscription_tps, handle_unsubscribe, uniqueid) < 0) {
+		ast_free(uniqueid);
+	}
+}
+
+static void mwi_sub_event_cb(const struct ast_event *event, void *userdata)
+{
+	struct mwi_sub_task *mwist;
+	
+	if (ast_event_get_type(event) != AST_EVENT_SUB)
+		return;
+
+	if (ast_event_get_ie_uint(event, AST_EVENT_IE_EVENTTYPE) != AST_EVENT_MWI)
+		return;
+
+	if ((mwist = ast_calloc(1, (sizeof(*mwist)))) == NULL) {
+		ast_log(LOG_ERROR, "could not allocate a mwi_sub_task\n");
+		return;
+	}
+	mwist->mailbox = ast_event_get_ie_str(event, AST_EVENT_IE_MAILBOX);
+	mwist->context = ast_event_get_ie_str(event, AST_EVENT_IE_CONTEXT);
+	mwist->uniqueid = ast_event_get_ie_uint(event, AST_EVENT_IE_UNIQUEID);
+	
+	if (ast_taskprocessor_push(mwi_subscription_tps, handle_subscribe, mwist) < 0) {
+		ast_free(mwist);
+	}
 }
 
 static void start_poll_thread(void)
@@ -9605,6 +9638,7 @@
 	if (poll_thread != AST_PTHREADT_NULL)
 		stop_poll_thread();
 
+	mwi_subscription_tps = ast_taskprocessor_unreference(mwi_subscription_tps);
 	return res;
 }
 
@@ -9616,6 +9650,10 @@
 
 	/* compute the location of the voicemail spool directory */
 	snprintf(VM_SPOOL_DIR, sizeof(VM_SPOOL_DIR), "%s/voicemail/", ast_config_AST_SPOOL_DIR);
+	
+	if (!(mwi_subscription_tps = ast_taskprocessor_get("app_voicemail", 0))) {
+		ast_log(LOG_WARNING, "failed to reference mwi subscription taskprocessor.  MWI will not work\n");
+	}
 
 	if ((res = load_config(0)))
 		return res;

Modified: team/russell/data_retrieval/build_tools/menuselect-deps.in
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/build_tools/menuselect-deps.in?view=diff&rev=115543&r1=115542&r2=115543
==============================================================================
--- team/russell/data_retrieval/build_tools/menuselect-deps.in (original)
+++ team/russell/data_retrieval/build_tools/menuselect-deps.in Wed May  7 22:27:44 2008
@@ -32,6 +32,7 @@
 RADIUS=@PBX_RADIUS@
 SPEEX=@PBX_SPEEX@
 SPEEXDSP=@PBX_SPEEXDSP@
+SPEEX_PREPROCESS=@PBX_SPEEX_PREPROCESS@
 SQLITE3=@PBX_SQLITE3@
 SQLITE=@PBX_SQLITE@
 SS7=@PBX_SS7@

Modified: team/russell/data_retrieval/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/channels/chan_h323.c?view=diff&rev=115543&r1=115542&r2=115543
==============================================================================
--- team/russell/data_retrieval/channels/chan_h323.c (original)
+++ team/russell/data_retrieval/channels/chan_h323.c Wed May  7 22:27:44 2008
@@ -1548,11 +1548,11 @@
 	struct oh323_peer *peer;
 	struct ast_variable *var;
 	struct ast_variable *tmp;
-	const char *addr;
+	const char *addr = NULL;
 
 	/* First check on peer name */
 	if (peername)
-		var = ast_load_realtime("h323", "name", peername, addr = NULL);
+		var = ast_load_realtime("h323", "name", peername, NULL);
 	else if (sin) /* Then check on IP address for dynamic peers */
 		var = ast_load_realtime("h323", "host", addr = ast_inet_ntoa(sin->sin_addr), NULL);
 	else

Modified: team/russell/data_retrieval/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/channels/chan_iax2.c?view=diff&rev=115543&r1=115542&r2=115543
==============================================================================
--- team/russell/data_retrieval/channels/chan_iax2.c (original)
+++ team/russell/data_retrieval/channels/chan_iax2.c Wed May  7 22:27:44 2008
@@ -87,7 +87,6 @@
 #include "asterisk/netsock.h"
 #include "asterisk/stringfields.h"
 #include "asterisk/linkedlists.h"
-#include "asterisk/dlinkedlists.h"
 #include "asterisk/event.h"
 #include "asterisk/astobj2.h"
 
@@ -640,8 +639,6 @@
 	int frames_dropped;
 	/*! received frame count: (just for stats) */
 	int frames_received;
-
-	AST_DLLIST_ENTRY(chan_iax2_pvt) entry;
 };
 
 /*!
@@ -1588,20 +1585,7 @@
 	ao2_unlink(iax_peercallno_pvts, pvt);
 }
 
-/*!
- * \todo XXX Note that this function contains a very expensive operation that
- * happens for *every* incoming media frame.  It iterates through every
- * possible call number, locking and unlocking each one, to try to match the
- * incoming frame to an active call.  Call numbers can be up to 2^15, 32768.
- * So, for a call with a local call number of 20000, every incoming audio
- * frame would require 20000 mutex lock and unlock operations.  Ouch.
- *
- * It's a shame that IAX2 media frames carry the source call number instead of
- * the destination call number.  If they did, this lookup wouldn't be needed.
- * However, it's too late to change that now.  Instead, we need to come up with
- * a better way of indexing active calls so that these frequent lookups are not
- * so expensive.
- *
+/*
  * \note Calling this function while holding another pvt lock can cause a deadlock.
  */
 static int __find_callno(unsigned short callno, unsigned short dcallno, struct sockaddr_in *sin, int new, int sockfd, int return_locked, int full_frame)

Modified: team/russell/data_retrieval/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/channels/chan_sip.c?view=diff&rev=115543&r1=115542&r2=115543
==============================================================================
--- team/russell/data_retrieval/channels/chan_sip.c (original)
+++ team/russell/data_retrieval/channels/chan_sip.c Wed May  7 22:27:44 2008
@@ -6171,11 +6171,6 @@
 	const char *to = get_header(req, "To");
 	const char *cseq = get_header(req, "Cseq");
 	struct sip_pvt *sip_pvt_ptr;
-
-	callid = get_header(req, "Call-ID");
-	from = get_header(req, "From");
-	to = get_header(req, "To");
-	cseq = get_header(req, "Cseq");
 
 	/* Call-ID, to, from and Cseq are required by RFC 3261. (Max-forwards and via too - ignored now) */
 	/* get_header always returns non-NULL so we must use ast_strlen_zero() */
@@ -15056,6 +15051,7 @@
 	char resp[256];
 	char resp_hash[256];
 	char uri[256];
+	char opaque[256] = "";
 	char cnonce[80];
 	const char *username;
 	const char *secret;
@@ -15104,11 +15100,17 @@
 	else
 		snprintf(resp, sizeof(resp), "%s:%s:%s", a1_hash, p->nonce, a2_hash);
 	ast_md5_hash(resp_hash, resp);
+
+	/* only include the opaque string if it's set */
+	if (!ast_strlen_zero(p->opaque)) {
+	  snprintf(opaque, sizeof(opaque), ", opaque=\"%s\"", p->opaque);
+	}
+
 	/* XXX We hard code our qop to "auth" for now.  XXX */
 	if (!ast_strlen_zero(p->qop))
-		snprintf(digest, digest_len, "Digest username=\"%s\", realm=\"%s\", algorithm=MD5, uri=\"%s\", nonce=\"%s\", response=\"%s\", opaque=\"%s\", qop=auth, cnonce=\"%s\", nc=%08x", username, p->realm, uri, p->nonce, resp_hash, p->opaque, cnonce, p->noncecount);
+		snprintf(digest, digest_len, "Digest username=\"%s\", realm=\"%s\", algorithm=MD5, uri=\"%s\", nonce=\"%s\", response=\"%s\"%s, qop=auth, cnonce=\"%s\", nc=%08x", username, p->realm, uri, p->nonce, resp_hash, opaque, cnonce, p->noncecount);
 	else
-		snprintf(digest, digest_len, "Digest username=\"%s\", realm=\"%s\", algorithm=MD5, uri=\"%s\", nonce=\"%s\", response=\"%s\", opaque=\"%s\"", username, p->realm, uri, p->nonce, resp_hash, p->opaque);
+		snprintf(digest, digest_len, "Digest username=\"%s\", realm=\"%s\", algorithm=MD5, uri=\"%s\", nonce=\"%s\", response=\"%s\"%s", username, p->realm, uri, p->nonce, resp_hash, opaque);
 
 	append_history(p, "AuthResp", "Auth response sent for %s in realm %s - nc %d", username, p->realm, p->noncecount);
 
@@ -21968,7 +21970,7 @@
 	/* Done, tell the manager */
 	manager_event(EVENT_FLAG_SYSTEM, "ChannelReload", "ChannelType: SIP\r\nReloadReason: %s\r\nRegistry_Count: %d\r\nPeer_Count: %d\r\nUser_Count: %d\r\n", channelreloadreason2txt(reason), registry_count, peer_count, user_count);
 	run_end = time(0);
-	ast_log(LOG_NOTICE, "reload_config done...Runtime= %d sec\n", (int)(run_end-run_start));
+	ast_debug(4, "reload_config done...Runtime= %d sec\n", (int)(run_end-run_start));
 
 	return 0;
 }
@@ -22487,7 +22489,7 @@
 	sip_send_all_registers();
 	end_poke = time(0);
 	
-	ast_log(LOG_NOTICE, "do_reload finished. peer poke/prune reg contact time = %d sec.\n", (int)(end_poke-start_poke));
+	ast_debug(4, "do_reload finished. peer poke/prune reg contact time = %d sec.\n", (int)(end_poke-start_poke));
 
 	ast_debug(4, "--------------- SIP reload done\n");
 

Modified: team/russell/data_retrieval/codecs/codec_speex.c
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/codecs/codec_speex.c?view=diff&rev=115543&r1=115542&r2=115543
==============================================================================
--- team/russell/data_retrieval/codecs/codec_speex.c (original)
+++ team/russell/data_retrieval/codecs/codec_speex.c Wed May  7 22:27:44 2008
@@ -32,6 +32,7 @@
 
 /*** MODULEINFO
 	<depend>speex</depend>
+	<depend>speex_preprocess</depend>
 	<use>speexdsp</use>
  ***/
 

Modified: team/russell/data_retrieval/configure.ac
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/configure.ac?view=diff&rev=115543&r1=115542&r2=115543
==============================================================================
--- team/russell/data_retrieval/configure.ac (original)
+++ team/russell/data_retrieval/configure.ac Wed May  7 22:27:44 2008
@@ -1314,7 +1314,18 @@
 
 AST_EXT_LIB_CHECK([SPEEX], [speex], [speex_encode], [speex/speex.h], [-lm])
 
+# See if the main speex library contains the preprocess functions
+AST_EXT_LIB_CHECK([SPEEX_PREPROCESS], [speex], [speex_preprocess_ctl], [speex/speex.h], [-lm])
+if test "${PBX_SPEEX_PREPROCESS}" = 1; then
+   PBX_SPEEX_PREPROCESS=1
+fi
+
 AST_EXT_LIB_CHECK([SPEEXDSP], [speexdsp], [speex_preprocess_ctl], [speex/speex.h], [-lm])
+if test "${PBX_SPEEXDSP}" = 1; then
+   PBX_SPEEX_PREPROCESS=1
+fi
+
+AC_SUBST(PBX_SPEEX_PREPROCESS)
 
 AST_EXT_LIB_CHECK([SQLITE], [sqlite], [sqlite_exec], [sqlite.h])
 

Modified: team/russell/data_retrieval/contrib/init.d/rc.debian.asterisk
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/contrib/init.d/rc.debian.asterisk?view=diff&rev=115543&r1=115542&r2=115543
==============================================================================
--- team/russell/data_retrieval/contrib/init.d/rc.debian.asterisk (original)
+++ team/russell/data_retrieval/contrib/init.d/rc.debian.asterisk Wed May  7 22:27:44 2008
@@ -51,6 +51,14 @@
 
 case "$1" in
   start)
+	# Check if Asterisk is already running.  If it is, then bug out, because
+	# starting up Asterisk when Asterisk is already running is very bad.
+	VERSION=`${ASTSBINDIR}/asterisk -rx 'core show version'`
+	if [ "${VERSION:0:8}" = "Asterisk" ]; then # otherwise "Unable t"
+		echo "Asterisk is already running.  $0 will exit now."
+		exit 1
+	fi
+
 	log_begin_msg "Starting $DESC: $NAME"
         if [ $AST_USER ] ; then
                 ASTARGS="-U $AST_USER"

Modified: team/russell/data_retrieval/contrib/init.d/rc.gentoo.asterisk
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/contrib/init.d/rc.gentoo.asterisk?view=diff&rev=115543&r1=115542&r2=115543
==============================================================================
--- team/russell/data_retrieval/contrib/init.d/rc.gentoo.asterisk (original)
+++ team/russell/data_retrieval/contrib/init.d/rc.gentoo.asterisk Wed May  7 22:27:44 2008
@@ -6,6 +6,14 @@
 }
 
 start() {
+	# Check if Asterisk is already running.  If it is, then bug out, because
+	# starting safe_asterisk when Asterisk is running is very bad.
+	VERSION=`${ASTSBINDIR}/asterisk -rx 'core show version'`
+	if [ "${VERSION:0:8}" = "Asterisk" ]; then # otherwise "Unable t"
+		echo "Asterisk is already running.  $0 will exit now."
+		exit 1
+	fi
+
 	ebegin "Starting Asterisk"
 	/usr/sbin/asterisk
 	eend $? "Failed to start Asterisk"

Modified: team/russell/data_retrieval/contrib/init.d/rc.mandrake.asterisk
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/contrib/init.d/rc.mandrake.asterisk?view=diff&rev=115543&r1=115542&r2=115543
==============================================================================
--- team/russell/data_retrieval/contrib/init.d/rc.mandrake.asterisk (original)
+++ team/russell/data_retrieval/contrib/init.d/rc.mandrake.asterisk Wed May  7 22:27:44 2008
@@ -119,6 +119,14 @@
 
 case "$1" in
 	start)
+		# Check if Asterisk is already running.  If it is, then bug out, because
+		# starting Asterisk when Asterisk is already running is very bad.
+		VERSION=`${ASTSBINDIR}/asterisk -rx 'core show version'`
+		if [ "${VERSION:0:8}" = "Asterisk" ]; then # otherwise "Unable t"
+			echo "Asterisk is already running.  $0 will exit now."
+			exit 1
+		fi
+
 		gprintf "Starting asterisk: "
 		run_asterisk >/dev/null 2>&1 &
 		sleep 2	# Give it time to die

Modified: team/russell/data_retrieval/contrib/init.d/rc.redhat.asterisk
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/contrib/init.d/rc.redhat.asterisk?view=diff&rev=115543&r1=115542&r2=115543
==============================================================================
--- team/russell/data_retrieval/contrib/init.d/rc.redhat.asterisk (original)
+++ team/russell/data_retrieval/contrib/init.d/rc.redhat.asterisk Wed May  7 22:27:44 2008
@@ -68,6 +68,14 @@
 RETVAL=0
 
 start() {
+	# Check if Asterisk is already running.  If it is, then bug out, because
+	# starting safe_asterisk when Asterisk is running is very bad.
+	VERSION=`${AST_SBIN}/asterisk -rx 'core show version'`
+	if [ "${VERSION:0:8}" = "Asterisk" ]; then # otherwise "Unable t"
+		echo "Asterisk is already running."
+		exit 1
+	fi
+
 	# Start daemons.
 	echo -n $"Starting asterisk: "
         if [ -f $SAFE_ASTERISK ] ; then

Modified: team/russell/data_retrieval/contrib/init.d/rc.slackware.asterisk
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/contrib/init.d/rc.slackware.asterisk?view=diff&rev=115543&r1=115542&r2=115543
==============================================================================
--- team/russell/data_retrieval/contrib/init.d/rc.slackware.asterisk (original)
+++ team/russell/data_retrieval/contrib/init.d/rc.slackware.asterisk Wed May  7 22:27:44 2008
@@ -10,6 +10,14 @@
 
 asterisk_start() {
    if [ -x /usr/sbin/asterisk ]; then
+      # Check if Asterisk is already running.  If it is, then bug out, because
+      # starting safe_asterisk when Asterisk is running is very bad.
+      VERSION=`/usr/sbin/asterisk -rx 'core show version'`
+      if [ "${VERSION:0:8}" = "Asterisk" ]; then # otherwise "Unable t"
+         echo "Asterisk is already running.  $0 will exit now."
+         exit 1
+      fi
+
       echo "Starting Asterisk   /usr/sbin/asterisk"
       /usr/sbin/asterisk
    fi

Modified: team/russell/data_retrieval/contrib/init.d/rc.suse.asterisk
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/contrib/init.d/rc.suse.asterisk?view=diff&rev=115543&r1=115542&r2=115543
==============================================================================
--- team/russell/data_retrieval/contrib/init.d/rc.suse.asterisk (original)
+++ team/russell/data_retrieval/contrib/init.d/rc.suse.asterisk Wed May  7 22:27:44 2008
@@ -63,6 +63,15 @@
 
 start() {
 	# Start daemons.
+
+	# Check if Asterisk is already running.  If it is, then bug out, because
+	# starting Asterisk when Asterisk is already running is very bad.
+	VERSION=`/usr/sbin/asterisk -rx 'core show version'`
+	if [ "${VERSION:0:8}" = "Asterisk" ]; then # otherwise "Unable t"
+		echo "Asterisk is already running.  $0 will exit now."
+		exit 1
+	fi
+
 	echo -n $"Starting asterisk: "
         if [ -f $SAFE_ASTERISK ] ; then
 		DAEMON=$SAFE_ASTERISK

Modified: team/russell/data_retrieval/contrib/scripts/asterisk.ldap-schema
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/contrib/scripts/asterisk.ldap-schema?view=diff&rev=115543&r1=115542&r2=115543
==============================================================================
--- team/russell/data_retrieval/contrib/scripts/asterisk.ldap-schema (original)
+++ team/russell/data_retrieval/contrib/scripts/asterisk.ldap-schema Wed May  7 22:27:44 2008
@@ -1,5 +1,12 @@
 #
-# Copyright (c) 2007 Suretec Systems Ltd. - <http://www.suretecsystems.com/>
+# Copyright (c) 2007-2008 Suretec Systems Ltd. - <http://www.suretecsystems.com/>
+#
+# Version: 3.1.5
+#
+# Changes:
+# - Fixed wrong DESC - 07/05/2008
+#
+# Author: Gavin Henry - <ghenry at suretecsystems.com>
 #
 # Asterisk LDAP Schema
 #
@@ -224,28 +231,28 @@
 
 attributetype ( AstAccountExpirationTimestamp 
         NAME 'AstAccountExpirationTimestamp'
-        DESC 'Asterisk Account Allowed Codec'
+        DESC 'Asterisk Account Expiration Timestamp'
         EQUALITY caseIgnoreMatch
         SUBSTR caseIgnoreSubstringsMatch
         SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
 
 attributetype ( AstAccountRegistrationContext 
         NAME 'AstAccountRegistrationContext'
-        DESC 'Asterisk Account AMA Flags'
+        DESC 'Asterisk Account Registration Context'
         EQUALITY caseIgnoreMatch
         SUBSTR caseIgnoreSubstringsMatch
         SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
 
 attributetype ( AstAccountRegistrationExten 
         NAME 'AstAccountRegistrationExten'
-        DESC 'Asterisk Account AMA Flags'
+        DESC 'Asterisk Account Registration Extension'
         EQUALITY caseIgnoreMatch
         SUBSTR caseIgnoreSubstringsMatch
         SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
 
 attributetype ( AstAccountNoTransfer 
         NAME 'AstAccountNoTransfer'
-        DESC 'Asterisk Account AMA Flags'

[... 1678 lines stripped ...]



More information about the svn-commits mailing list