[asterisk-commits] rmudgett: branch rmudgett/hold_retrieve r298929 - /team/rmudgett/hold_retriev...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Dec 17 22:22:25 UTC 2010


Author: rmudgett
Date: Fri Dec 17 16:22:20 2010
New Revision: 298929

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=298929
Log:
Make bridged channel send congestion tone while in RETRIEVE_FAIL state.

Modified:
    team/rmudgett/hold_retrieve/channels/sig_pri.c

Modified: team/rmudgett/hold_retrieve/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/hold_retrieve/channels/sig_pri.c?view=diff&rev=298929&r1=298928&r2=298929
==============================================================================
--- team/rmudgett/hold_retrieve/channels/sig_pri.c (original)
+++ team/rmudgett/hold_retrieve/channels/sig_pri.c Fri Dec 17 16:22:20 2010
@@ -4133,6 +4133,35 @@
 #if defined(HAVE_PRI_CALL_HOLD)
 /*!
  * \internal
+ * \brief Send an indication to the bridged channel for MOH FSM.
+ * \since 1.10
+ *
+ * \param pvt Channel private control structure.
+ * \param indication Control indication to send to bridged channel.
+ *
+ * \note Assumes the pvt->pri->lock is already obtained.
+ * \note Assumes the sig_pri_lock_private(pvt) is already obtained.
+ *
+ * \return Nothing
+ */
+static void sig_pri_moh_indicate(struct sig_pri_chan *pvt, int indication)
+{
+	int chanpos;
+	struct sig_pri_span *pri;
+
+	pri = pvt->pri;
+	for (chanpos = 0; chanpos < pri->numchans; ++chanpos) {
+		if (pri->pvts[chanpos] == pvt) {
+			pri_queue_control(pri, chanpos, indication);
+			break;
+		}
+	}
+}
+#endif	/* defined(HAVE_PRI_CALL_HOLD) */
+
+#if defined(HAVE_PRI_CALL_HOLD)
+/*!
+ * \internal
  * \brief Retrieve a call that was placed on hold by the HOLD message.
  * \since 1.10
  *
@@ -4392,6 +4421,9 @@
 		break;
 	case SIG_PRI_MOH_EVENT_HOLD_ACK:
 		next_state = sig_pri_moh_retrieve_call(pvt);
+		if (next_state == SIG_PRI_MOH_STATE_RETRIEVE_FAIL) {
+			sig_pri_moh_indicate(pvt, AST_CONTROL_CONGESTION);
+		}
 		break;
 	default:
 		break;
@@ -4427,6 +4459,9 @@
 		break;
 	case SIG_PRI_MOH_EVENT_UNHOLD:
 		next_state = sig_pri_moh_retrieve_call(pvt);
+		if (next_state == SIG_PRI_MOH_STATE_RETRIEVE_FAIL) {
+			sig_pri_moh_indicate(pvt, AST_CONTROL_CONGESTION);
+		}
 		break;
 	case SIG_PRI_MOH_EVENT_REMOTE_RETRIEVE_ACK:
 		/* Fall back to MOH */
@@ -4475,6 +4510,7 @@
 		next_state = SIG_PRI_MOH_STATE_IDLE;
 		break;
 	case SIG_PRI_MOH_EVENT_RETRIEVE_REJ:
+		sig_pri_moh_indicate(pvt, AST_CONTROL_CONGESTION);
 		next_state = SIG_PRI_MOH_STATE_RETRIEVE_FAIL;
 		break;
 	default:
@@ -4588,12 +4624,17 @@
 		next_state = SIG_PRI_MOH_STATE_IDLE;
 		break;
 	case SIG_PRI_MOH_EVENT_HOLD:
+		sig_pri_moh_indicate(pvt, -1);
 		next_state = SIG_PRI_MOH_STATE_HOLD;
 		break;
 	case SIG_PRI_MOH_EVENT_UNHOLD:
 		next_state = sig_pri_moh_retrieve_call(pvt);
+		if (next_state == SIG_PRI_MOH_STATE_RETRIEVE_REQ) {
+			sig_pri_moh_indicate(pvt, -1);
+		}
 		break;
 	case SIG_PRI_MOH_EVENT_REMOTE_RETRIEVE_ACK:
+		sig_pri_moh_indicate(pvt, -1);
 		next_state = SIG_PRI_MOH_STATE_IDLE;
 		break;
 	default:




More information about the asterisk-commits mailing list