[asterisk-commits] mattf: branch 1.6.0 r114094 - /branches/1.6.0/channels/chan_zap.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Apr 12 11:22:01 CDT 2008


Author: mattf
Date: Sat Apr 12 11:22:00 2008
New Revision: 114094

URL: http://svn.digium.com/view/asterisk?view=rev&rev=114094
Log:
Make sure we start incoming calls on SS7 with echo cancellation enabled.  Also make sure when completing a COT we call ss7_start_call with the proper locks held.  Lastly, make sure if we fail to get a channel from zt_new that we don't assume it's there.

Modified:
    branches/1.6.0/channels/chan_zap.c

Modified: branches/1.6.0/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_zap.c?view=diff&rev=114094&r1=114093&r2=114094
==============================================================================
--- branches/1.6.0/channels/chan_zap.c (original)
+++ branches/1.6.0/channels/chan_zap.c Sat Apr 12 11:22:00 2008
@@ -9115,6 +9115,7 @@
 	}
 }
 
+/* XXX: This function is assumed to be called with the private channel lock and linkset lock held */
 static void ss7_start_call(struct zt_pvt *p, struct zt_ss7 *linkset)
 {
 	struct ss7 *ss7 = linkset->ss7;
@@ -9140,11 +9141,16 @@
 
 	ast_mutex_unlock(&linkset->lock);
 	c = zt_new(p, AST_STATE_RING, 1, SUB_REAL, law, 0);
+
+	if (!c) {
+		ast_log(LOG_WARNING, "Unable to start PBX on CIC %d\n", p->cic);
+		return;
+	} else
+		ast_verb(3, "Accepting call to '%s' on CIC %d\n", p->exten, p->cic);
+
 	ast_mutex_lock(&linkset->lock);
-	if (c)
-		ast_verb(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);
+
+	zt_enable_ec(p);
 
 	if (!ast_strlen_zero(p->charge_number)) {
 		pbx_builtin_setvar_helper(c, "SS7_CHARGE_NUMBER", p->charge_number);
@@ -9507,10 +9513,14 @@
 				}
 				p = linkset->pvts[chanpos];
 
+				ast_mutex_lock(&p->lock);
+
 				if (p->loopedback) {
 					zt_loopback(p, 0);
 					ss7_start_call(p, linkset);
 				}
+
+				ast_mutex_unlock(&p->lock);
 
 				break;
 			case ISUP_EVENT_CCR:




More information about the asterisk-commits mailing list