[Asterisk-cvs] asterisk/channels chan_zap.c,1.142,1.143

martinp at lists.digium.com martinp at lists.digium.com
Fri Nov 21 11:58:29 CST 2003


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv11547/channels

Modified Files:
	chan_zap.c 
Log Message:
Don't crash if ZapHangup, ZapTransfer, ZapDialOffhook are used on the channel that is onhook (idle)


Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -d -r1.142 -r1.143
--- chan_zap.c	18 Nov 2003 18:09:29 -0000	1.142
+++ chan_zap.c	21 Nov 2003 18:24:49 -0000	1.143
@@ -3857,6 +3857,8 @@
 		i->isidlecall = 0;
 		i->alreadyhungup = 0;
 #endif
+		/* clear the fake event in case we posted one before we had ast_chanenl */
+		i->fake_event = 0;
 		/* Assure there is no confmute on this channel */
 		zt_confmute(i, 0);
 		if (startpbx) {
@@ -6814,6 +6816,10 @@
 		return 0;
 	}
 	p = find_channel(atoi(channel));
+	if (p->owner && p->owner->_state != AST_STATE_UP) {
+		astman_send_error(s, m, "Channel is on hook");
+		return 0;
+	}
 	if (!p) {
 		astman_send_error(s, m, "No such channel");
 		return 0;
@@ -6832,6 +6838,10 @@
 		return 0;
 	}
 	p = find_channel(atoi(channel));
+	if (p->owner && p->owner->_state != AST_STATE_UP) {
+		astman_send_error(s, m, "Channel is on hook");
+		return 0;
+	}
 	if (!p) {
 		astman_send_error(s, m, "No such channel");
 		return 0;
@@ -6856,6 +6866,15 @@
 		return 0;
 	}
 	p = find_channel(atoi(channel));
+	if (p->owner) {
+		if (p->owner->_state != AST_STATE_UP) {
+			astman_send_error(s, m, "Channel is on hook");
+			return 0;
+		}
+	} else {
+		astman_send_error(s, m, "Channel does not have it's owner");
+		return 0;
+	}
 	if (!p) {
 		astman_send_error(s, m, "No such channel");
 		return 0;




More information about the svn-commits mailing list