[asterisk-commits] mattf: trunk r86549 - /trunk/channels/chan_zap.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 19 13:46:28 CDT 2007


Author: mattf
Date: Fri Oct 19 13:46:28 2007
New Revision: 86549

URL: http://svn.digium.com/view/asterisk?view=rev&rev=86549
Log:
Add better support for blocking and unblocking of CICs (#10965)

Modified:
    trunk/channels/chan_zap.c

Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?view=diff&rev=86549&r1=86548&r2=86549
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Fri Oct 19 13:46:28 2007
@@ -8790,9 +8790,8 @@
 				p->cid_name[0] = '\0';
 				p->cid_ani2 = e->iam.oli_ani2;
 				p->cid_ton = 0;
-				
 				ast_copy_string(p->charge_number, e->iam.charge_number, sizeof(p->charge_number));
-
+					
 				/* Set DNID */
 				if (!ast_strlen_zero(e->iam.called_party_num))
 					ss7_apply_plan_to_number(p->dnid, sizeof(p->dnid), linkset, e->iam.called_party_num, e->iam.called_nai);
@@ -8901,7 +8900,6 @@
  				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);
@@ -8915,7 +8913,6 @@
 				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);
@@ -8925,12 +8922,22 @@
 				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_BLA:
+				chanpos = ss7_find_cic(linkset, e->bla.cic);
+				if (chanpos < 0) {
+					ast_log(LOG_WARNING, "BLA on unconfigured CIC %d\n", e->bla.cic);
+					break;
+				}
+				ast_debug(1, "Blocking CIC %d\n", e->bla.cic);
+				p = linkset->pvts[chanpos];
+				ast_mutex_lock(&p->lock);
+				p->locallyblocked = 1;
+				ast_mutex_unlock(&p->lock);
+				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);
@@ -8940,9 +8947,20 @@
 				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;
+			case ISUP_EVENT_UBA:
+				chanpos = ss7_find_cic(linkset, e->uba.cic);
+				if (chanpos < 0) {
+					ast_log(LOG_WARNING, "UBA on unconfigured CIC %d\n", e->uba.cic);
+					break;
+				}
+				p = linkset->pvts[chanpos];
+				ast_debug(1, "Unblocking CIC %d\n", e->uba.cic);
+				ast_mutex_lock(&p->lock);
+				p->locallyblocked = 0;
+				ast_mutex_unlock(&p->lock);
 				break;
 			case ISUP_EVENT_CON:
 			case ISUP_EVENT_ANM:
@@ -11844,9 +11862,6 @@
 		if (linksets[linkset-1].pvts[i]->cic == cic) {
 			blocked = linksets[linkset-1].pvts[i]->locallyblocked;
 			if (!blocked) {
-				ast_mutex_lock(&linksets[linkset-1].pvts[i]->lock);
-				linksets[linkset-1].pvts[i]->locallyblocked = 1;
-				ast_mutex_unlock(&linksets[linkset-1].pvts[i]->lock);
 				ast_mutex_lock(&linksets[linkset-1].lock);
 				isup_blo(linksets[linkset-1].ss7, cic, linksets[linkset-1].pvts[i]->dpc);
 				ast_mutex_unlock(&linksets[linkset-1].lock);
@@ -11908,9 +11923,6 @@
 		if (linksets[linkset-1].pvts[i]->cic == cic) {
 			blocked = linksets[linkset-1].pvts[i]->locallyblocked;
 			if (blocked) {
-				ast_mutex_lock(&linksets[linkset-1].pvts[i]->lock);
-				linksets[linkset-1].pvts[i]->locallyblocked = 0;
-				ast_mutex_unlock(&linksets[linkset-1].pvts[i]->lock);
 				ast_mutex_lock(&linksets[linkset-1].lock);
 				isup_ubl(linksets[linkset-1].ss7, cic, linksets[linkset-1].pvts[i]->dpc);
 				ast_mutex_unlock(&linksets[linkset-1].lock);




More information about the asterisk-commits mailing list