[Asterisk-Users] Re: Forbidding ZAP interface bridging

Samuel Tardieu sam at rfc1149.net
Wed Feb 2 02:46:17 MST 2005


>>>>> "Sam" == Samuel Tardieu <sam at rfc1149.net> writes:

Sam> Is there a way to prevent bridging?

The following patch prevents bridging between Zap channel if
busydetect is enabled on either of them. Does it look correct or are
there cases where bridging should be enabled anyway?

Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.405
diff -u -r1.405 chan_zap.c
--- chan_zap.c	28 Jan 2005 05:19:06 -0000	1.405
+++ chan_zap.c	2 Feb 2005 09:44:41 -0000
@@ -2619,6 +2619,14 @@
 		return -2;
 	}
 
+	/* if busy detection is enabled on either channel, they cannot
+	 * be bridged as hangup will not get properly detected */
+	if (p0->busydetect || p1->busydetect) {
+		ast_mutex_unlock(&c0->lock);
+		ast_mutex_unlock(&c1->lock);
+		return -2;
+	}
+
 	op0 = p0 = c0->pvt->pvt;
 	op1 = p1 = c1->pvt->pvt;
 	ofd1 = c0->fds[0];

 Sam
-- 
Samuel Tardieu -- sam at rfc1149.net -- http://www.rfc1149.net/sam




More information about the asterisk-users mailing list