[asterisk-commits] rmudgett: branch 11 r376060 - in /branches/11: ./ channels/sig_ss7.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Nov 8 15:10:50 CST 2012


Author: rmudgett
Date: Thu Nov  8 15:10:47 2012
New Revision: 376060

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=376060
Log:
chan_dahdi/SS7: Made reject incoming call for an in-alarm or blocked channel.

If a SS7 call comes in requesting a CIC that is in-alarm, the call is
accepted and connects if the extension exists in the dialplan.  The call
does not have any audio.

* Made release the call immediately with circuit congestion cause.

(closes issue ASTERISK-20204)
Reported by: Tuan Le
Patches:
      jira_asterisk_20204_v1.8.patch (license #5621) patch uploaded by rmudgett
........

Merged revisions 376058 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 376059 from http://svn.asterisk.org/svn/asterisk/branches/10

Modified:
    branches/11/   (props changed)
    branches/11/channels/sig_ss7.c

Propchange: branches/11/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Modified: branches/11/channels/sig_ss7.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/sig_ss7.c?view=diff&rev=376060&r1=376059&r2=376060
==============================================================================
--- branches/11/channels/sig_ss7.c (original)
+++ branches/11/channels/sig_ss7.c Thu Nov  8 15:10:47 2012
@@ -293,6 +293,24 @@
 
 /*!
  * \internal
+ * \brief Determine if a private channel structure is available.
+ *
+ * \param pvt Channel to determine if available.
+ *
+ * \return TRUE if the channel is available.
+ */
+static int sig_ss7_is_chan_available(struct sig_ss7_chan *pvt)
+{
+	if (!pvt->inalarm && !pvt->owner && !pvt->ss7call
+		&& pvt->call_level == SIG_SS7_CALL_LEVEL_IDLE
+		&& !pvt->locallyblocked && !pvt->remotelyblocked) {
+		return 1;
+	}
+	return 0;
+}
+
+/*!
+ * \internal
  * \brief Obtain the sig_ss7 owner channel lock if the owner exists.
  * \since 1.8
  *
@@ -589,7 +607,7 @@
 		ast_log(LOG_WARNING, "Unable to start PBX on CIC %d\n", p->cic);
 		ast_mutex_lock(&linkset->lock);
 		sig_ss7_lock_private(p);
-		isup_rel(linkset->ss7, p->ss7call, -1);
+		isup_rel(linkset->ss7, p->ss7call, AST_CAUSE_SWITCH_CONGESTION);
 		p->call_level = SIG_SS7_CALL_LEVEL_IDLE;
 		p->alreadyhungup = 1;
 		ast_callid_threadstorage_auto_clean(callid, callid_created);
@@ -975,12 +993,12 @@
 						 * We have not sent our IAM yet and we never will at this point.
 						 */
 						p->alreadyhungup = 1;
-						isup_rel(ss7, e->iam.call, -1);
+						isup_rel(ss7, e->iam.call, AST_CAUSE_NORMAL_CIRCUIT_CONGESTION);
 					}
 					p->call_level = SIG_SS7_CALL_LEVEL_GLARE;
 					if (p->owner) {
-						ss7_queue_pvt_cause_data(p->owner, "SS7 ISUP_EVENT_IAM (glare)", AST_CAUSE_NORMAL_CLEARING);
-						ast_channel_hangupcause_set(p->owner, AST_CAUSE_NORMAL_CLEARING);
+						ss7_queue_pvt_cause_data(p->owner, "SS7 ISUP_EVENT_IAM (glare)", AST_CAUSE_NORMAL_CIRCUIT_CONGESTION);
+						ast_channel_hangupcause_set(p->owner, AST_CAUSE_NORMAL_CIRCUIT_CONGESTION);
 						ast_softhangup_nolock(p->owner, AST_SOFTHANGUP_DEV);
 						ast_channel_unlock(p->owner);
 					}
@@ -992,6 +1010,13 @@
 				 * are in the process of creating an owner for it.
 				 */
 				ast_assert(!p->owner);
+
+				if (!sig_ss7_is_chan_available(p)) {
+					/* Circuit is likely blocked or in alarm. */
+					isup_rel(ss7, e->iam.call, AST_CAUSE_NORMAL_CIRCUIT_CONGESTION);
+					sig_ss7_unlock_private(p);
+					break;
+				}
 
 				/* Mark channel as in use so no outgoing call will steal it. */
 				p->call_level = SIG_SS7_CALL_LEVEL_ALLOCATED;
@@ -1444,24 +1469,6 @@
 }
 
 /*!
- * \internal
- * \brief Determine if a private channel structure is available.
- *
- * \param pvt Channel to determine if available.
- *
- * \return TRUE if the channel is available.
- */
-static int sig_ss7_is_chan_available(struct sig_ss7_chan *pvt)
-{
-	if (!pvt->inalarm && !pvt->owner && !pvt->ss7call
-		&& pvt->call_level == SIG_SS7_CALL_LEVEL_IDLE
-		&& !pvt->locallyblocked && !pvt->remotelyblocked) {
-		return 1;
-	}
-	return 0;
-}
-
-/*!
  * \brief Determine if the specified channel is available for an outgoing call.
  * \since 1.8
  *




More information about the asterisk-commits mailing list