[asterisk-commits] jrose: branch 1.8 r352959 - /branches/1.8/res/res_monitor.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 27 13:12:37 CST 2012


Author: jrose
Date: Fri Jan 27 13:12:34 2012
New Revision: 352959

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=352959
Log:
Make failed PauseMonitor and UnpauseMonitor with no valid channel not close AMI session.

I also went ahead and took a little time to make sure that the manager value
AMI_SUCCESS was used instead of just return 0 being thrown around everywhere since that's
how we handle this stuff these days.

(closes issue ASTERISK-19249)
Reporter: Jamuel Starkey
Patches:
	res_monitor.c-ASTERISK-19249.diff uploaded by Jamuel Starkey (license 5766)

Modified:
    branches/1.8/res/res_monitor.c

Modified: branches/1.8/res/res_monitor.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/res/res_monitor.c?view=diff&rev=352959&r1=352958&r2=352959
==============================================================================
--- branches/1.8/res/res_monitor.c (original)
+++ branches/1.8/res/res_monitor.c Fri Jan 27 13:12:34 2012
@@ -748,12 +748,12 @@
 
 	if (ast_strlen_zero(name)) {
 		astman_send_error(s, m, "No channel specified");
-		return 0;
+		return AMI_SUCCESS;
 	}
 
 	if (!(c = ast_channel_get_by_name(name))) {
 		astman_send_error(s, m, "No such channel");
-		return 0;
+		return AMI_SUCCESS;
 	}
 
 	if (ast_strlen_zero(fname)) {
@@ -771,7 +771,7 @@
 		if (ast_monitor_change_fname(c, fname, 1)) {
 			astman_send_error(s, m, "Could not start monitoring channel");
 			c = ast_channel_unref(c);
-			return 0;
+			return AMI_SUCCESS;
 		}
 	}
 
@@ -785,7 +785,7 @@
 
 	astman_send_ack(s, m, "Started monitoring channel");
 
-	return 0;
+	return AMI_SUCCESS;
 }
 
 /*! \brief Stop monitoring a channel by manager connection */
@@ -797,12 +797,12 @@
 
 	if (ast_strlen_zero(name)) {
 		astman_send_error(s, m, "No channel specified");
-		return 0;
+		return AMI_SUCCESS;
 	}
 
 	if (!(c = ast_channel_get_by_name(name))) {
 		astman_send_error(s, m, "No such channel");
-		return 0;
+		return AMI_SUCCESS;
 	}
 
 	res = ast_monitor_stop(c, 1);
@@ -811,12 +811,12 @@
 
 	if (res) {
 		astman_send_error(s, m, "Could not stop monitoring channel");
-		return 0;
+		return AMI_SUCCESS;
 	}
 
 	astman_send_ack(s, m, "Stopped monitoring channel");
 
-	return 0;
+	return AMI_SUCCESS;
 }
 
 /*! \brief Change filename of a monitored channel by manager connection */
@@ -828,30 +828,30 @@
 
 	if (ast_strlen_zero(name)) {
 		astman_send_error(s, m, "No channel specified");
-		return 0;
+		return AMI_SUCCESS;
 	}
 
 	if (ast_strlen_zero(fname)) {
 		astman_send_error(s, m, "No filename specified");
-		return 0;
+		return AMI_SUCCESS;
 	}
 
 	if (!(c = ast_channel_get_by_name(name))) {
 		astman_send_error(s, m, "No such channel");
-		return 0;
+		return AMI_SUCCESS;
 	}
 
 	if (ast_monitor_change_fname(c, fname, 1)) {
 		c = ast_channel_unref(c);
 		astman_send_error(s, m, "Could not change monitored filename of channel");
-		return 0;
+		return AMI_SUCCESS;
 	}
 
 	c = ast_channel_unref(c);
 
 	astman_send_ack(s, m, "Changed monitor filename");
 
-	return 0;
+	return AMI_SUCCESS;
 }
 
 void AST_OPTIONAL_API_NAME(ast_monitor_setjoinfiles)(struct ast_channel *chan, int turnon)
@@ -865,7 +865,7 @@
 	MONITOR_ACTION_PAUSE,
 	MONITOR_ACTION_UNPAUSE
 };
- 
+
 static int do_pause_or_unpause(struct mansession *s, const struct message *m, int action)
 {
 	struct ast_channel *c = NULL;
@@ -873,12 +873,12 @@
 
 	if (ast_strlen_zero(name)) {
 		astman_send_error(s, m, "No channel specified");
-		return -1;
+		return AMI_SUCCESS;
 	}
 
 	if (!(c = ast_channel_get_by_name(name))) {
 		astman_send_error(s, m, "No such channel");
-		return -1;
+		return AMI_SUCCESS;
 	}
 
 	if (action == MONITOR_ACTION_PAUSE) {
@@ -891,7 +891,7 @@
 
 	astman_send_ack(s, m, (action == MONITOR_ACTION_PAUSE ? "Paused monitoring of the channel" : "Unpaused monitoring of the channel"));
 
-	return 0;
+	return AMI_SUCCESS;
 }
 
 static int pause_monitor_action(struct mansession *s, const struct message *m)
@@ -903,7 +903,6 @@
 {
 	return do_pause_or_unpause(s, m, MONITOR_ACTION_UNPAUSE);
 }
-	
 
 static int load_module(void)
 {




More information about the asterisk-commits mailing list