[libpri-commits] rmudgett: branch group/ccss r1436 - in /team/group/ccss: ./ doc/

SVN commits to the libpri project libpri-commits at lists.digium.com
Thu Jan 21 21:07:52 CST 2010


Author: rmudgett
Date: Thu Jan 21 21:07:46 2010
New Revision: 1436

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1436
Log:
Need to block the stop alerting event when we are the one doing the CC recall.

Added CC_STATE_WAIT_CALLBACK and CC_STATE_CALLBACK to the PTMP monitor FSM
to be more precise in handling the CC events.  Could not get away with the
simplified FSM.  Bad things happened in the upper layer when the
PRI_SUBCMD_CC_STOP_ALERTING event was not blocked when we are the one
doing the CC recall call.

Modified:
    team/group/ccss/doc/cc_ptmp_monitor.fsm
    team/group/ccss/doc/cc_ptmp_monitor_flattened.fsm
    team/group/ccss/pri_cc.c

Modified: team/group/ccss/doc/cc_ptmp_monitor.fsm
URL: http://svnview.digium.com/svn/libpri/team/group/ccss/doc/cc_ptmp_monitor.fsm?view=diff&rev=1436&r1=1435&r2=1436
==============================================================================
--- team/group/ccss/doc/cc_ptmp_monitor.fsm (original)
+++ team/group/ccss/doc/cc_ptmp_monitor.fsm Thu Jan 21 21:07:46 2010
@@ -117,6 +117,37 @@
 		}
 	}
 	State CC_STATE_ACTIVATED {
+		Stimulus CC_EVENT_B_FREE {
+			/* Received CCBSBFree */
+			Action Pass_Up_B_Free;
+		}
+		Stimulus CC_EVENT_REMOTE_USER_FREE {
+			/* Received CCBSRemoteUserFree */
+			Action Pass_Up_Remote_User_Free;
+			Next_State CC_STATE_WAIT_CALLBACK;
+		}
+	}
+	State CC_STATE_WAIT_CALLBACK {
+		Stimulus CC_EVENT_STOP_ALERTING {
+			Action Pass_Up_Stop_Alerting;
+			Next_State CC_STATE_ACTIVATED;
+		}
+		Stimulus CC_EVENT_RECALL {
+			/* The original call parameters have already been set. */
+			Action Queue_SETUP_Recall;
+			Next_State CC_STATE_CALLBACK;
+		}
+	}
+	State CC_STATE_CALLBACK {
+		/*
+		 * We are waiting for the CC records to be torn down because
+		 * CC is complete.
+		 * This state is mainly to block CC_EVENT_STOP_ALERTING since
+		 * we are the one doing the CC recall so we do not need to stop
+		 * alerting.
+		 */
+	}
+	Superstate CC_ACTIVE(CC_STATE_ACTIVATED, CC_STATE_WAIT_CALLBACK, CC_STATE_CALLBACK) {
 		Prolog {
 			/*
 			 * Start T_CCBS2 or T_CCNR2 depending upon CC mode.
@@ -131,21 +162,6 @@
 		}
 		Epilog {
 			Action Stop_T_SUPERVISION;
-		}
-		Stimulus CC_EVENT_B_FREE {
-			/* Received CCBSBFree */
-			Action Pass_Up_B_Free;
-		}
-		Stimulus CC_EVENT_REMOTE_USER_FREE {
-			/* Received CCBSRemoteUserFree */
-			Action Pass_Up_Remote_User_Free;
-		}
-		Stimulus CC_EVENT_STOP_ALERTING {
-			Action Pass_Up_Stop_Alerting;
-		}
-		Stimulus CC_EVENT_RECALL {
-			/* The original call parameters have already been set. */
-			Action Queue_SETUP_Recall;
 		}
 		Stimulus CC_EVENT_TIMEOUT_T_SUPERVISION {
 			Action Send_CC_Deactivate_Req;

Modified: team/group/ccss/doc/cc_ptmp_monitor_flattened.fsm
URL: http://svnview.digium.com/svn/libpri/team/group/ccss/doc/cc_ptmp_monitor_flattened.fsm?view=diff&rev=1436&r1=1435&r2=1436
==============================================================================
--- team/group/ccss/doc/cc_ptmp_monitor_flattened.fsm (original)
+++ team/group/ccss/doc/cc_ptmp_monitor_flattened.fsm Thu Jan 21 21:07:46 2010
@@ -139,13 +139,38 @@
 		Stimulus CC_EVENT_REMOTE_USER_FREE {
 			/* Received CCBSRemoteUserFree */
 			Action Pass_Up_Remote_User_Free;
-		}
+			Next_State CC_STATE_WAIT_CALLBACK;
+		}
+		Stimulus CC_EVENT_TIMEOUT_T_SUPERVISION {
+			Action Send_CC_Deactivate_Req;
+			Action Pass_Up_CC_Cancel;
+			Action Stop_T_SUPERVISION;
+			Action Set_Selfdestruct;
+			Next_State CC_STATE_IDLE;
+		}
+		Stimulus CC_EVENT_LINK_CANCEL {
+			/* Received CCBSErase */
+			Action Pass_Up_CC_Cancel;
+			Action Stop_T_SUPERVISION;
+			Action Set_Selfdestruct;
+			Next_State CC_STATE_IDLE;
+		}
+		Stimulus CC_EVENT_CANCEL {
+			Action Send_CC_Deactivate_Req;
+			Action Stop_T_SUPERVISION;
+			Action Set_Selfdestruct;
+			Next_State CC_STATE_IDLE;
+		}
+	}
+	State CC_STATE_WAIT_CALLBACK {
 		Stimulus CC_EVENT_STOP_ALERTING {
 			Action Pass_Up_Stop_Alerting;
+			Next_State CC_STATE_ACTIVATED;
 		}
 		Stimulus CC_EVENT_RECALL {
 			/* The original call parameters have already been set. */
 			Action Queue_SETUP_Recall;
+			Next_State CC_STATE_CALLBACK;
 		}
 		Stimulus CC_EVENT_TIMEOUT_T_SUPERVISION {
 			Action Send_CC_Deactivate_Req;
@@ -168,4 +193,33 @@
 			Next_State CC_STATE_IDLE;
 		}
 	}
+	State CC_STATE_CALLBACK {
+		/*
+		 * We are waiting for the CC records to be torn down because
+		 * CC is complete.
+		 * This state is mainly to block CC_EVENT_STOP_ALERTING since
+		 * we are the one doing the CC recall so we do not need to stop
+		 * alerting.
+		 */
+		Stimulus CC_EVENT_TIMEOUT_T_SUPERVISION {
+			Action Send_CC_Deactivate_Req;
+			Action Pass_Up_CC_Cancel;
+			Action Stop_T_SUPERVISION;
+			Action Set_Selfdestruct;
+			Next_State CC_STATE_IDLE;
+		}
+		Stimulus CC_EVENT_LINK_CANCEL {
+			/* Received CCBSErase */
+			Action Pass_Up_CC_Cancel;
+			Action Stop_T_SUPERVISION;
+			Action Set_Selfdestruct;
+			Next_State CC_STATE_IDLE;
+		}
+		Stimulus CC_EVENT_CANCEL {
+			Action Send_CC_Deactivate_Req;
+			Action Stop_T_SUPERVISION;
+			Action Set_Selfdestruct;
+			Next_State CC_STATE_IDLE;
+		}
+	}
 }

Modified: team/group/ccss/pri_cc.c
URL: http://svnview.digium.com/svn/libpri/team/group/ccss/pri_cc.c?view=diff&rev=1436&r1=1435&r2=1436
==============================================================================
--- team/group/ccss/pri_cc.c (original)
+++ team/group/ccss/pri_cc.c Thu Jan 21 21:07:46 2010
@@ -5120,14 +5120,102 @@
 	case CC_EVENT_REMOTE_USER_FREE:
 		/* Received CCBSRemoteUserFree */
 		pri_cc_act_pass_up_remote_user_free(ctrl, cc_record);
-		break;
+		cc_record->state = CC_STATE_WAIT_CALLBACK;
+		break;
+	case CC_EVENT_TIMEOUT_T_SUPERVISION:
+		pri_cc_act_send_cc_deactivate_req(ctrl, cc_record);
+		pri_cc_act_pass_up_cc_cancel(ctrl, cc_record);
+		pri_cc_act_stop_t_supervision(ctrl, cc_record);
+		pri_cc_act_set_self_destruct(ctrl, cc_record);
+		cc_record->state = CC_STATE_IDLE;
+		break;
+	case CC_EVENT_LINK_CANCEL:
+		/* Received CCBSErase */
+		pri_cc_act_pass_up_cc_cancel(ctrl, cc_record);
+		pri_cc_act_stop_t_supervision(ctrl, cc_record);
+		pri_cc_act_set_self_destruct(ctrl, cc_record);
+		cc_record->state = CC_STATE_IDLE;
+		break;
+	case CC_EVENT_CANCEL:
+		pri_cc_act_send_cc_deactivate_req(ctrl, cc_record);
+		pri_cc_act_stop_t_supervision(ctrl, cc_record);
+		pri_cc_act_set_self_destruct(ctrl, cc_record);
+		cc_record->state = CC_STATE_IDLE;
+		break;
+	default:
+		break;
+	}
+}
+
+/*!
+ * \internal
+ * \brief CC FSM PTMP monitor CC_STATE_WAIT_CALLBACK.
+ *
+ * \param ctrl D channel controller.
+ * \param call Q.931 call leg.
+ * \param cc_record Call completion record to process event.
+ * \param event Event to process.
+ *
+ * \return Nothing
+ */
+static void pri_cc_fsm_ptmp_monitor_wait_callback(struct pri *ctrl, q931_call *call, struct pri_cc_record *cc_record, enum CC_EVENTS event)
+{
+	switch (event) {
 	case CC_EVENT_STOP_ALERTING:
 		pri_cc_act_pass_up_stop_alerting(ctrl, cc_record);
+		cc_record->state = CC_STATE_ACTIVATED;
 		break;
 	case CC_EVENT_RECALL:
 		/* The original call parameters have already been set. */
 		pri_cc_act_queue_setup_recall(ctrl, cc_record, call);
-		break;
+		cc_record->state = CC_STATE_CALLBACK;
+		break;
+	case CC_EVENT_TIMEOUT_T_SUPERVISION:
+		pri_cc_act_send_cc_deactivate_req(ctrl, cc_record);
+		pri_cc_act_pass_up_cc_cancel(ctrl, cc_record);
+		pri_cc_act_stop_t_supervision(ctrl, cc_record);
+		pri_cc_act_set_self_destruct(ctrl, cc_record);
+		cc_record->state = CC_STATE_IDLE;
+		break;
+	case CC_EVENT_LINK_CANCEL:
+		/* Received CCBSErase */
+		pri_cc_act_pass_up_cc_cancel(ctrl, cc_record);
+		pri_cc_act_stop_t_supervision(ctrl, cc_record);
+		pri_cc_act_set_self_destruct(ctrl, cc_record);
+		cc_record->state = CC_STATE_IDLE;
+		break;
+	case CC_EVENT_CANCEL:
+		pri_cc_act_send_cc_deactivate_req(ctrl, cc_record);
+		pri_cc_act_stop_t_supervision(ctrl, cc_record);
+		pri_cc_act_set_self_destruct(ctrl, cc_record);
+		cc_record->state = CC_STATE_IDLE;
+		break;
+	default:
+		break;
+	}
+}
+
+/*!
+ * \internal
+ * \brief CC FSM PTMP monitor CC_STATE_CALLBACK.
+ *
+ * \param ctrl D channel controller.
+ * \param call Q.931 call leg.
+ * \param cc_record Call completion record to process event.
+ * \param event Event to process.
+ *
+ * \return Nothing
+ */
+static void pri_cc_fsm_ptmp_monitor_callback(struct pri *ctrl, q931_call *call, struct pri_cc_record *cc_record, enum CC_EVENTS event)
+{
+	/*
+	 * We are waiting for the CC records to be torn down because
+	 * CC is complete.
+	 * This state is mainly to block CC_EVENT_STOP_ALERTING since
+	 * we are the one doing the CC recall so we do not need to stop
+	 * alerting.
+	 */
+	switch (event) {
 	case CC_EVENT_TIMEOUT_T_SUPERVISION:
 		pri_cc_act_send_cc_deactivate_req(ctrl, cc_record);
 		pri_cc_act_pass_up_cc_cancel(ctrl, cc_record);
@@ -6561,6 +6649,8 @@
 	[CC_STATE_REQUESTED] = pri_cc_fsm_ptmp_monitor_req,
 	[CC_STATE_WAIT_DESTRUCTION] = pri_cc_fsm_ptmp_monitor_wait_destruction,
 	[CC_STATE_ACTIVATED] = pri_cc_fsm_ptmp_monitor_activated,
+	[CC_STATE_WAIT_CALLBACK] = pri_cc_fsm_ptmp_monitor_wait_callback,
+	[CC_STATE_CALLBACK] = pri_cc_fsm_ptmp_monitor_callback,
 /* *INDENT-ON* */
 };
 




More information about the libpri-commits mailing list