Bug 5858 - Make the chanvars.c functions return a 'const char *'
This should prevent us from unintentionally changing variable values when they're returned from pbx_builtin_getvar_helper. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7304 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
a3c74f33dd
commit
3365b1cc9f
16
app.c
16
app.c
|
@ -1006,7 +1006,7 @@ int ast_play_and_prepend(struct ast_channel *chan, char *playfile, char *recordf
|
|||
|
||||
/* Channel group core functions */
|
||||
|
||||
int ast_app_group_split_group(char *data, char *group, int group_max, char *category, int category_max)
|
||||
int ast_app_group_split_group(const char *data, char *group, int group_max, char *category, int category_max)
|
||||
{
|
||||
int res=0;
|
||||
char tmp[256];
|
||||
|
@ -1035,7 +1035,7 @@ int ast_app_group_split_group(char *data, char *group, int group_max, char *cate
|
|||
return res;
|
||||
}
|
||||
|
||||
int ast_app_group_set_channel(struct ast_channel *chan, char *data)
|
||||
int ast_app_group_set_channel(struct ast_channel *chan, const char *data)
|
||||
{
|
||||
int res=0;
|
||||
char group[80] = "";
|
||||
|
@ -1049,13 +1049,13 @@ int ast_app_group_set_channel(struct ast_channel *chan, char *data)
|
|||
return res;
|
||||
}
|
||||
|
||||
int ast_app_group_get_count(char *group, char *category)
|
||||
int ast_app_group_get_count(const char *group, const char *category)
|
||||
{
|
||||
struct ast_channel *chan;
|
||||
int count = 0;
|
||||
char *test;
|
||||
const char *test;
|
||||
char cat[80];
|
||||
char *s;
|
||||
const char *s;
|
||||
|
||||
if (ast_strlen_zero(group))
|
||||
return 0;
|
||||
|
@ -1074,14 +1074,14 @@ int ast_app_group_get_count(char *group, char *category)
|
|||
return count;
|
||||
}
|
||||
|
||||
int ast_app_group_match_get_count(char *groupmatch, char *category)
|
||||
int ast_app_group_match_get_count(const char *groupmatch, const char *category)
|
||||
{
|
||||
regex_t regexbuf;
|
||||
struct ast_channel *chan;
|
||||
int count = 0;
|
||||
char *test;
|
||||
const char *test;
|
||||
char cat[80];
|
||||
char *s;
|
||||
const char *s;
|
||||
|
||||
if (ast_strlen_zero(groupmatch))
|
||||
return 0;
|
||||
|
|
|
@ -468,7 +468,7 @@ static int chanspy_exec(struct ast_channel *chan, void *data)
|
|||
prev=NULL;
|
||||
while(peer) {
|
||||
if (peer != chan) {
|
||||
char *group = NULL;
|
||||
const char *group = NULL;
|
||||
int igrp = 1;
|
||||
|
||||
if (peer == prev && !chosen) {
|
||||
|
|
|
@ -56,7 +56,6 @@ static int group_count_exec(struct ast_channel *chan, void *data)
|
|||
char group[80] = "";
|
||||
char category[80] = "";
|
||||
char ret[80] = "";
|
||||
char *grp;
|
||||
static int deprecation_warning = 0;
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
@ -69,7 +68,7 @@ static int group_count_exec(struct ast_channel *chan, void *data)
|
|||
ast_app_group_split_group(data, group, sizeof(group), category, sizeof(category));
|
||||
|
||||
if (ast_strlen_zero(group)) {
|
||||
grp = pbx_builtin_getvar_helper(chan, category);
|
||||
const char *grp = pbx_builtin_getvar_helper(chan, category);
|
||||
strncpy(group, grp, sizeof(group) - 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -89,6 +89,8 @@ LOCAL_USER_DECL;
|
|||
|
||||
static int macro_exec(struct ast_channel *chan, void *data)
|
||||
{
|
||||
const char *s;
|
||||
|
||||
char *tmp;
|
||||
char *cur, *rest;
|
||||
char *macro;
|
||||
|
@ -101,8 +103,7 @@ static int macro_exec(struct ast_channel *chan, void *data)
|
|||
int oldpriority;
|
||||
char pc[80], depthc[12];
|
||||
char oldcontext[AST_MAX_CONTEXT] = "";
|
||||
char *offsets;
|
||||
int offset, depth;
|
||||
int offset, depth = 0;
|
||||
int setmacrocontext=0;
|
||||
int autoloopflag;
|
||||
|
||||
|
@ -120,13 +121,9 @@ static int macro_exec(struct ast_channel *chan, void *data)
|
|||
LOCAL_USER_ADD(u);
|
||||
|
||||
/* Count how many levels deep the rabbit hole goes */
|
||||
tmp = pbx_builtin_getvar_helper(chan, "MACRO_DEPTH");
|
||||
if (tmp) {
|
||||
sscanf(tmp, "%d", &depth);
|
||||
} else {
|
||||
depth = 0;
|
||||
}
|
||||
|
||||
s = pbx_builtin_getvar_helper(chan, "MACRO_DEPTH");
|
||||
if (s)
|
||||
sscanf(s, "%d", &depth);
|
||||
if (depth >= 7) {
|
||||
ast_log(LOG_ERROR, "Macro(): possible infinite loop detected. Returning early.\n");
|
||||
LOCAL_USER_REMOVE(u);
|
||||
|
@ -193,12 +190,13 @@ static int macro_exec(struct ast_channel *chan, void *data)
|
|||
chan->priority = 1;
|
||||
|
||||
while((cur = strsep(&rest, "|")) && (argc < MAX_ARGS)) {
|
||||
const char *s;
|
||||
/* Save copy of old arguments if we're overwriting some, otherwise
|
||||
let them pass through to the other macro */
|
||||
snprintf(varname, sizeof(varname), "ARG%d", argc);
|
||||
oldargs[argc] = pbx_builtin_getvar_helper(chan, varname);
|
||||
if (oldargs[argc])
|
||||
oldargs[argc] = strdup(oldargs[argc]);
|
||||
s = pbx_builtin_getvar_helper(chan, varname);
|
||||
if (s)
|
||||
oldargs[argc] = strdup(s);
|
||||
pbx_builtin_setvar_helper(chan, varname, cur);
|
||||
argc++;
|
||||
}
|
||||
|
@ -286,6 +284,7 @@ static int macro_exec(struct ast_channel *chan, void *data)
|
|||
ast_copy_string(chan->context, oldcontext, sizeof(chan->context));
|
||||
if (!(chan->_softhangup & AST_SOFTHANGUP_ASYNCGOTO)) {
|
||||
/* Copy the extension, so long as we're not in softhangup, where we could be given an asyncgoto */
|
||||
const char *offsets;
|
||||
ast_copy_string(chan->exten, oldexten, sizeof(chan->exten));
|
||||
if ((offsets = pbx_builtin_getvar_helper(chan, "MACRO_OFFSET"))) {
|
||||
/* Handle macro offset if it's set by checking the availability of step n + offset + 1, otherwise continue
|
||||
|
|
|
@ -143,8 +143,8 @@ static struct ast_conference {
|
|||
int locked; /* Is the conference locked? */
|
||||
pthread_t recordthread; /* thread for recording */
|
||||
pthread_attr_t attr; /* thread attribute */
|
||||
char *recordingfilename; /* Filename to record the Conference into */
|
||||
char *recordingformat; /* Format to record the Conference in */
|
||||
const char *recordingfilename; /* Filename to record the Conference into */
|
||||
const char *recordingformat; /* Format to record the Conference in */
|
||||
char pin[AST_MAX_EXTENSION]; /* If protected by a PIN */
|
||||
char pinadmin[AST_MAX_EXTENSION]; /* If protected by a admin PIN */
|
||||
struct ast_conference *next;
|
||||
|
@ -813,8 +813,8 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
|||
int duration=20;
|
||||
struct ast_dsp *dsp=NULL;
|
||||
struct ast_app *app;
|
||||
char *agifile;
|
||||
char *agifiledefault = "conf-background.agi";
|
||||
const char *agifile;
|
||||
const char *agifiledefault = "conf-background.agi";
|
||||
char meetmesecs[30] = "";
|
||||
char exitcontext[AST_MAX_CONTEXT] = "";
|
||||
char recordingtmp[AST_MAX_EXTENSION] = "";
|
||||
|
@ -1086,7 +1086,8 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
|||
/* Find a pointer to the agi app and execute the script */
|
||||
app = pbx_findapp("agi");
|
||||
if (app) {
|
||||
ret = pbx_exec(chan, app, agifile, 1);
|
||||
char *s = ast_strdupa(agifile);
|
||||
ret = pbx_exec(chan, app, s, 1);
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Could not find application (agi)\n");
|
||||
ret = -2;
|
||||
|
|
|
@ -1992,7 +1992,6 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
|
|||
char oldcontext[AST_MAX_CONTEXT]="";
|
||||
char queuename[256]="";
|
||||
char *newnum;
|
||||
char *monitorfilename;
|
||||
struct ast_channel *peer;
|
||||
struct ast_channel *which;
|
||||
struct localuser *lpeer;
|
||||
|
@ -2209,7 +2208,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
|
|||
}
|
||||
/* Begin Monitoring */
|
||||
if (qe->parent->monfmt && *qe->parent->monfmt) {
|
||||
monitorfilename = pbx_builtin_getvar_helper(qe->chan, "MONITOR_FILENAME");
|
||||
const char *monitorfilename = pbx_builtin_getvar_helper(qe->chan, "MONITOR_FILENAME");
|
||||
if (pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC") || pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC_ARGS"))
|
||||
which = qe->chan;
|
||||
else
|
||||
|
@ -2845,7 +2844,7 @@ static int queue_exec(struct ast_channel *chan, void *data)
|
|||
char *options = NULL;
|
||||
char *url = NULL;
|
||||
char *announceoverride = NULL;
|
||||
char *user_priority;
|
||||
const char *user_priority;
|
||||
int prio;
|
||||
char *queuetimeoutstr = NULL;
|
||||
enum queue_result reason = QUEUE_UNKNOWN;
|
||||
|
|
|
@ -82,7 +82,7 @@ static int pop_exec(struct ast_channel *chan, void *data)
|
|||
|
||||
static int return_exec(struct ast_channel *chan, void *data)
|
||||
{
|
||||
char *label = pbx_builtin_getvar_helper(chan, STACKVAR);
|
||||
const char *label = pbx_builtin_getvar_helper(chan, STACKVAR);
|
||||
|
||||
if (ast_strlen_zero(label)) {
|
||||
ast_log(LOG_ERROR, "Return without Gosub: stack is empty\n");
|
||||
|
|
|
@ -122,7 +122,7 @@ static int execif_exec(struct ast_channel *chan, void *data) {
|
|||
#define VAR_SIZE 64
|
||||
|
||||
|
||||
static char *get_index(struct ast_channel *chan, const char *prefix, int index) {
|
||||
static const char *get_index(struct ast_channel *chan, const char *prefix, int index) {
|
||||
char varname[VAR_SIZE];
|
||||
|
||||
snprintf(varname, VAR_SIZE, "%s_%d", prefix, index);
|
||||
|
@ -209,15 +209,15 @@ static int _while_exec(struct ast_channel *chan, void *data, int end)
|
|||
{
|
||||
int res=0;
|
||||
struct localuser *u;
|
||||
char *while_pri = NULL;
|
||||
char *goto_str = NULL, *my_name = NULL;
|
||||
char *condition = NULL, *label = NULL;
|
||||
const char *while_pri = NULL;
|
||||
char *my_name = NULL;
|
||||
const char *condition = NULL, *label = NULL;
|
||||
char varname[VAR_SIZE], end_varname[VAR_SIZE];
|
||||
const char *prefix = "WHILE";
|
||||
size_t size=0;
|
||||
int used_index_i = -1, x=0;
|
||||
char used_index[VAR_SIZE] = "0", new_index[VAR_SIZE] = "0";
|
||||
|
||||
|
||||
if (!chan) {
|
||||
/* huh ? */
|
||||
return -1;
|
||||
|
@ -271,6 +271,7 @@ static int _while_exec(struct ast_channel *chan, void *data, int end)
|
|||
|
||||
if (!end && !ast_true(condition)) {
|
||||
/* Condition Met (clean up helper vars) */
|
||||
const char *goto_str;
|
||||
pbx_builtin_setvar_helper(chan, varname, NULL);
|
||||
pbx_builtin_setvar_helper(chan, my_name, NULL);
|
||||
snprintf(end_varname,VAR_SIZE,"END_%s",varname);
|
||||
|
@ -291,6 +292,7 @@ static int _while_exec(struct ast_channel *chan, void *data, int end)
|
|||
}
|
||||
|
||||
if (!end && !while_pri) {
|
||||
char *goto_str;
|
||||
size = strlen(chan->context) + strlen(chan->exten) + 32;
|
||||
goto_str = alloca(size);
|
||||
memset(goto_str, 0, size);
|
||||
|
@ -302,6 +304,7 @@ static int _while_exec(struct ast_channel *chan, void *data, int end)
|
|||
/* END of loop */
|
||||
snprintf(end_varname, VAR_SIZE, "END_%s", varname);
|
||||
if (! pbx_builtin_getvar_helper(chan, end_varname)) {
|
||||
char *goto_str;
|
||||
size = strlen(chan->context) + strlen(chan->exten) + 32;
|
||||
goto_str = alloca(size);
|
||||
memset(goto_str, 0, size);
|
||||
|
|
|
@ -296,7 +296,6 @@ static int conf_exec(struct ast_channel *chan, void *data)
|
|||
char confstr[80] = "", *tmp = NULL;
|
||||
struct ast_channel *tempchan = NULL, *lastchan = NULL,*ichan = NULL;
|
||||
struct ast_frame *f;
|
||||
char *mygroup;
|
||||
char *desired_group;
|
||||
int input=0,search_group=0;
|
||||
|
||||
|
@ -335,6 +334,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
|
|||
break;
|
||||
|
||||
if (tempchan && search_group) {
|
||||
const char *mygroup;
|
||||
if((mygroup = pbx_builtin_getvar_helper(tempchan, "GROUP")) && (!strcmp(mygroup, desired_group))) {
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Found Matching Channel %s in group %s\n", tempchan->name, desired_group);
|
||||
} else {
|
||||
|
|
|
@ -2770,7 +2770,7 @@ void ast_change_name(struct ast_channel *chan, char *newname)
|
|||
void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_channel *child)
|
||||
{
|
||||
struct ast_var_t *current, *newvar;
|
||||
char *varname;
|
||||
const char *varname;
|
||||
|
||||
AST_LIST_TRAVERSE(&parent->varshead, current, entries) {
|
||||
int vartype = 0;
|
||||
|
@ -3159,7 +3159,7 @@ struct ast_channel *ast_bridged_channel(struct ast_channel *chan)
|
|||
return bridged;
|
||||
}
|
||||
|
||||
static void bridge_playfile(struct ast_channel *chan, struct ast_channel *peer, char *sound, int remain)
|
||||
static void bridge_playfile(struct ast_channel *chan, struct ast_channel *peer, const char *sound, int remain)
|
||||
{
|
||||
int res=0, min=0, sec=0,check=0;
|
||||
|
||||
|
|
|
@ -1686,7 +1686,7 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
|
|||
AST_APP_ARG(options);
|
||||
AST_APP_ARG(extension);
|
||||
);
|
||||
char *tmpoptions = NULL;
|
||||
const char *tmpoptions = NULL;
|
||||
char *context = NULL;
|
||||
int play_announcement = 1;
|
||||
char agent_goodbye[AST_MAX_FILENAME_LEN];
|
||||
|
@ -2231,7 +2231,7 @@ static int agentmonitoroutgoing_exec(struct ast_channel *chan, void *data)
|
|||
int nowarnings = 0;
|
||||
int changeoutgoing = 0;
|
||||
int res = 0;
|
||||
char agent[AST_MAX_AGENT], *tmp;
|
||||
char agent[AST_MAX_AGENT];
|
||||
|
||||
if (data) {
|
||||
if (strchr(data, 'd'))
|
||||
|
@ -2242,6 +2242,7 @@ static int agentmonitoroutgoing_exec(struct ast_channel *chan, void *data)
|
|||
changeoutgoing = 1;
|
||||
}
|
||||
if (chan->cid.cid_num) {
|
||||
const char *tmp;
|
||||
char agentvar[AST_MAX_BUF];
|
||||
snprintf(agentvar, sizeof(agentvar), "%s_%s", GETAGENTBYCALLERID, chan->cid.cid_num);
|
||||
if ((tmp = pbx_builtin_getvar_helper(NULL, agentvar))) {
|
||||
|
|
|
@ -9137,7 +9137,6 @@ static int iax2_exec(struct ast_channel *chan, const char *context, const char *
|
|||
char odata[256];
|
||||
char req[256];
|
||||
char *ncontext;
|
||||
char *dialstatus;
|
||||
struct iax2_dpcache *dp;
|
||||
struct ast_app *dial;
|
||||
#if 0
|
||||
|
@ -9145,7 +9144,7 @@ static int iax2_exec(struct ast_channel *chan, const char *context, const char *
|
|||
#endif
|
||||
if (priority == 2) {
|
||||
/* Indicate status, can be overridden in dialplan */
|
||||
dialstatus = pbx_builtin_getvar_helper(chan, "DIALSTATUS");
|
||||
const char *dialstatus = pbx_builtin_getvar_helper(chan, "DIALSTATUS");
|
||||
if (dialstatus) {
|
||||
dial = pbx_findapp(dialstatus);
|
||||
if (dial)
|
||||
|
|
|
@ -889,7 +889,7 @@ static int mgcp_call(struct ast_channel *ast, char *dest, int timeout)
|
|||
struct mgcp_endpoint *p;
|
||||
struct mgcp_subchannel *sub;
|
||||
char tone[50] = "";
|
||||
char *distinctive_ring = NULL;
|
||||
const char *distinctive_ring = NULL;
|
||||
struct varshead *headp;
|
||||
struct ast_var_t *current;
|
||||
|
||||
|
|
|
@ -462,11 +462,11 @@ struct sip_pkt;
|
|||
|
||||
/*! \brief Parameters to the transmit_invite function */
|
||||
struct sip_invite_param {
|
||||
char *distinctive_ring; /*!< Distinctive ring header */
|
||||
const char *distinctive_ring; /*!< Distinctive ring header */
|
||||
char *osptoken; /*!< OSP token for this call */
|
||||
int addsipheaders; /*!< Add extra SIP headers */
|
||||
char *uri_options; /*!< URI options to add to the URI */
|
||||
char *vxml_url; /*!< VXML url for Cisco phones */
|
||||
const char *uri_options; /*!< URI options to add to the URI */
|
||||
const char *vxml_url; /*!< VXML url for Cisco phones */
|
||||
char *auth; /*!< Authentication */
|
||||
char *authheader; /*!< Auth header */
|
||||
enum sip_auth_type auth_type; /*!< Authentication type */
|
||||
|
@ -2478,7 +2478,7 @@ static int sip_hangup(struct ast_channel *ast)
|
|||
static int sip_answer(struct ast_channel *ast)
|
||||
{
|
||||
int res = 0,fmt;
|
||||
char *codec;
|
||||
const char *codec;
|
||||
struct sip_pvt *p = ast->tech_pvt;
|
||||
|
||||
ast_mutex_lock(&p->lock);
|
||||
|
|
|
@ -1932,7 +1932,7 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
|
|||
break;
|
||||
case SIG_FEATDMF_TA:
|
||||
{
|
||||
char *cic = NULL, *ozz = NULL;
|
||||
const char *cic, *ozz;
|
||||
|
||||
/* If you have to go through a Tandem Access point you need to use this */
|
||||
ozz = pbx_builtin_getvar_helper(p->owner, "FEATDMF_OZZ");
|
||||
|
|
24
chanvars.c
24
chanvars.c
|
@ -59,31 +59,27 @@ void ast_var_delete(struct ast_var_t *var)
|
|||
free(var);
|
||||
}
|
||||
|
||||
char *ast_var_name(struct ast_var_t *var)
|
||||
const char *ast_var_name(const struct ast_var_t *var)
|
||||
{
|
||||
char *name;
|
||||
const char *name;
|
||||
|
||||
if (var == NULL)
|
||||
return NULL;
|
||||
if (var->name == NULL)
|
||||
if (var == NULL || (name = var->name) == NULL)
|
||||
return NULL;
|
||||
/* Return the name without the initial underscores */
|
||||
if (var->name[0] == '_') {
|
||||
if (var->name[1] == '_')
|
||||
name = (char*)&(var->name[2]);
|
||||
else
|
||||
name = (char*)&(var->name[1]);
|
||||
} else
|
||||
name = var->name;
|
||||
if (name[0] == '_') {
|
||||
name++;
|
||||
if (name[0] == '_')
|
||||
name++;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
char *ast_var_full_name(struct ast_var_t *var)
|
||||
const char *ast_var_full_name(const struct ast_var_t *var)
|
||||
{
|
||||
return (var ? var->name : NULL);
|
||||
}
|
||||
|
||||
char *ast_var_value(struct ast_var_t *var)
|
||||
const char *ast_var_value(const struct ast_var_t *var)
|
||||
{
|
||||
return (var ? var->value : NULL);
|
||||
}
|
||||
|
|
4
frame.c
4
frame.c
|
@ -539,7 +539,7 @@ static struct ast_codec_alias_table {
|
|||
{"g723.1","g723"},
|
||||
};
|
||||
|
||||
static char *ast_expand_codec_alias(char *in) {
|
||||
static const char *ast_expand_codec_alias(const char *in) {
|
||||
int x = 0;
|
||||
|
||||
for (x = 0; x < sizeof(ast_codec_alias_table) / sizeof(struct ast_codec_alias_table) ; x++) {
|
||||
|
@ -549,7 +549,7 @@ static char *ast_expand_codec_alias(char *in) {
|
|||
return in;
|
||||
}
|
||||
|
||||
int ast_getformatbyname(char *name)
|
||||
int ast_getformatbyname(const char *name)
|
||||
{
|
||||
int x = 0, all = 0, format = 0;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ static char *group_count_function_read(struct ast_channel *chan, char *cmd, char
|
|||
int count;
|
||||
char group[80] = "";
|
||||
char category[80] = "";
|
||||
char *grp;
|
||||
const char *grp;
|
||||
|
||||
ast_app_group_split_group(data, group, sizeof(group), category, sizeof(category));
|
||||
|
||||
|
@ -101,7 +101,7 @@ struct ast_custom_function group_match_count_function = {
|
|||
static char *group_function_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
|
||||
{
|
||||
char varname[256];
|
||||
char *group;
|
||||
const char *group;
|
||||
|
||||
if (!ast_strlen_zero(data)) {
|
||||
snprintf(varname, sizeof(varname), "%s_%s", GROUP_CATEGORY_PREFIX, data);
|
||||
|
|
|
@ -167,16 +167,16 @@ char *ast_read_textfile(const char *file);
|
|||
#define GROUP_CATEGORY_PREFIX "GROUP"
|
||||
|
||||
/*! Split a group string into group and category, returning a default category if none is provided. */
|
||||
int ast_app_group_split_group(char *data, char *group, int group_max, char *category, int category_max);
|
||||
int ast_app_group_split_group(const char *data, char *group, int group_max, char *category, int category_max);
|
||||
|
||||
/*! Set the group for a channel, splitting the provided data into group and category, if specified. */
|
||||
int ast_app_group_set_channel(struct ast_channel *chan, char *data);
|
||||
int ast_app_group_set_channel(struct ast_channel *chan, const char *data);
|
||||
|
||||
/*! Get the current channel count of the specified group and category. */
|
||||
int ast_app_group_get_count(char *group, char *category);
|
||||
int ast_app_group_get_count(const char *group, const char *category);
|
||||
|
||||
/*! Get the current channel count of all groups that match the specified pattern and category. */
|
||||
int ast_app_group_match_get_count(char *groupmatch, char *category);
|
||||
int ast_app_group_match_get_count(const char *groupmatch, const char *category);
|
||||
|
||||
/*!
|
||||
\brief Define an application argument
|
||||
|
|
|
@ -454,9 +454,9 @@ struct ast_bridge_config {
|
|||
long timelimit;
|
||||
long play_warning;
|
||||
long warning_freq;
|
||||
char *warning_sound;
|
||||
char *end_sound;
|
||||
char *start_sound;
|
||||
const char *warning_sound;
|
||||
const char *end_sound;
|
||||
const char *start_sound;
|
||||
int firstpass;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
|
|
@ -35,8 +35,8 @@ AST_LIST_HEAD_NOLOCK(varshead, ast_var_t);
|
|||
|
||||
struct ast_var_t *ast_var_assign(const char *name, const char *value);
|
||||
void ast_var_delete(struct ast_var_t *var);
|
||||
char *ast_var_name(struct ast_var_t *var);
|
||||
char *ast_var_full_name(struct ast_var_t *var);
|
||||
char *ast_var_value(struct ast_var_t *var);
|
||||
const char *ast_var_name(const struct ast_var_t *var);
|
||||
const char *ast_var_full_name(const struct ast_var_t *var);
|
||||
const char *ast_var_value(const struct ast_var_t *var);
|
||||
|
||||
#endif /* _ASTERISK_CHANVARS_H */
|
||||
|
|
|
@ -389,7 +389,7 @@ extern char* ast_getformatname_multiple(char *buf, size_t size, int format);
|
|||
* \param name string of format
|
||||
* \return This returns the form of the format in binary on success, 0 on error.
|
||||
*/
|
||||
extern int ast_getformatbyname(char *name);
|
||||
extern int ast_getformatbyname(const char *name);
|
||||
|
||||
/*! \brief Get a name from a format
|
||||
* Gets a name from a format
|
||||
|
|
|
@ -605,7 +605,7 @@ struct ast_ignorepat *ast_walk_context_ignorepats(struct ast_context *con,
|
|||
struct ast_sw *ast_walk_context_switches(struct ast_context *con, struct ast_sw *sw);
|
||||
|
||||
int pbx_builtin_serialize_variables(struct ast_channel *chan, char *buf, size_t size);
|
||||
extern char *pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name);
|
||||
extern const char *pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name);
|
||||
extern void pbx_builtin_pushvar_helper(struct ast_channel *chan, const char *name, const char *value);
|
||||
extern void pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value);
|
||||
extern void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, char *workspace, int workspacelen, struct varshead *headp);
|
||||
|
@ -620,11 +620,11 @@ int ast_extension_patmatch(const char *pattern, const char *data);
|
|||
set to 1, sets to auto fall through. If newval set to 0, sets to no auto
|
||||
fall through (reads extension instead). Returns previous value. */
|
||||
extern int pbx_set_autofallthrough(int newval);
|
||||
int ast_goto_if_exists(struct ast_channel *chan, char* context, char *exten, int priority);
|
||||
int ast_goto_if_exists(struct ast_channel *chan, const char *context, const char *exten, int priority);
|
||||
/* I can find neither parsable nor parseable at dictionary.com, but google gives me 169000 hits for parseable and only 49,800 for parsable */
|
||||
int ast_parseable_goto(struct ast_channel *chan, const char *goto_string);
|
||||
int ast_explicit_goto(struct ast_channel *chan, const char *context, const char *exten, int priority);
|
||||
int ast_async_goto_if_exists(struct ast_channel *chan, char* context, char *exten, int priority);
|
||||
int ast_async_goto_if_exists(struct ast_channel *chan, const char *context, const char *exten, int priority);
|
||||
|
||||
struct ast_custom_function* ast_custom_function_find(char *name);
|
||||
int ast_custom_function_unregister(struct ast_custom_function *acf);
|
||||
|
|
|
@ -726,7 +726,7 @@ static int action_getvar(struct mansession *s, struct message *m)
|
|||
char *name = astman_get_header(m, "Channel");
|
||||
char *varname = astman_get_header(m, "Variable");
|
||||
char *id = astman_get_header(m,"ActionID");
|
||||
char *varval;
|
||||
const char *varval;
|
||||
char *varval2=NULL;
|
||||
|
||||
if (!strlen(varname)) {
|
||||
|
|
24
pbx.c
24
pbx.c
|
@ -1129,9 +1129,9 @@ icky:
|
|||
ast_log(LOG_WARNING,"Comparing variable '%s' with '%s'\n",var,ast_var_name(variables));
|
||||
#endif
|
||||
if (strcasecmp(ast_var_name(variables),var)==0) {
|
||||
*ret=ast_var_value(variables);
|
||||
if (*ret) {
|
||||
ast_copy_string(workspace, *ret, workspacelen);
|
||||
const char *s = ast_var_value(variables);
|
||||
if (s) {
|
||||
ast_copy_string(workspace, s, workspacelen);
|
||||
*ret = workspace;
|
||||
}
|
||||
break;
|
||||
|
@ -1145,9 +1145,9 @@ icky:
|
|||
ast_log(LOG_WARNING,"Comparing variable '%s' with '%s'\n",var,ast_var_name(variables));
|
||||
#endif
|
||||
if (strcasecmp(ast_var_name(variables),var)==0) {
|
||||
*ret = ast_var_value(variables);
|
||||
if (*ret) {
|
||||
ast_copy_string(workspace, *ret, workspacelen);
|
||||
const char *s = ast_var_value(variables);
|
||||
if (s) {
|
||||
ast_copy_string(workspace, s, workspacelen);
|
||||
*ret = workspace;
|
||||
}
|
||||
}
|
||||
|
@ -2413,7 +2413,7 @@ static int __ast_pbx_run(struct ast_channel *c)
|
|||
ast_cdr_update(c);
|
||||
}
|
||||
} else {
|
||||
char *status;
|
||||
const char *status;
|
||||
|
||||
status = pbx_builtin_getvar_helper(c, "DIALSTATUS");
|
||||
if (!status)
|
||||
|
@ -5846,7 +5846,7 @@ static int pbx_builtin_goto(struct ast_channel *chan, void *data)
|
|||
int pbx_builtin_serialize_variables(struct ast_channel *chan, char *buf, size_t size)
|
||||
{
|
||||
struct ast_var_t *variables;
|
||||
char *var, *val;
|
||||
const char *var, *val;
|
||||
int total = 0;
|
||||
|
||||
if (!chan)
|
||||
|
@ -5870,7 +5870,7 @@ int pbx_builtin_serialize_variables(struct ast_channel *chan, char *buf, size_t
|
|||
return total;
|
||||
}
|
||||
|
||||
char *pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
|
||||
const char *pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
|
||||
{
|
||||
struct ast_var_t *variables;
|
||||
struct varshead *headp;
|
||||
|
@ -6383,7 +6383,7 @@ int ast_context_verify_includes(struct ast_context *con)
|
|||
}
|
||||
|
||||
|
||||
static int __ast_goto_if_exists(struct ast_channel *chan, char *context, char *exten, int priority, int async)
|
||||
static int __ast_goto_if_exists(struct ast_channel *chan, const char *context, const char *exten, int priority, int async)
|
||||
{
|
||||
int (*goto_func)(struct ast_channel *chan, const char *context, const char *exten, int priority);
|
||||
|
||||
|
@ -6400,11 +6400,11 @@ static int __ast_goto_if_exists(struct ast_channel *chan, char *context, char *e
|
|||
return -3;
|
||||
}
|
||||
|
||||
int ast_goto_if_exists(struct ast_channel *chan, char* context, char *exten, int priority) {
|
||||
int ast_goto_if_exists(struct ast_channel *chan, const char* context, const char *exten, int priority) {
|
||||
return __ast_goto_if_exists(chan, context, exten, priority, 0);
|
||||
}
|
||||
|
||||
int ast_async_goto_if_exists(struct ast_channel *chan, char* context, char *exten, int priority) {
|
||||
int ast_async_goto_if_exists(struct ast_channel *chan, const char * context, const char *exten, int priority) {
|
||||
return __ast_goto_if_exists(chan, context, exten, priority, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -180,18 +180,14 @@ struct ast_bridge_thread_obj
|
|||
static void check_goto_on_transfer(struct ast_channel *chan)
|
||||
{
|
||||
struct ast_channel *xferchan;
|
||||
char *goto_on_transfer;
|
||||
const char *val = pbx_builtin_getvar_helper(chan, "GOTO_ON_BLINDXFR");
|
||||
char *x, *goto_on_transfer;
|
||||
struct ast_frame *f;
|
||||
|
||||
goto_on_transfer = pbx_builtin_getvar_helper(chan, "GOTO_ON_BLINDXFR");
|
||||
|
||||
if (!ast_strlen_zero(goto_on_transfer) && (xferchan = ast_channel_alloc(0))) {
|
||||
char *x;
|
||||
struct ast_frame *f;
|
||||
|
||||
if (!ast_strlen_zero(val) && (goto_on_transfer = ast_strdupa(val)) && (xferchan = ast_channel_alloc(0))) {
|
||||
for (x = goto_on_transfer; x && *x; x++)
|
||||
if (*x == '^')
|
||||
*x = '|';
|
||||
|
||||
strcpy(xferchan->name, chan->name);
|
||||
/* Make formats okay */
|
||||
xferchan->readformat = chan->readformat;
|
||||
|
@ -446,7 +442,7 @@ int ast_masq_park_call(struct ast_channel *rchan, struct ast_channel *peer, int
|
|||
|
||||
static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense)
|
||||
{
|
||||
char *touch_monitor = NULL, *caller_chan_id = NULL, *callee_chan_id = NULL, *args = NULL, *touch_format = NULL;
|
||||
char *caller_chan_id = NULL, *callee_chan_id = NULL, *args = NULL;
|
||||
int x = 0;
|
||||
size_t len;
|
||||
struct ast_channel *caller_chan = NULL, *callee_chan = NULL;
|
||||
|
@ -494,11 +490,12 @@ static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *pee
|
|||
}
|
||||
|
||||
if (caller_chan && callee_chan) {
|
||||
touch_format = pbx_builtin_getvar_helper(caller_chan, "TOUCH_MONITOR_FORMAT");
|
||||
const char *touch_format = pbx_builtin_getvar_helper(caller_chan, "TOUCH_MONITOR_FORMAT");
|
||||
const char *touch_monitor = pbx_builtin_getvar_helper(caller_chan, "TOUCH_MONITOR");
|
||||
|
||||
if (!touch_format)
|
||||
touch_format = pbx_builtin_getvar_helper(callee_chan, "TOUCH_MONITOR_FORMAT");
|
||||
|
||||
touch_monitor = pbx_builtin_getvar_helper(caller_chan, "TOUCH_MONITOR");
|
||||
if (!touch_monitor)
|
||||
touch_monitor = pbx_builtin_getvar_helper(callee_chan, "TOUCH_MONITOR");
|
||||
|
||||
|
@ -541,7 +538,7 @@ static int builtin_blindtransfer(struct ast_channel *chan, struct ast_channel *p
|
|||
{
|
||||
struct ast_channel *transferer;
|
||||
struct ast_channel *transferee;
|
||||
char *transferer_real_context;
|
||||
const char *transferer_real_context;
|
||||
char newext[256];
|
||||
int res;
|
||||
|
||||
|
@ -670,7 +667,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
|
|||
struct ast_channel *newchan, *xferchan=NULL;
|
||||
int outstate=0;
|
||||
struct ast_bridge_config bconfig;
|
||||
char *transferer_real_context;
|
||||
const char *transferer_real_context;
|
||||
char xferto[256],dialstr[265];
|
||||
char *cid_num;
|
||||
char *cid_name;
|
||||
|
@ -981,7 +978,7 @@ static int ast_feature_interpret(struct ast_channel *chan, struct ast_channel *p
|
|||
struct ast_flags features;
|
||||
int res = FEATURE_RETURN_PASSDIGITS;
|
||||
struct ast_call_feature *feature;
|
||||
char *dynamic_features=pbx_builtin_getvar_helper(chan,"DYNAMIC_FEATURES");
|
||||
const char *dynamic_features=pbx_builtin_getvar_helper(chan,"DYNAMIC_FEATURES");
|
||||
|
||||
if (sense == FEATURE_SENSE_CHAN)
|
||||
ast_copy_flags(&features, &(config->features_caller), AST_FLAGS_ALL);
|
||||
|
@ -1047,9 +1044,7 @@ static void set_config_flags(struct ast_channel *chan, struct ast_channel *peer,
|
|||
}
|
||||
|
||||
if (chan && peer && !(ast_test_flag(config, AST_BRIDGE_DTMF_CHANNEL_0) && ast_test_flag(config, AST_BRIDGE_DTMF_CHANNEL_1))) {
|
||||
char *dynamic_features;
|
||||
|
||||
dynamic_features = pbx_builtin_getvar_helper(chan, "DYNAMIC_FEATURES");
|
||||
const char *dynamic_features = pbx_builtin_getvar_helper(chan, "DYNAMIC_FEATURES");
|
||||
|
||||
if (dynamic_features) {
|
||||
char *tmp = ast_strdupa(dynamic_features);
|
||||
|
@ -1261,7 +1256,6 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
|
|||
struct ast_option_header *aoh;
|
||||
struct timeval start = { 0 , 0 };
|
||||
struct ast_bridge_config backup_config;
|
||||
char *monitor_exec;
|
||||
|
||||
memset(&backup_config, 0, sizeof(backup_config));
|
||||
|
||||
|
@ -1274,14 +1268,24 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
|
|||
pbx_builtin_setvar_helper(chan, "BLINDTRANSFER", NULL);
|
||||
|
||||
if (monitor_ok) {
|
||||
const char *monitor_exec;
|
||||
struct ast_channel *src = NULL;
|
||||
if (!monitor_app) {
|
||||
if (!(monitor_app = pbx_findapp("Monitor")))
|
||||
monitor_ok=0;
|
||||
}
|
||||
if ((monitor_exec = pbx_builtin_getvar_helper(chan, "AUTO_MONITOR")))
|
||||
pbx_exec(chan, monitor_app, monitor_exec, 1);
|
||||
src = chan;
|
||||
else if ((monitor_exec = pbx_builtin_getvar_helper(peer, "AUTO_MONITOR")))
|
||||
pbx_exec(peer, monitor_app, monitor_exec, 1);
|
||||
src = peer;
|
||||
if (src) {
|
||||
char *tmp = ast_strdupa(monitor_exec);
|
||||
if (tmp) {
|
||||
pbx_exec(src, monitor_app, tmp, 1);
|
||||
} else {
|
||||
ast_log(LOG_ERROR, "Monitor failed: out of memory\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set_config_flags(chan, peer, config);
|
||||
|
|
|
@ -212,7 +212,6 @@ int ast_monitor_start( struct ast_channel *chan, const char *format_spec,
|
|||
/* Stop monitoring a channel */
|
||||
int ast_monitor_stop(struct ast_channel *chan, int need_lock)
|
||||
{
|
||||
char *execute, *execute_args;
|
||||
int delfiles = 0;
|
||||
|
||||
if (need_lock) {
|
||||
|
@ -261,6 +260,7 @@ int ast_monitor_stop(struct ast_channel *chan, int need_lock)
|
|||
char *name = chan->monitor->filename_base;
|
||||
int directory = strchr(name, '/') ? 1 : 0;
|
||||
char *dir = directory ? "" : ast_config_AST_MONITOR_DIR;
|
||||
const char *execute, *execute_args;
|
||||
|
||||
/* Set the execute application */
|
||||
execute = pbx_builtin_getvar_helper(chan, "MONITOR_EXEC");
|
||||
|
|
Reference in New Issue