]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_dahdi/SS7: Made reject incoming call for an in-alarm or blocked channel.
authorRichard Mudgett <rmudgett@digium.com>
Thu, 8 Nov 2012 21:05:40 +0000 (21:05 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Thu, 8 Nov 2012 21:05:40 +0000 (21:05 +0000)
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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@376058 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/sig_ss7.c

index e768b41c0c3d2b6dbbe0ee4ddec6e774496c74f3..3a25babf1f11a5a57d63e5c65eb649a0f3e70d4e 100644 (file)
@@ -279,6 +279,24 @@ static void sig_ss7_handle_link_exception(struct sig_ss7_linkset *linkset, int w
        }
 }
 
+/*!
+ * \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.
@@ -547,7 +565,7 @@ static void ss7_start_call(struct sig_ss7_chan *p, struct sig_ss7_linkset *links
                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;
                return;
@@ -894,11 +912,11 @@ void *ss7_linkset(void *data)
                                                 * 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) {
-                                               p->owner->hangupcause = AST_CAUSE_NORMAL_CLEARING;
+                                               p->owner->hangupcause = AST_CAUSE_NORMAL_CIRCUIT_CONGESTION;
                                                ast_softhangup_nolock(p->owner, AST_SOFTHANGUP_DEV);
                                                ast_channel_unlock(p->owner);
                                        }
@@ -911,6 +929,13 @@ void *ss7_linkset(void *data)
                                 */
                                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;
                                p->ss7call = e->iam.call;
@@ -1349,24 +1374,6 @@ int sig_ss7_add_sigchan(struct sig_ss7_linkset *linkset, int which, int ss7type,
        return 0;
 }
 
-/*!
- * \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