[asterisk-commits] russell: trunk r46661 - /trunk/main/manager.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Oct 31 08:22:28 MST 2006


Author: russell
Date: Tue Oct 31 09:22:28 2006
New Revision: 46661

URL: http://svn.digium.com/view/asterisk?rev=46661&view=rev
Log:
Fix the new send text manager command.  There is no way this could have worked.

- Check the channel name string length to be zero, not non-zero
- Check the message string length to be zero, not non-zero
- unlock the channel *after* calling sendtext

Modified:
    trunk/main/manager.c

Modified: trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/main/manager.c?rev=46661&r1=46660&r2=46661&view=diff
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Tue Oct 31 09:22:28 2006
@@ -1443,11 +1443,12 @@
 	char *textmsg = astman_get_header(m, "Message");
 	int res = 0;
 
-	if (!ast_strlen_zero(name)) {
+	if (ast_strlen_zero(name)) {
 		astman_send_error(s, m, "No channel specified");
 		return 0;
 	}
-	if (!ast_strlen_zero(textmsg)) {
+
+	if (ast_strlen_zero(textmsg)) {
 		astman_send_error(s, m, "No Message specified");
 		return 0;
 	}
@@ -1458,13 +1459,14 @@
 		return 0;
 	}
 
+	res = ast_sendtext(c, textmsg);
 	ast_mutex_unlock(&c->lock);
-	res = ast_sendtext(c, textmsg);
-	if (res > 0) {
+	
+	if (res > 0)
 		astman_send_ack(s, m, "Success");
-	} else {
+	else
 		astman_send_error(s, m, "Failure");
-	}
+	
 	return res;
 }
 



More information about the asterisk-commits mailing list