[svn-commits] mattf: branch mattf/asterisk-ss7 r39727 - in /team/mattf/asterisk-ss7: channe...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Mon Aug 14 09:42:56 MST 2006


Author: mattf
Date: Mon Aug 14 11:42:55 2006
New Revision: 39727

URL: http://svn.digium.com/view/asterisk?rev=39727&view=rev
Log:
Add support for A-links and links where ISUP calls don't terminate directly at 
the adjacent point code (defaultdpc).  Also most of continuity testing is done.

Modified:
    team/mattf/asterisk-ss7/channels/chan_zap.c
    team/mattf/asterisk-ss7/configs/zapata.conf.sample

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=39727&r1=39726&r2=39727&view=diff
==============================================================================
--- team/mattf/asterisk-ss7/channels/chan_zap.c (original)
+++ team/mattf/asterisk-ss7/channels/chan_zap.c Mon Aug 14 11:42:55 2006
@@ -430,6 +430,7 @@
 static int cur_cicbeginswith = -1;
 static int cur_adjpointcode = -1;
 static int cur_networkindicator = -1;
+static int cur_defaultdpc = -1;
 #endif /* HAVE_SS7 */
 
 #ifdef HAVE_PRI
@@ -724,6 +725,7 @@
 #ifdef HAVE_SS7
 	struct zt_ss7 *ss7;
 	struct isup_call *ss7call;
+	int transcap;
 	int cic;							/*!< CIC associated with channel */
 #endif
 } *iflist = NULL, *ifend = NULL;
@@ -8037,6 +8039,32 @@
 	}
 }
 
+static void ss7_start_call(struct zt_pvt *p, struct zt_ss7 *linkset)
+{
+	struct ss7 *ss7 = linkset->ss7;
+	int res;
+	int law = 1;
+	struct ast_channel *c;
+
+	if (ioctl(p->subs[SUB_REAL].zfd, ZT_AUDIOMODE, &law) == -1)
+		ast_log(LOG_WARNING, "Unable to set audio mode on channel %d to %d\n", p->channel, law);
+	
+	law = ZT_LAW_ALAW;
+	res = zt_setlaw(p->subs[SUB_REAL].zfd, law);
+	if (res < 0) 
+		ast_log(LOG_WARNING, "Unable to set law on channel %d\n", p->channel);
+	
+	isup_acm(ss7, p->ss7call);
+
+	ast_mutex_unlock(&linkset->lock);
+	c = zt_new(p, AST_STATE_RING, 1, SUB_REAL, law, 0);
+	ast_mutex_lock(&linkset->lock);
+	if (c)
+		ast_verbose(VERBOSE_PREFIX_3 "Accepting call to '%s' on CIC %d\n", p->exten, p->cic);
+	else
+		ast_log(LOG_WARNING, "Unable to start PBX on CIC %d\n", p->cic);
+}
+
 static void *ss7_linkset(void *data)
 {
 	int res, i;
@@ -8044,7 +8072,6 @@
 	struct zt_ss7 *linkset = (struct zt_ss7 *) data;
 	struct ss7 *ss7 = linkset->ss7;
 	ss7_event *e = NULL;
-	struct ast_channel *c;
 	struct zt_pvt *p;
 	int chanpos;
 	pthread_attr_t attr;
@@ -8196,31 +8223,34 @@
 					ast_copy_string(p->dnid, e->iam.called_party_num, sizeof(p->exten));
 
 				if (ast_exists_extension(NULL, p->context, p->exten, 1, p->cid_num)) {
-					int law = 1;
-
-					if (ioctl(p->subs[SUB_REAL].zfd, ZT_AUDIOMODE, &law) == -1)
-						ast_log(LOG_WARNING, "Unable to set audio mode on channel %d to %d\n", p->channel, law);
-					
-					law = ZT_LAW_ALAW;
-					res = zt_setlaw(p->subs[SUB_REAL].zfd, law);
-					if (res < 0) 
-						ast_log(LOG_WARNING, "Unable to set law on channel %d\n", p->channel);
-					
-					isup_acm(ss7, e->iam.call);
-
-					ast_mutex_unlock(&linkset->lock);
-					c = zt_new(p, AST_STATE_RING, 1, SUB_REAL, law, e->iam.transcap);
-					ast_mutex_lock(&linkset->lock);
-					if (c)
-						ast_verbose(VERBOSE_PREFIX_3 "Accepting call to '%s' on CIC %d\n", p->exten, p->cic);
-					else
-						ast_log(LOG_WARNING, "Unable to start PBX on CIC %d\n", p->cic);
+
+					if (e->iam.cot_check_required) {
+#if 0
+						zt_loopback(p, 1);
+#endif
+					} else
+						ss7_start_call(p, linkset);
 				} else {
 					ast_log(LOG_DEBUG, "Call on CIC for unconfigured extension %s\n", p->exten);
 					isup_rel(ss7, e->iam.call, -1);
 				}
-
 				ast_mutex_unlock(&p->lock);
+				break;
+			case ISUP_EVENT_COT:
+				chanpos = ss7_find_cic(linkset, e->cot.cic);
+				if (chanpos < 0) {
+					ast_log(LOG_WARNING, "COT on unconfigured CIC %d\n", e->cot.cic);
+					isup_rel(ss7, e->cot.call, -1);
+					break;
+				}
+				p = linkset->pvts[chanpos];
+
+#if 0
+				zt_loopback(p, 0);
+#endif
+				
+				isup_acm(ss7, p->ss7call);
+				ss7_start_call(p, linkset);
 				break;
 			case ISUP_EVENT_REL:
 				chanpos = ss7_find_cic(linkset, e->rel.cic);
@@ -10833,8 +10863,14 @@
 		ast_log(LOG_ERROR, "Unspecified adjpointcode!\n");
 		return -1;
 	} else {
-		ss7_set_default_dpc(link->ss7, cur_adjpointcode);
 		ss7_set_adjpc(link->ss7, link->fds[curfd], cur_adjpointcode);
+	}
+
+	if (cur_defaultdpc < 0) {
+		ast_log(LOG_ERROR, "Unspecified defaultdpc!\n");
+		return -1;
+	} else {
+		ss7_set_default_dpc(link->ss7, cur_defaultdpc);
 	}
 
 	if (cur_networkindicator < 0) {
@@ -11546,6 +11582,8 @@
 				cur_pointcode = atoi(v->value);
 			} else if (!strcasecmp(v->name, "adjpointcode")) {
 				cur_adjpointcode = atoi(v->value);
+			} else if (!strcasecmp(v->name, "defaultdpc")) {
+				cur_defaultdpc = atoi(v->value);
 			} else if (!strcasecmp(v->name, "cicbeginswith")) {
 				cur_cicbeginswith = atoi(v->value);
 			} else if (!strcasecmp(v->name, "networkindicator")) {

Modified: team/mattf/asterisk-ss7/configs/zapata.conf.sample
URL: http://svn.digium.com/view/asterisk/team/mattf/asterisk-ss7/configs/zapata.conf.sample?rev=39727&r1=39726&r2=39727&view=diff
==============================================================================
--- team/mattf/asterisk-ss7/configs/zapata.conf.sample (original)
+++ team/mattf/asterisk-ss7/configs/zapata.conf.sample Mon Aug 14 11:42:55 2006
@@ -650,8 +650,13 @@
 ; Point code of the linkset
 pointcode = 1
 
-; Point code of node adjacent to this signaling link
+; Point code of node adjacent to this signaling link (Possibly the STP between you and
+; your destination)
 adjpointcode = 2
+
+; Default point code that you would like to assign to outgoing messages (in case of
+; routing through STPs, or using A links)
+defaultdpc = 3
 
 ; Begin CIC (Circuit indication codes) count with this number
 cicbeginswith = 1



More information about the svn-commits mailing list