[asterisk-commits] mmichelson: branch mmichelson/atxfer_features r393366 - /team/mmichelson/atxf...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 1 16:45:01 CDT 2013


Author: mmichelson
Date: Mon Jul  1 16:45:00 2013
New Revision: 393366

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393366
Log:
s/next/exit/ for transfer state properties.

Also added some doxygen for state properties.


Modified:
    team/mmichelson/atxfer_features/main/bridging_basic.c

Modified: team/mmichelson/atxfer_features/main/bridging_basic.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/atxfer_features/main/bridging_basic.c?view=diff&rev=393366&r1=393365&r2=393366
==============================================================================
--- team/mmichelson/atxfer_features/main/bridging_basic.c (original)
+++ team/mmichelson/atxfer_features/main/bridging_basic.c Mon Jul  1 16:45:00 2013
@@ -1187,11 +1187,11 @@
 };
 
 static int calling_target_enter(struct attended_transfer_properties *props);
-static enum attended_transfer_state calling_target_next(struct attended_transfer_properties *props,
+static enum attended_transfer_state calling_target_exit(struct attended_transfer_properties *props,
 		enum attended_transfer_stimulus stimulus);
 
 static int hesitant_enter(struct attended_transfer_properties *props);
-static enum attended_transfer_state hesitant_next(struct attended_transfer_properties *props,
+static enum attended_transfer_state hesitant_exit(struct attended_transfer_properties *props,
 		enum attended_transfer_stimulus stimulus);
 
 static int rebridge_enter(struct attended_transfer_properties *props);
@@ -1201,11 +1201,11 @@
 static int threeway_enter(struct attended_transfer_properties *props);
 
 static int consulting_enter(struct attended_transfer_properties *props);
-static enum attended_transfer_state consulting_next(struct attended_transfer_properties *props,
+static enum attended_transfer_state consulting_exit(struct attended_transfer_properties *props,
 		enum attended_transfer_stimulus stimulus);
 
 static int double_checking_enter(struct attended_transfer_properties *props);
-static enum attended_transfer_state double_checking_next(struct attended_transfer_properties *props,
+static enum attended_transfer_state double_checking_exit(struct attended_transfer_properties *props,
 		enum attended_transfer_stimulus stimulus);
 
 static int complete_enter(struct attended_transfer_properties *props);
@@ -1213,44 +1213,55 @@
 static int blond_enter(struct attended_transfer_properties *props);
 
 static int blond_nonfinal_enter(struct attended_transfer_properties *props);
-static enum attended_transfer_state blond_nonfinal_next(struct attended_transfer_properties *props,
+static enum attended_transfer_state blond_nonfinal_exit(struct attended_transfer_properties *props,
 		enum attended_transfer_stimulus stimulus);
 
 static int recalling_enter(struct attended_transfer_properties *props);
-static enum attended_transfer_state recalling_next(struct attended_transfer_properties *props,
+static enum attended_transfer_state recalling_exit(struct attended_transfer_properties *props,
 		enum attended_transfer_stimulus stimulus);
 
 static int wait_to_retransfer_enter(struct attended_transfer_properties *props);
-static enum attended_transfer_state wait_to_retransfer_next(struct attended_transfer_properties *props,
+static enum attended_transfer_state wait_to_retransfer_exit(struct attended_transfer_properties *props,
 		enum attended_transfer_stimulus stimulus);
 
 static int retransfer_enter(struct attended_transfer_properties *props);
-static enum attended_transfer_state retransfer_next(struct attended_transfer_properties *props,
+static enum attended_transfer_state retransfer_exit(struct attended_transfer_properties *props,
 		enum attended_transfer_stimulus stimulus);
 
 static int wait_to_recall_enter(struct attended_transfer_properties *props);
-static enum attended_transfer_state wait_to_recall_next(struct attended_transfer_properties *props,
+static enum attended_transfer_state wait_to_recall_exit(struct attended_transfer_properties *props,
 		enum attended_transfer_stimulus stimulus);
 
 static int fail_enter(struct attended_transfer_properties *props);
 
+/*!
+ * \brief Properties of an attended transfer state
+ */
 static struct attended_transfer_state_properties {
+	/*! The name of the state. Used for debugging */
 	const char *state_name;
+	/*! Function used to enter a state */
 	int (*enter)(struct attended_transfer_properties *props);
-	enum attended_transfer_state (*next)(struct attended_transfer_properties *props,
+	/*! Function used to exit a state
+	 * This is used both to determine what the next state
+	 * to transition to will be and to perform any cleanup
+	 * necessary before exiting the current state.
+	 */
+	enum attended_transfer_state (*exit)(struct attended_transfer_properties *props,
 			enum attended_transfer_stimulus stimulus);
+	/*! Flags associated with this state */
 	enum attended_transfer_state_flags flags;
 } state_properties [] = {
 	[TRANSFER_CALLING_TARGET] = {
 		.state_name = "Calling Target",
 		.enter = calling_target_enter,
-		.next = calling_target_next,
+		.exit = calling_target_exit,
 		.flags = TRANSFER_STATE_IS_TIMED | TRANSFER_STATE_RESET_TIMER,
 	},
 	[TRANSFER_HESITANT] = {
 		.state_name = "Hesitant",
 		.enter = hesitant_enter,
-		.next = hesitant_next,
+		.exit = hesitant_exit,
 		.flags = TRANSFER_STATE_IS_TIMED,
 	},
 	[TRANSFER_REBRIDGE] = {
@@ -1271,12 +1282,12 @@
 	[TRANSFER_CONSULTING] = {
 		.state_name = "Consulting",
 		.enter = consulting_enter,
-		.next = consulting_next,
+		.exit = consulting_exit,
 	},
 	[TRANSFER_DOUBLECHECKING] = {
 		.state_name = "Double Checking",
 		.enter = double_checking_enter,
-		.next = double_checking_next,
+		.exit = double_checking_exit,
 	},
 	[TRANSFER_COMPLETE] = {
 		.state_name = "Complete",
@@ -1291,31 +1302,31 @@
 	[TRANSFER_BLOND_NONFINAL] = {
 		.state_name = "Blond Non-Final",
 		.enter = blond_nonfinal_enter,
-		.next = blond_nonfinal_next,
+		.exit = blond_nonfinal_exit,
 		.flags = TRANSFER_STATE_IS_TIMED,
 	},
 	[TRANSFER_RECALLING] = {
 		.state_name = "Recalling",
 		.enter = recalling_enter,
-		.next = recalling_next,
+		.exit = recalling_exit,
 		.flags = TRANSFER_STATE_IS_TIMED | TRANSFER_STATE_RESET_TIMER,
 	},
 	[TRANSFER_WAIT_TO_RETRANSFER] = {
 		.state_name = "Wait to Retransfer",
 		.enter = wait_to_retransfer_enter,
-		.next = wait_to_retransfer_next,
+		.exit = wait_to_retransfer_exit,
 		.flags = TRANSFER_STATE_IS_TIMED | TRANSFER_STATE_RESET_TIMER | TRANSFER_STATE_TIMER_LOOP_DELAY,
 	},
 	[TRANSFER_RETRANSFER] = {
 		.state_name = "Retransfer",
 		.enter = retransfer_enter,
-		.next = retransfer_next,
+		.exit = retransfer_exit,
 		.flags = TRANSFER_STATE_IS_TIMED | TRANSFER_STATE_RESET_TIMER,
 	},
 	[TRANSFER_WAIT_TO_RECALL] = {
 		.state_name = "Wait to Recall",
 		.enter = wait_to_recall_enter,
-		.next = wait_to_recall_next,
+		.exit = wait_to_recall_exit,
 		.flags = TRANSFER_STATE_IS_TIMED | TRANSFER_STATE_RESET_TIMER | TRANSFER_STATE_TIMER_LOOP_DELAY,
 	},
 	[TRANSFER_FAIL] = {
@@ -1336,7 +1347,7 @@
 	return bridge_move(props->target_bridge, props->transferee_bridge, props->transferer, NULL);
 }
 
-static enum attended_transfer_state calling_target_next(struct attended_transfer_properties *props,
+static enum attended_transfer_state calling_target_exit(struct attended_transfer_properties *props,
 		enum attended_transfer_stimulus stimulus)
 {
 	switch (stimulus) {
@@ -1377,7 +1388,7 @@
 	return 0;
 }
 
-static enum attended_transfer_state hesitant_next(struct attended_transfer_properties *props,
+static enum attended_transfer_state hesitant_exit(struct attended_transfer_properties *props,
 		enum attended_transfer_stimulus stimulus)
 {
 	switch (stimulus) {
@@ -1451,7 +1462,7 @@
 	return 0;
 }
 
-static enum attended_transfer_state consulting_next(struct attended_transfer_properties *props,
+static enum attended_transfer_state consulting_exit(struct attended_transfer_properties *props,
 		enum attended_transfer_stimulus stimulus)
 {
 	switch (stimulus) {
@@ -1504,7 +1515,7 @@
 	return 0;
 }
 
-static enum attended_transfer_state double_checking_next(struct attended_transfer_properties *props,
+static enum attended_transfer_state double_checking_exit(struct attended_transfer_properties *props,
 		enum attended_transfer_stimulus stimulus)
 {
 	switch (stimulus) {
@@ -1555,7 +1566,7 @@
 	return blond_enter(props);
 }
 
-static enum attended_transfer_state blond_nonfinal_next(struct attended_transfer_properties *props,
+static enum attended_transfer_state blond_nonfinal_exit(struct attended_transfer_properties *props,
 		enum attended_transfer_stimulus stimulus)
 {
 	switch (stimulus) {
@@ -1627,7 +1638,7 @@
 	return 0;
 }
 
-static enum attended_transfer_state recalling_next(struct attended_transfer_properties *props,
+static enum attended_transfer_state recalling_exit(struct attended_transfer_properties *props,
 		enum attended_transfer_stimulus stimulus)
 {
 	/* No matter what the outcome was, we need to kill off the dial */
@@ -1674,7 +1685,7 @@
 	return 0;
 }
 
-static enum attended_transfer_state wait_to_retransfer_next(struct attended_transfer_properties *props,
+static enum attended_transfer_state wait_to_retransfer_exit(struct attended_transfer_properties *props,
 		enum attended_transfer_stimulus stimulus)
 {
 	bridge_unhold(props->transferee_bridge);
@@ -1754,7 +1765,7 @@
 	return 0;
 }
 
-static enum attended_transfer_state retransfer_next(struct attended_transfer_properties *props,
+static enum attended_transfer_state retransfer_exit(struct attended_transfer_properties *props,
 		enum attended_transfer_stimulus stimulus)
 {
 	switch (stimulus) {
@@ -1791,7 +1802,7 @@
 	return 0;
 }
 
-static enum attended_transfer_state wait_to_recall_next(struct attended_transfer_properties *props,
+static enum attended_transfer_state wait_to_recall_exit(struct attended_transfer_properties *props,
 		enum attended_transfer_stimulus stimulus)
 {
 	bridge_unhold(props->transferee_bridge);
@@ -2137,11 +2148,11 @@
 
 		ast_log(LOG_NOTICE, "Received stimulus %s\n", stimulus_strs[stimulus]);
 		
-		ast_assert(state_properties[props->state].next != NULL);
-
-		props->state = state_properties[props->state].next(props, stimulus);
-
-		ast_log(LOG_NOTICE, "Told to enter state %s next\n", state_properties[props->state].state_name);
+		ast_assert(state_properties[props->state].exit != NULL);
+
+		props->state = state_properties[props->state].exit(props, stimulus);
+
+		ast_log(LOG_NOTICE, "Told to enter state %s exit\n", state_properties[props->state].state_name);
 	}
 
 	attended_transfer_properties_shutdown(props);




More information about the asterisk-commits mailing list