diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/channel.c | 7 | ||||
-rw-r--r-- | main/manager.c | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/main/channel.c b/main/channel.c index 65ef91b67..9080d8b36 100644 --- a/main/channel.c +++ b/main/channel.c @@ -4465,13 +4465,18 @@ char *ast_recvtext(struct ast_channel *chan, int timeout) int ast_sendtext(struct ast_channel *chan, const char *text) { int res = 0; + + ast_channel_lock(chan); /* Stop if we're a zombie or need a soft hangup */ - if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) + if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) { + ast_channel_unlock(chan); return -1; + } CHECK_BLOCKING(chan); if (chan->tech->send_text) res = chan->tech->send_text(chan, text); ast_clear_flag(chan, AST_FLAG_BLOCKING); + ast_channel_unlock(chan); return res; } diff --git a/main/manager.c b/main/manager.c index a64e802ca..0a91c34ba 100644 --- a/main/manager.c +++ b/main/manager.c @@ -3251,12 +3251,10 @@ static int action_sendtext(struct mansession *s, const struct message *m) return 0; } - ast_channel_lock(c); res = ast_sendtext(c, textmsg); - ast_channel_unlock(c); c = ast_channel_unref(c); - if (res > 0) { + if (res >= 0) { astman_send_ack(s, m, "Success"); } else { astman_send_error(s, m, "Failure"); |