diff --git addons/chan_ooh323.c addons/chan_ooh323.c index a883ace..31e0e1f 100644 --- addons/chan_ooh323.c +++ addons/chan_ooh323.c @@ -82,7 +82,7 @@ /* Defaults */ #define DEFAULT_CONTEXT "default" #define DEFAULT_H323ID "Asterisk PBX" -#define DEFAULT_LOGFILE "/var/log/asterisk/h323_log" +#define DEFAULT_LOGFILE "h323_log" #define DEFAULT_H323ACCNT "ast_h323" /* Flags */ @@ -346,7 +346,7 @@ void onModeChanged(ooCallData *call, int t38mode); extern OOH323EndPoint gH323ep; -static char gLogFile[256] = DEFAULT_LOGFILE; +static char gLogFile[PATH_MAX] = DEFAULT_LOGFILE; static int gPort = 1720; static char gIP[2+8*4+7]; /* Max for IPv6 addr */ struct ast_sockaddr bindaddr; @@ -2855,7 +2855,7 @@ int reload_config(int reload) } /* Inintialize everything to default */ - strcpy(gLogFile, DEFAULT_LOGFILE); + snprintf(gLogFile, sizeof(gLogFile), "%s/%s", ast_config_AST_LOG_DIR, DEFAULT_LOGFILE); gPort = 1720; gIP[0] = '\0'; strcpy(gCallerID, DEFAULT_H323ID); @@ -3029,7 +3029,11 @@ int reload_config(int reload) ast_copy_string(gGatekeeper, v->value, sizeof(gGatekeeper)); } } else if (!strcasecmp(v->name, "logfile")) { - ast_copy_string(gLogFile, v->value, sizeof(gLogFile)); + if (v->value[0] == '/') { + ast_copy_string(gLogFile, v->value, sizeof(gLogFile)); + } else { + snprintf(gLogFile, sizeof(gLogFile), "%s/%s", ast_config_AST_LOG_DIR, v->value); + } } else if (!strcasecmp(v->name, "context")) { ast_copy_string(gContext, v->value, sizeof(gContext)); ast_verb(3, " == Setting default context to %s\n", gContext); diff --git addons/chan_ooh323.h addons/chan_ooh323.h index 0dde50b..ae26a0b 100644 --- addons/chan_ooh323.h +++ addons/chan_ooh323.h @@ -66,6 +66,7 @@ #include "asterisk/udptl.h" #include "asterisk/stasis_channels.h" #include "asterisk/format_cache.h" +#include "asterisk/paths.h" #include "ootypes.h" #include "ooUtils.h"