aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/abstract_jb.c19
-rw-r--r--main/app.c6
-rw-r--r--main/ast_expr2.fl4
-rw-r--r--main/asterisk.c4
-rw-r--r--main/astobj2.c8
-rw-r--r--main/cdr.c8
-rw-r--r--main/channel.c2
-rw-r--r--main/cli.c107
-rw-r--r--main/dsp.c17
-rw-r--r--main/features.c37
-rw-r--r--main/frame.c6
-rw-r--r--main/image.c6
-rw-r--r--main/loader.c2
-rw-r--r--main/manager.c62
-rw-r--r--main/pbx.c135
-rw-r--r--main/taskprocessor.c8
-rw-r--r--main/udptl.c2
-rw-r--r--main/ulaw.c2
-rw-r--r--main/utils.c8
19 files changed, 219 insertions, 224 deletions
diff --git a/main/abstract_jb.c b/main/abstract_jb.c
index d7ff7354a..cda9a6dca 100644
--- a/main/abstract_jb.c
+++ b/main/abstract_jb.c
@@ -110,8 +110,7 @@ static void jb_force_resynch_adaptive(void *jb);
static void jb_empty_and_reset_adaptive(void *jb);
/* Available jb implementations */
-static struct ast_jb_impl avail_impl[] =
-{
+static const struct ast_jb_impl avail_impl[] = {
{
.name = "fixed",
.create = jb_create_fixed,
@@ -150,13 +149,13 @@ enum {
};
/* Translations between impl and abstract return codes */
-static int fixed_to_abstract_code[] =
+static const int fixed_to_abstract_code[] =
{JB_IMPL_OK, JB_IMPL_DROP, JB_IMPL_INTERP, JB_IMPL_NOFRAME};
-static int adaptive_to_abstract_code[] =
+static const int adaptive_to_abstract_code[] =
{JB_IMPL_OK, JB_IMPL_NOFRAME, JB_IMPL_NOFRAME, JB_IMPL_INTERP, JB_IMPL_DROP, JB_IMPL_OK};
/* JB_GET actions (used only for the frames log) */
-static char *jb_get_actions[] = {"Delivered", "Dropped", "Interpolated", "No"};
+static const char * const jb_get_actions[] = {"Delivered", "Dropped", "Interpolated", "No"};
/*! \brief Macros for the frame log files */
#define jb_framelog(...) do { \
@@ -181,7 +180,7 @@ static void jb_choose_impl(struct ast_channel *chan)
{
struct ast_jb *jb = &chan->jb;
struct ast_jb_conf *jbconf = &jb->conf;
- struct ast_jb_impl *test_impl;
+ const struct ast_jb_impl *test_impl;
int i, avail_impl_count = ARRAY_LEN(avail_impl);
jb->impl = &avail_impl[default_impl];
@@ -303,7 +302,7 @@ int ast_jb_get_when_to_wakeup(struct ast_channel *c0, struct ast_channel *c1, in
int ast_jb_put(struct ast_channel *chan, struct ast_frame *f)
{
struct ast_jb *jb = &chan->jb;
- struct ast_jb_impl *jbimpl = jb->impl;
+ const struct ast_jb_impl *jbimpl = jb->impl;
void *jbobj = jb->jbobj;
struct ast_frame *frr;
long now = 0;
@@ -385,7 +384,7 @@ void ast_jb_get_and_deliver(struct ast_channel *c0, struct ast_channel *c1)
static void jb_get_and_deliver(struct ast_channel *chan)
{
struct ast_jb *jb = &chan->jb;
- struct ast_jb_impl *jbimpl = jb->impl;
+ const struct ast_jb_impl *jbimpl = jb->impl;
void *jbobj = jb->jbobj;
struct ast_frame *f, finterp;
long now;
@@ -450,7 +449,7 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr)
{
struct ast_jb *jb = &chan->jb;
struct ast_jb_conf *jbconf = &jb->conf;
- struct ast_jb_impl *jbimpl = jb->impl;
+ const struct ast_jb_impl *jbimpl = jb->impl;
void *jbobj;
struct ast_channel *bridged;
long now;
@@ -534,7 +533,7 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr)
void ast_jb_destroy(struct ast_channel *chan)
{
struct ast_jb *jb = &chan->jb;
- struct ast_jb_impl *jbimpl = jb->impl;
+ const struct ast_jb_impl *jbimpl = jb->impl;
void *jbobj = jb->jbobj;
struct ast_frame *f;
diff --git a/main/app.c b/main/app.c
index 8e28b0c9a..72af3e085 100644
--- a/main/app.c
+++ b/main/app.c
@@ -180,7 +180,7 @@ enum ast_getdata_result ast_app_getdata(struct ast_channel *c, const char *promp
/* The lock type used by ast_lock_path() / ast_unlock_path() */
static enum AST_LOCK_TYPE ast_lock_type = AST_LOCK_TYPE_LOCKFILE;
-int ast_app_getdata_full(struct ast_channel *c, char *prompt, char *s, int maxlen, int timeout, int audiofd, int ctrlfd)
+int ast_app_getdata_full(struct ast_channel *c, const char *prompt, char *s, int maxlen, int timeout, int audiofd, int ctrlfd)
{
int res, to = 2000, fto = 6000;
@@ -949,8 +949,8 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
return res;
}
-static char default_acceptdtmf[] = "#";
-static char default_canceldtmf[] = "";
+static const char default_acceptdtmf[] = "#";
+static const char default_canceldtmf[] = "";
int ast_play_and_record_full(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, int silencethreshold, int maxsilence, const char *path, const char *acceptdtmf, const char *canceldtmf)
{
diff --git a/main/ast_expr2.fl b/main/ast_expr2.fl
index 499706811..98d2ea5c4 100644
--- a/main/ast_expr2.fl
+++ b/main/ast_expr2.fl
@@ -313,7 +313,7 @@ void ast_expr_clear_extra_error_info(void)
extra_error_message[0] = 0;
}
-static char *expr2_token_equivs1[] =
+static const char * const expr2_token_equivs1[] =
{
"TOKEN",
"TOK_COND",
@@ -339,7 +339,7 @@ static char *expr2_token_equivs1[] =
"TOK_LP"
};
-static char *expr2_token_equivs2[] =
+static const char * const expr2_token_equivs2[] =
{
"<token>",
"?",
diff --git a/main/asterisk.c b/main/asterisk.c
index 744ed2959..c45f6d8c8 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -765,7 +765,7 @@ int64_t ast_mark(int i, int startstop)
static char *handle_show_profile(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
int i, min, max;
- char *search = NULL;
+ const char *search = NULL;
switch (cmd) {
case CLI_INIT:
e->command = "core show profile";
@@ -800,7 +800,7 @@ static char *handle_show_profile(struct ast_cli_entry *e, int cmd, struct ast_cl
static char *handle_clear_profile(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
int i, min, max;
- char *search = NULL;
+ const char *search = NULL;
switch (cmd) {
case CLI_INIT:
e->command = "core clear profile";
diff --git a/main/astobj2.c b/main/astobj2.c
index 78c4cc00f..13e0c54b2 100644
--- a/main/astobj2.c
+++ b/main/astobj2.c
@@ -927,10 +927,10 @@ static void container_destruct_debug(void *_c)
#ifdef AO2_DEBUG
static int print_cb(void *obj, void *arg, int flag)
{
- int *fd = arg;
+ struct ast_cli_args *a = (struct ast_cli_args *) arg;
char *s = (char *)obj;
- ast_cli(*fd, "string <%s>\n", s);
+ ast_cli(a->fd, "string <%s>\n", s);
return 0;
}
@@ -1017,7 +1017,7 @@ static char *handle_astobj2_test(struct ast_cli_entry *e, int cmd, struct ast_cl
ao2_t_ref(obj, -1, "test");
}
ast_cli(a->fd, "testing callbacks\n");
- ao2_t_callback(c1, 0, print_cb, &a->fd, "test callback");
+ ao2_t_callback(c1, 0, print_cb, a, "test callback");
ast_cli(a->fd, "testing iterators, remove every second object\n");
{
struct ao2_iterator ai;
@@ -1038,7 +1038,7 @@ static char *handle_astobj2_test(struct ast_cli_entry *e, int cmd, struct ast_cl
}
}
ast_cli(a->fd, "testing callbacks again\n");
- ao2_t_callback(c1, 0, print_cb, &a->fd, "test callback");
+ ao2_t_callback(c1, 0, print_cb, a, "test callback");
ast_verbose("now you should see an error message:\n");
ao2_t_ref(&i, -1, ""); /* i is not a valid object so we print an error here */
diff --git a/main/cdr.c b/main/cdr.c
index 65c4e3e01..169625fca 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -282,10 +282,10 @@ void ast_cdr_getvar(struct ast_cdr *cdr, const char *name, char **ret, char *wor
}
/* readonly cdr variables */
-static const char *cdr_readonly_vars[] = { "clid", "src", "dst", "dcontext", "channel", "dstchannel",
- "lastapp", "lastdata", "start", "answer", "end", "duration",
- "billsec", "disposition", "amaflags", "accountcode", "uniqueid",
- "userfield", NULL };
+static const char * const cdr_readonly_vars[] = { "clid", "src", "dst", "dcontext", "channel", "dstchannel",
+ "lastapp", "lastdata", "start", "answer", "end", "duration",
+ "billsec", "disposition", "amaflags", "accountcode", "uniqueid",
+ "userfield", NULL };
/*! Set a CDR channel variable
\note You can't set the CDR variables that belong to the actual CDR record, like "billsec".
*/
diff --git a/main/channel.c b/main/channel.c
index 91bc8869c..969c0cfd6 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -3541,7 +3541,7 @@ int ast_senddigit_begin(struct ast_channel *chan, char digit)
{
/* Device does not support DTMF tones, lets fake
* it by doing our own generation. */
- static const char* dtmf_tones[] = {
+ static const char * const dtmf_tones[] = {
"941+1336", /* 0 */
"697+1209", /* 1 */
"697+1336", /* 2 */
diff --git a/main/cli.c b/main/cli.c
index 8217e52d1..136d56a1e 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -365,13 +365,13 @@ static char *handle_verbose(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
int atleast = 0;
int fd = a->fd;
int argc = a->argc;
- char **argv = a->argv;
- char *argv3 = a->argv ? S_OR(a->argv[3], "") : "";
+ const char * const *argv = a->argv;
+ const char *argv3 = a->argv ? S_OR(a->argv[3], "") : "";
int *dst;
char *what;
struct debug_file_list *dfl;
struct ast_debug_file *adf;
- char *fn;
+ const char *fn;
switch (cmd) {
case CLI_INIT:
@@ -387,7 +387,7 @@ static char *handle_verbose(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
case CLI_GENERATE:
if (a->pos == 3 || (a->pos == 4 && !strcasecmp(a->argv[3], "atleast"))) {
- char *pos = a->pos == 3 ? argv3 : S_OR(a->argv[4], "");
+ const char *pos = a->pos == 3 ? argv3 : S_OR(a->argv[4], "");
int numbermatch = (ast_strlen_zero(pos) || strchr("123456789", pos[0])) ? 0 : 21;
if (a->n < 21 && numbermatch == 0) {
return complete_number(pos, 0, 0x7fffffff, a->n);
@@ -534,7 +534,7 @@ static char *handle_unload(struct ast_cli_entry *e, int cmd, struct ast_cli_args
/* "module unload mod_1 [mod_2 .. mod_N]" */
int x;
int force = AST_FORCE_SOFT;
- char *s;
+ const char *s;
switch (cmd) {
case CLI_INIT:
@@ -685,7 +685,7 @@ static char * handle_showuptime(struct ast_cli_entry *e, int cmd, struct ast_cli
static char *handle_modlist(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- char *like;
+ const char *like;
switch (cmd) {
case CLI_INIT:
@@ -787,8 +787,6 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
struct ast_channel *c = NULL;
int numchans = 0, concise = 0, verbose = 0, count = 0;
- int fd, argc;
- char **argv;
struct ast_channel_iterator *iter = NULL;
switch (cmd) {
@@ -808,16 +806,13 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
case CLI_GENERATE:
return NULL;
}
- fd = a->fd;
- argc = a->argc;
- argv = a->argv;
if (a->argc == e->args) {
- if (!strcasecmp(argv[e->args-1],"concise"))
+ if (!strcasecmp(a->argv[e->args-1],"concise"))
concise = 1;
- else if (!strcasecmp(argv[e->args-1],"verbose"))
+ else if (!strcasecmp(a->argv[e->args-1],"verbose"))
verbose = 1;
- else if (!strcasecmp(argv[e->args-1],"count"))
+ else if (!strcasecmp(a->argv[e->args-1],"count"))
count = 1;
else
return CLI_SHOWUSAGE;
@@ -826,9 +821,9 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
if (!count) {
if (!concise && !verbose)
- ast_cli(fd, FORMAT_STRING2, "Channel", "Location", "State", "Application(Data)");
+ ast_cli(a->fd, FORMAT_STRING2, "Channel", "Location", "State", "Application(Data)");
else if (verbose)
- ast_cli(fd, VERBOSE_FORMAT_STRING2, "Channel", "Context", "Extension", "Priority", "State", "Application", "Data",
+ ast_cli(a->fd, VERBOSE_FORMAT_STRING2, "Channel", "Context", "Extension", "Priority", "State", "Application", "Data",
"CallerID", "Duration", "Accountcode", "BridgedTo");
}
@@ -857,7 +852,7 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
}
}
if (concise) {
- ast_cli(fd, CONCISE_FORMAT_STRING, c->name, c->context, c->exten, c->priority, ast_state2str(c->_state),
+ ast_cli(a->fd, CONCISE_FORMAT_STRING, c->name, c->context, c->exten, c->priority, ast_state2str(c->_state),
c->appl ? c->appl : "(None)",
S_OR(c->data, ""), /* XXX different from verbose ? */
S_OR(c->cid.cid_num, ""),
@@ -867,7 +862,7 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
bc ? bc->name : "(None)",
c->uniqueid);
} else if (verbose) {
- ast_cli(fd, VERBOSE_FORMAT_STRING, c->name, c->context, c->exten, c->priority, ast_state2str(c->_state),
+ ast_cli(a->fd, VERBOSE_FORMAT_STRING, c->name, c->context, c->exten, c->priority, ast_state2str(c->_state),
c->appl ? c->appl : "(None)",
c->data ? S_OR(c->data, "(Empty)" ): "(None)",
S_OR(c->cid.cid_num, ""),
@@ -882,7 +877,7 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
snprintf(locbuf, sizeof(locbuf), "%s@%s:%d", c->exten, c->context, c->priority);
if (c->appl)
snprintf(appdata, sizeof(appdata), "%s(%s)", c->appl, S_OR(c->data, ""));
- ast_cli(fd, FORMAT_STRING, c->name, locbuf, ast_state2str(c->_state), appdata);
+ ast_cli(a->fd, FORMAT_STRING, c->name, locbuf, ast_state2str(c->_state), appdata);
}
}
ast_channel_unlock(c);
@@ -894,15 +889,15 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
if (!concise) {
numchans = ast_active_channels();
- ast_cli(fd, "%d active channel%s\n", numchans, ESS(numchans));
+ ast_cli(a->fd, "%d active channel%s\n", numchans, ESS(numchans));
if (option_maxcalls)
- ast_cli(fd, "%d of %d max active call%s (%5.2f%% of capacity)\n",
+ ast_cli(a->fd, "%d of %d max active call%s (%5.2f%% of capacity)\n",
ast_active_calls(), option_maxcalls, ESS(ast_active_calls()),
((double)ast_active_calls() / (double)option_maxcalls) * 100.0);
else
- ast_cli(fd, "%d active call%s\n", ast_active_calls(), ESS(ast_active_calls()));
+ ast_cli(a->fd, "%d active call%s\n", ast_active_calls(), ESS(ast_active_calls()));
- ast_cli(fd, "%d call%s processed\n", ast_processed_calls(), ESS(ast_processed_calls()));
+ ast_cli(a->fd, "%d call%s processed\n", ast_processed_calls(), ESS(ast_processed_calls()));
}
return CLI_SUCCESS;
@@ -1238,7 +1233,6 @@ static char *handle_core_set_debug_channel(struct ast_cli_entry *e, int cmd, str
"Usage: core set debug channel <all|channel> [off]\n"
" Enables/disables debugging on all or on a specific channel.\n";
return NULL;
-
case CLI_GENERATE:
/* XXX remember to handle the optional "off" */
if (a->pos != e->args)
@@ -1246,8 +1240,11 @@ static char *handle_core_set_debug_channel(struct ast_cli_entry *e, int cmd, str
return a->n == 0 ? ast_strdup("all") : ast_complete_channels(a->line, a->word, a->pos, a->n - 1, e->args);
}
- /* 'core set debug channel {all|chan_id}' */
- if (a->argc == e->args + 2) {
+ if (cmd == (CLI_HANDLER + 1000)) {
+ /* called from handle_nodebugchan_deprecated */
+ args.is_off = 1;
+ } else if (a->argc == e->args + 2) {
+ /* 'core set debug channel {all|chan_id}' */
if (!strcasecmp(a->argv[e->args + 1], "off"))
args.is_off = 1;
else
@@ -1282,18 +1279,27 @@ static char *handle_core_set_debug_channel(struct ast_cli_entry *e, int cmd, str
static char *handle_nodebugchan_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
char *res;
- if (cmd == CLI_HANDLER) {
- if (a->argc != e->args + 1)
- return CLI_SHOWUSAGE;
- /* pretend we have an extra "off" at the end. We can do this as the array
- * is NULL terminated so we overwrite that entry.
- */
- a->argv[e->args+1] = "off";
- a->argc++;
- }
- res = handle_core_set_debug_channel(e, cmd, a);
- if (cmd == CLI_INIT)
+
+ switch (cmd) {
+ case CLI_INIT:
e->command = "no debug channel";
+ return NULL;
+ case CLI_HANDLER:
+ /* exit out of switch statement */
+ break;
+ default:
+ return NULL;
+ }
+
+ if (a->argc != e->args + 1)
+ return CLI_SHOWUSAGE;
+
+ /* add a 'magic' value to the CLI_HANDLER command so that
+ * handle_core_set_debug_channel() will act as if 'off'
+ * had been specified as part of the command
+ */
+ res = handle_core_set_debug_channel(e, CLI_HANDLER + 1000, a);
+
return res;
}
@@ -1421,7 +1427,7 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
* helper function to generate CLI matches from a fixed set of values.
* A NULL word is acceptable.
*/
-char *ast_cli_complete(const char *word, char *const choices[], int state)
+char *ast_cli_complete(const char *word, const char * const choices[], int state)
{
int i, which = 0, len;
len = ast_strlen_zero(word) ? 0 : strlen(word);
@@ -1823,15 +1829,15 @@ static char *is_prefix(const char *word, const char *token,
* 1 true only on complete, exact match.
*
*/
-static struct ast_cli_entry *find_cli(char *const cmds[], int match_type)
+static struct ast_cli_entry *find_cli(const char * const cmds[], int match_type)
{
int matchlen = -1; /* length of longest match so far */
struct ast_cli_entry *cand = NULL, *e=NULL;
while ( (e = cli_next(e)) ) {
/* word-by word regexp comparison */
- char * const *src = cmds;
- char * const *dst = e->cmda;
+ const char * const *src = cmds;
+ const char * const *dst = e->cmda;
int n = 0;
for (;; dst++, src += n) {
n = word_match(*src, *dst);
@@ -1867,16 +1873,15 @@ static struct ast_cli_entry *find_cli(char *const cmds[], int match_type)
return e ? e : cand;
}
-static char *find_best(char *argv[])
+static char *find_best(const char *argv[])
{
static char cmdline[80];
int x;
/* See how close we get, then print the candidate */
- char *myargv[AST_MAX_CMD_LEN];
- for (x=0;x<AST_MAX_CMD_LEN;x++)
- myargv[x]=NULL;
+ const char *myargv[AST_MAX_CMD_LEN] = { NULL, };
+
AST_RWLIST_RDLOCK(&helpers);
- for (x=0;argv[x];x++) {
+ for (x = 0; argv[x]; x++) {
myargv[x] = argv[x];
if (!find_cli(myargv, -1))
break;
@@ -2002,7 +2007,7 @@ int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
/*! \brief helper for final part of handle_help
* if locked = 1, assume the list is already locked
*/
-static char *help1(int fd, char *match[], int locked)
+static char *help1(int fd, const char * const match[], int locked)
{
char matchstr[80] = "";
struct ast_cli_entry *e = NULL;
@@ -2077,7 +2082,7 @@ static char *handle_help(struct ast_cli_entry *e, int cmd, struct ast_cli_args *
return res;
}
-static char *parse_args(const char *s, int *argc, char *argv[], int max, int *trailingwhitespace)
+static char *parse_args(const char *s, int *argc, const char *argv[], int max, int *trailingwhitespace)
{
char *duplicate, *cur;
int x = 0;
@@ -2208,7 +2213,7 @@ char **ast_cli_completion_matches(const char *text, const char *word)
}
/*! \brief returns true if there are more words to match */
-static int more_words (char * const *dst)
+static int more_words (const char * const *dst)
{
int i;
for (i = 0; dst[i]; i++) {
@@ -2223,7 +2228,7 @@ static int more_words (char * const *dst)
*/
static char *__ast_cli_generator(const char *text, const char *word, int state, int lock)
{
- char *argv[AST_MAX_ARGS];
+ const char *argv[AST_MAX_ARGS];
struct ast_cli_entry *e = NULL;
int x = 0, argindex, matchlen;
int matchnum=0;
@@ -2311,7 +2316,7 @@ char *ast_cli_generator(const char *text, const char *word, int state)
int ast_cli_command_full(int uid, int gid, int fd, const char *s)
{
- char *args[AST_MAX_ARGS + 1];
+ const char *args[AST_MAX_ARGS + 1];
struct ast_cli_entry *e;
int x;
char *duplicate = parse_args(s, &x, args + 1, AST_MAX_ARGS, NULL);
diff --git a/main/dsp.c b/main/dsp.c
index 6c0b013e4..ab7cacf1a 100644
--- a/main/dsp.c
+++ b/main/dsp.c
@@ -283,24 +283,17 @@ typedef struct
} td;
} digit_detect_state_t;
-static float dtmf_row[] =
-{
+static const float dtmf_row[] = {
697.0, 770.0, 852.0, 941.0
};
-static float dtmf_col[] =
-{
+static const float dtmf_col[] = {
1209.0, 1336.0, 1477.0, 1633.0
};
-
-static float mf_tones[] =
-{
+static const float mf_tones[] = {
700.0, 900.0, 1100.0, 1300.0, 1500.0, 1700.0
};
-
-static char dtmf_positions[] = "123A" "456B" "789C" "*0#D";
-
-static char bell_mf_positions[] = "1247C-358A--69*---0B----#";
-
+static const char dtmf_positions[] = "123A" "456B" "789C" "*0#D";
+static const char bell_mf_positions[] = "1247C-358A--69*---0B----#";
static int thresholds[THRESHOLD_MAX];
static inline void goertzel_sample(goertzel_state_t *s, short sample)
diff --git a/main/features.c b/main/features.c
index 5315140ba..8da3c7baa 100644
--- a/main/features.c
+++ b/main/features.c
@@ -921,7 +921,7 @@ static void set_peers(struct ast_channel **caller, struct ast_channel **callee,
* Setup channel, set return exten,priority to 's,1'
* answer chan, sleep chan, park call
*/
-static int builtin_parkcall(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data)
+static int builtin_parkcall(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data)
{
struct ast_channel *parker;
struct ast_channel *parkee;
@@ -991,7 +991,7 @@ static int play_message_in_bridged_call(struct ast_channel *caller_chan, struct
* \retval AST_FEATURE_RETURN_SUCCESS on success.
* \retval -1 on error.
*/
-static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data)
+static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data)
{
char *caller_chan_id = NULL, *callee_chan_id = NULL, *args = NULL, *touch_filename = NULL;
int x = 0;
@@ -1084,7 +1084,7 @@ static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *pee
return -1;
}
-static int builtin_automixmonitor(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data)
+static int builtin_automixmonitor(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data)
{
char *caller_chan_id = NULL, *callee_chan_id = NULL, *args = NULL, *touch_filename = NULL;
int x = 0;
@@ -1194,7 +1194,7 @@ static int builtin_automixmonitor(struct ast_channel *chan, struct ast_channel *
}
-static int builtin_disconnect(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data)
+static int builtin_disconnect(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data)
{
ast_verb(4, "User hit '%s' to disconnect call.\n", code);
return AST_FEATURE_RETURN_HANGUP;
@@ -1244,7 +1244,7 @@ static const char *real_ctx(struct ast_channel *transferer, struct ast_channel *
* \retval AST_FEATURE_RETURN_SUCCESS.
* \retval -1 on failure.
*/
-static int builtin_blindtransfer(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data)
+static int builtin_blindtransfer(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data)
{
struct ast_channel *transferer;
struct ast_channel *transferee;
@@ -1375,7 +1375,7 @@ static int check_compat(struct ast_channel *c, struct ast_channel *newchan)
*
* \return -1 on failure
*/
-static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data)
+static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data)
{
struct ast_channel *transferer;
struct ast_channel *transferee;
@@ -1719,8 +1719,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
AST_RWLOCK_DEFINE_STATIC(features_lock);
-static struct ast_call_feature builtin_features[] =
-{
+static struct ast_call_feature builtin_features[] = {
{ AST_FEATURE_REDIRECT, "Blind Transfer", "blindxfer", "#", "#", builtin_blindtransfer, AST_FEATURE_FLAG_NEEDSDTMF, "" },
{ AST_FEATURE_REDIRECT, "Attended Transfer", "atxfer", "", "", builtin_atxfer, AST_FEATURE_FLAG_NEEDSDTMF, "" },
{ AST_FEATURE_AUTOMON, "One Touch Monitor", "automon", "", "", builtin_automonitor, AST_FEATURE_FLAG_NEEDSDTMF, "" },
@@ -1925,7 +1924,7 @@ struct ast_call_feature *ast_find_call_feature(const char *name)
* \retval -1 error.
* \retval -2 when an application cannot be found.
*/
-static int feature_exec_app(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data)
+static int feature_exec_app(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data)
{
struct ast_app *app;
struct ast_call_feature *feature = data;
@@ -2021,7 +2020,7 @@ static int remap_feature(const char *name, const char *value)
* \retval -1 on failure.
*/
static int feature_interpret_helper(struct ast_channel *chan, struct ast_channel *peer,
- struct ast_bridge_config *config, char *code, int sense, char *dynamic_features_buf,
+ struct ast_bridge_config *config, const char *code, int sense, char *dynamic_features_buf,
struct ast_flags *features, int operation, struct ast_call_feature *feature)
{
int x;
@@ -2124,7 +2123,7 @@ static int feature_interpret_helper(struct ast_channel *chan, struct ast_channel
* \retval -1 on failure.
*/
-static int feature_interpret(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense) {
+static int feature_interpret(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense) {
char dynamic_features_buf[128];
const char *peer_dynamic_features, *chan_dynamic_features;
@@ -2153,7 +2152,7 @@ static int feature_interpret(struct ast_channel *chan, struct ast_channel *peer,
}
-int ast_feature_detect(struct ast_channel *chan, struct ast_flags *features, char *code, struct ast_call_feature *feature) {
+int ast_feature_detect(struct ast_channel *chan, struct ast_flags *features, const char *code, struct ast_call_feature *feature) {
return feature_interpret_helper(chan, NULL, NULL, code, 0, NULL, features, 0, feature);
}
@@ -3254,7 +3253,7 @@ AST_APP_OPTIONS(park_call_options, BEGIN_OPTIONS
END_OPTIONS );
/*! \brief Park a call */
-static int park_call_exec(struct ast_channel *chan, void *data)
+static int park_call_exec(struct ast_channel *chan, const char *data)
{
/* Cache the original channel name in case we get masqueraded in the middle
* of a park--it is still theoretically possible for a transfer to happen before
@@ -3340,7 +3339,7 @@ static int park_call_exec(struct ast_channel *chan, void *data)
}
/*! \brief Pickup parked call */
-static int park_exec_full(struct ast_channel *chan, void *data, struct ast_parkinglot *parkinglot)
+static int park_exec_full(struct ast_channel *chan, const char *data, struct ast_parkinglot *parkinglot)
{
int res = 0;
struct ast_channel *peer=NULL;
@@ -3350,7 +3349,7 @@ static int park_exec_full(struct ast_channel *chan, void *data, struct ast_parki
struct ast_bridge_config config;
if (data)
- park = atoi((char *)data);
+ park = atoi((char *) data);
parkinglot = find_parkinglot(findparkinglotname(chan));
if (!parkinglot)
@@ -3503,7 +3502,7 @@ static int park_exec_full(struct ast_channel *chan, void *data, struct ast_parki
return -1;
}
-static int park_exec(struct ast_channel *chan, void *data)
+static int park_exec(struct ast_channel *chan, const char *data)
{
return park_exec_full(chan, data, default_parkinglot);
}
@@ -4110,7 +4109,7 @@ static char *handle_features_reload(struct ast_cli_entry *e, int cmd, struct ast
return CLI_SUCCESS;
}
-static char mandescr_bridge[] =
+static const char mandescr_bridge[] =
"Description: Bridge together two channels already in the PBX\n"
"Variables: ( Headers marked with * are required )\n"
" *Channel1: Channel to Bridge to Channel2\n"
@@ -4383,7 +4382,7 @@ static int manager_parking_status(struct mansession *s, const struct message *m)
return RESULT_SUCCESS;
}
-static char mandescr_park[] =
+static const char mandescr_park[] =
"Description: Park a channel.\n"
"Variables: (Names marked with * are required)\n"
" *Channel: Channel name to park\n"
@@ -4556,7 +4555,7 @@ END_OPTIONS );
* answer call if not already, check compatible channels, setup bridge config
* now bridge call, if transfered party hangs up return to PBX extension.
*/
-static int bridge_exec(struct ast_channel *chan, void *data)
+static int bridge_exec(struct ast_channel *chan, const char *data)
{
struct ast_channel *current_dest_chan, *final_dest_chan;
char *tmp_data = NULL;
diff --git a/main/frame.c b/main/frame.c
index a0feb6558..bc1c60b8a 100644
--- a/main/frame.c
+++ b/main/frame.c
@@ -1354,7 +1354,7 @@ static unsigned char get_n_bits_at(unsigned char *data, int n, int bit)
static int speex_get_wb_sz_at(unsigned char *data, int len, int bit)
{
- static int SpeexWBSubModeSz[] = {
+ static const int SpeexWBSubModeSz[] = {
0, 36, 112, 192,
352, 0, 0, 0 };
int off = bit;
@@ -1384,12 +1384,12 @@ static int speex_get_wb_sz_at(unsigned char *data, int len, int bit)
static int speex_samples(unsigned char *data, int len)
{
- static int SpeexSubModeSz[] = {
+ static const int SpeexSubModeSz[] = {
5, 43, 119, 160,
220, 300, 364, 492,
79, 0, 0, 0,
0, 0, 0, 0 };
- static int SpeexInBandSz[] = {
+ static const int SpeexInBandSz[] = {
1, 1, 4, 4,
4, 4, 4, 4,
8, 8, 16, 16,
diff --git a/main/image.c b/main/image.c
index c47f808a6..8ecea603b 100644
--- a/main/image.c
+++ b/main/image.c
@@ -81,7 +81,7 @@ static int file_exists(char *filename)
return 0;
}
-static void make_filename(char *buf, int len, char *filename, const char *preflang, char *ext)
+static void make_filename(char *buf, int len, const char *filename, const char *preflang, char *ext)
{
if (filename[0] == '/') {
if (!ast_strlen_zero(preflang))
@@ -96,7 +96,7 @@ static void make_filename(char *buf, int len, char *filename, const char *prefla
}
}
-struct ast_frame *ast_read_image(char *filename, const char *preflang, int format)
+struct ast_frame *ast_read_image(const char *filename, const char *preflang, int format)
{
struct ast_imager *i;
char buf[256];
@@ -152,7 +152,7 @@ struct ast_frame *ast_read_image(char *filename, const char *preflang, int forma
return f;
}
-int ast_send_image(struct ast_channel *chan, char *filename)
+int ast_send_image(struct ast_channel *chan, const char *filename)
{
struct ast_frame *f;
int res = -1;
diff --git a/main/loader.c b/main/loader.c
index 4e07e843b..fefd29e80 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -69,7 +69,7 @@ struct ast_module_user {
AST_LIST_HEAD(module_user_list, ast_module_user);
-static unsigned char expected_key[] =
+static const unsigned char expected_key[] =
{ 0x87, 0x76, 0x79, 0x35, 0x23, 0xea, 0x3a, 0xd3,
0x25, 0x2a, 0xbb, 0x35, 0x87, 0xe4, 0x22, 0x24 };
diff --git a/main/manager.c b/main/manager.c
index d9cc3e846..7d5ee7a59 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1208,7 +1208,7 @@ static int authenticate(struct mansession *s, const struct message *m)
}
/*! \brief Manager PING */
-static char mandescr_ping[] =
+static const char mandescr_ping[] =
"Description: A 'Ping' action will ellicit a 'Pong' response. Used to keep the\n"
" manager connection open.\n"
"Variables: NONE\n";
@@ -1225,7 +1225,7 @@ static int action_ping(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_getconfig[] =
+static const char mandescr_getconfig[] =
"Description: A 'GetConfig' action will dump the contents of a configuration\n"
"file by category and contents or optionally by specified category only.\n"
"Variables: (Names marked with * are required)\n"
@@ -1273,7 +1273,7 @@ static int action_getconfig(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_listcategories[] =
+static const char mandescr_listcategories[] =
"Description: A 'ListCategories' action will dump the categories in\n"
"a given file.\n"
"Variables:\n"
@@ -1324,7 +1324,7 @@ static void json_escape(char *out, const char *in)
*out = '\0';
}
-static char mandescr_getconfigjson[] =
+static const char mandescr_getconfigjson[] =
"Description: A 'GetConfigJSON' action will dump the contents of a configuration\n"
"file by category and contents in JSON format. This only makes sense to be used\n"
"using rawman over the HTTP interface.\n"
@@ -1543,7 +1543,7 @@ static enum error_type handle_updates(struct mansession *s, const struct message
return result;
}
-static char mandescr_updateconfig[] =
+static const char mandescr_updateconfig[] =
"Description: A 'UpdateConfig' action will modify, create, or delete\n"
"configuration elements in Asterisk configuration files.\n"
"Variables (X's represent 6 digit number beginning with 000000):\n"
@@ -1632,7 +1632,7 @@ static int action_updateconfig(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_createconfig[] =
+static const char mandescr_createconfig[] =
"Description: A 'CreateConfig' action will create an empty file in the\n"
"configuration directory. This action is intended to be used before an\n"
"UpdateConfig action.\n"
@@ -1658,7 +1658,7 @@ static int action_createconfig(struct mansession *s, const struct message *m)
}
/*! \brief Manager WAITEVENT */
-static char mandescr_waitevent[] =
+static const char mandescr_waitevent[] =
"Description: A 'WaitEvent' action will ellicit a 'Success' response. Whenever\n"
"a manager event is queued. Once WaitEvent has been called on an HTTP manager\n"
"session, events will be generated and queued.\n"
@@ -1771,7 +1771,7 @@ static int action_waitevent(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_listcommands[] =
+static const char mandescr_listcommands[] =
"Description: Returns the action name and synopsis for every\n"
" action that is available to the user\n"
"Variables: NONE\n";
@@ -1794,7 +1794,7 @@ static int action_listcommands(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_events[] =
+static const char mandescr_events[] =
"Description: Enable/Disable sending of events to this manager\n"
" client.\n"
"Variables:\n"
@@ -1817,7 +1817,7 @@ static int action_events(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_logoff[] =
+static const char mandescr_logoff[] =
"Description: Logoff this manager session\n"
"Variables: NONE\n";
@@ -1867,7 +1867,7 @@ static int action_challenge(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_hangup[] =
+static const char mandescr_hangup[] =
"Description: Hangup a channel\n"
"Variables: \n"
" Channel: The channel name to be hungup\n"
@@ -1916,7 +1916,7 @@ static int action_hangup(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_setvar[] =
+static const char mandescr_setvar[] =
"Description: Set a global or local channel variable.\n"
"Variables: (Names marked with * are required)\n"
" Channel: Channel to set variable for\n"
@@ -1953,7 +1953,7 @@ static int action_setvar(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_getvar[] =
+static const char mandescr_getvar[] =
"Description: Get the value of a global or local channel variable.\n"
"Variables: (Names marked with * are required)\n"
" Channel: Channel to read variable from\n"
@@ -2006,7 +2006,7 @@ static int action_getvar(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_status[] =
+static const char mandescr_status[] =
"Description: Lists channel status along with requested channel vars.\n"
"Variables: (Names marked with * are required)\n"
" *Channel: Name of the channel to query for status\n"
@@ -2163,7 +2163,7 @@ static int action_status(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_sendtext[] =
+static const char mandescr_sendtext[] =
"Description: Sends A Text Message while in a call.\n"
"Variables: (Names marked with * are required)\n"
" *Channel: Channel to send message to\n"
@@ -2206,7 +2206,7 @@ static int action_sendtext(struct mansession *s, const struct message *m)
return res;
}
-static char mandescr_redirect[] =
+static const char mandescr_redirect[] =
"Description: Redirect (transfer) a call.\n"
"Variables: (Names marked with * are required)\n"
" *Channel: Channel to redirect\n"
@@ -2306,7 +2306,7 @@ static int action_redirect(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_atxfer[] =
+static const char mandescr_atxfer[] =
"Description: Attended transfer.\n"
"Variables: (Names marked with * are required)\n"
" *Channel: Transferer's channel\n"
@@ -2399,7 +2399,7 @@ static int check_blacklist(const char *cmd)
return 0;
}
-static char mandescr_command[] =
+static const char mandescr_command[] =
"Description: Run a CLI command.\n"
"Variables: (Names marked with * are required)\n"
" *Command: Asterisk CLI command to run\n"
@@ -2526,7 +2526,7 @@ static void *fast_originate(void *data)
return NULL;
}
-static char mandescr_originate[] =
+static const char mandescr_originate[] =
"Description: Generates an outgoing call to a Extension/Context/Priority or\n"
" Application/Data\n"
"Variables: (Names marked with * are required)\n"
@@ -2673,7 +2673,7 @@ static int action_originate(struct mansession *s, const struct message *m)
/*! \brief Help text for manager command mailboxstatus
*/
-static char mandescr_mailboxstatus[] =
+static const char mandescr_mailboxstatus[] =
"Description: Checks a voicemail account for status.\n"
"Variables: (Names marked with * are required)\n"
" *Mailbox: Full mailbox ID <mailbox>@<vm-context>\n"
@@ -2701,7 +2701,7 @@ static int action_mailboxstatus(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_mailboxcount[] =
+static const char mandescr_mailboxcount[] =
"Description: Checks a voicemail account for new messages.\n"
"Variables: (Names marked with * are required)\n"
" *Mailbox: Full mailbox ID <mailbox>@<vm-context>\n"
@@ -2734,7 +2734,7 @@ static int action_mailboxcount(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_extensionstate[] =
+static const char mandescr_extensionstate[] =
"Description: Report the extension state for given extension.\n"
" If the extension has a hint, will use devicestate to check\n"
" the status of the device connected to the extension.\n"
@@ -2770,7 +2770,7 @@ static int action_extensionstate(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_timeout[] =
+static const char mandescr_timeout[] =
"Description: Hangup a channel after a certain time.\n"
"Variables: (Names marked with * are required)\n"
" *Channel: Channel name to hangup\n"
@@ -2839,7 +2839,7 @@ static int process_events(struct mansession *s)
return ret;
}
-static char mandescr_userevent[] =
+static const char mandescr_userevent[] =
"Description: Send an event to manager sessions.\n"
"Variables: (Names marked with * are required)\n"
" *UserEvent: EventStringToSend\n"
@@ -2864,7 +2864,7 @@ static int action_userevent(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_coresettings[] =
+static const char mandescr_coresettings[] =
"Description: Query for Core PBX settings.\n"
"Variables: (Names marked with * are optional)\n"
" *ActionID: ActionID of this transaction\n";
@@ -2911,7 +2911,7 @@ static int action_coresettings(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_corestatus[] =
+static const char mandescr_corestatus[] =
"Description: Query for Core PBX status.\n"
"Variables: (Names marked with * are optional)\n"
" *ActionID: ActionID of this transaction\n";
@@ -2950,7 +2950,7 @@ static int action_corestatus(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_reload[] =
+static const char mandescr_reload[] =
"Description: Send a reload event.\n"
"Variables: (Names marked with * are optional)\n"
" *ActionID: ActionID of this transaction\n"
@@ -2970,7 +2970,7 @@ static int action_reload(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_coreshowchannels[] =
+static const char mandescr_coreshowchannels[] =
"Description: List currently defined channels and some information\n"
" about them.\n"
"Variables:\n"
@@ -3052,7 +3052,7 @@ static int action_coreshowchannels(struct mansession *s, const struct message *m
return 0;
}
-static char mandescr_modulecheck[] =
+static const char mandescr_modulecheck[] =
"Description: Checks if Asterisk module is loaded\n"
"Variables: \n"
" ActionID: <id> Action ID for this transaction. Will be returned.\n"
@@ -3105,7 +3105,7 @@ static int manager_modulecheck(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_moduleload[] =
+static const char mandescr_moduleload[] =
"Description: Loads, unloads or reloads an Asterisk module in a running system.\n"
"Variables: \n"
" ActionID: <id> Action ID for this transaction. Will be returned.\n"
@@ -3684,7 +3684,7 @@ enum output_format {
FORMAT_XML,
};
-static char *contenttype[] = {
+static const char * const contenttype[] = {
[FORMAT_RAW] = "plain",
[FORMAT_HTML] = "html",
[FORMAT_XML] = "xml",
diff --git a/main/pbx.c b/main/pbx.c
index 28c04802d..a24690278 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -855,7 +855,7 @@ struct ast_context {
/*! \brief ast_app: A registered application */
struct ast_app {
- int (*execute)(struct ast_channel *chan, void *data);
+ int (*execute)(struct ast_channel *chan, const char *data);
AST_DECLARE_STRING_FIELDS(
AST_STRING_FIELD(synopsis); /*!< Synopsis text for 'show applications' */
AST_STRING_FIELD(description); /*!< Description (help text) for 'show application &lt;name&gt;' */
@@ -919,33 +919,33 @@ struct pbx_exception {
int priority; /*!< Priority associated with this exception */
};
-static int pbx_builtin_answer(struct ast_channel *, void *);
-static int pbx_builtin_goto(struct ast_channel *, void *);
-static int pbx_builtin_hangup(struct ast_channel *, void *);
-static int pbx_builtin_background(struct ast_channel *, void *);
-static int pbx_builtin_wait(struct ast_channel *, void *);
-static int pbx_builtin_waitexten(struct ast_channel *, void *);
-static int pbx_builtin_incomplete(struct ast_channel *, void *);
-static int pbx_builtin_resetcdr(struct ast_channel *, void *);
-static int pbx_builtin_setamaflags(struct ast_channel *, void *);
-static int pbx_builtin_ringing(struct ast_channel *, void *);
-static int pbx_builtin_proceeding(struct ast_channel *, void *);
-static int pbx_builtin_progress(struct ast_channel *, void *);
-static int pbx_builtin_congestion(struct ast_channel *, void *);
-static int pbx_builtin_busy(struct ast_channel *, void *);
-static int pbx_builtin_noop(struct ast_channel *, void *);
-static int pbx_builtin_gotoif(struct ast_channel *, void *);
-static int pbx_builtin_gotoiftime(struct ast_channel *, void *);
-static int pbx_builtin_execiftime(struct ast_channel *, void *);
-static int pbx_builtin_saynumber(struct ast_channel *, void *);
-static int pbx_builtin_saydigits(struct ast_channel *, void *);
-static int pbx_builtin_saycharacters(struct ast_channel *, void *);
-static int pbx_builtin_sayphonetic(struct ast_channel *, void *);
+static int pbx_builtin_answer(struct ast_channel *, const char *);
+static int pbx_builtin_goto(struct ast_channel *, const char *);
+static int pbx_builtin_hangup(struct ast_channel *, const char *);
+static int pbx_builtin_background(struct ast_channel *, const char *);
+static int pbx_builtin_wait(struct ast_channel *, const char *);
+static int pbx_builtin_waitexten(struct ast_channel *, const char *);
+static int pbx_builtin_incomplete(struct ast_channel *, const char *);
+static int pbx_builtin_resetcdr(struct ast_channel *, const char *);
+static int pbx_builtin_setamaflags(struct ast_channel *, const char *);
+static int pbx_builtin_ringing(struct ast_channel *, const char *);
+static int pbx_builtin_proceeding(struct ast_channel *, const char *);
+static int pbx_builtin_progress(struct ast_channel *, const char *);
+static int pbx_builtin_congestion(struct ast_channel *, const char *);
+static int pbx_builtin_busy(struct ast_channel *, const char *);
+static int pbx_builtin_noop(struct ast_channel *, const char *);
+static int pbx_builtin_gotoif(struct ast_channel *, const char *);
+static int pbx_builtin_gotoiftime(struct ast_channel *, const char *);
+static int pbx_builtin_execiftime(struct ast_channel *, const char *);
+static int pbx_builtin_saynumber(struct ast_channel *, const char *);
+static int pbx_builtin_saydigits(struct ast_channel *, const char *);
+static int pbx_builtin_saycharacters(struct ast_channel *, const char *);
+static int pbx_builtin_sayphonetic(struct ast_channel *, const char *);
static int matchcid(const char *cidpattern, const char *callerid);
-int pbx_builtin_setvar(struct ast_channel *, void *);
+int pbx_builtin_setvar(struct ast_channel *, const char *);
void log_match_char_tree(struct match_char *node, char *prefix); /* for use anywhere */
-int pbx_builtin_setvar_multiple(struct ast_channel *, void *);
-static int pbx_builtin_importvar(struct ast_channel *, void *);
+int pbx_builtin_setvar_multiple(struct ast_channel *, const char *);
+static int pbx_builtin_importvar(struct ast_channel *, const char *);
static void set_ext_pri(struct ast_channel *c, const char *exten, int pri);
static void new_find_extension(const char *str, struct scoreboard *score,
struct match_char *tree, int length, int spec, const char *callerid,
@@ -1083,7 +1083,7 @@ static AST_RWLIST_HEAD_STATIC(acf_root, ast_custom_function);
/*! \brief Declaration of builtin applications */
static struct pbx_builtin {
char name[AST_MAX_APP];
- int (*execute)(struct ast_channel *chan, void *data);
+ int (*execute)(struct ast_channel *chan, const char *data);
} builtins[] =
{
/* These applications are built into the PBX core and do not
@@ -1320,9 +1320,9 @@ int check_contexts(char *file, int line )
/*
\note This function is special. It saves the stack so that no matter
how many times it is called, it returns to the same place */
-int pbx_exec(struct ast_channel *c, /*!< Channel */
- struct ast_app *app, /*!< Application */
- void *data) /*!< Data for execution */
+int pbx_exec(struct ast_channel *c, /*!< Channel */
+ struct ast_app *app, /*!< Application */
+ const char *data) /*!< Data for execution */
{
int res;
struct ast_module_user *u = NULL;
@@ -3040,9 +3040,8 @@ static struct ast_datastore_info exception_store_info = {
.destroy = exception_store_free,
};
-int pbx_builtin_raise_exception(struct ast_channel *chan, void *vreason)
+int pbx_builtin_raise_exception(struct ast_channel *chan, const char *reason)
{
- const char *reason = vreason;
struct ast_datastore *ds = ast_channel_datastore_find(chan, &exception_store_info, NULL);
struct pbx_exception *exception = NULL;
@@ -5332,7 +5331,7 @@ int ast_context_unlockmacro(const char *context)
}
/*! \brief Dynamically register a new dial plan application */
-int ast_register_application2(const char *app, int (*execute)(struct ast_channel *, void *), const char *synopsis, const char *description, void *mod)
+int ast_register_application2(const char *app, int (*execute)(struct ast_channel *, const char *), const char *synopsis, const char *description, void *mod)
{
struct ast_app *tmp, *cur = NULL;
char tmps[80];
@@ -5757,7 +5756,7 @@ static char *handle_show_applications(struct ast_cli_entry *e, int cmd, struct a
int like = 0, describing = 0;
int total_match = 0; /* Number of matches in like clause */
int total_apps = 0; /* Number of apps registered */
- static char* choices[] = { "like", "describing", NULL };
+ static const char * const choices[] = { "like", "describing", NULL };
switch (cmd) {
case CLI_INIT:
@@ -6127,7 +6126,7 @@ static char *handle_show_dialplan(struct ast_cli_entry *e, int cmd, struct ast_c
if (ast_strlen_zero(exten))
exten = NULL;
} else { /* no '@' char, only context given */
- context = a->argv[2];
+ context = ast_strdupa(a->argv[2]);
}
if (ast_strlen_zero(context))
context = NULL;
@@ -6195,7 +6194,7 @@ static char *handle_debug_dialplan(struct ast_cli_entry *e, int cmd, struct ast_
if (ast_strlen_zero(exten))
exten = NULL;
} else { /* no '@' char, only context given */
- context = a->argv[2];
+ context = ast_strdupa(a->argv[2]);
}
if (ast_strlen_zero(context))
context = NULL;
@@ -6417,7 +6416,7 @@ static int manager_show_dialplan(struct mansession *s, const struct message *m)
return 0;
}
-static char mandescr_show_dialplan[] =
+static const char mandescr_show_dialplan[] =
"Description: Show dialplan contexts and extensions.\n"
"Be aware that showing the full dialplan may take a lot of capacity\n"
"Variables: \n"
@@ -7025,7 +7024,7 @@ int ast_context_add_include(const char *context, const char *include, const char
* return the index of the matching entry, starting from 1.
* If names is not supplied, try numeric values.
*/
-static int lookup_name(const char *s, char *const names[], int max)
+static int lookup_name(const char *s, const char * const names[], int max)
{
int i;
@@ -7048,7 +7047,7 @@ static int lookup_name(const char *s, char *const names[], int max)
/*! \brief helper function to return a range up to max (7, 12, 31 respectively).
* names, if supplied, is an array of names that should be mapped to numbers.
*/
-static unsigned get_range(char *src, int max, char *const names[], const char *msg)
+static unsigned get_range(char *src, int max, const char * const names[], const char *msg)
{
int start, end; /* start and ending position */
unsigned int mask = 0;
@@ -7151,7 +7150,7 @@ static void get_timerange(struct ast_timing *i, char *times)
return;
}
-static char *days[] =
+static const char * const days[] =
{
"sun",
"mon",
@@ -7163,7 +7162,7 @@ static char *days[] =
NULL,
};
-static char *months[] =
+static const char * const months[] =
{
"jan",
"feb",
@@ -8659,7 +8658,7 @@ void ast_context_destroy(struct ast_context *con, const char *registrar)
ast_unlock_contexts();
}
-static void wait_for_hangup(struct ast_channel *chan, void *data)
+static void wait_for_hangup(struct ast_channel *chan, const void *data)
{
int res;
struct ast_frame *f;
@@ -8684,7 +8683,7 @@ static void wait_for_hangup(struct ast_channel *chan, void *data)
/*!
* \ingroup applications
*/
-static int pbx_builtin_proceeding(struct ast_channel *chan, void *data)
+static int pbx_builtin_proceeding(struct ast_channel *chan, const char *data)
{
ast_indicate(chan, AST_CONTROL_PROCEEDING);
return 0;
@@ -8693,7 +8692,7 @@ static int pbx_builtin_proceeding(struct ast_channel *chan, void *data)
/*!
* \ingroup applications
*/
-static int pbx_builtin_progress(struct ast_channel *chan, void *data)
+static int pbx_builtin_progress(struct ast_channel *chan, const char *data)
{
ast_indicate(chan, AST_CONTROL_PROGRESS);
return 0;
@@ -8702,7 +8701,7 @@ static int pbx_builtin_progress(struct ast_channel *chan, void *data)
/*!
* \ingroup applications
*/
-static int pbx_builtin_ringing(struct ast_channel *chan, void *data)
+static int pbx_builtin_ringing(struct ast_channel *chan, const char *data)
{
ast_indicate(chan, AST_CONTROL_RINGING);
return 0;
@@ -8711,7 +8710,7 @@ static int pbx_builtin_ringing(struct ast_channel *chan, void *data)
/*!
* \ingroup applications
*/
-static int pbx_builtin_busy(struct ast_channel *chan, void *data)
+static int pbx_builtin_busy(struct ast_channel *chan, const char *data)
{
ast_indicate(chan, AST_CONTROL_BUSY);
/* Don't change state of an UP channel, just indicate
@@ -8727,7 +8726,7 @@ static int pbx_builtin_busy(struct ast_channel *chan, void *data)
/*!
* \ingroup applications
*/
-static int pbx_builtin_congestion(struct ast_channel *chan, void *data)
+static int pbx_builtin_congestion(struct ast_channel *chan, const char *data)
{
ast_indicate(chan, AST_CONTROL_CONGESTION);
/* Don't change state of an UP channel, just indicate
@@ -8741,7 +8740,7 @@ static int pbx_builtin_congestion(struct ast_channel *chan, void *data)
/*!
* \ingroup applications
*/
-static int pbx_builtin_answer(struct ast_channel *chan, void *data)
+static int pbx_builtin_answer(struct ast_channel *chan, const char *data)
{
int delay = 0;
int answer_cdr = 1;
@@ -8773,9 +8772,9 @@ static int pbx_builtin_answer(struct ast_channel *chan, void *data)
return __ast_answer(chan, delay, answer_cdr);
}
-static int pbx_builtin_incomplete(struct ast_channel *chan, void *data)
+static int pbx_builtin_incomplete(struct ast_channel *chan, const char *data)
{
- char *options = data;
+ const char *options = data;
int answer = 1;
/* Some channels can receive DTMF in unanswered state; some cannot */
@@ -8803,7 +8802,7 @@ AST_APP_OPTIONS(resetcdr_opts, {
/*!
* \ingroup applications
*/
-static int pbx_builtin_resetcdr(struct ast_channel *chan, void *data)
+static int pbx_builtin_resetcdr(struct ast_channel *chan, const char *data)
{
char *args;
struct ast_flags flags = { 0 };
@@ -8821,7 +8820,7 @@ static int pbx_builtin_resetcdr(struct ast_channel *chan, void *data)
/*!
* \ingroup applications
*/
-static int pbx_builtin_setamaflags(struct ast_channel *chan, void *data)
+static int pbx_builtin_setamaflags(struct ast_channel *chan, const char *data)
{
/* Copy the AMA Flags as specified */
ast_cdr_setamaflags(chan, data ? data : "");
@@ -8831,7 +8830,7 @@ static int pbx_builtin_setamaflags(struct ast_channel *chan, void *data)
/*!
* \ingroup applications
*/
-static int pbx_builtin_hangup(struct ast_channel *chan, void *data)
+static int pbx_builtin_hangup(struct ast_channel *chan, const char *data)
{
if (!ast_strlen_zero(data)) {
int cause;
@@ -8861,7 +8860,7 @@ static int pbx_builtin_hangup(struct ast_channel *chan, void *data)
/*!
* \ingroup applications
*/
-static int pbx_builtin_gotoiftime(struct ast_channel *chan, void *data)
+static int pbx_builtin_gotoiftime(struct ast_channel *chan, const char *data)
{
char *s, *ts, *branch1, *branch2, *branch;
struct ast_timing timing;
@@ -8896,7 +8895,7 @@ static int pbx_builtin_gotoiftime(struct ast_channel *chan, void *data)
/*!
* \ingroup applications
*/
-static int pbx_builtin_execiftime(struct ast_channel *chan, void *data)
+static int pbx_builtin_execiftime(struct ast_channel *chan, const char *data)
{
char *s, *appname;
struct ast_timing timing;
@@ -8950,7 +8949,7 @@ static int pbx_builtin_execiftime(struct ast_channel *chan, void *data)
/*!
* \ingroup applications
*/
-static int pbx_builtin_wait(struct ast_channel *chan, void *data)
+static int pbx_builtin_wait(struct ast_channel *chan, const char *data)
{
double s;
int ms;
@@ -8966,7 +8965,7 @@ static int pbx_builtin_wait(struct ast_channel *chan, void *data)
/*!
* \ingroup applications
*/
-static int pbx_builtin_waitexten(struct ast_channel *chan, void *data)
+static int pbx_builtin_waitexten(struct ast_channel *chan, const char *data)
{
int ms, res;
double s;
@@ -9035,7 +9034,7 @@ static int pbx_builtin_waitexten(struct ast_channel *chan, void *data)
/*!
* \ingroup applications
*/
-static int pbx_builtin_background(struct ast_channel *chan, void *data)
+static int pbx_builtin_background(struct ast_channel *chan, const char *data)
{
int res = 0;
int mres = 0;
@@ -9133,7 +9132,7 @@ done:
/*! Goto
* \ingroup applications
*/
-static int pbx_builtin_goto(struct ast_channel *chan, void *data)
+static int pbx_builtin_goto(struct ast_channel *chan, const char *data)
{
int res = ast_parseable_goto(chan, data);
if (!res)
@@ -9302,7 +9301,7 @@ void pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const
ast_rwlock_unlock(&globalslock);
}
-int pbx_builtin_setvar(struct ast_channel *chan, void *data)
+int pbx_builtin_setvar(struct ast_channel *chan, const char *data)
{
char *name, *value, *mydata;
@@ -9325,7 +9324,7 @@ int pbx_builtin_setvar(struct ast_channel *chan, void *data)
return(0);
}
-int pbx_builtin_setvar_multiple(struct ast_channel *chan, void *vdata)
+int pbx_builtin_setvar_multiple(struct ast_channel *chan, const char *vdata)
{
char *data;
int x;
@@ -9361,7 +9360,7 @@ int pbx_builtin_setvar_multiple(struct ast_channel *chan, void *vdata)
return 0;
}
-int pbx_builtin_importvar(struct ast_channel *chan, void *data)
+int pbx_builtin_importvar(struct ast_channel *chan, const char *data)
{
char *name;
char *value;
@@ -9398,7 +9397,7 @@ int pbx_builtin_importvar(struct ast_channel *chan, void *data)
return(0);
}
-static int pbx_builtin_noop(struct ast_channel *chan, void *data)
+static int pbx_builtin_noop(struct ast_channel *chan, const char *data)
{
return 0;
}
@@ -9425,7 +9424,7 @@ int pbx_checkcondition(const char *condition)
}
}
-static int pbx_builtin_gotoif(struct ast_channel *chan, void *data)
+static int pbx_builtin_gotoif(struct ast_channel *chan, const char *data)
{
char *condition, *branch1, *branch2, *branch;
char *stringp;
@@ -9449,7 +9448,7 @@ static int pbx_builtin_gotoif(struct ast_channel *chan, void *data)
return pbx_builtin_goto(chan, branch);
}
-static int pbx_builtin_saynumber(struct ast_channel *chan, void *data)
+static int pbx_builtin_saynumber(struct ast_channel *chan, const char *data)
{
char tmp[256];
char *number = tmp;
@@ -9477,7 +9476,7 @@ static int pbx_builtin_saynumber(struct ast_channel *chan, void *data)
return 0;
}
-static int pbx_builtin_saydigits(struct ast_channel *chan, void *data)
+static int pbx_builtin_saydigits(struct ast_channel *chan, const char *data)
{
int res = 0;
@@ -9486,7 +9485,7 @@ static int pbx_builtin_saydigits(struct ast_channel *chan, void *data)
return res;
}
-static int pbx_builtin_saycharacters(struct ast_channel *chan, void *data)
+static int pbx_builtin_saycharacters(struct ast_channel *chan, const char *data)
{
int res = 0;
@@ -9495,7 +9494,7 @@ static int pbx_builtin_saycharacters(struct ast_channel *chan, void *data)
return res;
}
-static int pbx_builtin_sayphonetic(struct ast_channel *chan, void *data)
+static int pbx_builtin_sayphonetic(struct ast_channel *chan, const char *data)
{
int res = 0;
diff --git a/main/taskprocessor.c b/main/taskprocessor.c
index 9aa86ce00..0de97e503 100644
--- a/main/taskprocessor.c
+++ b/main/taskprocessor.c
@@ -62,7 +62,7 @@ struct tps_taskprocessor_stats {
/*! \brief A ast_taskprocessor structure is a singleton by name */
struct ast_taskprocessor {
/*! \brief Friendly name of the taskprocessor */
- char *name;
+ const char *name;
/*! \brief Thread poll condition */
ast_cond_t poll_cond;
/*! \brief Taskprocessor thread */
@@ -189,7 +189,7 @@ static int tps_ping_handler(void *datap)
static char *cli_tps_ping(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct timeval begin, end, delta;
- char *name;
+ const char *name;
struct timeval when;
struct timespec ts;
struct ast_taskprocessor *tps = NULL;
@@ -366,7 +366,7 @@ static void tps_taskprocessor_destroy(void *tps)
ast_free(t->stats);
t->stats = NULL;
}
- ast_free(t->name);
+ ast_free((char *) t->name);
}
/* pop the front task and return it */
@@ -404,7 +404,7 @@ const char *ast_taskprocessor_name(struct ast_taskprocessor *tps)
/* Provide a reference to a taskprocessor. Create the taskprocessor if necessary, but don't
* create the taskprocessor if we were told via ast_tps_options to return a reference only
* if it already exists */
-struct ast_taskprocessor *ast_taskprocessor_get(char *name, enum ast_tps_options create)
+struct ast_taskprocessor *ast_taskprocessor_get(const char *name, enum ast_tps_options create)
{
struct ast_taskprocessor *p, tmp_tps = {
.name = name,
diff --git a/main/udptl.c b/main/udptl.c
index 478ce8f5f..dfe89e126 100644
--- a/main/udptl.c
+++ b/main/udptl.c
@@ -1134,7 +1134,7 @@ static char *handle_cli_udptl_set_debug(struct ast_cli_entry *e, int cmd, struct
if (strncasecmp(a->argv[3], "ip", 2))
return CLI_SHOWUSAGE;
port = 0;
- arg = a->argv[4];
+ arg = ast_strdupa(a->argv[4]);
p = strstr(arg, ":");
if (p) {
*p = '\0';
diff --git a/main/ulaw.c b/main/ulaw.c
index 18a118f60..0be633c4c 100644
--- a/main/ulaw.c
+++ b/main/ulaw.c
@@ -177,7 +177,7 @@ void ast_ulaw_init(void)
#ifndef G711_NEW_ALGORITHM
for (i = 0;i < 256;i++) {
short mu,e,f,y;
- static short etab[]={0,132,396,924,1980,4092,8316,16764};
+ static const short etab[]={0,132,396,924,1980,4092,8316,16764};
mu = 255-i;
e = (mu & 0x70)/16;
diff --git a/main/utils.c b/main/utils.c
index e724160f4..59a29ce5a 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -227,7 +227,7 @@ struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp)
}
/*! \brief Produce 32 char MD5 hash of value. */
-void ast_md5_hash(char *output, char *input)
+void ast_md5_hash(char *output, const char *input)
{
struct MD5Context md5;
unsigned char digest[16];
@@ -235,7 +235,7 @@ void ast_md5_hash(char *output, char *input)
int x;
MD5Init(&md5);
- MD5Update(&md5, (unsigned char *)input, strlen(input));
+ MD5Update(&md5, (const unsigned char *) input, strlen(input));
MD5Final(digest, &md5);
ptr = output;
for (x = 0; x < 16; x++)
@@ -243,7 +243,7 @@ void ast_md5_hash(char *output, char *input)
}
/*! \brief Produce 40 char SHA1 hash of value. */
-void ast_sha1_hash(char *output, char *input)
+void ast_sha1_hash(char *output, const char *input)
{
struct SHA1Context sha;
char *ptr;
@@ -1446,7 +1446,7 @@ char *ast_process_quotes_and_slashes(char *start, char find, char replace_with)
return dataPut;
}
-void ast_join(char *s, size_t len, char * const w[])
+void ast_join(char *s, size_t len, const char * const w[])
{
int x, ofs = 0;
const char *src;