[asterisk-commits] branch mattf/asterisk-ss7 r37923 - /team/mattf/asterisk-ss7/channels/chan_zap.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Jul 18 16:31:12 MST 2006


Author: mattf
Date: Tue Jul 18 18:31:11 2006
New Revision: 37923

URL: http://svn.digium.com/view/asterisk?rev=37923&view=rev
Log:
More fleshing out of chan_zap.c and libss7 integration.

Modified:
    team/mattf/asterisk-ss7/channels/chan_zap.c

Modified: team/mattf/asterisk-ss7/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/mattf/asterisk-ss7/channels/chan_zap.c?rev=37923&r1=37922&r2=37923&view=diff
==============================================================================
--- team/mattf/asterisk-ss7/channels/chan_zap.c (original)
+++ team/mattf/asterisk-ss7/channels/chan_zap.c Tue Jul 18 18:31:11 2006
@@ -890,16 +890,26 @@
 #endif			
 }
 
+static void zap_queue_frame(struct zt_pvt *p, struct ast_frame *f, void *data)
+{
 #ifdef HAVE_PRI
-static void zap_queue_frame(struct zt_pvt *p, struct ast_frame *f, struct zt_pri *pri)
-#else
-static void zap_queue_frame(struct zt_pvt *p, struct ast_frame *f, void *pri)
+	struct zt_pri *pri = (struct zt_pri*) data;
 #endif
-{
+	struct zt_ss7 *ss7 = (struct zt_ss7*) data;
 	/* We must unlock the PRI to avoid the possibility of a deadlock */
-#ifdef HAVE_PRI
-	if (pri)
-		ast_mutex_unlock(&pri->lock);
+#if defined(HAVE_PRI) || defined(HAVE_SS7)
+	if (data) {
+		switch (p->sig) {
+		case SIG_PRI:
+			ast_mutex_unlock(&pri->lock);
+			break;
+		case SIG_SS7:
+			ast_mutex_unlock(&ss7->lock);
+			break;
+		default:
+			break;
+		}
+	}
 #endif		
 	for (;;) {
 		if (p->owner) {
@@ -915,9 +925,20 @@
 		} else
 			break;
 	}
-#ifdef HAVE_PRI
-	if (pri)
-		ast_mutex_lock(&pri->lock);
+#if defined(HAVE_PRI) || defined(HAVE_SS7)
+	if (data) {
+		switch (p->sig) {
+		case SIG_PRI:
+			ast_mutex_lock(&pri->lock);
+			break;
+		case SIG_SS7:
+			ast_mutex_lock(&ss7->lock);
+			break;
+		default:
+			break;
+		}
+	}
+
 #endif		
 }
 
@@ -8162,7 +8183,7 @@
 				chanpos = ss7_find_cic(linkset, e->rel.cic);
 				if (chanpos < 0) {
 					ast_log(LOG_WARNING, "REL on unconfigured CIC %d\n", e->rel.cic);
-					isup_rlc(ss7, e->iam.call);
+					isup_rlc(ss7, e->rel.call);
 					break;
 				}
 				p = linkset->pvts[chanpos];
@@ -8181,10 +8202,39 @@
 				break;
 			case SS7_EVENT_ACM:
 				ast_log(LOG_DEBUG, "Got ACM for cic %d\n", e->acm.cic);
+				chanpos = ss7_find_cic(linkset, e->acm.cic);
+				if (chanpos < 0) {
+					ast_log(LOG_WARNING, "ACM on unconfigured CIC %d\n", e->acm.cic);
+					isup_rlc(ss7, e->acm.call);
+					break;
+				} else {
+					struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_PROCEEDING, };
+
+					p = linkset->pvts[chanpos];
+
+					ast_log(LOG_DEBUG, "Queueing frame from SS7_EVENT_ACM on CIC %d\n", p->cic);
+
+					ast_mutex_lock(&p->lock);
+					zap_queue_frame(p, &f, linkset);
+					p->proceeding = 1;
+
+					ast_mutex_unlock(&p->lock);
+				}
 				break;
 			case SS7_EVENT_ANM:
-				printf("Got ANM for cic %d\n", e->anm.cic);
-				isup_rel(ss7, e->anm.call, 16);
+				ast_log(LOG_DEBUG, "Got ANM for cic %d\n", e->anm.cic);
+				chanpos = ss7_find_cic(linkset, e->anm.cic);
+				if (chanpos < 0) {
+					ast_log(LOG_WARNING, "ANM on unconfigured CIC %d\n", e->anm.cic);
+					isup_rlc(ss7, e->anm.call);
+					break;
+				} else {
+					p = linkset->pvts[chanpos];
+					ast_mutex_lock(&p->lock);
+					p->subs[SUB_REAL].needanswer = 1;
+					zt_enable_ec(p);
+					ast_mutex_unlock(&p->lock);
+				}
 				break;
 			case SS7_EVENT_RLC:
 				printf("Got RLC for cic %d\n", e->rlc.cic);



More information about the asterisk-commits mailing list