[asterisk-commits] dlee: branch dlee/ari-url-shuffle r392280 - in /team/dlee/ari-url-shuffle: ./...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 19 17:54:17 CDT 2013


Author: dlee
Date: Wed Jun 19 17:54:15 2013
New Revision: 392280

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=392280
Log:
Merged revisions 392139-392279 from http://svn.asterisk.org/svn/asterisk/trunk

Modified:
    team/dlee/ari-url-shuffle/   (props changed)
    team/dlee/ari-url-shuffle/Makefile
    team/dlee/ari-url-shuffle/funcs/func_cdr.c
    team/dlee/ari-url-shuffle/include/asterisk/bridging.h
    team/dlee/ari-url-shuffle/include/asterisk/cel.h
    team/dlee/ari-url-shuffle/main/Makefile
    team/dlee/ari-url-shuffle/main/bridging.c
    team/dlee/ari-url-shuffle/main/bridging_basic.c
    team/dlee/ari-url-shuffle/main/cel.c
    team/dlee/ari-url-shuffle/tests/test_substitution.c

Propchange: team/dlee/ari-url-shuffle/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jun 19 17:54:15 2013
@@ -1,1 +1,1 @@
-/trunk:1-392136
+/trunk:1-392279

Modified: team/dlee/ari-url-shuffle/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-url-shuffle/Makefile?view=diff&rev=392280&r1=392279&r2=392280
==============================================================================
--- team/dlee/ari-url-shuffle/Makefile (original)
+++ team/dlee/ari-url-shuffle/Makefile Wed Jun 19 17:54:15 2013
@@ -251,8 +251,8 @@
 MOD_SUBDIRS_MENUSELECT_TREE:=$(MOD_SUBDIRS:%=%-menuselect-tree)
 
 ifneq ($(findstring darwin,$(OSARCH)),)
-  _ASTCFLAGS+=-D__Darwin__
-  _SOLINK=-Xlinker -macosx_version_min -Xlinker 10.6 -Xlinker -undefined -Xlinker dynamic_lookup
+  _ASTCFLAGS+=-D__Darwin__ -mmacosx-version-min=10.6
+  _SOLINK=-mmacosx-version-min=10.6 -Xlinker -undefined -Xlinker dynamic_lookup
   _SOLINK+=/usr/lib/bundle1.o
   SOLINK=-bundle $(_SOLINK)
   DYLINK=-Xlinker -dylib $(_SOLINK)

Modified: team/dlee/ari-url-shuffle/funcs/func_cdr.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-url-shuffle/funcs/func_cdr.c?view=diff&rev=392280&r1=392279&r2=392280
==============================================================================
--- team/dlee/ari-url-shuffle/funcs/func_cdr.c (original)
+++ team/dlee/ari-url-shuffle/funcs/func_cdr.c Wed Jun 19 17:54:15 2013
@@ -205,8 +205,9 @@
 		    char *buf, size_t len)
 {
 	char format_buf[128];
+	char *value = NULL;
 	struct ast_flags flags = { 0 };
-	char tempbuf[128];
+	char tempbuf[512];
 	char *info;
 	AST_DECLARE_APP_ARGS(args,
 			     AST_APP_ARG(variable);
@@ -228,7 +229,15 @@
 		ast_app_parse_options(cdr_func_options, &flags, NULL, args.options);
 	}
 
-	if (ast_cdr_getvar(ast_channel_name(chan), args.variable, tempbuf, sizeof(tempbuf))) {
+	if (ast_strlen_zero(ast_channel_name(chan))) {
+		/* Format request on a dummy channel */
+		ast_cdr_format_var(ast_channel_cdr(chan), args.variable, &value, tempbuf, sizeof(tempbuf), 0);
+		if (ast_strlen_zero(value)) {
+			return 0;
+		}
+		ast_copy_string(tempbuf, value, sizeof(tempbuf));
+		ast_set_flag(&flags, OPT_UNPARSED);
+	}else if (ast_cdr_getvar(ast_channel_name(chan), args.variable, tempbuf, sizeof(tempbuf))) {
 		return 0;
 	}
 

Modified: team/dlee/ari-url-shuffle/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-url-shuffle/include/asterisk/bridging.h?view=diff&rev=392280&r1=392279&r2=392280
==============================================================================
--- team/dlee/ari-url-shuffle/include/asterisk/bridging.h (original)
+++ team/dlee/ari-url-shuffle/include/asterisk/bridging.h Wed Jun 19 17:54:15 2013
@@ -436,6 +436,8 @@
 	unsigned int reconfigured:1;
 	/*! TRUE if the bridge has been dissolved.  Any channel that now tries to join is immediately ejected. */
 	unsigned int dissolved:1;
+	/*! TRUE if the bridge construction was completed. */
+	unsigned int construction_completed:1;
 };
 
 /*!

Modified: team/dlee/ari-url-shuffle/include/asterisk/cel.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-url-shuffle/include/asterisk/cel.h?view=diff&rev=392280&r1=392279&r2=392280
==============================================================================
--- team/dlee/ari-url-shuffle/include/asterisk/cel.h (original)
+++ team/dlee/ari-url-shuffle/include/asterisk/cel.h Wed Jun 19 17:54:15 2013
@@ -148,31 +148,6 @@
  */
 enum ast_cel_event_type ast_cel_str_to_event_type(const char *name);
 
-/*! 
- * \brief Check and potentially retire a Linked ID
- *
- * \param chan channel that is being destroyed or its linkedid is changing
- *
- * \since 1.8
- *
- * If at least one CEL backend is looking for CEL_LINKEDID_END
- * events, this function will check if the given channel is the last
- * active channel with that linkedid, and if it is, emit a
- * CEL_LINKEDID_END event.
- *
- * \return nothing
- */
-void ast_cel_check_retire_linkedid(struct ast_channel *chan);
-
-/*!
- * \brief Inform CEL that a new linkedid is being used
- * \since 11
- *
- * \retval -1 error
- * \retval 0 success
- */
-int ast_cel_linkedid_ref(const char *linkedid);
-
 /*!
  * \brief Create a fake channel from data in a CEL event
  *

Modified: team/dlee/ari-url-shuffle/main/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-url-shuffle/main/Makefile?view=diff&rev=392280&r1=392279&r2=392280
==============================================================================
--- team/dlee/ari-url-shuffle/main/Makefile (original)
+++ team/dlee/ari-url-shuffle/main/Makefile Wed Jun 19 17:54:15 2013
@@ -56,7 +56,7 @@
 
 ifneq ($(findstring darwin,$(OSARCH)),)
   AST_LIBS+=-lresolv
-  ASTLINK=-Xlinker -macosx_version_min -Xlinker 10.6 -Xlinker -undefined -Xlinker dynamic_lookup -force_flat_namespace
+  ASTLINK=-mmacosx-version-min=10.6 -Xlinker -undefined -Xlinker dynamic_lookup -force_flat_namespace
   ASTLINK+=/usr/lib/bundle1.o
 else
 # These are used for all but Darwin

Modified: team/dlee/ari-url-shuffle/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-url-shuffle/main/bridging.c?view=diff&rev=392280&r1=392279&r2=392280
==============================================================================
--- team/dlee/ari-url-shuffle/main/bridging.c (original)
+++ team/dlee/ari-url-shuffle/main/bridging.c Wed Jun 19 17:54:15 2013
@@ -651,6 +651,7 @@
 		|| ast_bridge_channel_establish_roles(bridge_channel)) {
 		ast_debug(1, "Bridge %s: pushing %p(%s) into bridge failed\n",
 			bridge->uniqueid, bridge_channel, ast_channel_name(bridge_channel->chan));
+		bridge_features_remove(bridge_channel->features, AST_BRIDGE_HOOK_REMOVE_ON_PULL);
 		return -1;
 	}
 	bridge_channel->in_bridge = 1;
@@ -1381,6 +1382,7 @@
 static struct stasis_message *create_bridge_snapshot_message(struct ast_bridge *bridge)
 {
 	RAII_VAR(struct ast_bridge_snapshot *, snapshot, NULL, ao2_cleanup);
+
 	snapshot = ast_bridge_snapshot_create(bridge);
 	if (!snapshot) {
 		return NULL;
@@ -1392,17 +1394,21 @@
 static void destroy_bridge(void *obj)
 {
 	struct ast_bridge *bridge = obj;
-	RAII_VAR(struct stasis_message *, clear_msg, NULL, ao2_cleanup);
 
 	ast_debug(1, "Bridge %s: actually destroying %s bridge, nobody wants it anymore\n",
 		bridge->uniqueid, bridge->v_table->name);
 
-	clear_msg = create_bridge_snapshot_message(bridge);
-	if (clear_msg) {
-		RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
-		msg = stasis_cache_clear_create(clear_msg);
-		if (msg) {
-			stasis_publish(ast_bridge_topic(bridge), msg);
+	if (bridge->construction_completed) {
+		RAII_VAR(struct stasis_message *, clear_msg, NULL, ao2_cleanup);
+
+		clear_msg = create_bridge_snapshot_message(bridge);
+		if (clear_msg) {
+			RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
+
+			msg = stasis_cache_clear_create(clear_msg);
+			if (msg) {
+				stasis_publish(ast_bridge_topic(bridge), msg);
+			}
 		}
 	}
 
@@ -1446,6 +1452,7 @@
 struct ast_bridge *ast_bridge_register(struct ast_bridge *bridge)
 {
 	if (bridge) {
+		bridge->construction_completed = 1;
 		ast_bridge_publish_state(bridge);
 		if (!ao2_link(bridges, bridge)) {
 			ast_bridge_destroy(bridge);
@@ -1494,8 +1501,8 @@
 	/* Use our helper function to find the "best" bridge technology. */
 	self->technology = find_best_technology(capabilities, self);
 	if (!self->technology) {
-		ast_debug(1, "Bridge %s: Could not create.  No technology available to support it.\n",
-			self->uniqueid);
+		ast_log(LOG_WARNING, "Bridge %s: Could not create class %s.  No technology to support it.\n",
+			self->uniqueid, self->v_table->name);
 		ao2_ref(self, -1);
 		return NULL;
 	}
@@ -1504,7 +1511,7 @@
 	ast_debug(1, "Bridge %s: calling %s technology constructor\n",
 		self->uniqueid, self->technology->name);
 	if (self->technology->create && self->technology->create(self)) {
-		ast_debug(1, "Bridge %s: failed to setup %s technology\n",
+		ast_log(LOG_WARNING, "Bridge %s: failed to setup bridge technology %s\n",
 			self->uniqueid, self->technology->name);
 		ao2_ref(self, -1);
 		return NULL;
@@ -1512,7 +1519,7 @@
 	ast_debug(1, "Bridge %s: calling %s technology start\n",
 		self->uniqueid, self->technology->name);
 	if (self->technology->start && self->technology->start(self)) {
-		ast_debug(1, "Bridge %s: failed to start %s technology\n",
+		ast_log(LOG_WARNING, "Bridge %s: failed to start bridge technology %s\n",
 			self->uniqueid, self->technology->name);
 		ao2_ref(self, -1);
 		return NULL;

Modified: team/dlee/ari-url-shuffle/main/bridging_basic.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-url-shuffle/main/bridging_basic.c?view=diff&rev=392280&r1=392279&r2=392280
==============================================================================
--- team/dlee/ari-url-shuffle/main/bridging_basic.c (original)
+++ team/dlee/ari-url-shuffle/main/bridging_basic.c Wed Jun 19 17:54:15 2013
@@ -119,7 +119,6 @@
  * \param swap Bridge channel to swap places with if not NULL.
  *
  * \note On entry, self is already locked.
- * \note Stub because of nothing to do.
  *
  * \retval 0 on success
  * \retval -1 on failure

Modified: team/dlee/ari-url-shuffle/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-url-shuffle/main/cel.c?view=diff&rev=392280&r1=392279&r2=392280
==============================================================================
--- team/dlee/ari-url-shuffle/main/cel.c (original)
+++ team/dlee/ari-url-shuffle/main/cel.c Wed Jun 19 17:54:15 2013
@@ -634,6 +634,7 @@
 	return 1;
 }
 
+static int cel_linkedid_ref(const char *linkedid);
 static int report_event_snapshot(struct ast_channel_snapshot *snapshot,
 		enum ast_cel_event_type event_type, const char *userdefevname,
 		const char *extra, const char *peer2_name)
@@ -663,7 +664,7 @@
 	/* Record the linkedid of new channels if we are tracking LINKEDID_END even if we aren't
 	 * reporting on CHANNEL_START so we can track when to send LINKEDID_END */
 	if (ast_cel_track_event(AST_CEL_LINKEDID_END) && event_type == AST_CEL_CHANNEL_START && linkedid) {
-		if (ast_cel_linkedid_ref(linkedid)) {
+		if (cel_linkedid_ref(linkedid)) {
 			return -1;
 		}
 	}
@@ -868,7 +869,7 @@
 	return tchan;
 }
 
-int ast_cel_linkedid_ref(const char *linkedid)
+static int cel_linkedid_ref(const char *linkedid)
 {
 	char *lid;
 
@@ -909,7 +910,7 @@
 	/* Record the linkedid of new channels if we are tracking LINKEDID_END even if we aren't
 	 * reporting on CHANNEL_START so we can track when to send LINKEDID_END */
 	if (ast_cel_track_event(AST_CEL_LINKEDID_END) && event_type == AST_CEL_CHANNEL_START && linkedid) {
-		if (ast_cel_linkedid_ref(linkedid)) {
+		if (cel_linkedid_ref(linkedid)) {
 			return -1;
 		}
 	}
@@ -1114,7 +1115,11 @@
 		return;
 	}
 
+	ast_assert(!ast_strlen_zero(new_snapshot->linkedid));
+	ast_assert(!ast_strlen_zero(old_snapshot->linkedid));
+
 	if (strcmp(old_snapshot->linkedid, new_snapshot->linkedid)) {
+		cel_linkedid_ref(new_snapshot->linkedid);
 		check_retire_linkedid(old_snapshot);
 	}
 }

Modified: team/dlee/ari-url-shuffle/tests/test_substitution.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-url-shuffle/tests/test_substitution.c?view=diff&rev=392280&r1=392279&r2=392280
==============================================================================
--- team/dlee/ari-url-shuffle/tests/test_substitution.c (original)
+++ team/dlee/ari-url-shuffle/tests/test_substitution.c Wed Jun 19 17:54:15 2013
@@ -286,7 +286,7 @@
 	pbx_builtin_setvar_helper(c, "list1", "ab&cd&ef");
 	TEST(test_expected_result(test, c, "${LISTFILTER(list1,&,cd)}", "ab&ef"));
 	TEST(test_expected_result(test, c, "${SHELL(printf '%d' 123)},${SHELL(printf '%d' 456)}", "123,456"));
-	TEST(test_expected_result(test, c, "${foo},${CDR(answer)},${SHELL(printf '%d' 456)}", "123,,456"));
+	TEST(test_expected_result(test, c, "${foo},${CDR(answer)},${SHELL(printf '%d' 456)}", "123,0.000000,456"));
 	TEST(test_expected_result(test, c, "${foo},${this_does_not_exist},${THIS_DOES_NOT_EXIST(either)}", "123,,"));
 #undef TEST
 




More information about the asterisk-commits mailing list