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

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Mar 30 13:54:43 MST 2007


Author: mattf
Date: Fri Mar 30 15:54:42 2007
New Revision: 59555

URL: http://svn.digium.com/view/asterisk?view=rev&rev=59555
Log:
Update to support multiple CIC groups and DPCs per linkset.

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=59555&r1=59554&r2=59555
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Fri Mar 30 15:54:42 2007
@@ -625,6 +625,7 @@
 	struct isup_call *ss7call;
 	int transcap;
 	int cic;							/*!< CIC associated with channel */
+	unsigned int dpc;						/*!< CIC's DPC */
 #endif
 	char begindigit;
 } *iflist = NULL, *ifend = NULL;
@@ -2196,7 +2197,7 @@
 			return -1;
 		}
 
-		isup_init_call(p->ss7->ss7, p->ss7call, p->cic, c + p->stripmsd, l);
+		isup_init_call(p->ss7->ss7, p->ss7call, p->cic, p->dpc, c + p->stripmsd, l);
 
 		isup_iam(p->ss7->ss7, p->ss7call);
 		ss7_rel(p->ss7);
@@ -7579,6 +7580,9 @@
 				}
 
 				tmp->cic = cur_cicbeginswith++;
+
+				/* DB: Add CIC's DPC information */
+				tmp->dpc = cur_defaultdpc;
 
 				tmp->ss7 = ss7;
 				tmp->ss7call = NULL;
@@ -8398,23 +8402,28 @@
 
 static void ss7_reset_linkset(struct zt_ss7 *linkset)
 {
-	int i, startcic = -1, endcic;
+	int i, startcic = -1, endcic, dpc;
 
 	if (linkset->numchans <= 0)
 		return;
 
 	startcic = linkset->pvts[0]->cic;
+	/* DB: CIC's DPC fix */
+	dpc = linkset->pvts[0]->dpc;
 
 	for (i = 0; i < linkset->numchans; i++) {
-		if (linkset->pvts[i+1] && ((linkset->pvts[i+1]->cic - linkset->pvts[i]->cic) == 1) && (linkset->pvts[i]->cic - startcic < 31)) {
+		if (linkset->pvts[i+1] && linkset->pvts[i+1]->dpc == dpc && ((linkset->pvts[i+1]->cic - linkset->pvts[i]->cic) == 1) && (linkset->pvts[i]->cic - startcic < 31)) {
 			continue;
 		} else {
 			endcic = linkset->pvts[i]->cic;
 			ast_verbose("Resetting CICs %d to %d\n", startcic, endcic);
-			isup_grs(linkset->ss7, startcic, endcic);
-
-			if (linkset->pvts[i+1])
+			isup_grs(linkset->ss7, startcic, endcic, dpc);
+
+			/* DB: CIC's DPC fix */
+			if (linkset->pvts[i+1]) {
 				startcic = linkset->pvts[i+1]->cic;
+				dpc = linkset->pvts[i+1]->dpc;
+			}
 		}
 	}
 }
@@ -8457,6 +8466,7 @@
 	else
 		ast_log(LOG_WARNING, "Unable to start PBX on CIC %d\n", p->cic);
 }
+
 
 static void *ss7_linkset(void *data)
 {
@@ -8470,6 +8480,7 @@
 	pthread_attr_t attr;
 	struct pollfd pollers[NUM_DCHANS];
 	int cic;
+	unsigned int dpc;
 	int nextms = 0;
 
 	pthread_attr_init(&attr);
@@ -8621,12 +8632,20 @@
 				ast_mutex_lock(&p->lock);
 				p->inservice = 1;
 				p->remotelyblocked = 0;
+				dpc = p->dpc;
+				isup_set_call_dpc(e->rsc.call, dpc);
 				ast_mutex_unlock(&p->lock);
 				isup_rlc(ss7, e->rsc.call);
 				break;
 			case ISUP_EVENT_GRS:
 				ast_log(LOG_DEBUG, "Got Reset for CICs %d to %d: Acknowledging\n", e->grs.startcic, e->grs.endcic);
-				isup_gra(ss7, e->grs.startcic, e->grs.endcic);
+				chanpos = ss7_find_cic(linkset, e->grs.startcic);
+				if (chanpos < 0) {
+					ast_log(LOG_WARNING, "GRS on unconfigured CIC %d\n", e->grs.startcic);
+					break;
+				}
+				p = linkset->pvts[chanpos];
+				isup_gra(ss7, e->grs.startcic, e->grs.endcic, p->dpc);
 				ss7_block_cics(linkset, e->grs.startcic, e->grs.endcic, NULL, 0);
 				break;
 			case ISUP_EVENT_GRA:
@@ -8656,7 +8675,9 @@
 					}
 				}
 
+				dpc = p->dpc;
 				p->ss7call = e->iam.call;
+				isup_set_call_dpc(p->ss7call, dpc);
 
 				if (p->use_callerid)
 					ast_copy_string(p->cid_num, e->iam.calling_party_num, sizeof(p->cid_num));
@@ -8747,12 +8768,24 @@
 				}
 				break;
 			case ISUP_EVENT_CGB:
+ 				chanpos = ss7_find_cic(linkset, e->cgb.startcic);
+ 				if (chanpos < 0) {
+ 					ast_log(LOG_WARNING, "CGB on unconfigured CIC %d\n", e->cgb.startcic);
+ 					break;
+ 				}
+ 				p = linkset->pvts[chanpos];
 				ss7_block_cics(linkset, e->cgb.startcic, e->cgb.endcic, e->cgb.status, 1);
-				isup_cgba(linkset->ss7, e->cgb.startcic, e->cgb.endcic, e->cgb.status, e->cgb.type);
+ 				isup_cgba(linkset->ss7, e->cgb.startcic, e->cgb.endcic, p->dpc, e->cgb.status, e->cgb.type);
 				break;
 			case ISUP_EVENT_CGU:
+ 				chanpos = ss7_find_cic(linkset, e->cgu.startcic);
+ 				if (chanpos < 0) {
+ 					ast_log(LOG_WARNING, "CGU on unconfigured CIC %d\n", e->cgu.startcic);
+ 					break;
+ 				}
+ 				p = linkset->pvts[chanpos];
 				ss7_block_cics(linkset, e->cgu.startcic, e->cgu.endcic, e->cgu.status, 0);
-				isup_cgua(linkset->ss7, e->cgu.startcic, e->cgu.endcic, e->cgu.status, e->cgu.type);
+ 				isup_cgua(linkset->ss7, e->cgu.startcic, e->cgu.endcic, p->dpc, e->cgu.status, e->cgu.type);
 				break;
 			case ISUP_EVENT_BLO:
 				chanpos = ss7_find_cic(linkset, e->blo.cic);
@@ -8765,7 +8798,7 @@
 				ast_mutex_lock(&p->lock);
 				p->remotelyblocked = 1;
 				ast_mutex_unlock(&p->lock);
-				isup_bla(linkset->ss7, e->blo.cic);
+				isup_bla(linkset->ss7, e->blo.cic, p->dpc);
 				break;
 			case ISUP_EVENT_UBL:
 				chanpos = ss7_find_cic(linkset, e->ubl.cic);
@@ -8778,7 +8811,7 @@
 				ast_mutex_lock(&p->lock);
 				p->remotelyblocked = 0;
 				ast_mutex_unlock(&p->lock);
-				isup_uba(linkset->ss7, e->ubl.cic);
+				isup_uba(linkset->ss7, e->ubl.cic, p->dpc);
 				break;
 			case ISUP_EVENT_CON:
 			case ISUP_EVENT_ANM:
@@ -11589,7 +11622,7 @@
 				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);
+				isup_blo(linksets[linkset-1].ss7, cic, linksets[linkset-1].pvts[i]->dpc);
 				ast_mutex_unlock(&linksets[linkset-1].lock);
 			}
 		}
@@ -11642,7 +11675,7 @@
 				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);
+				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