aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-22 23:27:03 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-22 23:27:03 +0000
commit9b4a8662902577bd8e9519105e415d3515fc81f8 (patch)
tree927bc916c8af0771ebba25edd20b83e86831d4ca /res
parent3fa01978b52c71b970120b96bfb3b33317f77e90 (diff)
Merged revisions 166470 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r166470 | mmichelson | 2008-12-22 17:25:34 -0600 (Mon, 22 Dec 2008) | 11 lines Always use the value of the AGISIGHUP when running an AGI. Prior to this patch, the value of AGISIGUP was not always honored when set on a channel. (closes issue #13711) Reported by: fmueller Patches: 13711.patch uploaded by putnopvut (license 60) ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@166471 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r--res/res_agi.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/res/res_agi.c b/res/res_agi.c
index ab9297b35..c3dc147ff 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -2631,25 +2631,34 @@ static enum agi_result run_agi(struct ast_channel *chan, char *request, AGI *agi
/* how many times we'll retry if ast_waitfor_nandfs will return without either
channel or file descriptor in case select is interrupted by a system call (EINTR) */
int retry = AGI_NANDFS_RETRY;
- const char *sighup;
+ int send_sighup;
+ const char *sighup_str;
+
+ ast_channel_lock(chan);
+ sighup_str = pbx_builtin_getvar_helper(chan, "AGISIGHUP");
+ send_sighup = ast_strlen_zero(sighup_str) || !ast_false(sighup_str);
+ ast_channel_unlock(chan);
if (!(readf = fdopen(agi->ctrl, "r"))) {
ast_log(LOG_WARNING, "Unable to fdopen file descriptor\n");
- if (pid > -1)
+ if (send_sighup && pid > -1)
kill(pid, SIGHUP);
close(agi->ctrl);
return AGI_RESULT_FAILURE;
}
+
setlinebuf(readf);
setup_env(chan, request, agi->fd, (agi->audio > -1), argc, argv);
for (;;) {
if (needhup) {
needhup = 0;
dead = 1;
- if (pid > -1) {
- kill(pid, SIGHUP);
- } else if (agi->fast) {
- send(agi->ctrl, "HANGUP\n", 7, MSG_OOB);
+ if (send_sighup) {
+ if (pid > -1) {
+ kill(pid, SIGHUP);
+ } else if (agi->fast) {
+ send(agi->ctrl, "HANGUP\n", 7, MSG_OOB);
+ }
}
}
ms = -1;
@@ -2734,8 +2743,7 @@ static enum agi_result run_agi(struct ast_channel *chan, char *request, AGI *agi
}
}
/* Notify process */
- sighup = pbx_builtin_getvar_helper(chan, "AGISIGHUP");
- if (ast_strlen_zero(sighup) || !ast_false(sighup)) {
+ if (send_sighup) {
if (pid > -1) {
if (kill(pid, SIGHUP)) {
ast_log(LOG_WARNING, "unable to send SIGHUP to AGI process %d: %s\n", pid, strerror(errno));