From c61d95442215d4b6be4bcaa5a79bd1daaeebc303 Mon Sep 17 00:00:00 2001
From: Matthew Fredrickson <creslin@digium.com>
Date: Thu, 6 Sep 2007 16:38:54 +0000
Subject: [PATCH] Patch on 10575.  Add support for unequipped CIC (UCIC)
 message as well as improve some of our CIC flags in chan_zap

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81742 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 channels/chan_zap.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 45337874e9..f7efa069f5 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -8831,7 +8831,22 @@ static void *ss7_linkset(void *data)
 				ss7_block_cics(linkset, e->cgu.startcic, e->cgu.endcic, e->cgu.status, 0);
  				isup_cgua(linkset->ss7, e->cgu.startcic, e->cgu.endcic, p->dpc, e->cgu.status, e->cgu.type);
 				break;
+			case ISUP_EVENT_UCIC:
+				ast_verb(3,"Got UCIC message on CIC %d\n", e->ucic.cic);
+				chanpos = ss7_find_cic(linkset, e->ucic.cic);
+				if (chanpos < 0) {
+					ast_log(LOG_WARNING, "UCIC on unconfigured CIC %d\n", e->ucic.cic);
+					break;
+				}
+				p = linkset->pvts[chanpos];
+				ast_debug(1, "Unequiped Circuit Id Code on CIC %d\n", e->ucic.cic);
+				ast_mutex_lock(&p->lock);
+				p->remotelyblocked = 1;
+				p->inservice = 0;
+				ast_mutex_unlock(&p->lock);			//doesn't require a SS7 acknowledgement
+				break;
 			case ISUP_EVENT_BLO:
+				ast_verb(3,"Got BLO acknowledgement from CIC %d\n", e->ubl.cic);
 				chanpos = ss7_find_cic(linkset, e->blo.cic);
 				if (chanpos < 0) {
 					ast_log(LOG_WARNING, "BLO on unconfigured CIC %d\n", e->blo.cic);
@@ -8841,10 +8856,12 @@ static void *ss7_linkset(void *data)
 				ast_debug(1, "Blocking CIC %d\n", e->blo.cic);
 				ast_mutex_lock(&p->lock);
 				p->remotelyblocked = 1;
+				p->inservice = 0;
 				ast_mutex_unlock(&p->lock);
 				isup_bla(linkset->ss7, e->blo.cic, p->dpc);
 				break;
 			case ISUP_EVENT_UBL:
+				ast_verb(3,"Got UBL acknowledgement from CIC %d\n", e->ubl.cic);
 				chanpos = ss7_find_cic(linkset, e->ubl.cic);
 				if (chanpos < 0) {
 					ast_log(LOG_WARNING, "UBL on unconfigured CIC %d\n", e->ubl.cic);
@@ -8854,6 +8871,7 @@ static void *ss7_linkset(void *data)
 				ast_debug(1, "Unblocking CIC %d\n", e->ubl.cic);
 				ast_mutex_lock(&p->lock);
 				p->remotelyblocked = 0;
+				p->inservice = 1;
 				ast_mutex_unlock(&p->lock);
 				isup_uba(linkset->ss7, e->ubl.cic, p->dpc);
 				break;
-- 
GitLab