Index: funcs/func_env.c =================================================================== --- funcs/func_env.c (revision 219061) +++ funcs/func_env.c (working copy) @@ -44,6 +44,7 @@ + Variables starting with AST_ are reserved to the system and may not be set. @@ -106,7 +107,7 @@ static int env_write(struct ast_channel *chan, const char *cmd, char *data, const char *value) { - if (!ast_strlen_zero(data)) { + if (!ast_strlen_zero(data) && strncmp(data, "AST_", 4)) { if (!ast_strlen_zero(value)) { setenv(data, value, 1); } else { Index: main/asterisk.c =================================================================== --- main/asterisk.c (revision 219061) +++ main/asterisk.c (working copy) @@ -3091,6 +3091,18 @@ ast_config_destroy(cfg); } +static void env_init(void) +{ + setenv("AST_SYSTEMNAME", ast_config_AST_SYSTEM_NAME, 1); + setenv("AST_BUILD_HOST", ast_build_hostname, 1); + setenv("AST_BUILD_DATE", ast_build_date, 1); + setenv("AST_BUILD_KERNEL", ast_build_kernel, 1); + setenv("AST_BUILD_MACHINE", ast_build_machine, 1); + setenv("AST_BUILD_OS", ast_build_os, 1); + setenv("AST_BUILD_USER", ast_build_user, 1); + setenv("AST_VERSION", ast_get_version(), 1); +} + int main(int argc, char *argv[]) { int c; @@ -3268,6 +3280,7 @@ } ast_readconfig(); + env_init(); if (ast_opt_remote && remotesock != NULL) ast_copy_string((char *) cfg_paths.socket_path, remotesock, sizeof(cfg_paths.socket_path));