char ast_config_AST_CTL_OWNER[AST_CONFIG_MAX_PATH] = "\0";
char ast_config_AST_CTL_GROUP[AST_CONFIG_MAX_PATH] = "\0";
char ast_config_AST_CTL[AST_CONFIG_MAX_PATH] = "asterisk.ctl";
+char ast_config_AST_SYSTEM_NAME[20]="";
static char *_argv[256];
static int shuttingdown = 0;
/* What group to run as */
} else if (!strcasecmp(v->name, "rungroup")) {
ast_copy_string(ast_config_AST_RUN_GROUP, v->value, sizeof(ast_config_AST_RUN_GROUP));
+ } else if (!strcasecmp(v->name, "systemname")) {
+ ast_copy_string(ast_config_AST_SYSTEM_NAME, v->value, sizeof(ast_config_AST_SYSTEM_NAME));
}
v = v->next;
}
tmp->fin = global_fin;
tmp->fout = global_fout;
ast_mutex_lock(&uniquelock);
- snprintf(tmp->uniqueid, sizeof(tmp->uniqueid), "%li.%d", (long) time(NULL), uniqueint++);
+ if (ast_strlen_zero(ast_config_AST_SYSTEM_NAME))
+ ast_string_field_build(tmp, uniqueid, "%li.%d", (long) time(NULL), uniqueint++);
+ else
+ ast_string_field_build(tmp, uniqueid, "%s-%li.%d", ast_config_AST_SYSTEM_NAME, (long) time(NULL), uniqueint++);
ast_mutex_unlock(&uniquelock);
headp = &tmp->varshead;
ast_mutex_init(&tmp->lock);
static struct ast_channel *agent_request(const char *type, int format, void *data, int *cause);
static int agent_devicestate(void *data);
-static void agent_logoff_maintenance(struct agent_pvt *p, char *loginchan, long logintime, char *uniqueid, char *logcommand);
+static void agent_logoff_maintenance(struct agent_pvt *p, char *loginchan, long logintime, const char *uniqueid, char *logcommand);
static int agent_digit(struct ast_channel *ast, char digit);
static int agent_call(struct ast_channel *ast, char *dest, int timeout);
static int agent_hangup(struct ast_channel *ast);
return 0;
}
-static void agent_logoff_maintenance(struct agent_pvt *p, char *loginchan, long logintime, char *uniqueid, char *logcommand)
+static void agent_logoff_maintenance(struct agent_pvt *p, char *loginchan, long logintime, const char *uniqueid, char *logcommand)
{
char *tmp = NULL;
char agent[AST_MAX_AGENT];
maxcalls = 255 ; The maximum number of concurrent calls you want to allow
execincludes = yes | no ; Allow #exec entries in configuration files
dontwarn = yes | no ; Don't over-inform the Asterisk sysadm, he's a guru
+systemname = <a_string> ; System name. Used to prefix CDR uniqueid and to fill ${SYSTEMNAME}
[files]
; Changing the following lines may compromise your security
${TRANSFER_CONTEXT} Context for transferred calls
${FORWARD_CONTEXT} Context for forwarded calls
${UNIQUEID} * Current call unique identifier
+${SYSTEMNAME} * value of the systemname option of asterisk.conf
Application return values
-------------------------
extern char ast_config_AST_CTL_OWNER[AST_CONFIG_MAX_PATH];
extern char ast_config_AST_CTL_GROUP[AST_CONFIG_MAX_PATH];
extern char ast_config_AST_CTL[AST_CONFIG_MAX_PATH];
+extern char ast_config_AST_SYSTEM_NAME[20];
/* Provided by asterisk.c */
int ast_set_priority(int);
AST_STRING_FIELD(musicclass); /*! Default music class */
AST_STRING_FIELD(accountcode); /*! Account code for billing */
AST_STRING_FIELD(call_forward); /*! Where to forward to if asked to dial on this interface */
+ AST_STRING_FIELD(uniqueid); /*! Unique Channel Identifier */
);
/*! File descriptor for channel -- Drivers will poll on these file descriptors, so at least one must be non -1. */
unsigned int fin;
unsigned int fout;
- /* Unique Channel Identifier */
- char uniqueid[32];
-
/* Why is the channel hanged up */
int hangupcause;
void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, char *workspace, int workspacelen, struct varshead *headp)
{
const char not_found = '\0';
- char tmpvar[80];
+ char *tmpvar;
const char *s; /* the result */
int offset, length;
int i, need_substring;
* Then if called directly, we might need to run substring() on the result;
* remember this for later in 'need_substring', 'offset' and 'length'
*/
- ast_copy_string(tmpvar, var, sizeof(tmpvar)); /* parse_variable_name modifies the string */
+ tmpvar = ast_strdupa(var); /* parse_variable_name modifies the string */
need_substring = parse_variable_name(tmpvar, &offset, &length, &i /* ignored */);
/*
if (!strcmp(var, "EPOCH")) {
snprintf(workspace, workspacelen, "%u",(int)time(NULL));
s = workspace;
+ } else if (!strcmp(var, "SYSTEMNAME")) {
+ ast_copy_string(workspace, ast_config_AST_SYSTEM_NAME, workspacelen);
}
}
/* if not found, look into chanvars or global vars */