mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-20 00:30:20 +00:00
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: https://origsvn.digium.com/svn/asterisk/trunk@46661 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1443,11 +1443,12 @@ static int action_sendtext(struct mansession *s, struct message *m)
|
|||||||
char *textmsg = astman_get_header(m, "Message");
|
char *textmsg = astman_get_header(m, "Message");
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
if (!ast_strlen_zero(name)) {
|
if (ast_strlen_zero(name)) {
|
||||||
astman_send_error(s, m, "No channel specified");
|
astman_send_error(s, m, "No channel specified");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!ast_strlen_zero(textmsg)) {
|
|
||||||
|
if (ast_strlen_zero(textmsg)) {
|
||||||
astman_send_error(s, m, "No Message specified");
|
astman_send_error(s, m, "No Message specified");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1458,13 +1459,14 @@ static int action_sendtext(struct mansession *s, struct message *m)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_mutex_unlock(&c->lock);
|
|
||||||
res = ast_sendtext(c, textmsg);
|
res = ast_sendtext(c, textmsg);
|
||||||
if (res > 0) {
|
ast_mutex_unlock(&c->lock);
|
||||||
|
|
||||||
|
if (res > 0)
|
||||||
astman_send_ack(s, m, "Success");
|
astman_send_ack(s, m, "Success");
|
||||||
} else {
|
else
|
||||||
astman_send_error(s, m, "Failure");
|
astman_send_error(s, m, "Failure");
|
||||||
}
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user