[asterisk-commits] moy: branch moy/mfcr2-1.2 r129905 - /team/moy/mfcr2-1.2/channels/chan_zap.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 10 23:46:37 CDT 2008


Author: moy
Date: Thu Jul 10 23:46:36 2008
New Revision: 129905

URL: http://svn.digium.com/view/asterisk?view=rev&rev=129905
Log:
added proper locking and setting of mfcr2call when requesting an outgoing channel

Modified:
    team/moy/mfcr2-1.2/channels/chan_zap.c

Modified: team/moy/mfcr2-1.2/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/moy/mfcr2-1.2/channels/chan_zap.c?view=diff&rev=129905&r1=129904&r2=129905
==============================================================================
--- team/moy/mfcr2-1.2/channels/chan_zap.c (original)
+++ team/moy/mfcr2-1.2/channels/chan_zap.c Thu Jul 10 23:46:36 2008
@@ -7754,6 +7754,7 @@
 		}
 #endif
 #ifdef HAVE_OPENR2
+		/* Trust MFC/R2 */
 		if (p->mfcr2) {
 			if (p->mfcr2call)
 				return 0;
@@ -8044,6 +8045,18 @@
 				}
 			}
 #endif			
+#ifdef HAVE_OPENR2
+			if (p->mfcr2) {
+				ast_mutex_lock(&p->lock);
+				if (p->mfcr2call) {
+					ast_log(LOG_DEBUG, "Yay!, someone just beat us in the race for channel %d.\n", p->channel);
+					ast_mutex_unlock(&p->lock);
+					goto next;
+				}
+				ast_mutex_unlock(&p->lock);
+				zt_r2_update_monitor_count(p->mfcr2, 0);
+			}
+#endif
 			if (p->channel == CHAN_PSEUDO) {
 				p = chandup(p);
 				if (!p) {
@@ -8058,11 +8071,6 @@
 			}
 			p->outgoing = 1;
 			tmp = zt_new(p, AST_STATE_RESERVED, 0, p->owner ? SUB_CALLWAIT : SUB_REAL, 0, 0);
-#ifdef HAVE_OPENR2
-			if (p->mfcr2) {
-				zt_r2_update_monitor_count(p->mfcr2, 0);
-			}
-#endif
 #ifdef ZAPATA_PRI
 			if (p->bearer) {
 				/* Log owner to bearer channel, too */




More information about the asterisk-commits mailing list