[asterisk-commits] kmoore: branch kmoore/stasis-bridge_events r385168 - in /team/kmoore/stasis-b...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 10 08:05:31 CDT 2013


Author: kmoore
Date: Wed Apr 10 08:05:28 2013
New Revision: 385168

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385168
Log:
Multiple revisions 384990,384995,385056,385093,385128,385167

........
  r384990 | kmoore | 2013-04-08 14:11:23 -0500 (Mon, 08 Apr 2013) | 37 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
  ........
  
  Merged revisions 384956 from http://svn.asterisk.org/svn/asterisk/team/group/bridge_construction
........
  r384995 | root | 2013-04-08 14:18:37 -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
........
  r385056 | root | 2013-04-08 19:18:40 -0500 (Mon, 08 Apr 2013) | 13 lines
  
  Modified the list of keys for the driver backends for sake of sample clarity
  
  Added a line showing the mapping of "mysql" to res_config_mysql available in add-ons. We used "mysql" as an example driver key in the sample, but didn't show what module it mapped too. Also added a subtitle above the list of keys for driver backends.
  ........
  
  Merged revisions 385047 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 385048 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 385049 from file:///srv/subversion/repos/asterisk/trunk
........
  r385093 | root | 2013-04-09 01:18:35 -0500 (Tue, 09 Apr 2013) | 11 lines
  
  Add inheritance support to FEATURE()/FEATUREMAP().
  
  The settings saved on the channel for FEATURE()/FEATUREMAP() were only
  for that channel.  This patch adds the ability to have these settings
  inherited to child channels if you set FEATURE(inherit)=yes.
  
  Review: https://reviewboard.asterisk.org/r/2415/
  ........
  
  Merged revisions 385088 from file:///srv/subversion/repos/asterisk/trunk
........
  r385128 | root | 2013-04-09 14:18:32 -0500 (Tue, 09 Apr 2013) | 1 line
  
  automerge cancel
........
  r385167 | kmoore | 2013-04-10 07:51:52 -0500 (Wed, 10 Apr 2013) | 95 lines
  
  Multiple revisions 384991,385010,385034-385038,385051,385089,385124,385143
  
  ........
    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.
  ........
    r385051 | root | 2013-04-08 19:17:19 -0500 (Mon, 08 Apr 2013) | 13 lines
    
    Modified the list of keys for the driver backends for sake of sample clarity
    
    Added a line showing the mapping of "mysql" to res_config_mysql available in add-ons. We used "mysql" as an example driver key in the sample, but didn't show what module it mapped too. Also added a subtitle above the list of keys for driver backends.
    ........
    
    Merged revisions 385047 from http://svn.asterisk.org/svn/asterisk/branches/1.8
    ........
    
    Merged revisions 385048 from http://svn.asterisk.org/svn/asterisk/branches/11
    ........
    
    Merged revisions 385049 from file:///srv/subversion/repos/asterisk/trunk
  ........
    r385089 | root | 2013-04-09 01:17:20 -0500 (Tue, 09 Apr 2013) | 11 lines
    
    Add inheritance support to FEATURE()/FEATUREMAP().
    
    The settings saved on the channel for FEATURE()/FEATUREMAP() were only
    for that channel.  This patch adds the ability to have these settings
    inherited to child channels if you set FEATURE(inherit)=yes.
    
    Review: https://reviewboard.asterisk.org/r/2415/
    ........
    
    Merged revisions 385088 from file:///srv/subversion/repos/asterisk/trunk
  ........
    r385124 | root | 2013-04-09 14:17:21 -0500 (Tue, 09 Apr 2013) | 9 lines
    
    Backported app_stasis fix from stasis-http branch.
    
    The hash and compare functions for the control container was reusing
    the wrong ones, causing some problems. I fixed it, but in the wrong
    branch. Oh well, it happens.
    ........
    
    Merged revisions 385116 from file:///srv/subversion/repos/asterisk/trunk
  ........
    r385143 | root | 2013-04-09 15:17:20 -0500 (Tue, 09 Apr 2013) | 7 lines
    
    Rename struct feature_ds to struct feature_datastore.
    
    Because "struct feature_ds *feature_ds" is not a good thing.
    ........
    
    Merged revisions 385142 from file:///srv/subversion/repos/asterisk/trunk
  ........
  
  Merged revisions 384991,385010,385034-385038,385051,385089,385124,385143 from http://svn.asterisk.org/svn/asterisk/team/group/bridge_construction
........

Merged revisions 384990,384995,385056,385093,385128,385167 from http://svn.asterisk.org/svn/asterisk/team/kmoore/stasis-bridging-channel_events

Added:
    team/kmoore/stasis-bridge_events/include/asterisk/stasis_channels.h
      - copied unchanged from r385167, team/kmoore/stasis-bridging-channel_events/include/asterisk/stasis_channels.h
    team/kmoore/stasis-bridge_events/main/stasis_channels.c
      - copied unchanged from r385167, team/kmoore/stasis-bridging-channel_events/main/stasis_channels.c
    team/kmoore/stasis-bridge_events/tests/test_stasis_channels.c
      - copied unchanged from r385167, team/kmoore/stasis-bridging-channel_events/tests/test_stasis_channels.c
Modified:
    team/kmoore/stasis-bridge_events/   (props changed)
    team/kmoore/stasis-bridge_events/CHANGES
    team/kmoore/stasis-bridge_events/Makefile
    team/kmoore/stasis-bridge_events/apps/app_dial.c
    team/kmoore/stasis-bridge_events/apps/app_stasis.c
    team/kmoore/stasis-bridge_events/apps/app_userevent.c
    team/kmoore/stasis-bridge_events/apps/stasis_json.c
    team/kmoore/stasis-bridge_events/bridges/bridge_builtin_features.c
    team/kmoore/stasis-bridge_events/bridges/bridge_builtin_interval_features.c
    team/kmoore/stasis-bridge_events/bridges/bridge_softmix.c
    team/kmoore/stasis-bridge_events/build_tools/make_buildopts_h
    team/kmoore/stasis-bridge_events/build_tools/make_linker_version_script
    team/kmoore/stasis-bridge_events/build_tools/make_version
    team/kmoore/stasis-bridge_events/build_tools/mkpkgconfig
    team/kmoore/stasis-bridge_events/configs/extconfig.conf.sample
    team/kmoore/stasis-bridge_events/configs/features.conf.sample
    team/kmoore/stasis-bridge_events/include/asterisk/app_stasis.h
    team/kmoore/stasis-bridge_events/include/asterisk/bridging.h
    team/kmoore/stasis-bridge_events/include/asterisk/bridging_features.h
    team/kmoore/stasis-bridge_events/include/asterisk/channel.h
    team/kmoore/stasis-bridge_events/main/bridging.c
    team/kmoore/stasis-bridge_events/main/channel.c
    team/kmoore/stasis-bridge_events/main/channel_internal_api.c
    team/kmoore/stasis-bridge_events/main/dial.c
    team/kmoore/stasis-bridge_events/main/features.c
    team/kmoore/stasis-bridge_events/main/manager_channels.c
    team/kmoore/stasis-bridge_events/main/pbx.c
    team/kmoore/stasis-bridge_events/pbx/pbx_realtime.c
    team/kmoore/stasis-bridge_events/res/res_http_websocket.c
    team/kmoore/stasis-bridge_events/res/res_stasis_websocket.c

Propchange: team/kmoore/stasis-bridge_events/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/kmoore/stasis-bridge_events/
            ('bridge_construction-integrated' removed)

Propchange: team/kmoore/stasis-bridge_events/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Apr 10 08:05:28 2013
@@ -1,1 +1,1 @@
-/team/kmoore/stasis-bridging-channel_events:1-384983
+/team/kmoore/stasis-bridging-channel_events:1-385167

Modified: team/kmoore/stasis-bridge_events/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/CHANGES?view=diff&rev=385168&r1=385167&r2=385168
==============================================================================
--- team/kmoore/stasis-bridge_events/CHANGES (original)
+++ team/kmoore/stasis-bridge_events/CHANGES Wed Apr 10 08:05:28 2013
@@ -53,6 +53,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
 ------------------
 
@@ -82,6 +88,10 @@
 
  * PARKINGSLOT and PARKEDLOT channel variables will now be set for a parked
    channel even when comebactoorigin=yes
+
+ * You can now have the settings for a channel updated using the FEATURE()
+   and FEATUREMAP() functions inherited to child channels by setting
+   FEATURE(inherit)=yes.
 
 Logging
 -------------------

Modified: team/kmoore/stasis-bridge_events/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/Makefile?view=diff&rev=385168&r1=385167&r2=385168
==============================================================================
--- team/kmoore/stasis-bridge_events/Makefile (original)
+++ team/kmoore/stasis-bridge_events/Makefile Wed Apr 10 08:05:28 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/kmoore/stasis-bridge_events/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/apps/app_dial.c?view=diff&rev=385168&r1=385167&r2=385168
==============================================================================
--- team/kmoore/stasis-bridge_events/apps/app_dial.c (original)
+++ team/kmoore/stasis-bridge_events/apps/app_dial.c Wed Apr 10 08:05:28 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/kmoore/stasis-bridge_events/apps/app_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/apps/app_stasis.c?view=diff&rev=385168&r1=385167&r2=385168
==============================================================================
--- team/kmoore/stasis-bridge_events/apps/app_stasis.c (original)
+++ team/kmoore/stasis-bridge_events/apps/app_stasis.c Wed Apr 10 08:05:28 2013
@@ -35,10 +35,12 @@
 #include "asterisk/app_stasis.h"
 #include "asterisk/astobj2.h"
 #include "asterisk/channel.h"
+#include "asterisk/lock.h"
 #include "asterisk/module.h"
 #include "asterisk/stasis.h"
 #include "asterisk/stasis_message_router.h"
 #include "asterisk/strings.h"
+#include "asterisk/stasis_channels.h"
 #include "asterisk/callerid.h"
 #include "asterisk/stasis_bridging.h"
 
@@ -50,7 +52,8 @@
 				<para>Name of the application to invoke.</para>
 			</parameter>
 			<parameter name="args">
-				<para>Optional comma-delimited arguments for the application invocation.</para>
+				<para>Optional comma-delimited arguments for the
+				application invocation.</para>
 			</parameter>
 		</syntax>
 		<description>
@@ -353,7 +356,7 @@
 	 */
 	int continue_to_dialplan:1;
 	/*! Uniqueid of the associated channel */
-	char channel_uniqueid[];
+	char channel_id[];
 };
 
 static struct stasis_app_control *control_create(const char *uniqueid)
@@ -367,9 +370,33 @@
 		return NULL;
 	}
 
-	strncpy(control->channel_uniqueid, uniqueid, size - sizeof(*control));
+	strncpy(control->channel_id, uniqueid, size - sizeof(*control));
 
 	return control;
+}
+
+/*! AO2 hash function for \ref stasis_app_control */
+static int control_hash(const void *obj, const int flags)
+{
+	const struct stasis_app_control *control = obj;
+	const char *id = flags & OBJ_KEY ? obj : control->channel_id;
+
+	return ast_str_hash(id);
+}
+
+/*! AO2 comparison function for \ref stasis_app_control */
+static int control_compare(void *lhs, void *rhs, int flags)
+{
+	const struct stasis_app_control *lhs_control = lhs;
+	const struct stasis_app_control *rhs_control = rhs;
+	const char *rhs_name =
+		flags & OBJ_KEY ? rhs : rhs_control->channel_id;
+
+	if (strcmp(lhs_control->channel_id, rhs_name) == 0) {
+		return CMP_MATCH | CMP_STOP;
+	} else {
+		return 0;
+	}
 }
 
 struct stasis_app_control *stasis_app_control_find_by_channel(
@@ -1081,7 +1108,8 @@
 	}
 
 	controls = app_controls();
-	ao2_unlink_flags(controls, control, OBJ_POINTER | OBJ_UNLINK | OBJ_NODATA);
+	ao2_unlink_flags(controls, control,
+			 OBJ_POINTER | OBJ_UNLINK | OBJ_NODATA);
 	ao2_cleanup(control);
 }
 
@@ -1114,7 +1142,8 @@
 
 	app = ao2_find(apps, args.app_name, OBJ_KEY);
 	if (!app) {
-		ast_log(LOG_ERROR, "Stasis app '%s' not registered\n", args.app_name);
+		ast_log(LOG_ERROR,
+			"Stasis app '%s' not registered\n", args.app_name);
 		return -1;
 	}
 
@@ -1132,7 +1161,8 @@
 
 	res = send_start_msg(app, chan, args.argc - 1, args.app_argv);
 	if (res != 0) {
-		ast_log(LOG_ERROR, "Error sending start message to %s\n", args.app_name);
+		ast_log(LOG_ERROR,
+			"Error sending start message to %s\n", args.app_name);
 		return res;
 	}
 
@@ -1144,14 +1174,16 @@
 	while (!hungup && !control_continue_test_and_reset(control) && ast_waitfor(chan, -1) > -1) {
 		RAII_VAR(struct ast_frame *, f, ast_read(chan), ast_frame_dtor);
 		if (!f) {
-			ast_debug(3, "%s: No more frames. Must be done, I guess.\n", ast_channel_uniqueid(chan));
+			ast_debug(3, "%s: No more frames. Must be done, I guess.\n",
+				  ast_channel_uniqueid(chan));
 			break;
 		}
 
 		switch (f->frametype) {
 		case AST_FRAME_CONTROL:
 			if (f->subclass.integer == AST_CONTROL_HANGUP) {
-				ast_debug(3, "%s: Received hangup\n", ast_channel_uniqueid(chan));
+				ast_debug(3, "%s: Received hangup\n",
+					  ast_channel_uniqueid(chan));
 				hungup = 1;
 			}
 			break;
@@ -1164,7 +1196,8 @@
 	app_remove_channel(app, chan);
 	res = send_end_msg(app, chan);
 	if (res != 0) {
-		ast_log(LOG_ERROR, "Error sending end message to %s\n", args.app_name);
+		ast_log(LOG_ERROR,
+			"Error sending end message to %s\n", args.app_name);
 		return res;
 	}
 
@@ -1179,10 +1212,11 @@
 	app = ao2_find(apps, app_name, OBJ_KEY);
 
 	if (!app) {
-		/* XXX We can do a better job handling late binding, queueing up the call for a few seconds
-		 * to wait for the app to register.
+		/* XXX We can do a better job handling late binding, queueing up
+		 * the call for a few seconds to wait for the app to register.
 		 */
-		ast_log(LOG_WARNING, "Stasis app '%s' not registered\n", app_name);
+		ast_log(LOG_WARNING,
+			"Stasis app '%s' not registered\n", app_name);
 		return -1;
 	}
 
@@ -1236,12 +1270,14 @@
 {
 	int r = 0;
 
-	__apps_registry = ao2_container_alloc(APPS_NUM_BUCKETS, app_hash, app_compare);
+	__apps_registry =
+		ao2_container_alloc(APPS_NUM_BUCKETS, app_hash, app_compare);
 	if (__apps_registry == NULL) {
 		return AST_MODULE_LOAD_FAILURE;
 	}
 
-	__app_controls = ao2_container_alloc(CONTROLS_NUM_BUCKETS, app_hash, app_compare);
+	__app_controls = ao2_container_alloc(CONTROLS_NUM_BUCKETS,
+					     control_hash, control_compare);
 	if (__app_controls == NULL) {
 		return AST_MODULE_LOAD_FAILURE;
 	}
@@ -1299,6 +1335,7 @@
 	return r;
 }
 
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Stasis dialplan application",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS,
+		"Stasis dialplan application",
 		.load = load_module,
 		.unload = unload_module);

Modified: team/kmoore/stasis-bridge_events/apps/app_userevent.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/apps/app_userevent.c?view=diff&rev=385168&r1=385167&r2=385168
==============================================================================
--- team/kmoore/stasis-bridge_events/apps/app_userevent.c (original)
+++ team/kmoore/stasis-bridge_events/apps/app_userevent.c Wed Apr 10 08:05:28 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/kmoore/stasis-bridge_events/apps/stasis_json.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/apps/stasis_json.c?view=diff&rev=385168&r1=385167&r2=385168
==============================================================================
--- team/kmoore/stasis-bridge_events/apps/stasis_json.c (original)
+++ team/kmoore/stasis-bridge_events/apps/stasis_json.c Wed Apr 10 08:05:28 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/kmoore/stasis-bridge_events/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/bridges/bridge_builtin_features.c?view=diff&rev=385168&r1=385167&r2=385168
==============================================================================
--- team/kmoore/stasis-bridge_events/bridges/bridge_builtin_features.c (original)
+++ team/kmoore/stasis-bridge_events/bridges/bridge_builtin_features.c Wed Apr 10 08:05:28 2013
@@ -329,6 +329,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/kmoore/stasis-bridge_events/bridges/bridge_builtin_interval_features.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/bridges/bridge_builtin_interval_features.c?view=diff&rev=385168&r1=385167&r2=385168
==============================================================================
--- team/kmoore/stasis-bridge_events/bridges/bridge_builtin_interval_features.c (original)
+++ team/kmoore/stasis-bridge_events/bridges/bridge_builtin_interval_features.c Wed Apr 10 08:05:28 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/kmoore/stasis-bridge_events/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/bridges/bridge_softmix.c?view=diff&rev=385168&r1=385167&r2=385168
==============================================================================
--- team/kmoore/stasis-bridge_events/bridges/bridge_softmix.c (original)
+++ team/kmoore/stasis-bridge_events/bridges/bridge_softmix.c Wed Apr 10 08:05:28 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/kmoore/stasis-bridge_events/build_tools/make_buildopts_h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/build_tools/make_buildopts_h?view=diff&rev=385168&r1=385167&r2=385168
==============================================================================
--- team/kmoore/stasis-bridge_events/build_tools/make_buildopts_h (original)
+++ team/kmoore/stasis-bridge_events/build_tools/make_buildopts_h Wed Apr 10 08:05:28 2013
@@ -1,4 +1,7 @@
 #!/bin/sh
+
+GREP=${GREP:-grep}
+MD5=${MD5:-md5sum}
 
 cat << END
 /*

Modified: team/kmoore/stasis-bridge_events/build_tools/make_linker_version_script
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/build_tools/make_linker_version_script?view=diff&rev=385168&r1=385167&r2=385168
==============================================================================
--- team/kmoore/stasis-bridge_events/build_tools/make_linker_version_script (original)
+++ team/kmoore/stasis-bridge_events/build_tools/make_linker_version_script Wed Apr 10 08:05:28 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/kmoore/stasis-bridge_events/build_tools/make_version
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/build_tools/make_version?view=diff&rev=385168&r1=385167&r2=385168
==============================================================================
--- team/kmoore/stasis-bridge_events/build_tools/make_version (original)
+++ team/kmoore/stasis-bridge_events/build_tools/make_version Wed Apr 10 08:05:28 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/kmoore/stasis-bridge_events/build_tools/mkpkgconfig
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/build_tools/mkpkgconfig?view=diff&rev=385168&r1=385167&r2=385168
==============================================================================
--- team/kmoore/stasis-bridge_events/build_tools/mkpkgconfig (original)
+++ team/kmoore/stasis-bridge_events/build_tools/mkpkgconfig Wed Apr 10 08:05:28 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/kmoore/stasis-bridge_events/configs/extconfig.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/configs/extconfig.conf.sample?view=diff&rev=385168&r1=385167&r2=385168
==============================================================================
--- team/kmoore/stasis-bridge_events/configs/extconfig.conf.sample (original)
+++ team/kmoore/stasis-bridge_events/configs/extconfig.conf.sample Wed Apr 10 08:05:28 2013
@@ -58,13 +58,17 @@
 ; start at 1 and be sequential (i.e. if you have only priorities 1, 2,
 ; and 4, then 4 will be ignored, because there is no 3).
 ;
+;
+; Possible driver backends:
+;
 ; "odbc" is shown in the examples below, but is not the only valid realtime
-; engine.  There is:
+; engine.  Here are several of the possible options:
 ;    odbc ... res_config_odbc
 ;    sqlite ... res_config_sqlite
 ;    pgsql ... res_config_pgsql
 ;    curl ... res_config_curl
 ;    ldap ... res_config_ldap
+;    mysql ... res_config_mysql (available via add-ons in menuselect)
 ;
 ; Note: The res_config_pgsql and res_config_sqlite backends configure the
 ; database used in their respective configuration files and ignore the

Modified: team/kmoore/stasis-bridge_events/configs/features.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/configs/features.conf.sample?view=diff&rev=385168&r1=385167&r2=385168
==============================================================================
--- team/kmoore/stasis-bridge_events/configs/features.conf.sample (original)
+++ team/kmoore/stasis-bridge_events/configs/features.conf.sample Wed Apr 10 08:05:28 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/kmoore/stasis-bridge_events/include/asterisk/app_stasis.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/include/asterisk/app_stasis.h?view=diff&rev=385168&r1=385167&r2=385168
==============================================================================
--- team/kmoore/stasis-bridge_events/include/asterisk/app_stasis.h (original)
+++ team/kmoore/stasis-bridge_events/include/asterisk/app_stasis.h Wed Apr 10 08:05:28 2013
@@ -49,6 +49,8 @@
 #include "asterisk/channel.h"
 #include "asterisk/json.h"
 #include "asterisk/stasis_bridging.h"
+
+struct ast_channel_snapshot;
 
 /*! @{ */
 

Modified: team/kmoore/stasis-bridge_events/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/include/asterisk/bridging.h?view=diff&rev=385168&r1=385167&r2=385168
==============================================================================
--- team/kmoore/stasis-bridge_events/include/asterisk/bridging.h (original)
+++ team/kmoore/stasis-bridge_events/include/asterisk/bridging.h Wed Apr 10 08:05:28 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,

[... 2210 lines stripped ...]



More information about the asterisk-commits mailing list