[asterisk-commits] rmudgett: branch jrose/bridge_projects r385050 - in /team/jrose/bridge_projec...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 8 18:55:13 CDT 2013


Author: rmudgett
Date: Mon Apr  8 18:55:07 2013
New Revision: 385050

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385050
Log:
Multiple revisions 384956,384991,385010,385034-385038

........
  r384956 | rmudgett | 2013-04-08 11:18:52 -0500 (Mon, 08 Apr 2013) | 34 lines
  
  Multiple revisions 384910,384942
  
  ........
    r384910 | mjordan | 2013-04-08 09:26:37 -0500 (Mon, 08 Apr 2013) | 17 lines
    
    Add multi-channel Stasis messages; refactor Dial AMI events to Stasis
    
    This patch does the following:
     * A new Stasis payload has been defined for multi-channel messages. This
       payload can store multiple ast_channel_snapshot objects along with a single
       JSON blob. The payload object itself is opaque; the snapshots are stored
       in a container keyed by roles. APIs have been provided to query for and
       retrieve the snapshots from the payload object.
     * The Dial AMI events have been refactored onto Stasis. This includes dial
       messages in app_dial, as well as the core dialing framework. The AMI events
       have been modified to send out a DialBegin/DialEnd events, as opposed to
       the subevent type that was previously used.
     * Stasis messages, types, and other objects related to channels have been
       placed in their own file, stasis_channels. Unit tests for some of these
       objects/messages have also been written.
  ........
    r384942 | mjordan | 2013-04-08 10:38:34 -0500 (Mon, 08 Apr 2013) | 9 lines
    
    Don't attempt a websocket protocol removal if res_http_websocket isn't there
    
    This patch sets the protocols container provided by res_http_websocket to NULL
    when the module gets unloaded and adds the necessary checks when adding/
    removing a websocket protocol. This prevents some FRACKing on an invalid
    pointer to the disposed container if a module that uses res_http_websocket is
    unloaded after it.
  ........
  
  Merged revisions 384910,384942 from http://svn.asterisk.org/svn/asterisk/trunk
........
  r384991 | root | 2013-04-08 14:17:20 -0500 (Mon, 08 Apr 2013) | 7 lines
  
  Clean up Makefile "warning" clutter when makeopts doesn't exist.
  
  Review: https://reviewboard.asterisk.org/r/2304
  ........
  
  Merged revisions 384989 from file:///srv/subversion/repos/asterisk/trunk
........
  r385010 | rmudgett | 2013-04-08 15:04:41 -0500 (Mon, 08 Apr 2013) | 10 lines
  
  Add support for playing a file and running an application on a bridge channel.
  
  * Added AST_BRIDGE_ACTION_PLAY_FILE and AST_BRIDGE_ACTION_RUN_APP.
  
  * Refactored bridge write frame code to make it easier to put action and
  control frames into the bridge.
  
  * Refactored code to make it easier to put action frames onto the bridge
  channel write queue.
........
  r385034 | rmudgett | 2013-04-08 15:26:16 -0500 (Mon, 08 Apr 2013) | 1 line
  
  Make ast_bridge_channel_lock_bridge() more public.
........
  r385035 | rmudgett | 2013-04-08 15:32:35 -0500 (Mon, 08 Apr 2013) | 1 line
  
  Move bridge_channel wr_queue flushing to the destructor.
........
  r385036 | rmudgett | 2013-04-08 15:42:59 -0500 (Mon, 08 Apr 2013) | 2 lines
  
  Add hooks for successful bridge join and leave.
........
  r385037 | rmudgett | 2013-04-08 15:50:26 -0500 (Mon, 08 Apr 2013) | 1 line
  
  Add AST_BRIDGE_CAPABILITY_EARLY in anticipation of early bridge.
........
  r385038 | rmudgett | 2013-04-08 15:55:07 -0500 (Mon, 08 Apr 2013) | 1 line
  
  Make channel point back to the correct bridge_channel after atxfer.
........

Merged revisions 384956,384991,385010,385034-385038 from http://svn.asterisk.org/svn/asterisk/team/group/bridge_construction

Added:
    team/jrose/bridge_projects/include/asterisk/stasis_channels.h
      - copied unchanged from r385038, team/group/bridge_construction/include/asterisk/stasis_channels.h
    team/jrose/bridge_projects/main/stasis_channels.c
      - copied unchanged from r385038, team/group/bridge_construction/main/stasis_channels.c
    team/jrose/bridge_projects/tests/test_stasis_channels.c
      - copied unchanged from r385038, team/group/bridge_construction/tests/test_stasis_channels.c
Modified:
    team/jrose/bridge_projects/   (props changed)
    team/jrose/bridge_projects/CHANGES
    team/jrose/bridge_projects/Makefile
    team/jrose/bridge_projects/apps/app_dial.c
    team/jrose/bridge_projects/apps/app_stasis.c
    team/jrose/bridge_projects/apps/app_userevent.c
    team/jrose/bridge_projects/apps/stasis_json.c
    team/jrose/bridge_projects/bridges/bridge_builtin_features.c
    team/jrose/bridge_projects/bridges/bridge_builtin_interval_features.c
    team/jrose/bridge_projects/bridges/bridge_softmix.c
    team/jrose/bridge_projects/build_tools/make_buildopts_h
    team/jrose/bridge_projects/build_tools/make_linker_version_script
    team/jrose/bridge_projects/build_tools/make_version
    team/jrose/bridge_projects/build_tools/mkpkgconfig
    team/jrose/bridge_projects/configs/features.conf.sample
    team/jrose/bridge_projects/include/asterisk/app_stasis.h
    team/jrose/bridge_projects/include/asterisk/bridging.h
    team/jrose/bridge_projects/include/asterisk/bridging_features.h
    team/jrose/bridge_projects/include/asterisk/channel.h
    team/jrose/bridge_projects/include/asterisk/manager.h
    team/jrose/bridge_projects/main/bridging.c
    team/jrose/bridge_projects/main/channel.c
    team/jrose/bridge_projects/main/channel_internal_api.c
    team/jrose/bridge_projects/main/dial.c
    team/jrose/bridge_projects/main/features.c
    team/jrose/bridge_projects/main/manager_channels.c
    team/jrose/bridge_projects/main/pbx.c
    team/jrose/bridge_projects/pbx/pbx_realtime.c
    team/jrose/bridge_projects/res/parking/parking_manager.c
    team/jrose/bridge_projects/res/parking/res_parking.h
    team/jrose/bridge_projects/res/res_http_websocket.c
    team/jrose/bridge_projects/res/res_stasis_websocket.c

Propchange: team/jrose/bridge_projects/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/jrose/bridge_projects/
------------------------------------------------------------------------------
--- bridge_construction-integrated (original)
+++ bridge_construction-integrated Mon Apr  8 18:55:07 2013
@@ -1,1 +1,1 @@
-/trunk:1-384889
+/trunk:1-384990

Propchange: team/jrose/bridge_projects/
------------------------------------------------------------------------------
--- bridge_projects-integrated (original)
+++ bridge_projects-integrated Mon Apr  8 18:55:07 2013
@@ -1,1 +1,1 @@
-/team/group/bridge_construction:1-384918
+/team/group/bridge_construction:1-385046

Modified: team/jrose/bridge_projects/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/CHANGES?view=diff&rev=385050&r1=385049&r2=385050
==============================================================================
--- team/jrose/bridge_projects/CHANGES (original)
+++ team/jrose/bridge_projects/CHANGES Mon Apr  8 18:55:07 2013
@@ -65,6 +65,12 @@
 
  * The deprecated use of | (pipe) as a separator in the channelvars setting in
    manager.conf has been removed.
+
+ * Channel Variables conveyed with a channel no longer contain the name of the
+   channel as part of the key field, i.e., ChanVariable(SIP/foo): bar=baz is now
+   ChanVariable: bar=baz. When multiple channels are present in a single AMI
+   event, the various ChanVariable fields will contain a suffix that specifies
+   which channel they correspond to.
 
 Channel Drivers
 ------------------

Modified: team/jrose/bridge_projects/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/Makefile?view=diff&rev=385050&r1=385049&r2=385050
==============================================================================
--- team/jrose/bridge_projects/Makefile (original)
+++ team/jrose/bridge_projects/Makefile Mon Apr  8 18:55:07 2013
@@ -81,6 +81,8 @@
                           # should go directly to ASTLDFLAGS
 
 #--- paths to various commands
+# The makeopts include below tries to set these if they're found during
+# configure.
 export CC
 export CXX
 export AR
@@ -221,10 +223,13 @@
   _ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include -D_XPG4_2 -D__EXTENSIONS__
 endif
 
-ASTERISKVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) GIT=$(GIT) build_tools/make_version .)
-
-ifneq ($(wildcard .version),)
-  ASTERISKVERSIONNUM:=$(shell $(AWK) -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
+ifneq ($(GREP),)
+  ASTERISKVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) GIT=$(GIT) build_tools/make_version .)
+endif
+ifneq ($(AWK),)
+  ifneq ($(wildcard .version),)
+    ASTERISKVERSIONNUM:=$(shell $(AWK) -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
+  endif
 endif
 
 ifneq ($(wildcard .svn),)
@@ -450,7 +455,11 @@
 	done
 	$(MAKE) -C sounds install
 
-doc/core-en_US.xml: makeopts cleantest $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
+ifneq ($(GREP),)
+  XML_core_en_US = $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
+endif
+
+doc/core-en_US.xml: makeopts cleantest $(XML_core_en_US)
 	@printf "Building Documentation For: "
 	@echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $@
 	@echo "<!DOCTYPE docs SYSTEM \"appdocsxml.dtd\">" >> $@
@@ -464,7 +473,11 @@
 	@echo
 	@echo "</docs>" >> $@
 
-doc/full-en_US.xml: makeopts cleantest $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
+ifneq ($(GREP),)
+  XMX_full_en_US = $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
+endif
+
+doc/full-en_US.xml: makeopts cleantest $(XML_full_en_US)
 ifeq ($(PYTHON),:)
 	@echo "--------------------------------------------------------------------------"
 	@echo "---        Please install python to build full documentation           ---"

Modified: team/jrose/bridge_projects/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/apps/app_dial.c?view=diff&rev=385050&r1=385049&r2=385050
==============================================================================
--- team/jrose/bridge_projects/apps/app_dial.c (original)
+++ team/jrose/bridge_projects/apps/app_dial.c Mon Apr  8 18:55:07 2013
@@ -68,6 +68,7 @@
 #include "asterisk/indications.h"
 #include "asterisk/framehook.h"
 #include "asterisk/bridging.h"
+#include "asterisk/stasis_channels.h"
 
 /*** DOCUMENTATION
 	<application name="Dial" language="en_US">
@@ -819,63 +820,6 @@
 	return ast_get_hint(NULL, 0, name, namelen, chan, context, exten) ? name : "";
 }
 
-static void senddialevent(struct ast_channel *src, struct ast_channel *dst, const char *dialstring)
-{
-	struct ast_channel *chans[] = { src, dst };
-	/*** DOCUMENTATION
-		<managerEventInstance>
-			<synopsis>Raised when a dial action has started.</synopsis>
-			<syntax>
-				<parameter name="SubEvent">
-					<para>A sub event type, specifying whether the dial action has begun or ended.</para>
-					<enumlist>
-						<enum name="Begin"/>
-						<enum name="End"/>
-					</enumlist>
-				</parameter>
-			</syntax>
-		</managerEventInstance>
-	***/
-	ast_manager_event_multichan(EVENT_FLAG_CALL, "Dial", 2, chans,
-		"SubEvent: Begin\r\n"
-		"Channel: %s\r\n"
-		"Destination: %s\r\n"
-		"CallerIDNum: %s\r\n"
-		"CallerIDName: %s\r\n"
-		"ConnectedLineNum: %s\r\n"
-		"ConnectedLineName: %s\r\n"
-		"UniqueID: %s\r\n"
-		"DestUniqueID: %s\r\n"
-		"Dialstring: %s\r\n",
-		ast_channel_name(src), ast_channel_name(dst),
-		S_COR(ast_channel_caller(src)->id.number.valid, ast_channel_caller(src)->id.number.str, "<unknown>"),
-		S_COR(ast_channel_caller(src)->id.name.valid, ast_channel_caller(src)->id.name.str, "<unknown>"),
-		S_COR(ast_channel_connected(src)->id.number.valid, ast_channel_connected(src)->id.number.str, "<unknown>"),
-		S_COR(ast_channel_connected(src)->id.name.valid, ast_channel_connected(src)->id.name.str, "<unknown>"),
-		ast_channel_uniqueid(src), ast_channel_uniqueid(dst),
-		dialstring ? dialstring : "");
-}
-
-static void senddialendevent(struct ast_channel *src, const char *dialstatus)
-{
-	/*** DOCUMENTATION
-		<managerEventInstance>
-			<synopsis>Raised when a dial action has ended.</synopsis>
-			<syntax>
-				<parameter name="DialStatus">
-					<para>The value of the <variable>DIALSTATUS</variable> channel variable.</para>
-				</parameter>
-			</syntax>
-		</managerEventInstance>
-	***/
-	ast_manager_event(src, EVENT_FLAG_CALL, "Dial",
-		"SubEvent: End\r\n"
-		"Channel: %s\r\n"
-		"UniqueID: %s\r\n"
-		"DialStatus: %s\r\n",
-		ast_channel_name(src), ast_channel_uniqueid(src), dialstatus);
-}
-
 /*!
  * helper function for wait_for_answer()
  *
@@ -1070,7 +1014,7 @@
 			num->nochan++;
 		} else {
 			ast_channel_lock_both(c, in);
-			senddialevent(in, c, stuff);
+			ast_channel_publish_dial(c, in, stuff, NULL);
 			ast_channel_unlock(in);
 			ast_channel_unlock(c);
 			/* Hangup the original channel now, in case we needed it */
@@ -1090,6 +1034,33 @@
 	char privintro[1024];
 	char status[256];
 };
+
+static const char *hangup_cause_to_dial_status(int hangup_cause)
+{
+	switch(hangup_cause) {
+	case AST_CAUSE_BUSY:
+		return "BUSY";
+	case AST_CAUSE_CONGESTION:
+		return "CONGESTION";
+	case AST_CAUSE_NO_ROUTE_DESTINATION:
+	case AST_CAUSE_UNREGISTERED:
+		return "CHANUNAVAIL";
+	case AST_CAUSE_NO_ANSWER:
+	default:
+		return "NOANSWER";
+	}
+}
+
+static void publish_dial_end_event(struct ast_channel *in, struct dial_head *out_chans, struct ast_channel *exception, const char *status)
+{
+	struct chanlist *outgoing;
+	AST_LIST_TRAVERSE(out_chans, outgoing, node) {
+		if (!outgoing->chan || outgoing->chan == exception) {
+			continue;
+		}
+		ast_channel_publish_dial(in, outgoing->chan, NULL, status);
+	}
+}
 
 static struct ast_channel *wait_for_answer(struct ast_channel *in,
 	struct dial_head *out_chans, int *to, struct ast_flags64 *peerflags,
@@ -1134,6 +1105,7 @@
 				*to = -1;
 				strcpy(pa->status, "CONGESTION");
 				ast_cdr_failed(ast_channel_cdr(in));
+				ast_channel_publish_dial(in, outgoing->chan, NULL, pa->status);
 				return NULL;
 			}
 		}
@@ -1294,6 +1266,7 @@
 #ifdef HAVE_EPOLL
 				ast_poll_channel_del(in, c);
 #endif
+				ast_channel_publish_dial(in, c, NULL, hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
 				ast_hangup(c);
 				c = o->chan = NULL;
 				ast_clear_flag64(o, DIAL_STILLGOING);
@@ -1334,6 +1307,8 @@
 							}
 						}
 						peer = c;
+						ast_channel_publish_dial(in, peer, NULL, "ANSWER");
+						publish_dial_end_event(in, out_chans, peer, "CANCEL");
 						if (ast_channel_cdr(peer)) {
 							ast_channel_cdr(peer)->answer = ast_tvnow();
 							ast_channel_cdr(peer)->disposition = AST_CDR_ANSWERED;
@@ -1347,9 +1322,10 @@
 							DIAL_NOFORWARDHTML);
 						ast_channel_dialcontext_set(c, "");
 						ast_channel_exten_set(c, "");
-						if (CAN_EARLY_BRIDGE(peerflags, in, peer))
+						if (CAN_EARLY_BRIDGE(peerflags, in, peer)) {
 							/* Setup early bridge if appropriate */
 							ast_channel_early_bridge(in, peer);
+						}
 					}
 					/* If call has been answered, then the eventual hangup is likely to be normal hangup */
 					ast_channel_hangupcause_set(in, AST_CAUSE_NORMAL_CLEARING);
@@ -1358,6 +1334,7 @@
 				case AST_CONTROL_BUSY:
 					ast_verb(3, "%s is busy\n", ast_channel_name(c));
 					ast_channel_hangupcause_set(in, ast_channel_hangupcause(c));
+					ast_channel_publish_dial(in, c, NULL, hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
 					ast_hangup(c);
 					c = o->chan = NULL;
 					ast_clear_flag64(o, DIAL_STILLGOING);
@@ -1366,6 +1343,7 @@
 				case AST_CONTROL_CONGESTION:
 					ast_verb(3, "%s is circuit-busy\n", ast_channel_name(c));
 					ast_channel_hangupcause_set(in, ast_channel_hangupcause(c));
+					ast_channel_publish_dial(in, c, NULL, hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
 					ast_hangup(c);
 					c = o->chan = NULL;
 					ast_clear_flag64(o, DIAL_STILLGOING);
@@ -1573,6 +1551,7 @@
 				*to = -1;
 				strcpy(pa->status, "CANCEL");
 				ast_cdr_noanswer(ast_channel_cdr(in));
+				publish_dial_end_event(in, out_chans, NULL, pa->status);
 				if (f) {
 					if (f->data.uint32) {
 						ast_channel_hangupcause_set(in, f->data.uint32);
@@ -1597,6 +1576,7 @@
 						ast_cdr_noanswer(ast_channel_cdr(in));
 						*result = f->subclass.integer;
 						strcpy(pa->status, "CANCEL");
+						publish_dial_end_event(in, out_chans, NULL, pa->status);
 						ast_frfree(f);
 						ast_channel_unlock(in);
 						if (is_cc_recall) {
@@ -1613,6 +1593,7 @@
 					*to = 0;
 					strcpy(pa->status, "CANCEL");
 					ast_cdr_noanswer(ast_channel_cdr(in));
+					publish_dial_end_event(in, out_chans, NULL, pa->status);
 					ast_frfree(f);
 					if (is_cc_recall) {
 						ast_cc_completed(in, "CC completed, but the caller hung up with DTMF");
@@ -1708,6 +1689,7 @@
 
 	if (!*to) {
 		ast_verb(3, "Nobody picked up in %d ms\n", orig);
+		publish_dial_end_event(in, out_chans, NULL, "NOANSWER");
 	}
 	if (!*to || ast_check_hangup(in)) {
 		ast_cdr_noanswer(ast_channel_cdr(in));
@@ -2656,7 +2638,7 @@
 			continue;
 		}
 
-		senddialevent(chan, tmp->chan, tmp->number);
+		ast_channel_publish_dial(chan, tmp->chan, tmp->number, NULL);
 		ast_channel_unlock(chan);
 
 		ast_verb(3, "Called %s\n", tmp->interface);
@@ -3111,7 +3093,6 @@
 	ast_channel_early_bridge(chan, NULL);
 	hanguptree(&out_chans, NULL, ast_channel_hangupcause(chan)==AST_CAUSE_ANSWERED_ELSEWHERE || ast_test_flag64(&opts, OPT_CANCEL_ELSEWHERE) ? 1 : 0 ); /* forward 'answered elsewhere' if we received it */
 	pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
-	senddialendevent(chan, pa.status);
 	ast_debug(1, "Exiting with DIALSTATUS=%s.\n", pa.status);
 
 	if ((ast_test_flag64(peerflags, OPT_GO_ON)) && !ast_check_hangup(chan) && (res != AST_PBX_INCOMPLETE)) {

Modified: team/jrose/bridge_projects/apps/app_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/apps/app_stasis.c?view=diff&rev=385050&r1=385049&r2=385050
==============================================================================
--- team/jrose/bridge_projects/apps/app_stasis.c (original)
+++ team/jrose/bridge_projects/apps/app_stasis.c Mon Apr  8 18:55:07 2013
@@ -38,6 +38,7 @@
 #include "asterisk/module.h"
 #include "asterisk/stasis.h"
 #include "asterisk/strings.h"
+#include "asterisk/stasis_channels.h"
 
 /*** DOCUMENTATION
 	<application name="Stasis" language="en_US">

Modified: team/jrose/bridge_projects/apps/app_userevent.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/apps/app_userevent.c?view=diff&rev=385050&r1=385049&r2=385050
==============================================================================
--- team/jrose/bridge_projects/apps/app_userevent.c (original)
+++ team/jrose/bridge_projects/apps/app_userevent.c Mon Apr  8 18:55:07 2013
@@ -34,6 +34,7 @@
 #include "asterisk/manager.h"
 #include "asterisk/app.h"
 #include "asterisk/json.h"
+#include "asterisk/stasis_channels.h"
 
 /*** DOCUMENTATION
 	<application name="UserEvent" language="en_US">

Modified: team/jrose/bridge_projects/apps/stasis_json.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/apps/stasis_json.c?view=diff&rev=385050&r1=385049&r2=385050
==============================================================================
--- team/jrose/bridge_projects/apps/stasis_json.c (original)
+++ team/jrose/bridge_projects/apps/stasis_json.c Mon Apr  8 18:55:07 2013
@@ -28,6 +28,7 @@
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/app_stasis.h"
+#include "asterisk/stasis_channels.h"
 
 struct ast_json *ast_channel_snapshot_to_json(const struct ast_channel_snapshot *snapshot)
 {

Modified: team/jrose/bridge_projects/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/bridges/bridge_builtin_features.c?view=diff&rev=385050&r1=385049&r2=385050
==============================================================================
--- team/jrose/bridge_projects/bridges/bridge_builtin_features.c (original)
+++ team/jrose/bridge_projects/bridges/bridge_builtin_features.c Mon Apr  8 18:55:07 2013
@@ -363,6 +363,18 @@
 	 */
 	ast_bridge_join(attended_bridge, bridge_channel->chan, NULL, &caller_features, NULL, 0);
 
+/*
+ * BUGBUG there is a small window where the channel does not point to the bridge_channel.
+ *
+ * This window is expected to go away when atxfer is redesigned
+ * to fully support existing functionality.  There will be one
+ * and only one ast_bridge_channel structure per channel.
+ */
+	/* Point the channel back to the original bridge_channel. */
+	ast_channel_lock(bridge_channel->chan);
+	ast_channel_internal_bridge_channel_set(bridge_channel->chan, bridge_channel);
+	ast_channel_unlock(bridge_channel->chan);
+
 	/* Wait for peer thread to exit bridge and die. */
 	if (!ast_autoservice_start(bridge_channel->chan)) {
 		ast_bridge_depart(peer);

Modified: team/jrose/bridge_projects/bridges/bridge_builtin_interval_features.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/bridges/bridge_builtin_interval_features.c?view=diff&rev=385050&r1=385049&r2=385050
==============================================================================
--- team/jrose/bridge_projects/bridges/bridge_builtin_interval_features.c (original)
+++ team/jrose/bridge_projects/bridges/bridge_builtin_interval_features.c Mon Apr  8 18:55:07 2013
@@ -98,7 +98,13 @@
 		ast_stream_and_wait(bridge_channel->chan, file, AST_DIGIT_NONE);
 	}
 
-	/* It may be necessary to resume music on hold after we finish playing the announcment. */
+	/*
+	 * It may be necessary to resume music on hold after we finish
+	 * playing the announcment.
+	 *
+	 * XXX We have no idea what MOH class was in use before playing
+	 * the file.
+	 */
 	if (ast_test_flag(ast_channel_flags(bridge_channel->chan), AST_FLAG_MOH)) {
 		ast_moh_start(bridge_channel->chan, NULL, NULL);
 	}

Modified: team/jrose/bridge_projects/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/bridges/bridge_softmix.c?view=diff&rev=385050&r1=385049&r2=385050
==============================================================================
--- team/jrose/bridge_projects/bridges/bridge_softmix.c (original)
+++ team/jrose/bridge_projects/bridges/bridge_softmix.c Mon Apr  8 18:55:07 2013
@@ -382,12 +382,7 @@
  */
 static void softmix_src_change(struct ast_bridge_channel *bridge_channel)
 {
-	struct ast_frame frame = {
-		.frametype = AST_FRAME_CONTROL,
-		.subclass.integer = AST_CONTROL_SRCCHANGE
-	};
-
-	ast_bridge_channel_queue_frame(bridge_channel, &frame);
+	ast_bridge_channel_queue_control_data(bridge_channel, AST_CONTROL_SRCCHANGE, NULL, 0);
 }
 
 /*! \brief Function called when a channel is joined into the bridge */

Modified: team/jrose/bridge_projects/build_tools/make_buildopts_h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/build_tools/make_buildopts_h?view=diff&rev=385050&r1=385049&r2=385050
==============================================================================
--- team/jrose/bridge_projects/build_tools/make_buildopts_h (original)
+++ team/jrose/bridge_projects/build_tools/make_buildopts_h Mon Apr  8 18:55:07 2013
@@ -1,4 +1,7 @@
 #!/bin/sh
+
+GREP=${GREP:-grep}
+MD5=${MD5:-md5sum}
 
 cat << END
 /*

Modified: team/jrose/bridge_projects/build_tools/make_linker_version_script
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/build_tools/make_linker_version_script?view=diff&rev=385050&r1=385049&r2=385050
==============================================================================
--- team/jrose/bridge_projects/build_tools/make_linker_version_script (original)
+++ team/jrose/bridge_projects/build_tools/make_linker_version_script Mon Apr  8 18:55:07 2013
@@ -1,5 +1,6 @@
 #!/bin/sh
+
+AWK=${AWK:-awk}
 
 test -f ${1}.exports.in && ${AWK} "{sub(\"LINKER_SYMBOL_PREFIX\", \"${2}\"); print;}" ${1}.exports.in > ${1}.exports && exit 0
 test -f ${1}.exports.in || rm -f ${1}.exports && cp ${3}/default.exports ${1}.exports && exit 0
-

Modified: team/jrose/bridge_projects/build_tools/make_version
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/build_tools/make_version?view=diff&rev=385050&r1=385049&r2=385050
==============================================================================
--- team/jrose/bridge_projects/build_tools/make_version (original)
+++ team/jrose/bridge_projects/build_tools/make_version Mon Apr  8 18:55:07 2013
@@ -1,4 +1,8 @@
 #!/bin/sh
+
+AWK=${AWK:-awk}
+GIT=${GIT:-git}
+GREP=${GREP:-grep}
 
 if [ -f ${1}/.version ]; then
     cat ${1}/.version
@@ -92,7 +96,7 @@
     # If the first log commit messages indicates that this is checked into
     # subversion, we'll just use the SVN- form of the revision.
     MODIFIED=""
-    SVN_REV=`${GIT} log --pretty=full -1 | grep -F "git-svn-id:" | sed -e "s/.*\@\([^\s]*\)\s.*/\1/g"`
+    SVN_REV=`${GIT} log --pretty=full -1 | ${GREP} -F "git-svn-id:" | sed -e "s/.*\@\([^\s]*\)\s.*/\1/g"`
     if [ -z "$SVN_REV" ]; then
         VERSION=GIT-`${GIT} describe --long --always --tags --dirty=M 2> /dev/null`
         if [ $? -ne 0 ]; then
@@ -105,7 +109,7 @@
         fi
         echo ${VERSION}
     else
-        PARTS=`LANG=C ${GIT} log --pretty=full | grep -F "git-svn-id:" | head -1 | awk '{print $2;}' | sed -e s:^.*/svn/$2/:: | sed -e 's:/: :g' | sed -e 's/@.*$//g'`
+        PARTS=`LANG=C ${GIT} log --pretty=full | ${GREP} -F "git-svn-id:" | head -1 | ${AWK} '{print $2;}' | sed -e s:^.*/svn/$2/:: | sed -e 's:/: :g' | sed -e 's/@.*$//g'`
         BRANCH=0
         TEAM=0
         TAG=0

Modified: team/jrose/bridge_projects/build_tools/mkpkgconfig
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/build_tools/mkpkgconfig?view=diff&rev=385050&r1=385049&r2=385050
==============================================================================
--- team/jrose/bridge_projects/build_tools/mkpkgconfig (original)
+++ team/jrose/bridge_projects/build_tools/mkpkgconfig Mon Apr  8 18:55:07 2013
@@ -1,5 +1,6 @@
 #!/bin/sh
 PPATH="$1"
+GREP=${GREP:-grep}
 ## Make sure we were called from Makefile
 
 if [ "x$ASTERISKVERSIONNUM" = "x" ]; then

Modified: team/jrose/bridge_projects/configs/features.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/configs/features.conf.sample?view=diff&rev=385050&r1=385049&r2=385050
==============================================================================
--- team/jrose/bridge_projects/configs/features.conf.sample (original)
+++ team/jrose/bridge_projects/configs/features.conf.sample Mon Apr  8 18:55:07 2013
@@ -157,7 +157,7 @@
 ;
 ;    Set(__DYNAMIC_FEATURES=myfeature1#myfeature2#myfeature3)
 ;
-; (Note: The two leading underscores allow these feature settings to be set on
+; (Note: The two leading underscores allow these feature settings to be set
 ;  on the outbound channels, as well.  Otherwise, only the original channel
 ;  will have access to these features.)
 ;

Modified: team/jrose/bridge_projects/include/asterisk/app_stasis.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/include/asterisk/app_stasis.h?view=diff&rev=385050&r1=385049&r2=385050
==============================================================================
--- team/jrose/bridge_projects/include/asterisk/app_stasis.h (original)
+++ team/jrose/bridge_projects/include/asterisk/app_stasis.h Mon Apr  8 18:55:07 2013
@@ -48,6 +48,8 @@
 
 #include "asterisk/channel.h"
 #include "asterisk/json.h"
+
+struct ast_channel_snapshot;
 
 /*! @{ */
 

Modified: team/jrose/bridge_projects/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/include/asterisk/bridging.h?view=diff&rev=385050&r1=385049&r2=385050
==============================================================================
--- team/jrose/bridge_projects/include/asterisk/bridging.h (original)
+++ team/jrose/bridge_projects/include/asterisk/bridging.h Mon Apr  8 18:55:07 2013
@@ -78,12 +78,14 @@
 enum ast_bridge_capability {
 	/*! Bridge technology can service calls on hold */
 	AST_BRIDGE_CAPABILITY_HOLDING = (1 << 0),
+	/*! Bridge waits for channel to answer.  Passes early media. */
+	AST_BRIDGE_CAPABILITY_EARLY = (1 << 1),
 	/*! Bridge should natively bridge two channels if possible */
-	AST_BRIDGE_CAPABILITY_NATIVE = (1 << 1),
+	AST_BRIDGE_CAPABILITY_NATIVE = (1 << 2),
 	/*! Bridge is only capable of mixing 2 channels */
-	AST_BRIDGE_CAPABILITY_1TO1MIX = (1 << 2),
+	AST_BRIDGE_CAPABILITY_1TO1MIX = (1 << 3),
 	/*! Bridge is capable of mixing 2 or more channels */
-	AST_BRIDGE_CAPABILITY_MULTIMIX = (1 << 3),
+	AST_BRIDGE_CAPABILITY_MULTIMIX = (1 << 4),
 };
 
 /*! \brief State information about a bridged channel */
@@ -188,6 +190,10 @@
 	AST_BRIDGE_ACTION_TALKING_START,
 	/*! Bridged channel is to indicate talking stop */
 	AST_BRIDGE_ACTION_TALKING_STOP,
+	/*! Bridge channel is to play the indicated sound file. */
+	AST_BRIDGE_ACTION_PLAY_FILE,
+	/*! Bridge channel is to run the indicated application. */
+	AST_BRIDGE_ACTION_RUN_APP,
 
 	/*
 	 * Bridge actions put after this comment must never be put onto
@@ -800,6 +806,25 @@
 }
 
 /*!
+ * \brief Lock the bridge associated with the bridge channel.
+ * \since 12.0.0
+ *
+ * \param bridge_channel Channel that wants to lock the bridge.
+ *
+ * \details
+ * This is an upstream lock operation.  The defined locking
+ * order is bridge then bridge_channel.
+ *
+ * \note On entry, neither the bridge nor bridge_channel is locked.
+ *
+ * \note The bridge_channel->bridge pointer changes because of a
+ * bridge-merge/channel-move operation between bridges.
+ *
+ * \return Nothing
+ */
+void ast_bridge_channel_lock_bridge(struct ast_bridge_channel *bridge_channel);
+
+/*!
  * \brief Set bridge channel state to leave bridge (if not leaving already) with no lock.
  *
  * \param bridge_channel Channel to change the state on
@@ -864,6 +889,173 @@
  * \note BUGBUG This may get moved.
  */
 int ast_bridge_channel_queue_frame(struct ast_bridge_channel *bridge_channel, struct ast_frame *fr);
+
+/*!
+ * \brief Used to queue an action frame onto a bridge channel and write an action frame into a bridge.
+ * \since 12.0.0
+ *
+ * \param bridge_channel Which channel work with.
+ * \param action Type of bridge action frame.
+ * \param data Frame payload data to pass.
+ * \param datalen Frame payload data length to pass.
+ *
+ * \return Nothing
+ */
+typedef void (*ast_bridge_channel_post_action_data)(struct ast_bridge_channel *bridge_channel, enum ast_bridge_action_type action, const void *data, size_t datalen);
+
+/*!
+ * \brief Queue an action frame onto the bridge channel with data.
+ * \since 12.0.0
+ *
+ * \param bridge_channel Which channel to queue the frame onto.
+ * \param action Type of bridge action frame.
+ * \param data Frame payload data to pass.
+ * \param datalen Frame payload data length to pass.
+ *
+ * \return Nothing
+ */
+void ast_bridge_channel_queue_action_data(struct ast_bridge_channel *bridge_channel, enum ast_bridge_action_type action, const void *data, size_t datalen);
+
+/*!
+ * \brief Write an action frame into the bridge with data.
+ * \since 12.0.0
+ *
+ * \param bridge_channel Which channel is putting the frame into the bridge.
+ * \param action Type of bridge action frame.
+ * \param data Frame payload data to pass.
+ * \param datalen Frame payload data length to pass.
+ *
+ * \return Nothing
+ */
+void ast_bridge_channel_write_action_data(struct ast_bridge_channel *bridge_channel, enum ast_bridge_action_type action, const void *data, size_t datalen);
+
+/*!
+ * \brief Queue a control frame onto the bridge channel with data.
+ * \since 12.0.0
+ *
+ * \param bridge_channel Which channel to queue the frame onto.
+ * \param control Type of control frame.
+ * \param data Frame payload data to pass.
+ * \param datalen Frame payload data length to pass.
+ *
+ * \return Nothing
+ */
+void ast_bridge_channel_queue_control_data(struct ast_bridge_channel *bridge_channel, enum ast_control_frame_type control, const void *data, size_t datalen);
+
+/*!
+ * \brief Write a control frame into the bridge with data.
+ * \since 12.0.0
+ *
+ * \param bridge_channel Which channel is putting the frame into the bridge.
+ * \param control Type of control frame.
+ * \param data Frame payload data to pass.
+ * \param datalen Frame payload data length to pass.
+ *
+ * \return Nothing
+ */
+void ast_bridge_channel_write_control_data(struct ast_bridge_channel *bridge_channel, enum ast_control_frame_type control, const void *data, size_t datalen);
+
+/*!
+ * \brief Run an application on the bridge channel.
+ * \since 12.0.0
+ *
+ * \param bridge_channel Which channel to run the application on.
+ * \param app_name Dialplan application name.
+ * \param app_args Arguments for the application. (NULL tolerant)
+ * \param moh_class MOH class to request bridge peers to hear while application is running.
+ *     NULL if no MOH.
+ *     Empty if default MOH class.
+ *
+ * \note This is intended to be called by bridge hooks.
+ *
+ * \return Nothing
+ */
+void ast_bridge_channel_run_app(struct ast_bridge_channel *bridge_channel, const char *app_name, const char *app_args, const char *moh_class);
+
+/*!
+ * \brief Write a bridge action run application frame into the bridge.
+ * \since 12.0.0
+ *
+ * \param bridge_channel Which channel is putting the frame into the bridge
+ * \param app_name Dialplan application name.
+ * \param app_args Arguments for the application. (NULL or empty for no arguments)
+ * \param moh_class MOH class to request bridge peers to hear while application is running.
+ *     NULL if no MOH.
+ *     Empty if default MOH class.
+ *
+ * \note This is intended to be called by bridge hooks.
+ *
+ * \return Nothing
+ */
+void ast_bridge_channel_write_app(struct ast_bridge_channel *bridge_channel, const char *app_name, const char *app_args, const char *moh_class);
+
+/*!
+ * \brief Queue a bridge action run application frame onto the bridge channel.
+ * \since 12.0.0
+ *
+ * \param bridge_channel Which channel to put the frame onto
+ * \param app_name Dialplan application name.
+ * \param app_args Arguments for the application. (NULL or empty for no arguments)
+ * \param moh_class MOH class to request bridge peers to hear while application is running.
+ *     NULL if no MOH.
+ *     Empty if default MOH class.
+ *
+ * \note This is intended to be called by bridge hooks.
+ *
+ * \return Nothing
+ */
+void ast_bridge_channel_queue_app(struct ast_bridge_channel *bridge_channel, const char *app_name, const char *app_args, const char *moh_class);
+
+/*!
+ * \brief Play a file on the bridge channel.
+ * \since 12.0.0
+ *
+ * \param bridge_channel Which channel to play the file on
+ * \param custom_play Call this function to play the playfile. (NULL if normal sound file to play)
+ * \param playfile Sound filename to play.
+ * \param moh_class MOH class to request bridge peers to hear while file is played.
+ *     NULL if no MOH.
+ *     Empty if default MOH class.
+ *
+ * \note This is intended to be called by bridge hooks.
+ *
+ * \return Nothing
+ */
+void ast_bridge_channel_playfile(struct ast_bridge_channel *bridge_channel, void (*custom_play)(const char *playfile), const char *playfile, const char *moh_class);
+
+/*!
+ * \brief Write a bridge action play file frame into the bridge.
+ * \since 12.0.0
+ *
+ * \param bridge_channel Which channel is putting the frame into the bridge
+ * \param custom_play Call this function to play the playfile. (NULL if normal sound file to play)
+ * \param playfile Sound filename to play.
+ * \param moh_class MOH class to request bridge peers to hear while file is played.
+ *     NULL if no MOH.
+ *     Empty if default MOH class.
+ *
+ * \note This is intended to be called by bridge hooks.
+ *
+ * \return Nothing
+ */
+void ast_bridge_channel_write_playfile(struct ast_bridge_channel *bridge_channel, void (*custom_play)(const char *playfile), const char *playfile, const char *moh_class);
+
+/*!
+ * \brief Queue a bridge action play file frame onto the bridge channel.
+ * \since 12.0.0
+ *
+ * \param bridge_channel Which channel to put the frame onto.
+ * \param custom_play Call this function to play the playfile. (NULL if normal sound file to play)
+ * \param playfile Sound filename to play.
+ * \param moh_class MOH class to request bridge peers to hear while file is played.
+ *     NULL if no MOH.
+ *     Empty if default MOH class.
+ *
+ * \note This is intended to be called by bridge hooks.
+ *
+ * \return Nothing
+ */
+void ast_bridge_channel_queue_playfile(struct ast_bridge_channel *bridge_channel, void (*custom_play)(const char *playfile), const char *playfile, const char *moh_class);
 
 /*!
  * \brief Restore the formats of a bridge channel's channel to how they were before bridge_channel_join

Modified: team/jrose/bridge_projects/include/asterisk/bridging_features.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/include/asterisk/bridging_features.h?view=diff&rev=385050&r1=385049&r2=385050
==============================================================================
--- team/jrose/bridge_projects/include/asterisk/bridging_features.h (original)
+++ team/jrose/bridge_projects/include/asterisk/bridging_features.h Mon Apr  8 18:55:07 2013
@@ -197,6 +197,10 @@
 	struct ao2_container *dtmf_hooks;
 	/*! Attached hangup interception hooks container */
 	struct ao2_container *hangup_hooks;
+	/*! Attached bridge channel join interception hooks container */
+	struct ao2_container *join_hooks;
+	/*! Attached bridge channel leave interception hooks container */
+	struct ao2_container *leave_hooks;
 	/*! Attached interval hooks */
 	struct ast_heap *interval_hooks;
 	/*! Used to determine when interval based features should be checked */
@@ -358,6 +362,66 @@
 int ast_bridge_interval_unregister(enum ast_bridge_builtin_interval interval);
 
 /*!
+ * \brief Attach a bridge channel join hook to a bridge features structure
+ *
+ * \param features Bridge features structure
+ * \param callback Function to execute upon activation
+ * \param hook_pvt Unique data
+ * \param destructor Optional destructor callback for hook_pvt data
+ * \param remove_on_pull TRUE if remove the hook when the channel is pulled from the bridge.
+ *
+ * \retval 0 on success
+ * \retval -1 on failure
+ *
+ * Example usage:
+ *
+ * \code
+ * struct ast_bridge_features features;
+ * ast_bridge_features_init(&features);
+ * ast_bridge_join_hook(&features, join_callback, NULL, NULL, 0);
+ * \endcode
+ *
+ * This makes the bridging core call join_callback when a
+ * channel successfully joins the bridging system.  A pointer to
+ * useful data may be provided to the hook_pvt parameter.
+ */
+int ast_bridge_join_hook(struct ast_bridge_features *features,
+	ast_bridge_hook_callback callback,
+	void *hook_pvt,
+	ast_bridge_hook_pvt_destructor destructor,
+	int remove_on_pull);
+
+/*!
+ * \brief Attach a bridge channel leave hook to a bridge features structure
+ *
+ * \param features Bridge features structure
+ * \param callback Function to execute upon activation
+ * \param hook_pvt Unique data
+ * \param destructor Optional destructor callback for hook_pvt data
+ * \param remove_on_pull TRUE if remove the hook when the channel is pulled from the bridge.
+ *
+ * \retval 0 on success
+ * \retval -1 on failure
+ *
+ * Example usage:
+ *
+ * \code
+ * struct ast_bridge_features features;
+ * ast_bridge_features_init(&features);
+ * ast_bridge_leave_hook(&features, leave_callback, NULL, NULL, 0);
+ * \endcode
+ *
+ * This makes the bridging core call leave_callback when a
+ * channel successfully leaves the bridging system.  A pointer
+ * to useful data may be provided to the hook_pvt parameter.

[... 1761 lines stripped ...]



More information about the asterisk-commits mailing list