[asterisk-commits] kmoore: branch kmoore/cel_transfers r393700 - in /team/kmoore/cel_transfers: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 4 10:05:41 CDT 2013


Author: kmoore
Date: Thu Jul  4 10:05:39 2013
New Revision: 393700

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393700
Log:
Make BRIDGE_TO_CONF, CONF_EXIT, and CONF_ENTER events a tad more useful

Modified:
    team/kmoore/cel_transfers/main/cel.c
    team/kmoore/cel_transfers/tests/test_cel.c

Modified: team/kmoore/cel_transfers/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_transfers/main/cel.c?view=diff&rev=393700&r1=393699&r2=393700
==============================================================================
--- team/kmoore/cel_transfers/main/cel.c (original)
+++ team/kmoore/cel_transfers/main/cel.c Thu Jul  4 10:05:39 2013
@@ -1238,7 +1238,7 @@
 
 	if (snapshot->capabilities & (AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_NATIVE)) {
 		if (assoc && assoc->track_as_conf) {
-			report_event_snapshot(chan_snapshot, AST_CEL_CONF_ENTER, NULL, NULL, NULL);
+			report_event_snapshot(chan_snapshot, AST_CEL_CONF_ENTER, NULL, snapshot->uniqueid, NULL);
 			return;
 		}
 
@@ -1273,9 +1273,11 @@
 
 			/* this bridge will no longer be treated like a bridge, so mark the bridge_assoc as such */
 			if (!assoc->track_as_conf) {
+				RAII_VAR(struct ast_str *, extra, ast_str_create(64), ast_free);
 				assoc->track_as_conf = 1;
+				ast_str_set(&extra, 0, "%s,%s", chan_snapshot->name, snapshot->uniqueid);
 				report_event_snapshot(assoc->primary_snapshot, AST_CEL_BRIDGE_TO_CONF, NULL,
-					chan_snapshot->name, assoc->secondary_name);
+					ast_str_buffer(extra), assoc->secondary_name);
 				ast_string_field_set(assoc, secondary_name, "");
 			}
 		}
@@ -1284,7 +1286,7 @@
 			add_bridge_primary(chan_snapshot, snapshot->uniqueid, "");
 			return;
 		}
-		report_event_snapshot(chan_snapshot, AST_CEL_CONF_ENTER, NULL, NULL, NULL);
+		report_event_snapshot(chan_snapshot, AST_CEL_CONF_ENTER, NULL, snapshot->uniqueid, NULL);
 	}
 }
 
@@ -1307,7 +1309,7 @@
 		}
 
 		if (assoc->track_as_conf) {
-			report_event_snapshot(chan_snapshot, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+			report_event_snapshot(chan_snapshot, AST_CEL_CONF_EXIT, NULL, snapshot->uniqueid, NULL);
 			return;
 		}
 
@@ -1317,7 +1319,7 @@
 			return;
 		}
 	} else if (snapshot->capabilities & AST_BRIDGE_CAPABILITY_MULTIMIX) {
-		report_event_snapshot(chan_snapshot, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+		report_event_snapshot(chan_snapshot, AST_CEL_CONF_EXIT, NULL, snapshot->uniqueid, NULL);
 	}
 }
 

Modified: team/kmoore/cel_transfers/tests/test_cel.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_transfers/tests/test_cel.c?view=diff&rev=393700&r1=393699&r2=393700
==============================================================================
--- team/kmoore/cel_transfers/tests/test_cel.c (original)
+++ team/kmoore/cel_transfers/tests/test_cel.c Thu Jul  4 10:05:39 2013
@@ -507,6 +507,7 @@
 	RAII_VAR(struct ast_channel *, chan_bob, NULL, safe_channel_release);
 	RAII_VAR(struct ast_channel *, chan_charlie, NULL, safe_channel_release);
 	RAII_VAR(struct ast_bridge *, bridge, NULL, ao2_cleanup);
+	RAII_VAR(struct ast_str *, extra, ast_str_create(64), ast_free);
 	struct ast_party_caller caller_alice = ALICE_CALLERID;
 	struct ast_party_caller caller_bob = BOB_CALLERID;
 	struct ast_party_caller caller_charlie = CHARLIE_CALLERID;
@@ -550,14 +551,15 @@
 	EMULATE_APP_DATA(chan_charlie, 2, "Bridge", "");
 	ast_bridge_impart(bridge, chan_charlie, NULL, NULL, 0);
 	do_sleep();
-	APPEND_EVENT(chan_alice, AST_CEL_BRIDGE_TO_CONF, NULL, ast_channel_name(chan_charlie), ast_channel_name(chan_bob));
+	ast_str_set(&extra, 0, "%s,%s", ast_channel_name(chan_charlie), bridge->uniqueid);
+	APPEND_EVENT(chan_alice, AST_CEL_BRIDGE_TO_CONF, NULL, ast_str_buffer(extra), ast_channel_name(chan_bob));
 
 	ast_bridge_depart(chan_alice);
-	APPEND_EVENT(chan_alice, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+	APPEND_EVENT(chan_alice, AST_CEL_CONF_EXIT, NULL, bridge->uniqueid, NULL);
 	ast_bridge_depart(chan_bob);
-	APPEND_EVENT(chan_bob, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+	APPEND_EVENT(chan_bob, AST_CEL_CONF_EXIT, NULL, bridge->uniqueid, NULL);
 	ast_bridge_depart(chan_charlie);
-	APPEND_EVENT(chan_charlie, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+	APPEND_EVENT(chan_charlie, AST_CEL_CONF_EXIT, NULL, bridge->uniqueid, NULL);
 
 	HANGUP_CHANNEL(chan_alice, AST_CAUSE_NORMAL, "16,,");
 	HANGUP_CHANNEL(chan_bob, AST_CAUSE_NORMAL, "16,,");
@@ -963,6 +965,7 @@
 	RAII_VAR(struct ast_channel *, chan_charlie, NULL, safe_channel_release);
 	RAII_VAR(struct ast_channel *, chan_david, NULL, safe_channel_release);
 	RAII_VAR(struct ast_bridge *, bridge, NULL, ao2_cleanup);
+	RAII_VAR(struct ast_str *, extra, ast_str_create(64), ast_free);
 	struct ast_party_caller alice_caller = ALICE_CALLERID;
 	struct ast_party_caller charlie_caller = CHARLIE_CALLERID;
 
@@ -1010,23 +1013,24 @@
 
 	ast_test_validate(test, 0 == ast_bridge_impart(bridge, chan_bob, NULL, NULL, 0));
 	do_sleep();
-	APPEND_EVENT(chan_charlie, AST_CEL_BRIDGE_TO_CONF, NULL, ast_channel_name(chan_bob), ast_channel_name(chan_david));
+	ast_str_set(&extra, 0, "%s,%s", ast_channel_name(chan_bob), bridge->uniqueid);
+	APPEND_EVENT(chan_charlie, AST_CEL_BRIDGE_TO_CONF, NULL, ast_str_buffer(extra), ast_channel_name(chan_david));
 
 	ast_test_validate(test, 0 == ast_bridge_impart(bridge, chan_alice, NULL, NULL, 0));
 	do_sleep();
-	APPEND_EVENT(chan_alice, AST_CEL_CONF_ENTER, NULL, NULL, NULL);
+	APPEND_EVENT(chan_alice, AST_CEL_CONF_ENTER, NULL, bridge->uniqueid, NULL);
 
 	ast_test_validate(test, 0 == ast_bridge_depart(chan_alice));
-	APPEND_EVENT(chan_alice, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+	APPEND_EVENT(chan_alice, AST_CEL_CONF_EXIT, NULL, bridge->uniqueid, NULL);
 
 	ast_test_validate(test, 0 == ast_bridge_depart(chan_bob));
-	APPEND_EVENT(chan_bob, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+	APPEND_EVENT(chan_bob, AST_CEL_CONF_EXIT, NULL, bridge->uniqueid, NULL);
 
 	ast_test_validate(test, 0 == ast_bridge_depart(chan_charlie));
-	APPEND_EVENT(chan_charlie, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+	APPEND_EVENT(chan_charlie, AST_CEL_CONF_EXIT, NULL, bridge->uniqueid, NULL);
 
 	ast_test_validate(test, 0 == ast_bridge_depart(chan_david));
-	APPEND_EVENT(chan_david, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+	APPEND_EVENT(chan_david, AST_CEL_CONF_EXIT, NULL, bridge->uniqueid, NULL);
 
 	HANGUP_CHANNEL(chan_alice, AST_CAUSE_NORMAL, "16,,ANSWER");
 	HANGUP_CHANNEL(chan_bob, AST_CAUSE_NORMAL, "16,,");
@@ -1098,7 +1102,7 @@
 	RAII_VAR(struct ast_channel *, chan_fred, NULL, safe_channel_release);
 	RAII_VAR(struct ast_bridge *, bridge1, NULL, ao2_cleanup);
 	RAII_VAR(struct ast_bridge *, bridge2, NULL, ao2_cleanup);
-	RAII_VAR(struct ast_str *, extra, ast_str_create(32), ast_free);
+	RAII_VAR(struct ast_str *, extra, ast_str_create(64), ast_free);
 	struct ast_party_caller alice_caller = ALICE_CALLERID;
 	struct ast_party_caller bob_caller = BOB_CALLERID;
 	struct ast_party_caller charlie_caller = CHARLIE_CALLERID;
@@ -1156,17 +1160,18 @@
 
 	ast_bridge_transfer_attended(chan_alice, chan_fred);
 	do_sleep();
-	APPEND_EVENT(chan_charlie, AST_CEL_BRIDGE_TO_CONF, NULL, ast_channel_name(chan_bob), ast_channel_name(chan_fred));
-	APPEND_EVENT(chan_fred, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+	ast_str_set(&extra, 0, "%s,%s", ast_channel_name(chan_bob), bridge2->uniqueid);
+	APPEND_EVENT(chan_charlie, AST_CEL_BRIDGE_TO_CONF, NULL, ast_str_buffer(extra), ast_channel_name(chan_fred));
+	APPEND_EVENT(chan_fred, AST_CEL_CONF_EXIT, NULL, bridge2->uniqueid, NULL);
 
 	ast_str_set(&extra, 0, "%s,%s,bridge:%s", bridge1->uniqueid, ast_channel_name(chan_fred), bridge2->uniqueid);
 	APPEND_EVENT(chan_alice, AST_CEL_ATTENDEDTRANSFER, NULL, ast_str_buffer(extra), NULL);
 
 
 	ast_test_validate(test, 0 == ast_bridge_depart(chan_bob));
-	APPEND_EVENT(chan_bob, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+	APPEND_EVENT(chan_bob, AST_CEL_CONF_EXIT, NULL, bridge2->uniqueid, NULL);
 	ast_test_validate(test, 0 == ast_bridge_depart(chan_charlie));
-	APPEND_EVENT(chan_charlie, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+	APPEND_EVENT(chan_charlie, AST_CEL_CONF_EXIT, NULL, bridge2->uniqueid, NULL);
 
 	do_sleep();
 	HANGUP_CHANNEL(chan_alice, AST_CAUSE_NORMAL, "16,,");
@@ -1232,7 +1237,8 @@
 
 	ast_test_validate(test, 0 == ast_bridge_impart(bridge1, chan_david, NULL, NULL, 0));
 	do_sleep();
-	APPEND_EVENT(chan_bob, AST_CEL_BRIDGE_TO_CONF, NULL, ast_channel_name(chan_david), ast_channel_name(chan_alice));
+	ast_str_set(&extra, 0, "%s,%s", ast_channel_name(chan_david), bridge1->uniqueid);
+	APPEND_EVENT(chan_bob, AST_CEL_BRIDGE_TO_CONF, NULL, ast_str_buffer(extra), ast_channel_name(chan_alice));
 
 	/* Create second set of bridged parties */
 	bridge2 = ast_bridge_basic_new();
@@ -1254,35 +1260,36 @@
 
 	ast_test_validate(test, 0 == ast_bridge_impart(bridge2, chan_eve, NULL, NULL, 0));
 	do_sleep();
-	APPEND_EVENT(chan_charlie, AST_CEL_BRIDGE_TO_CONF, NULL, ast_channel_name(chan_eve), ast_channel_name(chan_fred));
+	ast_str_set(&extra, 0, "%s,%s", ast_channel_name(chan_eve), bridge2->uniqueid);
+	APPEND_EVENT(chan_charlie, AST_CEL_BRIDGE_TO_CONF, NULL, ast_str_buffer(extra), ast_channel_name(chan_fred));
 
 	/* Perform attended transfer */
-	APPEND_EVENT(chan_charlie, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+	APPEND_EVENT(chan_charlie, AST_CEL_CONF_EXIT, NULL, bridge2->uniqueid, NULL);
 	eve_tmp_snapshot = ast_channel_snapshot_create(chan_eve);
 	ast_bridge_transfer_attended(chan_alice, chan_fred);
 	do_sleep();
-	APPEND_EVENT(chan_charlie, AST_CEL_CONF_ENTER, NULL, NULL, NULL);
+	APPEND_EVENT(chan_charlie, AST_CEL_CONF_ENTER, NULL, bridge1->uniqueid, NULL);
 
 	/* Fred goes away */
-	APPEND_EVENT(chan_fred, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
-	APPEND_EVENT_SNAPSHOT(eve_tmp_snapshot, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
-	APPEND_EVENT(chan_eve, AST_CEL_CONF_ENTER, NULL, NULL, NULL);
+	APPEND_EVENT(chan_fred, AST_CEL_CONF_EXIT, NULL, bridge2->uniqueid, NULL);
+	APPEND_EVENT_SNAPSHOT(eve_tmp_snapshot, AST_CEL_CONF_EXIT, NULL, bridge2->uniqueid, NULL);
+	APPEND_EVENT(chan_eve, AST_CEL_CONF_ENTER, NULL, bridge1->uniqueid, NULL);
 
 	/* Alice goes away */
-	APPEND_EVENT(chan_alice, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+	APPEND_EVENT(chan_alice, AST_CEL_CONF_EXIT, NULL, bridge1->uniqueid, NULL);
 
 	ast_str_set(&extra, 0, "%s,%s,bridge:%s", bridge1->uniqueid, ast_channel_name(chan_fred), bridge2->uniqueid);
 	APPEND_EVENT(chan_alice, AST_CEL_ATTENDEDTRANSFER, NULL, ast_str_buffer(extra), NULL);
 
 
 	ast_test_validate(test, 0 == ast_bridge_depart(chan_bob));
-	APPEND_EVENT(chan_bob, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+	APPEND_EVENT(chan_bob, AST_CEL_CONF_EXIT, NULL, bridge1->uniqueid, NULL);
 	ast_test_validate(test, 0 == ast_bridge_depart(chan_charlie));
-	APPEND_EVENT(chan_charlie, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+	APPEND_EVENT(chan_charlie, AST_CEL_CONF_EXIT, NULL, bridge1->uniqueid, NULL);
 	ast_test_validate(test, 0 == ast_bridge_depart(chan_david));
-	APPEND_EVENT(chan_david, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+	APPEND_EVENT(chan_david, AST_CEL_CONF_EXIT, NULL, bridge1->uniqueid, NULL);
 	ast_test_validate(test, 0 == ast_bridge_depart(chan_eve));
-	APPEND_EVENT(chan_eve, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+	APPEND_EVENT(chan_eve, AST_CEL_CONF_EXIT, NULL, bridge1->uniqueid, NULL);
 
 	do_sleep();
 	HANGUP_CHANNEL(chan_alice, AST_CAUSE_NORMAL, "16,,");
@@ -1352,7 +1359,8 @@
 
 	ast_test_validate(test, 0 == ast_bridge_impart(bridge1, chan_david, NULL, NULL, 0));
 	do_sleep();
-	APPEND_EVENT(chan_bob, AST_CEL_BRIDGE_TO_CONF, NULL, ast_channel_name(chan_david), ast_channel_name(chan_alice));
+	ast_str_set(&extra, 0, "%s,%s", ast_channel_name(chan_david), bridge1->uniqueid);
+	APPEND_EVENT(chan_bob, AST_CEL_BRIDGE_TO_CONF, NULL, ast_str_buffer(extra), ast_channel_name(chan_alice));
 
 	/* Create second set of bridged parties */
 	bridge2 = ast_bridge_basic_new();
@@ -1374,7 +1382,8 @@
 
 	ast_test_validate(test, 0 == ast_bridge_impart(bridge2, chan_eve, NULL, NULL, 0));
 	do_sleep();
-	APPEND_EVENT(chan_charlie, AST_CEL_BRIDGE_TO_CONF, NULL, ast_channel_name(chan_eve), ast_channel_name(chan_fred));
+	ast_str_set(&extra, 0, "%s,%s", ast_channel_name(chan_eve), bridge2->uniqueid);
+	APPEND_EVENT(chan_charlie, AST_CEL_BRIDGE_TO_CONF, NULL, ast_str_buffer(extra), ast_channel_name(chan_fred));
 
 	/* Perform attended transfer */
 	ast_bridge_transfer_attended(chan_alice, chan_fred);
@@ -1383,8 +1392,10 @@
 	/* Append dummy event for the link channel ;1 start */
 	APPEND_DUMMY_EVENT();
 
-	/* Append dummy events for the link channel ;2 start, answer */
+	/* Append dummy event for the link channel ;2 start */
 	APPEND_DUMMY_EVENT();
+
+	/* Append dummy event for the link channel ;2 answer */
 	APPEND_DUMMY_EVENT();
 
 	ast_str_set(&extra, 0, "%s,%s,bridge:%s", bridge1->uniqueid, ast_channel_name(chan_fred), bridge2->uniqueid);
@@ -1393,25 +1404,24 @@
 	/* Append dummy event for the link channel ;1 enter */
 	APPEND_DUMMY_EVENT();
 
-	/* Append dummy event for the link channel ;2 enter and Alice's exit,
+	/* Append dummy events for the link channel ;2 enter and Alice's exit,
 	 * must both be dummies since they're racing */
 	APPEND_DUMMY_EVENT();
 	APPEND_DUMMY_EVENT();
 
-	/* Fred goes away */
-	APPEND_EVENT(chan_fred, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
-
-	/* Append dummy event for the link channel ;1 answer */
+	/* Append dummy events for the link channel ;1 answer and Fred's exit,
+	 * must both be dummies since they're racing */
 	APPEND_DUMMY_EVENT();
+	APPEND_DUMMY_EVENT();
 
 	ast_test_validate(test, 0 == ast_bridge_depart(chan_bob));
-	APPEND_EVENT(chan_bob, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+	APPEND_EVENT(chan_bob, AST_CEL_CONF_EXIT, NULL, bridge1->uniqueid, NULL);
 	ast_test_validate(test, 0 == ast_bridge_depart(chan_charlie));
-	APPEND_EVENT(chan_charlie, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+	APPEND_EVENT(chan_charlie, AST_CEL_CONF_EXIT, NULL, bridge2->uniqueid, NULL);
 	ast_test_validate(test, 0 == ast_bridge_depart(chan_david));
-	APPEND_EVENT(chan_david, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+	APPEND_EVENT(chan_david, AST_CEL_CONF_EXIT, NULL, bridge1->uniqueid, NULL);
 	ast_test_validate(test, 0 == ast_bridge_depart(chan_eve));
-	APPEND_EVENT(chan_eve, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
+	APPEND_EVENT(chan_eve, AST_CEL_CONF_EXIT, NULL, bridge2->uniqueid, NULL);
 
 	do_sleep();
 	HANGUP_CHANNEL(chan_alice, AST_CAUSE_NORMAL, "16,,");




More information about the asterisk-commits mailing list