[asterisk-commits] moy: branch moy/mfcr2 r129904 - /team/moy/mfcr2/channels/chan_zap.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jul 10 23:33:52 CDT 2008
Author: moy
Date: Thu Jul 10 23:33:51 2008
New Revision: 129904
URL: http://svn.digium.com/view/asterisk?view=rev&rev=129904
Log:
added proper locking and setting of mfcr2call when requesting an outgoing channel
Modified:
team/moy/mfcr2/channels/chan_zap.c
Modified: team/moy/mfcr2/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/moy/mfcr2/channels/chan_zap.c?view=diff&rev=129904&r1=129903&r2=129904
==============================================================================
--- team/moy/mfcr2/channels/chan_zap.c (original)
+++ team/moy/mfcr2/channels/chan_zap.c Thu Jul 10 23:33:51 2008
@@ -9378,6 +9378,7 @@
}
#endif
#ifdef HAVE_OPENR2
+ /* Trust MFC/R2 */
if (p->mfcr2) {
if (p->mfcr2call)
return 0;
@@ -9660,6 +9661,19 @@
}
}
#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;
+ }
+ p->mfcr2call = 1;
+ ast_mutex_unlock(&p->lock);
+ zt_r2_update_monitor_count(p->mfcr2, 0);
+ }
+#endif
if (p->channel == CHAN_PSEUDO) {
p = chandup(p);
if (!p) {
@@ -9674,11 +9688,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 HAVE_PRI
if (p->bearer) {
/* Log owner to bearer channel, too */
More information about the asterisk-commits
mailing list