aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-31 15:22:28 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-31 15:22:28 +0000
commitd67754f068e22e26db98e6e8767ff444442b822c (patch)
tree055dca8c8628afe6861df2befb62359bc694b25d
parentd356d25107991b9e3c97981a40c296a1b1fb4a0e (diff)
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 git-svn-id: http://svn.digium.com/svn/asterisk/trunk@46661 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--main/manager.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/main/manager.c b/main/manager.c
index 0b87cdb55..99599b79f 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1443,11 +1443,12 @@ static int action_sendtext(struct mansession *s, struct message *m)
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 @@ static int action_sendtext(struct mansession *s, struct message *m)
return 0;
}
- ast_mutex_unlock(&c->lock);
res = ast_sendtext(c, textmsg);
- if (res > 0) {
+ ast_mutex_unlock(&c->lock);
+
+ if (res > 0)
astman_send_ack(s, m, "Success");
- } else {
+ else
astman_send_error(s, m, "Failure");
- }
+
return res;
}