Bug 4872 - Make Asterisk paths available to AGIs via environmental variables

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@8372 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2006-01-21 05:22:18 +00:00
parent e3e7e1d1b2
commit 0f2a9df6aa

View File

@@ -272,6 +272,18 @@ static int launch_script(char *script, char *argv[], int *fds, int *efd, int *op
return -1;
}
if (!pid) {
/* Pass paths to AGI via environmental variables */
setenv("AST_CONFIG_DIR", ast_config_AST_CONFIG_DIR, 1);
setenv("AST_CONFIG_FILE", ast_config_AST_CONFIG_FILE, 1);
setenv("AST_MODULE_DIR", ast_config_AST_MODULE_DIR, 1);
setenv("AST_SPOOL_DIR", ast_config_AST_SPOOL_DIR, 1);
setenv("AST_MONITOR_DIR", ast_config_AST_MONITOR_DIR, 1);
setenv("AST_VAR_DIR", ast_config_AST_VAR_DIR, 1);
setenv("AST_LOG_DIR", ast_config_AST_LOG_DIR, 1);
setenv("AST_AGI_DIR", ast_config_AST_AGI_DIR, 1);
setenv("AST_KEY_DIR", ast_config_AST_KEY_DIR, 1);
setenv("AST_RUN_DIR", ast_config_AST_RUN_DIR, 1);
/* Redirect stdin and out, provide enhanced audio channel if desired */
dup2(fromast[0], STDIN_FILENO);
dup2(toast[1], STDOUT_FILENO);