[svn-commits] branch oej/peermatch r34817 - in /team/oej/peermatch: ./ build_tools/ channel...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Mon Jun 19 07:12:40 MST 2006


Author: oej
Date: Mon Jun 19 09:12:39 2006
New Revision: 34817

URL: http://svn.digium.com/view/asterisk?rev=34817&view=rev
Log:
Update

Added:
    team/oej/peermatch/build_tools/get_makeopts
      - copied unchanged from r34788, trunk/build_tools/get_makeopts
    team/oej/peermatch/build_tools/get_moduleinfo
      - copied unchanged from r34788, trunk/build_tools/get_moduleinfo
    team/oej/peermatch/channels/chan_jingle.c
      - copied unchanged from r34788, trunk/channels/chan_jingle.c
    team/oej/peermatch/pbx/ael/ael-test/ael-test8/
      - copied from r34788, trunk/pbx/ael/ael-test/ael-test8/
    team/oej/peermatch/pbx/ael/ael-test/ael-test8/extensions.ael
      - copied unchanged from r34788, trunk/pbx/ael/ael-test/ael-test8/extensions.ael
    team/oej/peermatch/pbx/ael/ael-test/ref.ael-test8
      - copied unchanged from r34788, trunk/pbx/ael/ael-test/ref.ael-test8
Removed:
    team/oej/peermatch/build_tools/get_moduledeps
Modified:
    team/oej/peermatch/   (props changed)
    team/oej/peermatch/build_tools/Makefile
    team/oej/peermatch/build_tools/cflags.xml
    team/oej/peermatch/build_tools/menuselect-deps.in
    team/oej/peermatch/build_tools/menuselect.c
    team/oej/peermatch/build_tools/menuselect.h
    team/oej/peermatch/build_tools/menuselect_curses.c
    team/oej/peermatch/build_tools/prep_moduledeps
    team/oej/peermatch/cdr.c
    team/oej/peermatch/channel.c
    team/oej/peermatch/channels/chan_alsa.c
    team/oej/peermatch/channels/chan_features.c
    team/oej/peermatch/channels/chan_h323.c
    team/oej/peermatch/channels/chan_local.c
    team/oej/peermatch/channels/chan_mgcp.c
    team/oej/peermatch/channels/chan_misdn.c
    team/oej/peermatch/channels/chan_nbs.c
    team/oej/peermatch/channels/chan_phone.c
    team/oej/peermatch/channels/chan_skinny.c
    team/oej/peermatch/channels/chan_vpb.c
    team/oej/peermatch/channels/chan_zap.c
    team/oej/peermatch/channels/h323/Makefile
    team/oej/peermatch/channels/h323/h323.conf.sample
    team/oej/peermatch/channels/misdn_config.c
    team/oej/peermatch/config.c
    team/oej/peermatch/loader.c
    team/oej/peermatch/pbx/Makefile
    team/oej/peermatch/pbx/ael/ael-test/ref.ael-test1
    team/oej/peermatch/pbx/ael/ael-test/ref.ael-test2
    team/oej/peermatch/pbx/ael/ael-test/ref.ael-test3
    team/oej/peermatch/pbx/ael/ael-test/ref.ael-test4
    team/oej/peermatch/pbx/ael/ael-test/ref.ael-test5
    team/oej/peermatch/pbx/ael/ael-test/ref.ael-test6
    team/oej/peermatch/pbx/ael/ael-test/ref.ael-test7
    team/oej/peermatch/pbx/ael/ael.flex
    team/oej/peermatch/pbx/ael/ael.tab.c
    team/oej/peermatch/pbx/ael/ael.tab.h
    team/oej/peermatch/pbx/ael/ael.y
    team/oej/peermatch/pbx/ael/ael_lex.c
    team/oej/peermatch/pbx/dundi-parser.c
    team/oej/peermatch/pbx/pbx_ael.c
    team/oej/peermatch/pbx/pbx_config.c
    team/oej/peermatch/pbx/pbx_dundi.c
    team/oej/peermatch/pbx/pbx_gtkconsole.c
    team/oej/peermatch/pbx/pbx_loopback.c
    team/oej/peermatch/pbx/pbx_realtime.c
    team/oej/peermatch/pbx/pbx_spool.c
    team/oej/peermatch/term.c
    team/oej/peermatch/utils.c

Propchange: team/oej/peermatch/
------------------------------------------------------------------------------
    automerge = http://edvina.net/training/

Modified: team/oej/peermatch/build_tools/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/build_tools/Makefile?rev=34817&r1=34816&r2=34817&view=diff
==============================================================================
--- team/oej/peermatch/build_tools/Makefile (original)
+++ team/oej/peermatch/build_tools/Makefile Mon Jun 19 09:12:39 2006
@@ -15,13 +15,13 @@
 endif
 
 menuselect: $(MENUSELECT_OBJS)
-	$(CC) -g -o $@ $(MENUSELECT_OBJS) $(MENUSELECT_LIBS)
+	$(CC) -g -Wall -o $@ $(MENUSELECT_OBJS) $(MENUSELECT_LIBS)
 
 menuselect.o: menuselect.c menuselect.h
-	$(CC) -o $@ $(MENUSELECT_CFLAGS) $<
+	$(CC) -Wall -o $@ $(MENUSELECT_CFLAGS) $<
 
 menuselect_curses.o: menuselect_curses.c menuselect.h
-	$(CC) -o $@ $(MENUSELECT_CFLAGS) $(MENUSELECT_INCLUDE) $<
+	$(CC) -Wall -o $@ $(MENUSELECT_CFLAGS) $(MENUSELECT_INCLUDE) $<
 
 clean:
 	rm -f menuselect *.o

Modified: team/oej/peermatch/build_tools/cflags.xml
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/build_tools/cflags.xml?rev=34817&r1=34816&r2=34817&view=diff
==============================================================================
--- team/oej/peermatch/build_tools/cflags.xml (original)
+++ team/oej/peermatch/build_tools/cflags.xml Mon Jun 19 09:12:39 2006
@@ -1,9 +1,13 @@
-	<category name="MENUSELECT_CFLAGS" displayname="Compiler Flags" positive_output="yes" force_clean_on_change="yes">
+	<category name="MENUSELECT_CFLAGS" displayname="Compiler Flags" positive_output="yes" remove_on_change=".lastclean">
+		<member name="DEBUG_CHANNEL_LOCKS" displayname="Debug Channel Locking">
+		</member>
 		<member name="DEBUG_SCHEDULER" displayname="Enable Scheduler Debugging Output">
 		</member>
 		<member name="DEBUG_THREADS" displayname="Enable Thread Debugging">
 		</member>
 		<member name="DETECT_DEADLOCKS" displayname="Detect Deadlocks">
+		</member>
+		<member name="DONT_OPTIMIZE" displayname="Disable Optimizations from the Compiler">
 		</member>
 		<member name="DUMP_SCHEDULER" displayname="Dump Scheduler Contents for Debugging">
 		</member>
@@ -17,7 +21,4 @@
 		</member>
 		<member name="TRACE_FRAMES" displayname="Trace Frame Allocations">
 		</member>
-		<member name="WITH_SMDI" displayname="Include SMDI Support">
-			<defaultenabled>yes</defaultenabled>
-		</member>
 	</category>

Modified: team/oej/peermatch/build_tools/menuselect-deps.in
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/build_tools/menuselect-deps.in?rev=34817&r1=34816&r2=34817&view=diff
==============================================================================
--- team/oej/peermatch/build_tools/menuselect-deps.in (original)
+++ team/oej/peermatch/build_tools/menuselect-deps.in Mon Jun 19 09:12:39 2006
@@ -1,26 +1,28 @@
-ASOUND=@PBX_LIBasound@
+ASOUND=@PBX_LIBALSA@
 CURL=@PBX_CURL@
-FREETDS=@PBX_LIBtds@
+FREETDS=@PBX_LIBFREETDS@
 GTK=@PBX_GTK@
 H323=@PBX_H323@
 KDE=@PBX_KDE@
-LIBNEWT=@PBX_LIBnewt@
-LIBOSPTK=@PBX_LIBosptk@
-LIBPOPT=@PBX_LIBpopt@
-LIBPRI=@PBX_LIBpri@
-LIBSPEEX=@PBX_LIBspeex@
-LIBVORBIS=@PBX_LIBvorbis@
-NBS=@PBX_LIBnbs@
-OGG=@PBX_LIBogg@
-OSSAUDIO=@PBX_LIBossaudio@
+LIBNEWT=@PBX_LIBNEWT@
+LIBOSPTK=@PBX_LIBOSPTK@
+LIBPOPT=@PBX_LIBPOPT@
+LIBPRI=@PBX_LIBLIBPRI@
+LIBSPEEX=@PBX_LIBSPEEX@
+LIBVORBIS=@PBX_LIBVORBIS@
+NBS=@PBX_LIBNBS@
+OGG=@PBX_LIBOGG@
+OSSAUDIO=@PBX_LIBOSS@
 PGSQL=@PBX_LIBpq@
 QT=@PBX_QT@
-SQLITE=@PBX_LIBsqlite@
-SSL=@PBX_LIBssl@
-UNIXODBC=@PBX_LIBodbc@
+RADIUSCLIENT=@PBX_LIBRADIUSCLIENT@
+SQLITE=@PBX_LIBSQLITE@
+SSL=@PBX_LIBOPENSSL@
+UNIXODBC=@PBX_LIBUNIXODBC@
 VPBAPI=@PBX_LIBvpb@
 WIN32=@OSISWIN32@
-ZLIB=@PBX_LIBz@
-ZAPTEL=@PBX_LIBtonezone@
+ZLIB=@PBX_LIBZLIB@
+ZAPTEL=@PBX_LIBZAPTEL@
 LIBGSM=@PBX_LIBgsm@
+IKSEMEL=@PBX_LIBIKSEMEL@
 IXJUSER=@PBX_IXJUSER@

Modified: team/oej/peermatch/build_tools/menuselect.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/build_tools/menuselect.c?rev=34817&r1=34816&r2=34817&view=diff
==============================================================================
--- team/oej/peermatch/build_tools/menuselect.c (original)
+++ team/oej/peermatch/build_tools/menuselect.c Mon Jun 19 09:12:39 2006
@@ -16,7 +16,7 @@
  * at the top of the source tree.
  */
 
-/*
+/*!
  * \file
  *
  * \author Russell Bryant <russell at digium.com>
@@ -24,7 +24,7 @@
  * \brief A menu-driven system for Asterisk module selection
  */
 
-#include "autoconfig.h"
+#include "asterisk.h"
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -34,25 +34,9 @@
 #include "mxml/mxml.h"
 #include "menuselect.h"
 
-#include "asterisk.h"
-
 #include "asterisk/linkedlists.h"
 
 #undef MENUSELECT_DEBUG
-
-struct depend {
-	/*! the name of the dependency */
-	const char *name;
-	/*! for linking */
-	AST_LIST_ENTRY(depend) list;
-};
-
-struct conflict {
-	/*! the name of the conflict */
-	const char *name;
-	/*! for linking */
-	AST_LIST_ENTRY(conflict) list;
-};
 
 /*! The list of categories */
 struct categories categories = AST_LIST_HEAD_NOLOCK_INIT_VALUE;
@@ -86,21 +70,6 @@
 /*! This is set when the --check-deps argument is provided. */
 static int check_deps = 0;
 
-/*! Force a clean of the source tree */
-static int force_clean = 0;
-
-static int add_category(struct category *cat);
-static int add_member(struct member *mem, struct category *cat);
-static int parse_makeopts_xml(const char *makeopts_xml);
-static int process_deps(void);
-static int build_member_list(void);
-static void mark_as_present(const char *member, const char *category);
-static void process_prev_failed_deps(char *buf);
-static int parse_existing_config(const char *infile);
-static int generate_makeopts_file(void);
-static void free_member_list(void);
-static void free_trees(void);
-
 /*! \brief return a pointer to the first non-whitespace character */
 static inline char *skip_blanks(char *str)
 {
@@ -143,6 +112,19 @@
 	AST_LIST_INSERT_TAIL(&cat->members, mem, list);
 
 	return 0;
+}
+
+/*! \brief Free a member structure and all of its members */
+static void free_member(struct member *mem)
+{
+	struct depend *dep;
+	struct conflict *cnf;
+
+	while ((dep = AST_LIST_REMOVE_HEAD(&mem->deps, list)))
+		free(dep);
+	while ((cnf = AST_LIST_REMOVE_HEAD(&mem->conflicts, list)))
+		free(cnf);
+	free(mem);
 }
 
 /*! \brief Parse an input makeopts file */
@@ -190,8 +172,7 @@
 		cat->displayname = mxmlElementGetAttr(cur, "displayname");
 		if ((tmp = mxmlElementGetAttr(cur, "positive_output")))
 			cat->positive_output = !strcasecmp(tmp, "yes");
-		if ((tmp = mxmlElementGetAttr(cur, "force_clean_on_change")))
-			cat->force_clean_on_change = !strcasecmp(tmp, "yes");
+		cat->remove_on_change = mxmlElementGetAttr(cur, "remove_on_change");
 
 		if (add_category(cat)) {
 			free(cat);
@@ -208,8 +189,10 @@
 			mem->name = mxmlElementGetAttr(cur2, "name");
 			mem->displayname = mxmlElementGetAttr(cur2, "displayname");
 		
+			mem->remove_on_change = mxmlElementGetAttr(cur2, "remove_on_change");
+
 			if (!cat->positive_output)
-				mem->enabled = 1;
+				mem->was_enabled = mem->enabled = 1;
 	
 			cur3 = mxmlFindElement(cur2, cur2, "defaultenabled", NULL, NULL, MXML_DESCEND);
 			if (cur3 && cur3->child)
@@ -219,8 +202,10 @@
 			     cur3 && cur3->child;
 			     cur3 = mxmlFindElement(cur3, cur2, "depend", NULL, NULL, MXML_DESCEND))
 			{
-				if (!(dep = calloc(1, sizeof(*dep))))
+				if (!(dep = calloc(1, sizeof(*dep)))) {
+					free_member(mem);
 					return -1;
+				}
 				if (!strlen_zero(cur3->child->value.opaque)) {
 					dep->name = cur3->child->value.opaque;
 					AST_LIST_INSERT_HEAD(&mem->deps, dep, list);
@@ -232,8 +217,10 @@
 			     cur3 && cur3->child;
 			     cur3 = mxmlFindElement(cur3, cur2, "conflict", NULL, NULL, MXML_DESCEND))
 			{
-				if (!(cnf = calloc(1, sizeof(*cnf))))
+				if (!(cnf = calloc(1, sizeof(*cnf)))) {
+					free_member(mem);
 					return -1;
+				}
 				if (!strlen_zero(cur3->child->value.opaque)) {
 					cnf->name = cur3->child->value.opaque;
 					AST_LIST_INSERT_HEAD(&mem->conflicts, cnf, list);
@@ -242,7 +229,7 @@
 			}
 
 			if (add_member(mem, cat))
-				free(mem);
+				free_member(mem);
 		}
 	}
 
@@ -359,7 +346,7 @@
 			continue;
 		AST_LIST_TRAVERSE(&cat->members, mem, list) {
 			if (!strcmp(member, mem->name)) {
-				mem->enabled = cat->positive_output;
+				mem->was_enabled = mem->enabled = cat->positive_output;
 				break;
 			}
 		}
@@ -385,8 +372,6 @@
 
 	if (mem && !(mem->depsfailed || mem->conflictsfailed)) {
 		mem->enabled = !mem->enabled;
-		if (cat->force_clean_on_change)
-			force_clean = 1;
 	}
 }
 
@@ -518,6 +503,34 @@
 
 	fclose(f);
 
+	/* Traverse all categories and members and remove any files that are supposed
+	   to be removed when an item has been changed */
+	AST_LIST_TRAVERSE(&categories, cat, list) {
+		unsigned int had_changes = 0;
+		char *file, *buf;
+
+		AST_LIST_TRAVERSE(&cat->members, mem, list) {
+			if (mem->enabled == mem->was_enabled)
+				continue;
+
+			had_changes = 1;
+
+			if (mem->remove_on_change) {
+				for (buf = strdupa(mem->remove_on_change), file = strsep(&buf, " ");
+				     file;
+				     file = strsep(&buf, " "))
+					unlink(file);
+			}
+		}
+
+		if (cat->remove_on_change && had_changes) {
+			for (buf = strdupa(cat->remove_on_change), file = strsep(&buf, " ");
+			     file;
+			     file = strsep(&buf, " "))
+				unlink(file);
+		}
+	}
+
 	return 0;
 }
 
@@ -533,7 +546,8 @@
 	AST_LIST_TRAVERSE(&categories, cat, list) {
 		fprintf(stderr, "Category: '%s'\n", cat->name);
 		AST_LIST_TRAVERSE(&cat->members, mem, list) {
-			fprintf(stderr, "   ==>> Member: '%s'  (%s)\n", mem->name, mem->enabled ? "Enabled" : "Disabled");
+			fprintf(stderr, "   ==>> Member: '%s'  (%s)", mem->name, mem->enabled ? "Enabled" : "Disabled");
+			fprintf(stderr, "        Was %s\n", mem->was_enabled ? "Enabled" : "Disabled");
 			AST_LIST_TRAVERSE(&mem->deps, dep, list)
 				fprintf(stderr, "      --> Depends on: '%s'\n", dep->name);
 			if (!AST_LIST_EMPTY(&mem->deps))
@@ -712,19 +726,5 @@
 	free_trees();
 	free_member_list();
 
-	if (check_deps && !existing_config && !res) {
-		fprintf(stderr, "\n***********************************************************\n");
-		fprintf(stderr, "* menuselect.makeopts file generated with default values! *\n");
-		fprintf(stderr, "* Please rerun make to build Asterisk.                    *\n");
-		fprintf(stderr, "***********************************************************\n\n");
-		res = -1;
-	}
-
-	/* In some cases, such as modifying the CFLAGS for the build,
-	 * a "make clean" needs to be forced.  Removing the .lastclean 
-	 * file does this. */
-	if (force_clean)
-		unlink(".lastclean");
-
 	exit(res);
 }

Modified: team/oej/peermatch/build_tools/menuselect.h
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/build_tools/menuselect.h?rev=34817&r1=34816&r2=34817&view=diff
==============================================================================
--- team/oej/peermatch/build_tools/menuselect.h (original)
+++ team/oej/peermatch/build_tools/menuselect.h Mon Jun 19 09:12:39 2006
@@ -31,8 +31,19 @@
 #define OUTPUT_MAKEOPTS_DEFAULT "menuselect.makeopts"
 #define MENUSELECT_DEPS         "build_tools/menuselect-deps"
 
-struct depend;
-struct conflict;
+struct depend {
+	/*! the name of the dependency */
+	const char *name;
+	/*! for linking */
+	AST_LIST_ENTRY(depend) list;
+};
+
+struct conflict {
+	/*! the name of the conflict */
+	const char *name;
+	/*! for linking */
+	AST_LIST_ENTRY(conflict) list;
+};
 
 struct member {
 	/*! What will be sent to the makeopts file */
@@ -41,12 +52,16 @@
 	const char *displayname;
 	/*! Default setting */
 	const char *defaultenabled;
+	/*! Delete these file(s) if this member changes */
+	const char *remove_on_change;
 	/*! This module is currently selected */
-	int enabled;
+	unsigned int enabled:1;
+	/*! This module was enabled when the config was loaded */
+	unsigned int was_enabled:1;
 	/*! This module has failed dependencies */
-	int depsfailed;
+	unsigned int depsfailed:1;
 	/*! This module has failed conflicts */
-	int conflictsfailed;
+	unsigned int conflictsfailed:1;
 	/*! dependencies of this module */
 	AST_LIST_HEAD_NOLOCK(, depend) deps;
 	/*! conflicts of this module */
@@ -60,10 +75,10 @@
 	const char *name;
 	/*! the name displayed in the menu */
 	const char *displayname;
-	/*! Display what is selected, as opposed to not selected */
-	int positive_output;
-	/*! Force a clean of the source tree if anything in this category changes */
-	int force_clean_on_change;
+	/*! Delete these file(s) if anything in this category changes */
+	const char *remove_on_change;
+	/*! Output what is selected, as opposed to not selected */
+	unsigned int positive_output:1;
 	/*! the list of possible values to be set in this variable */
 	AST_LIST_HEAD_NOLOCK(, member) members;
 	/*! for linking */

Modified: team/oej/peermatch/build_tools/menuselect_curses.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/build_tools/menuselect_curses.c?rev=34817&r1=34816&r2=34817&view=diff
==============================================================================
--- team/oej/peermatch/build_tools/menuselect_curses.c (original)
+++ team/oej/peermatch/build_tools/menuselect_curses.c Mon Jun 19 09:12:39 2006
@@ -24,7 +24,7 @@
  * \brief curses frontend for Asterisk module selection
  */
 
-#include "autoconfig.h"
+#include "asterisk/autoconfig.h"
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -48,11 +48,11 @@
 
 
 /*! Maximum number of characters horizontally */
-int max_x = 0;
+static int max_x = 0;
 /*! Maximum number of characters vertically */
-int max_y = 0;
-
-const char * const help_info[] = {
+static int max_y = 0;
+
+static const char * const help_info[] = {
 	"scroll        => up/down arrows",
 	"(de)select    => Enter",
 	"select all    => F8",
@@ -64,16 +64,8 @@
 	"XXX means dependencies have not been met"
 };
 
-void winch_handler(int sig);
-void show_help(WINDOW *win);
-void draw_main_menu(WINDOW *menu, int curopt);
-void draw_category_menu(WINDOW *menu, struct category *cat, int start, int end, int curopt);
-int run_category_menu(WINDOW *menu, int cat_num);
-int run_category_menu(WINDOW *menu, int cat_num);
-void draw_title_window(WINDOW *title);
-
 /*! \brief Handle a window resize in xterm */
-void winch_handler(int sig)
+static void winch_handler(int sig)
 {
 	getmaxyx(stdscr, max_y, max_x);
 
@@ -85,7 +77,7 @@
 }
 
 /*! \brief Display help information */
-void show_help(WINDOW *win)
+static void show_help(WINDOW *win)
 {
 	int i;
 
@@ -98,7 +90,7 @@
 	getch(); /* display the help until the user hits a key */
 }
 
-void draw_main_menu(WINDOW *menu, int curopt)
+static void draw_main_menu(WINDOW *menu, int curopt)
 {
 	struct category *cat;
 	char buf[64];
@@ -122,16 +114,71 @@
 	wrefresh(menu);
 }
 
-void draw_category_menu(WINDOW *menu, struct category *cat, int start, int end, int curopt)
+static void display_mem_info(WINDOW *menu, struct member *mem, int start, int end)
+{
+	char buf[64];
+	struct depend *dep;
+	struct conflict *con;
+
+	wmove(menu, end - start + 2, max_x / 2 - 16);
+	wclrtoeol(menu);
+	wmove(menu, end - start + 3, max_x / 2 - 16);
+	wclrtoeol(menu);
+	wmove(menu, end - start + 4, max_x / 2 - 16);
+	wclrtoeol(menu);
+
+	if (mem->displayname) {
+		wmove(menu, end - start + 2, max_x / 2 - 16);
+		waddstr(menu, mem->displayname);
+	}
+	if (!AST_LIST_EMPTY(&mem->deps)) {
+		wmove(menu, end - start + 3, max_x / 2 - 16);
+		strcpy(buf, "Depends on: ");
+		AST_LIST_TRAVERSE(&mem->deps, dep, list) {
+			strncat(buf, dep->name, sizeof(buf) - strlen(buf) - 1);
+			if (AST_LIST_NEXT(dep, list))
+				strncat(buf, ", ", sizeof(buf) - strlen(buf) - 1);
+		}
+		waddstr(menu, buf);
+	}
+	if (!AST_LIST_EMPTY(&mem->conflicts)) {
+		wmove(menu, end - start + 4, max_x / 2 - 16);
+		strcpy(buf, "Conflicts with: ");
+		AST_LIST_TRAVERSE(&mem->conflicts, con, list) {
+			strncat(buf, con->name, sizeof(buf) - strlen(buf) - 1);
+			if (AST_LIST_NEXT(con, list))
+				strncat(buf, ", ", sizeof(buf) - strlen(buf) - 1);
+		}
+		waddstr(menu, buf);
+	}
+
+}
+
+static void draw_category_menu(WINDOW *menu, struct category *cat, int start, int end, int curopt, int changed)
 {
 	int i = 0;
 	int j = 0;
 	struct member *mem;
 	char buf[64];
-	const char *desc = NULL;
+
+	if (!changed) {
+		/* If all we have to do is move the cursor, 
+		 * then don't clear the screen and start over */
+		AST_LIST_TRAVERSE(&cat->members, mem, list) {
+			i++;
+			if (curopt + 1 == i) {
+				display_mem_info(menu, mem, start, end);
+				break;
+			}
+		}
+		wmove(menu, curopt - start, max_x / 2 - 9);
+		wrefresh(menu);
+		return;
+	}
 
 	wclear(menu);
 
+	i = 0;
 	AST_LIST_TRAVERSE(&cat->members, mem, list) {
 		if (i < start) {
 			i++;
@@ -146,22 +193,17 @@
 		waddstr(menu, buf);
 		
 		if (curopt + 1 == i)
-			desc = mem->displayname;
+			display_mem_info(menu, mem, start, end);
 
 		if (i == end)
 			break;
 	}
 
-	if (desc) {
-		wmove(menu, end - start + 2, max_x / 2 - 16);
-		waddstr(menu, desc);
-	}
 	wmove(menu, curopt - start, max_x / 2 - 9);
-
 	wrefresh(menu);
 }
 
-int run_category_menu(WINDOW *menu, int cat_num)
+static int run_category_menu(WINDOW *menu, int cat_num)
 {
 	struct category *cat;
 	int i = 0;
@@ -170,6 +212,7 @@
 	int c;
 	int curopt = 0;
 	int maxopt;
+	int changed = 1;
 
 	AST_LIST_TRAVERSE(&categories, cat, list) {
 		if (i++ == cat_num)
@@ -180,9 +223,10 @@
 
 	maxopt = count_members(cat) - 1;
 
-	draw_category_menu(menu, cat, start, end, curopt);
+	draw_category_menu(menu, cat, start, end, curopt, changed);
 
 	while ((c = getch())) {
+		changed = 0;
 		switch (c) {
 		case KEY_UP:
 			if (curopt > 0) {
@@ -190,6 +234,7 @@
 				if (curopt < start) {
 					start--;
 					end--;
+					changed = 1;
 				}
 			}
 			break;
@@ -199,6 +244,7 @@
 				if (curopt > end - 1) {
 					start++;
 					end++;
+					changed = 1;
 				}
 			}
 			break;
@@ -216,22 +262,26 @@
 		case '\n':
 		case ' ':
 			toggle_enabled(cat, curopt);
+			changed = 1;
 			break;
 		case 'h':
 		case 'H':
 			show_help(menu);
+			changed = 1;
 			break;
 		case KEY_F(7):
 			set_all(cat, 0);
+			changed = 1;
 			break;
 		case KEY_F(8):
 			set_all(cat, 1);
+			changed = 1;
 		default:
 			break;	
 		}
 		if (c == 'x' || c == 'X' || c == 'Q' || c == 'q')
 			break;	
-		draw_category_menu(menu, cat, start, end, curopt);
+		draw_category_menu(menu, cat, start, end, curopt, changed);
 	}
 
 	wrefresh(menu);
@@ -239,7 +289,7 @@
 	return c;
 }
 
-void draw_title_window(WINDOW *title)
+static void draw_title_window(WINDOW *title)
 {
 	wmove(title, 1, (max_x / 2) - (strlen(MENU_TITLE1) / 2));
 	waddstr(title, MENU_TITLE1);

Modified: team/oej/peermatch/build_tools/prep_moduledeps
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/build_tools/prep_moduledeps?rev=34817&r1=34816&r2=34817&view=diff
==============================================================================
--- team/oej/peermatch/build_tools/prep_moduledeps (original)
+++ team/oej/peermatch/build_tools/prep_moduledeps Mon Jun 19 09:12:39 2006
@@ -38,16 +38,22 @@
 		fname=${file##${dir}/}
 		get_description ${file}
 		desc=${TDESC}
-		echo -e "\t\t<member name=\"${fname%%.c}.so\" displayname=\"${desc}\">"
-		awk -f build_tools/get_moduledeps ${file}
+		echo -e "\t\t<member name=\"${fname%%.c}\" displayname=\"${desc}\" remove_on_change=\"${dir}/${fname%%.c}.o ${dir}/${fname%%.c}.so\">"
+		awk -f build_tools/get_moduleinfo ${file}
 		echo -e "\t\t</member>"
 	done
 	echo -e "\t</category>"
+
+	for file in ${dir}/${prefix}*.c
+	do
+		awk -f build_tools/get_makeopts ${file} >> .makeoptstmp
+	done
 }
 
 echo "<?xml version="1.0"?>"
 echo
 echo "<menu>"
+rm -f .makeoptstmp
 process_dir apps app APPS Applications
 process_dir cdr cdr CDR "Call Detail Recording"
 process_dir channels chan CHANNELS "Channel Drivers"
@@ -57,4 +63,7 @@
 process_dir pbx pbx PBX "PBX Modules"
 process_dir res res RES "Resource Modules"
 cat build_tools/cflags.xml
+cat sounds/sounds.xml
+cat .makeoptstmp
+rm -f .makeoptstmp
 echo "</menu>"

Modified: team/oej/peermatch/cdr.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/cdr.c?rev=34817&r1=34816&r2=34817&view=diff
==============================================================================
--- team/oej/peermatch/cdr.c (original)
+++ team/oej/peermatch/cdr.c Mon Jun 19 09:12:39 2006
@@ -31,15 +31,15 @@
  */
 
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <signal.h>
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/channel.h"
@@ -53,7 +53,6 @@
 #include "asterisk/sched.h"
 #include "asterisk/config.h"
 #include "asterisk/cli.h"
-// XXX #include "asterisk/module.h"
 #include "asterisk/stringfields.h"
 
 /*! Default AMA flag for billing records (CDR's) */

Modified: team/oej/peermatch/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/peermatch/channel.c?rev=34817&r1=34816&r2=34817&view=diff
==============================================================================
--- team/oej/peermatch/channel.c (original)
+++ team/oej/peermatch/channel.c Mon Jun 19 09:12:39 2006
@@ -23,6 +23,10 @@
  * \author Mark Spencer <markster at digium.com>
  */
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -30,9 +34,7 @@
 #include <signal.h>
 #include <errno.h>
 #include <unistd.h>
-#include <math.h>			/* For PI */
-
-#include "asterisk.h"
+#include <math.h>
 
 #ifdef HAVE_ZAPTEL
 #include <sys/ioctl.h>
@@ -45,8 +47,6 @@
 #error "You need newer zaptel!  Please cvs update zaptel"
 #endif
 #endif
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/pbx.h"
 #include "asterisk/frame.h"
@@ -116,52 +116,53 @@
 /*! map AST_CAUSE's to readable string representations */
 const struct ast_cause {
 	int cause;
+	const char *name;
 	const char *desc;
 } causes[] = {
-	{ AST_CAUSE_UNALLOCATED, "Unallocated (unassigned) number" },
-	{ AST_CAUSE_NO_ROUTE_TRANSIT_NET, "No route to specified transmit network" },
-	{ AST_CAUSE_NO_ROUTE_DESTINATION, "No route to destination" },
-	{ AST_CAUSE_CHANNEL_UNACCEPTABLE, "Channel unacceptable" },
-	{ AST_CAUSE_CALL_AWARDED_DELIVERED, "Call awarded and being delivered in an established channel" },
-	{ AST_CAUSE_NORMAL_CLEARING, "Normal Clearing" },
-	{ AST_CAUSE_USER_BUSY, "User busy" },
-	{ AST_CAUSE_NO_USER_RESPONSE, "No user responding" },
-	{ AST_CAUSE_NO_ANSWER, "User alerting, no answer" },
-	{ AST_CAUSE_CALL_REJECTED, "Call Rejected" },
-	{ AST_CAUSE_NUMBER_CHANGED, "Number changed" },
-	{ AST_CAUSE_DESTINATION_OUT_OF_ORDER, "Destination out of order" },
-	{ AST_CAUSE_INVALID_NUMBER_FORMAT, "Invalid number format" },
-	{ AST_CAUSE_FACILITY_REJECTED, "Facility rejected" },
-	{ AST_CAUSE_RESPONSE_TO_STATUS_ENQUIRY, "Response to STATus ENQuiry" },
-	{ AST_CAUSE_NORMAL_UNSPECIFIED, "Normal, unspecified" },
-	{ AST_CAUSE_NORMAL_CIRCUIT_CONGESTION, "Circuit/channel congestion" },
-	{ AST_CAUSE_NETWORK_OUT_OF_ORDER, "Network out of order" },
-	{ AST_CAUSE_NORMAL_TEMPORARY_FAILURE, "Temporary failure" },
-	{ AST_CAUSE_SWITCH_CONGESTION, "Switching equipment congestion" },
-	{ AST_CAUSE_ACCESS_INFO_DISCARDED, "Access information discarded" },
-	{ AST_CAUSE_REQUESTED_CHAN_UNAVAIL, "Requested channel not available" },
-	{ AST_CAUSE_PRE_EMPTED, "Pre-empted" },
-	{ AST_CAUSE_FACILITY_NOT_SUBSCRIBED, "Facility not subscribed" },
-	{ AST_CAUSE_OUTGOING_CALL_BARRED, "Outgoing call barred" },
-	{ AST_CAUSE_INCOMING_CALL_BARRED, "Incoming call barred" },
-	{ AST_CAUSE_BEARERCAPABILITY_NOTAUTH, "Bearer capability not authorized" },
-	{ AST_CAUSE_BEARERCAPABILITY_NOTAVAIL, "Bearer capability not available" },
-	{ AST_CAUSE_BEARERCAPABILITY_NOTIMPL, "Bearer capability not implemented" },
-	{ AST_CAUSE_CHAN_NOT_IMPLEMENTED, "Channel not implemented" },
-	{ AST_CAUSE_FACILITY_NOT_IMPLEMENTED, "Facility not implemented" },
-	{ AST_CAUSE_INVALID_CALL_REFERENCE, "Invalid call reference value" },
-	{ AST_CAUSE_INCOMPATIBLE_DESTINATION, "Incompatible destination" },
-	{ AST_CAUSE_INVALID_MSG_UNSPECIFIED, "Invalid message unspecified" },
-	{ AST_CAUSE_MANDATORY_IE_MISSING, "Mandatory information element is missing" },
-	{ AST_CAUSE_MESSAGE_TYPE_NONEXIST, "Message type nonexist." },
-	{ AST_CAUSE_WRONG_MESSAGE, "Wrong message" },
-	{ AST_CAUSE_IE_NONEXIST, "Info. element nonexist or not implemented" },
-	{ AST_CAUSE_INVALID_IE_CONTENTS, "Invalid information element contents" },
-	{ AST_CAUSE_WRONG_CALL_STATE, "Message not compatible with call state" },
-	{ AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE, "Recover on timer expiry" },
-	{ AST_CAUSE_MANDATORY_IE_LENGTH_ERROR, "Mandatory IE length error" },
-	{ AST_CAUSE_PROTOCOL_ERROR, "Protocol error, unspecified" },
-	{ AST_CAUSE_INTERWORKING, "Interworking, unspecified" },
+	{ AST_CAUSE_UNALLOCATED, "UNALLOCATED", "Unallocated (unassigned) number" },
+	{ AST_CAUSE_NO_ROUTE_TRANSIT_NET, "NO_ROUTE_TRANSIT_NET", "No route to specified transmit network" },
+	{ AST_CAUSE_NO_ROUTE_DESTINATION, "NO_ROUTE_DESTINATION", "No route to destination" },
+	{ AST_CAUSE_CHANNEL_UNACCEPTABLE, "CHANNEL_UNACCEPTABLE", "Channel unacceptable" },
+	{ AST_CAUSE_CALL_AWARDED_DELIVERED, "CALL_AWARDED_DELIVERED", "Call awarded and being delivered in an established channel" },
+	{ AST_CAUSE_NORMAL_CLEARING, "NORMAL_CLEARING", "Normal Clearing" },
+	{ AST_CAUSE_USER_BUSY, "USER_BUSY", "User busy" },
+	{ AST_CAUSE_NO_USER_RESPONSE, "NO_USER_RESPONSE", "No user responding" },
+	{ AST_CAUSE_NO_ANSWER, "NO_ANSWER", "User alerting, no answer" },
+	{ AST_CAUSE_CALL_REJECTED, "CALL_REJECTED", "Call Rejected" },
+	{ AST_CAUSE_NUMBER_CHANGED, "NUMBER_CHANGED", "Number changed" },
+	{ AST_CAUSE_DESTINATION_OUT_OF_ORDER, "DESTINATION_OUT_OF_ORDER", "Destination out of order" },
+	{ AST_CAUSE_INVALID_NUMBER_FORMAT, "INVALID_NUMBER_FORMAT", "Invalid number format" },
+	{ AST_CAUSE_FACILITY_REJECTED, "FACILITY_REJECTED", "Facility rejected" },
+	{ AST_CAUSE_RESPONSE_TO_STATUS_ENQUIRY, "RESPONSE_TO_STATUS_ENQUIRY", "Response to STATus ENQuiry" },
+	{ AST_CAUSE_NORMAL_UNSPECIFIED, "NORMAL_UNSPECIFIED", "Normal, unspecified" },
+	{ AST_CAUSE_NORMAL_CIRCUIT_CONGESTION, "NORMAL_CIRCUIT_CONGESTION", "Circuit/channel congestion" },
+	{ AST_CAUSE_NETWORK_OUT_OF_ORDER, "NETWORK_OUT_OF_ORDER", "Network out of order" },
+	{ AST_CAUSE_NORMAL_TEMPORARY_FAILURE, "NORMAL_TEMPORARY_FAILURE", "Temporary failure" },
+	{ AST_CAUSE_SWITCH_CONGESTION, "SWITCH_CONGESTION", "Switching equipment congestion" },
+	{ AST_CAUSE_ACCESS_INFO_DISCARDED, "ACCESS_INFO_DISCARDED", "Access information discarded" },
+	{ AST_CAUSE_REQUESTED_CHAN_UNAVAIL, "REQUESTED_CHAN_UNAVAIL", "Requested channel not available" },
+	{ AST_CAUSE_PRE_EMPTED, "PRE_EMPTED", "Pre-empted" },
+	{ AST_CAUSE_FACILITY_NOT_SUBSCRIBED, "FACILITY_NOT_SUBSCRIBED", "Facility not subscribed" },
+	{ AST_CAUSE_OUTGOING_CALL_BARRED, "OUTGOING_CALL_BARRED", "Outgoing call barred" },
+	{ AST_CAUSE_INCOMING_CALL_BARRED, "INCOMING_CALL_BARRED", "Incoming call barred" },
+	{ AST_CAUSE_BEARERCAPABILITY_NOTAUTH, "BEARERCAPABILITY_NOTAUTH", "Bearer capability not authorized" },
+	{ AST_CAUSE_BEARERCAPABILITY_NOTAVAIL, "BEARERCAPABILITY_NOTAVAIL", "Bearer capability not available" },
+	{ AST_CAUSE_BEARERCAPABILITY_NOTIMPL, "BEARERCAPABILITY_NOTIMPL", "Bearer capability not implemented" },
+	{ AST_CAUSE_CHAN_NOT_IMPLEMENTED, "CHAN_NOT_IMPLEMENTED", "Channel not implemented" },
+	{ AST_CAUSE_FACILITY_NOT_IMPLEMENTED, "FACILITY_NOT_IMPLEMENTED", "Facility not implemented" },
+	{ AST_CAUSE_INVALID_CALL_REFERENCE, "INVALID_CALL_REFERENCE", "Invalid call reference value" },
+	{ AST_CAUSE_INCOMPATIBLE_DESTINATION, "INCOMPATIBLE_DESTINATION", "Incompatible destination" },
+	{ AST_CAUSE_INVALID_MSG_UNSPECIFIED, "INVALID_MSG_UNSPECIFIED", "Invalid message unspecified" },
+	{ AST_CAUSE_MANDATORY_IE_MISSING, "MANDATORY_IE_MISSING", "Mandatory information element is missing" },
+	{ AST_CAUSE_MESSAGE_TYPE_NONEXIST, "MESSAGE_TYPE_NONEXIST", "Message type nonexist." },
+	{ AST_CAUSE_WRONG_MESSAGE, "WRONG_MESSAGE", "Wrong message" },
+	{ AST_CAUSE_IE_NONEXIST, "IE_NONEXIST", "Info. element nonexist or not implemented" },
+	{ AST_CAUSE_INVALID_IE_CONTENTS, "INVALID_IE_CONTENTS", "Invalid information element contents" },
+	{ AST_CAUSE_WRONG_CALL_STATE, "WRONG_CALL_STATE", "Message not compatible with call state" },
+	{ AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE, "RECOVERY_ON_TIMER_EXPIRE", "Recover on timer expiry" },
+	{ AST_CAUSE_MANDATORY_IE_LENGTH_ERROR, "MANDATORY_IE_LENGTH_ERROR", "Mandatory IE length error" },
+	{ AST_CAUSE_PROTOCOL_ERROR, "PROTOCOL_ERROR", "Protocol error, unspecified" },
+	{ AST_CAUSE_INTERWORKING, "INTERWORKING", "Interworking, unspecified" },
 };
 
 
@@ -477,6 +478,18 @@
 	return "Unknown";
 }
 
+/*! \brief Convert a symbolic hangup cause to number */
+int ast_str2cause(const char *name)
+{
+	int x;
+
+	for (x = 0; x < sizeof(causes) / sizeof(causes[0]); x++)
+		if (strncasecmp(causes[x].name, name, strlen(causes[x].name)) == 0)
+			return causes[x].cause;
+
+	return -1;
+}
+	 
 /*! \brief Gives the string form of a given channel state */
 char *ast_state2str(int state)
 {
@@ -526,7 +539,7 @@
 	}
 }
 
-/*! \brief Pick the best codec */
+/*! \brief Pick the best audio codec */
 int ast_best_codec(int fmts)
 {
 	/* This just our opinion, expressed in code.  We are asked to choose
@@ -559,7 +572,9 @@
 		/*! Down to G.723.1 which is proprietary but at least designed for voice */
 		AST_FORMAT_G723_1,
 	};
-	
+
+	/* Strip out video */
+	fmts &= AST_FORMAT_AUDIO_MASK;
 	
 	/* Find the first preferred codec in the format given */
 	for (x=0; x < (sizeof(prefs) / sizeof(prefs[0]) ); x++)
@@ -999,6 +1014,9 @@
 	while ((vardata = AST_LIST_REMOVE_HEAD(headp, entries)))
 		ast_var_delete(vardata);
 
+	/* Destroy the jitterbuffer */
+	ast_jb_destroy(chan);
+
 	ast_string_field_free_all(chan);
 	free(chan);
 	AST_LIST_UNLOCK(&channels);
@@ -1104,6 +1122,9 @@
 
 int ast_channel_spy_add(struct ast_channel *chan, struct ast_channel_spy *spy)
 {
+	/* Link the owner channel to the spy */
+	spy->chan = chan;
+
 	if (!ast_test_flag(spy, CHANSPY_FORMAT_AUDIO)) {
 		ast_log(LOG_WARNING, "Could not add channel spy '%s' to channel '%s', only audio format spies are supported.\n",
 			spy->type, chan->name);
@@ -1173,7 +1194,14 @@
 
 void ast_channel_spy_trigger_wait(struct ast_channel_spy *spy)
 {
-	ast_cond_wait(&spy->trigger, &spy->lock);
+	struct timeval tv;
+	struct timespec ts;
+
+	tv = ast_tvadd(ast_tvnow(), ast_samp2tv(50000, 1000));
+	ts.tv_sec = tv.tv_sec;
+	ts.tv_nsec = tv.tv_usec * 1000;
+
+	ast_cond_timedwait(&spy->trigger, &spy->lock, &ts);
 }
 
 void ast_channel_spy_remove(struct ast_channel *chan, struct ast_channel_spy *spy)
@@ -1186,6 +1214,8 @@
 	AST_LIST_REMOVE(&chan->spies->list, spy, list);
 
 	ast_mutex_lock(&spy->lock);
+
+	spy->chan = NULL;
 
 	for (f = spy->read_queue.head; f; f = spy->read_queue.head) {
 		spy->read_queue.head = f->next;
@@ -1224,6 +1254,7 @@
 	/* Marking the spies as done is sufficient.  Chanspy or spy users will get the picture. */
 	AST_LIST_TRAVERSE(&chan->spies->list, spy, list) {
 		ast_mutex_lock(&spy->lock);
+		spy->chan = NULL;
 		if (spy->status == CHANSPY_RUNNING)
 			spy->status = CHANSPY_DONE;
 		if (ast_test_flag(spy, CHANSPY_TRIGGER_MODE) != CHANSPY_TRIGGER_NONE)
@@ -1486,8 +1517,10 @@
 	int res = 0;
 	ast_channel_lock(chan);
 	/* You can't answer an outbound call */
-	if (ast_test_flag(chan, AST_FLAG_OUTGOING))
+	if (ast_test_flag(chan, AST_FLAG_OUTGOING)) {
+		ast_channel_unlock(chan);
 		return 0;
+	}
 	/* Stop if we're a zombie or need a soft hangup */
 	if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
 		ast_channel_unlock(chan);
@@ -1955,9 +1988,11 @@
 			if (f->subclass == AST_CONTROL_ANSWER) {
 				if (!ast_test_flag(chan, AST_FLAG_OUTGOING)) {
 					ast_log(LOG_DEBUG, "Ignoring answer on an inbound call!\n");
+					ast_frfree(f);
 					f = &ast_null_frame;
 				} else if (prestate == AST_STATE_UP) {
 					ast_log(LOG_DEBUG, "Dropping duplicate answer!\n");
+					ast_frfree(f);
 					f = &ast_null_frame;
 				} else {
 					/* Answer the CDR */
@@ -1973,6 +2008,7 @@
 					chan->dtmfq[strlen(chan->dtmfq)] = f->subclass;
 				else
 					ast_log(LOG_WARNING, "Dropping deferred DTMF digits on %s\n", chan->name);
+				ast_frfree(f);
 				f = &ast_null_frame;
 			}
 			break;
@@ -2078,7 +2114,7 @@
 int ast_internal_timing_enabled(struct ast_channel *chan)
 {
 	int ret = ast_opt_internal_timing && chan->timingfd > -1;
-	if (option_debug > 3)
+	if (option_debug > 4)
 		ast_log(LOG_DEBUG, "Internal timing is %s (option_internal_timing=%d chan->timingfd=%d)\n", ret? "enabled": "disabled", ast_opt_internal_timing, chan->timingfd);
 	return ret;
 }
@@ -2347,6 +2383,10 @@
 		res = (chan->tech->write_video == NULL) ? 0 :
 			chan->tech->write_video(chan, fr);
 		break;
+	case AST_FRAME_MODEM:
+		res = (chan->tech->write == NULL) ? 0 :
+			chan->tech->write(chan, fr);
+		break;
 	case AST_FRAME_VOICE:
 		if (chan->tech->write == NULL)
 			break;	/*! \todo XXX should return 0 maybe ? */
@@ -2531,7 +2571,12 @@
 					timeout = 0;		/* trick to force exit from the while() */
 					break;
 
-				case AST_CONTROL_PROGRESS:	/* Ignore */
+				/* Ignore these */
+				case AST_CONTROL_PROGRESS:
+				case AST_CONTROL_PROCEEDING:
+				case AST_CONTROL_HOLD:
+				case AST_CONTROL_UNHOLD:
+				case AST_CONTROL_VIDUPDATE:
 				case -1:			/* Ignore -- just stopping indications */
 					break;
 
@@ -2588,6 +2633,7 @@
 	int fmt;
 	int res;
 	int foo;
+	int videoformat = format & AST_FORMAT_VIDEO_MASK;
 
 	if (!cause)
 		cause = &foo;
@@ -2603,7 +2649,7 @@
 			continue;
 
 		capabilities = chan->tech->capabilities;
-		fmt = format;
+		fmt = format & AST_FORMAT_AUDIO_MASK;
 		res = ast_translator_best_choice(&fmt, &capabilities);
 		if (res < 0) {
 			ast_log(LOG_WARNING, "No translator path exists for channel type %s (native %d) to %d\n", type, chan->tech->capabilities, format);
@@ -2614,7 +2660,7 @@
 		if (!chan->tech->requester)
 			return NULL;
 		
-		if (!(c = chan->tech->requester(type, capabilities, data, cause)))
+		if (!(c = chan->tech->requester(type, capabilities | videoformat, data, cause)))
 			return NULL;
 
 		if (c->_state == AST_STATE_DOWN) {
@@ -2804,6 +2850,14 @@
 int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clone)
 {
 	int res = -1;
+
+	/* each of these channels may be sitting behind a channel proxy (i.e. chan_agent)
+	   and if so, we don't really want to masquerade it, but its proxy */
+	if (original->_bridge && (original->_bridge != ast_bridged_channel(original)))
+		original = original->_bridge;
+
+	if (clone->_bridge && (clone->_bridge != ast_bridged_channel(clone)))
+		clone = clone->_bridge;
 
 	if (original == clone) {
 		ast_log(LOG_WARNING, "Can't masquerade channel '%s' into itself!\n", original->name);
@@ -3282,6 +3336,9 @@
 	int watch_c0_dtmf;
 	int watch_c1_dtmf;
 	void *pvt0, *pvt1;
+	/* Indicates whether a frame was queued into a jitterbuffer */
+	int frame_put_in_jb = 0;
+	int jb_in_use;
 	int to;
 	
 	cs[0] = c0;
@@ -3293,6 +3350,9 @@
 	watch_c0_dtmf = config->flags & AST_BRIDGE_DTMF_CHANNEL_0;
 	watch_c1_dtmf = config->flags & AST_BRIDGE_DTMF_CHANNEL_1;
 
+	/* Check the need of a jitterbuffer for each channel */
+	jb_in_use = ast_jb_do_usecheck(c0, c1);
+
 	for (;;) {
 		struct ast_channel *who, *other;
 
@@ -3311,9 +3371,15 @@
 			}
 		} else
 			to = -1;
+		/* Calculate the appropriate max sleep interval - in general, this is the time,
+		   left to the closest jb delivery moment */
+		if (jb_in_use)
+			to = ast_jb_get_when_to_wakeup(c0, c1, to);
 		who = ast_waitfor_n(cs, 2, &to);
 		if (!who) {
-			ast_log(LOG_DEBUG, "Nobody there, continuing...\n");
+			/* No frame received within the specified timeout - check if we have to deliver now */
+			if (jb_in_use)
+				ast_jb_get_and_deliver(c0, c1);
 			if (c0->_softhangup == AST_SOFTHANGUP_UNBRIDGE || c1->_softhangup == AST_SOFTHANGUP_UNBRIDGE) {
 				if (c0->_softhangup == AST_SOFTHANGUP_UNBRIDGE)
 					c0->_softhangup = 0;
@@ -3333,6 +3399,9 @@
 		}
 
 		other = (who == c0) ? c1 : c0; /* the 'other' channel */
+		/* Try add the frame info the who's bridged channel jitterbuff */
+		if (jb_in_use)
+			frame_put_in_jb = !ast_jb_put(other, f);
 
 		if ((f->frametype == AST_FRAME_CONTROL) && !(config->flags & AST_BRIDGE_IGNORE_SIGS)) {
 			int bridge_exit = 0;
@@ -3369,8 +3438,13 @@
 				ast_log(LOG_DEBUG, "Got DTMF on channel (%s)\n", who->name);
 				break;
 			}
-			/* other frames go to the other side */
-			ast_write(other, f);

[... 14597 lines stripped ...]


More information about the svn-commits mailing list