[asterisk-commits] mmichelson: branch 12 r397921 - in /branches/12: apps/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 29 10:42:12 CDT 2013


Author: mmichelson
Date: Thu Aug 29 10:42:10 2013
New Revision: 397921

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397921
Log:
Resolve assumptions that bridge snapshots would be non-NULL for transfer stasis events.

Attempting to transfer an unbridged call would result in crashes in either CEL code or
in the conversion to AMI messages.


Modified:
    branches/12/apps/app_queue.c
    branches/12/main/cel.c
    branches/12/main/stasis_bridges.c

Modified: branches/12/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/apps/app_queue.c?view=diff&rev=397921&r1=397920&r2=397921
==============================================================================
--- branches/12/apps/app_queue.c (original)
+++ branches/12/apps/app_queue.c Thu Aug 29 10:42:10 2013
@@ -5431,7 +5431,7 @@
 		return;
 	}
 
-	if (ast_json_integer_get(result_blob) == AST_BRIDGE_TRANSFER_FAIL) {
+	if (ast_json_integer_get(result_blob) != AST_BRIDGE_TRANSFER_SUCCESS) {
 		return;
 	}
 
@@ -5490,7 +5490,7 @@
 		return;
 	}
 
-	if (atxfer_msg->result == AST_BRIDGE_TRANSFER_FAIL ||
+	if (atxfer_msg->result != AST_BRIDGE_TRANSFER_SUCCESS ||
 			atxfer_msg->dest_type == AST_ATTENDED_TRANSFER_DEST_THREEWAY) {
 		return;
 	}

Modified: branches/12/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/cel.c?view=diff&rev=397921&r1=397920&r2=397921
==============================================================================
--- branches/12/main/cel.c (original)
+++ branches/12/main/cel.c Thu Aug 29 10:42:10 2013
@@ -1197,10 +1197,24 @@
 	struct ast_channel_snapshot *chan_snapshot = obj->channel;
 	struct ast_bridge_snapshot *bridge_snapshot = obj->bridge;
 	struct ast_json *blob = obj->blob;
-	struct ast_json *json_exten = ast_json_object_get(blob, "exten");
-	struct ast_json *json_context = ast_json_object_get(blob, "context");
+	struct ast_json *json_result = ast_json_object_get(blob, "result");
+	struct ast_json *json_exten;
+	struct ast_json *json_context;
 	RAII_VAR(struct ast_json *, extra, NULL, ast_json_unref);
 	const char *exten, *context;
+	enum ast_transfer_result result;
+
+	if (!json_result) {
+		return;
+	}
+
+	result = ast_json_integer_get(json_result);
+	if (result != AST_BRIDGE_TRANSFER_SUCCESS) {
+		return;
+	}
+
+	json_exten = ast_json_object_get(blob, "exten");
+	json_context = ast_json_object_get(blob, "context");
 
 	if (!json_exten || !json_context) {
 		return;
@@ -1211,6 +1225,10 @@
 	if (!exten || !context) {
 		return;
 	}
+
+	ast_log(LOG_NOTICE, "exten is %s, context is %s, bridge_snapshot is %p\n",
+			exten, context, bridge_snapshot);
+
 	extra = ast_json_pack("{s: s, s: s, s: s}",
 		"extension", exten,
 		"context", context,

Modified: branches/12/main/stasis_bridges.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/stasis_bridges.c?view=diff&rev=397921&r1=397920&r2=397921
==============================================================================
--- branches/12/main/stasis_bridges.c (original)
+++ branches/12/main/stasis_bridges.c Thu Aug 29 10:42:10 2013
@@ -585,9 +585,15 @@
 	}
 
 	channel_state = ast_manager_build_channel_state_string_prefix(blob->channel, "Transferer");
-	bridge_state = ast_manager_build_bridge_state_string(blob->bridge);
-	if (!channel_state || !bridge_state) {
-		return NULL;
+	if (!channel_state) {
+		return NULL;
+	}
+
+	if (blob->bridge) {
+		bridge_state = ast_manager_build_bridge_state_string(blob->bridge);
+		if (!bridge_state) {
+			return NULL;
+		}
 	}
 
 	exten = ast_json_string_get(ast_json_object_get(blob->blob, "exten"));
@@ -604,7 +610,7 @@
 			"Extension: %s\r\n",
 			result_strs[result],
 			ast_str_buffer(channel_state),
-			ast_str_buffer(bridge_state),
+			bridge_state ? ast_str_buffer(bridge_state) : "",
 			is_external ? "Yes" : "No",
 			context,
 			exten);




More information about the asterisk-commits mailing list