[asterisk-commits] trunk r10088 - in /trunk: ./ channels/ doc/
include/ include/asterisk/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Feb 14 16:42:38 MST 2006
Author: kpfleming
Date: Tue Feb 14 17:42:36 2006
New Revision: 10088
URL: http://svn.digium.com/view/asterisk?rev=10088&view=rev
Log:
add 'systemname' option to prefix channel unique IDs with (issue #5825)
convert chan->uniqueid to a stringfield from a fixed-size buffer
Modified:
trunk/asterisk.c
trunk/channel.c
trunk/channels/chan_agent.c
trunk/doc/asterisk-conf.txt
trunk/doc/channelvariables.txt
trunk/include/asterisk.h
trunk/include/asterisk/channel.h
trunk/pbx.c
Modified: trunk/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/asterisk.c?rev=10088&r1=10087&r2=10088&view=diff
==============================================================================
--- trunk/asterisk.c (original)
+++ trunk/asterisk.c Tue Feb 14 17:42:36 2006
@@ -212,6 +212,7 @@
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;
@@ -1982,6 +1983,8 @@
/* 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;
}
Modified: trunk/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/channel.c?rev=10088&r1=10087&r2=10088&view=diff
==============================================================================
--- trunk/channel.c (original)
+++ trunk/channel.c Tue Feb 14 17:42:36 2006
@@ -670,7 +670,10 @@
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);
Modified: trunk/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_agent.c?rev=10088&r1=10087&r2=10088&view=diff
==============================================================================
--- trunk/channels/chan_agent.c (original)
+++ trunk/channels/chan_agent.c Tue Feb 14 17:42:36 2006
@@ -242,7 +242,7 @@
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);
@@ -1430,7 +1430,7 @@
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];
Modified: trunk/doc/asterisk-conf.txt
URL: http://svn.digium.com/view/asterisk/trunk/doc/asterisk-conf.txt?rev=10088&r1=10087&r2=10088&view=diff
==============================================================================
--- trunk/doc/asterisk-conf.txt (original)
+++ trunk/doc/asterisk-conf.txt Tue Feb 14 17:42:36 2006
@@ -62,6 +62,7 @@
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
Modified: trunk/doc/channelvariables.txt
URL: http://svn.digium.com/view/asterisk/trunk/doc/channelvariables.txt?rev=10088&r1=10087&r2=10088&view=diff
==============================================================================
--- trunk/doc/channelvariables.txt (original)
+++ trunk/doc/channelvariables.txt Tue Feb 14 17:42:36 2006
@@ -594,6 +594,7 @@
${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
-------------------------
Modified: trunk/include/asterisk.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk.h?rev=10088&r1=10087&r2=10088&view=diff
==============================================================================
--- trunk/include/asterisk.h (original)
+++ trunk/include/asterisk.h Tue Feb 14 17:42:36 2006
@@ -40,6 +40,7 @@
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);
Modified: trunk/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/channel.h?rev=10088&r1=10087&r2=10088&view=diff
==============================================================================
--- trunk/include/asterisk/channel.h (original)
+++ trunk/include/asterisk/channel.h Tue Feb 14 17:42:36 2006
@@ -283,6 +283,7 @@
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. */
@@ -395,9 +396,6 @@
unsigned int fin;
unsigned int fout;
- /* Unique Channel Identifier */
- char uniqueid[32];
-
/* Why is the channel hanged up */
int hangupcause;
Modified: trunk/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx.c?rev=10088&r1=10087&r2=10088&view=diff
==============================================================================
--- trunk/pbx.c (original)
+++ trunk/pbx.c Tue Feb 14 17:42:36 2006
@@ -890,7 +890,7 @@
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;
@@ -904,7 +904,7 @@
* 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 */);
/*
@@ -960,6 +960,8 @@
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 */
More information about the asterisk-commits
mailing list