[libpri-commits] rmudgett: branch rmudgett/facility r1160 - /team/rmudgett/facility/

SVN commits to the libpri project libpri-commits at lists.digium.com
Wed Oct 7 14:55:47 CDT 2009


Author: rmudgett
Date: Wed Oct  7 14:55:44 2009
New Revision: 1160

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1160
Log:
Add call to explicitly enable HOLD/RETRIEVE support.

Modified:
    team/rmudgett/facility/libpri.h
    team/rmudgett/facility/pri.c
    team/rmudgett/facility/pri_internal.h
    team/rmudgett/facility/q931.c

Modified: team/rmudgett/facility/libpri.h
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/facility/libpri.h?view=diff&rev=1160&r1=1159&r2=1160
==============================================================================
--- team/rmudgett/facility/libpri.h (original)
+++ team/rmudgett/facility/libpri.h Wed Oct  7 14:55:44 2009
@@ -1025,6 +1025,16 @@
 int pri_callrerouting_facility(struct pri *pri, q931_call *call, const char *dest, const char* original, const char* reason);
 
 /*!
+ * \brief Set the call hold feature enable flag.
+ *
+ * \param ctrl D channel controller.
+ * \param enable TRUE to enable call hold feature.
+ *
+ * \return Nothing
+ */
+void pri_hold_enable(struct pri *ctrl, int enable);
+
+/*!
  * \brief Send the HOLD message.
  *
  * \param ctrl D channel controller.

Modified: team/rmudgett/facility/pri.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/facility/pri.c?view=diff&rev=1160&r1=1159&r2=1160
==============================================================================
--- team/rmudgett/facility/pri.c (original)
+++ team/rmudgett/facility/pri.c Wed Oct  7 14:55:44 2009
@@ -1313,6 +1313,14 @@
 	}
 }
 
+void pri_hold_enable(struct pri *ctrl, int enable)
+{
+	ctrl = PRI_MASTER(ctrl);
+	if (ctrl) {
+		ctrl->hold_support = enable ? 1 : 0;
+	}
+}
+
 int pri_hold(struct pri *ctrl, q931_call *call)
 {
 	if (!ctrl || !call) {

Modified: team/rmudgett/facility/pri_internal.h
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/facility/pri_internal.h?view=diff&rev=1160&r1=1159&r2=1160
==============================================================================
--- team/rmudgett/facility/pri_internal.h (original)
+++ team/rmudgett/facility/pri_internal.h Wed Oct  7 14:55:44 2009
@@ -70,6 +70,7 @@
 	int protodisc;
 	unsigned int bri:1;
 	unsigned int acceptinbanddisconnect:1;	/* Should we allow inband progress after DISCONNECT? */
+	unsigned int hold_support:1;/* TRUE if upper layer supports call hold. */
 	
 	/* Q.921 State */
 	int q921_state;	

Modified: team/rmudgett/facility/q931.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/facility/q931.c?view=diff&rev=1160&r1=1159&r2=1160
==============================================================================
--- team/rmudgett/facility/q931.c (original)
+++ team/rmudgett/facility/q931.c Wed Oct  7 14:55:44 2009
@@ -4478,10 +4478,6 @@
 {
 	struct q931_call *winner;
 
-	/* Stop the upper layer does not implement guard timer. */
-	pri_schedule_del(ctrl, call->hold_timer);
-	call->hold_timer = 0;
-
 	UPDATE_HOLD_STATE(ctrl, call, Q931_HOLD_STATE_CALL_HELD);
 
 	winner = q931_find_winning_call(call);
@@ -4536,10 +4532,6 @@
 {
 	struct q931_call *winner;
 
-	/* Stop the upper layer does not implement guard timer. */
-	pri_schedule_del(ctrl, call->hold_timer);
-	call->hold_timer = 0;
-
 	UPDATE_HOLD_STATE(ctrl, call, Q931_HOLD_STATE_IDLE);
 
 	winner = q931_find_winning_call(call);
@@ -4548,27 +4540,6 @@
 	}
 
 	return q931_send_hold_rej_msg(ctrl, winner, cause);
-}
-
-/*!
- * \internal
- * \brief Send HOLD message response guard timeout.
- *
- * \param data Q.931 call leg. (Master Q.931 subcall structure)
- *
- * \return Nothing
- */
-static void q931_hold_guard_timeout(void *data)
-{
-	struct q931_call *call = data;
-	struct pri *ctrl = call->pri;
-
-	if (ctrl->debug & PRI_DEBUG_Q931_STATE) {
-		pri_message(ctrl,
-			"Time-out for upper layer HOLD response (assume not implemented)\n");
-	}
-
-	q931_send_hold_rej(ctrl, call, PRI_CAUSE_FACILITY_NOT_IMPLEMENTED);
 }
 
 /*!
@@ -6358,6 +6329,14 @@
 		return res;
 	case Q931_HOLD:
 		res = 0;
+		if (!PRI_MASTER(ctrl)->hold_support) {
+			/*
+			 * Blocking any calls from getting on HOLD effectively
+			 * disables HOLD/RETRIEVE.
+			 */
+			q931_send_hold_rej_msg(ctrl, c, PRI_CAUSE_FACILITY_NOT_IMPLEMENTED);
+			break;
+		}
 		switch (c->ourcallstate) {
 		case Q931_CALL_STATE_CALL_RECEIVED:
 		case Q931_CALL_STATE_CONNECT_REQUEST:
@@ -6396,11 +6375,9 @@
 
 				UPDATE_HOLD_STATE(ctrl, master_call, Q931_HOLD_STATE_HOLD_IND);
 
-				/* Start the upper layer does not implement guard timer. */
+				/* Stop any T-HOLD timer from possible hold collision. */
 				pri_schedule_del(ctrl, master_call->hold_timer);
-				master_call->hold_timer = pri_schedule_event(ctrl,
-					ctrl->timers[PRI_TIMER_T_HOLD] / 2, q931_hold_guard_timeout,
-					master_call);
+				master_call->hold_timer = 0;
 				break;
 			default:
 				q931_send_hold_rej_msg(ctrl, c, PRI_CAUSE_WRONG_CALL_STATE);
@@ -6512,11 +6489,7 @@
 
 				UPDATE_HOLD_STATE(ctrl, master_call, Q931_HOLD_STATE_RETRIEVE_IND);
 
-				/*
-				 * Stop any T-RETRIEVE timer.
-				 * The upper layer must implement HOLD for a call to even get
-				 * on hold.
-				 */
+				/* Stop any T-RETRIEVE timer from possible retrieve collision. */
 				pri_schedule_del(ctrl, master_call->hold_timer);
 				master_call->hold_timer = 0;
 				break;




More information about the libpri-commits mailing list