Kill off red blobs in most of main/*

Everything still compiled after making these changes, so I assume these
whitespace-only changes didn't break anything (and shouldn't have).


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360190 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kinsey Moore 2012-03-22 19:51:16 +00:00
parent 1d1c28ac4b
commit c5b3db1956
59 changed files with 1339 additions and 1339 deletions

View File

@ -168,7 +168,7 @@ int ast_app_dtget(struct ast_channel *chan, const char *context, char *collect,
* \param prompt The file to stream to the channel
* \param s The string to read in to. Must be at least the size of your length
* \param maxlen How many digits to read (maximum)
* \param timeout set timeout to 0 for "standard" timeouts. Set timeout to -1 for
* \param timeout set timeout to 0 for "standard" timeouts. Set timeout to -1 for
* "ludicrous time" (essentially never times out) */
enum ast_getdata_result ast_app_getdata(struct ast_channel *c, const char *prompt, char *s, int maxlen, int timeout)
{
@ -1605,7 +1605,7 @@ int ast_unlock_path(const char *path)
return r;
}
int ast_record_review(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, const char *path)
int ast_record_review(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, const char *path)
{
int silencethreshold;
int maxsilence = 0;

View File

@ -23,18 +23,18 @@
*
* \par Developer Documentation for Asterisk
*
* This is the main developer documentation for Asterisk. It is
* generated by running "make progdocs" from the Asterisk source tree.
* This is the main developer documentation for Asterisk. It is
* generated by running "make progdocs" from the Asterisk source tree.
*
* In addition to the information available on the Asterisk source code,
* please see the appendices for information on coding guidelines,
* In addition to the information available on the Asterisk source code,
* please see the appendices for information on coding guidelines,
* release management, commit policies, and more.
*
* \arg \ref AsteriskArchitecture
*
* \par Additional documentation
* \arg \ref Licensing
* \arg \ref DevDoc
* \arg \ref DevDoc
* \arg \ref ConfigFiles
*
* \section copyright Copyright and Author
@ -56,7 +56,7 @@
/*! \file
\brief Top level source file for Asterisk - the Open Source PBX. Implementation
of PBX core functions and CLI interface.
*/
#include "asterisk.h"
@ -170,7 +170,7 @@ int daemon(int, int); /* defined in libresolv of all places */
/*! \defgroup main_options Main Configuration Options
* \brief Main configuration options from asterisk.conf or OS command line on starting Asterisk.
* \arg \ref Config_ast "asterisk.conf"
* \note Some of them can be changed in the CLI
* \note Some of them can be changed in the CLI
*/
/*! @{ */
@ -323,7 +323,7 @@ void ast_register_file_version(const char *file, const char *version)
work = ast_strdupa(version);
work = ast_strip(ast_strip_quoted(work, "$", "$"));
version_length = strlen(work) + 1;
if (!(new = ast_calloc(1, sizeof(*new) + version_length)))
return;
@ -385,8 +385,8 @@ const char *ast_file_version_find(const char *file)
if (iterator)
return iterator->version;
return NULL;
}
}
struct thread_list_t {
@ -399,7 +399,7 @@ struct thread_list_t {
static AST_RWLIST_HEAD_STATIC(thread_list, thread_list_t);
void ast_register_thread(char *name)
{
{
struct thread_list_t *new = ast_calloc(1, sizeof(*new));
if (!new)
@ -459,7 +459,7 @@ static char *handle_show_settings(struct ast_cli_entry *e, int cmd, struct ast_c
else
ast_cli(a->fd, " Maximum calls: Not set\n");
if (option_maxfiles)
ast_cli(a->fd, " Maximum open file handles: %d\n", option_maxfiles);
ast_cli(a->fd, " Maximum open file handles: %d\n", option_maxfiles);
else
ast_cli(a->fd, " Maximum open file handles: Not set\n");
ast_cli(a->fd, " Verbosity: %d\n", option_verbose);
@ -522,7 +522,7 @@ static char *handle_show_threads(struct ast_cli_entry *e, int cmd, struct ast_cl
switch (cmd) {
case CLI_INIT:
e->command = "core show threads";
e->usage =
e->usage =
"Usage: core show threads\n"
" List threads currently active in the system.\n";
return NULL;
@ -535,7 +535,7 @@ static char *handle_show_threads(struct ast_cli_entry *e, int cmd, struct ast_cl
ast_cli(a->fd, "%p %d %s\n", (void *)cur->id, cur->lwp, cur->name);
count++;
}
AST_RWLIST_UNLOCK(&thread_list);
AST_RWLIST_UNLOCK(&thread_list);
ast_cli(a->fd, "%d threads listed.\n", count);
return CLI_SUCCESS;
}
@ -754,7 +754,7 @@ int64_t ast_profile(int i, int64_t delta)
#elif defined(linux)
static __inline uint64_t
rdtsc(void)
{
{
uint64_t rv;
__asm __volatile(".byte 0x0f, 0x31" : "=A" (rv));
@ -877,7 +877,7 @@ static char *handle_show_version_files(struct ast_cli_entry *e, int cmd, struct
switch (cmd) {
case CLI_INIT:
e->command = "core show file version [like]";
e->usage =
e->usage =
"Usage: core show file version [like <pattern>]\n"
" Lists the revision numbers of the files used to build this copy of Asterisk.\n"
" Optional regular expression pattern is used to filter the file list.\n";
@ -954,7 +954,7 @@ int ast_register_atexit(void (*func)(void))
ae->func = func;
ast_unregister_atexit(func);
ast_unregister_atexit(func);
AST_RWLIST_WRLOCK(&atexits);
AST_RWLIST_INSERT_HEAD(&atexits, ae, list);
@ -1056,7 +1056,7 @@ int ast_safe_system(const char *s)
pid = fork();
#else
pid = vfork();
#endif
#endif
if (pid == 0) {
#ifdef HAVE_CAP
@ -1082,7 +1082,7 @@ int ast_safe_system(const char *s)
if (res > -1) {
res = WIFEXITED(status) ? WEXITSTATUS(status) : -1;
break;
} else if (errno != EINTR)
} else if (errno != EINTR)
break;
}
} else {
@ -1149,7 +1149,7 @@ static void ast_network_puts_mutable(const char *string, int level)
if (consoles[x].mute)
continue;
if (consoles[x].fd > -1) {
if (!consoles[x].levels[level])
if (!consoles[x].levels[level])
fdprint(consoles[x].p[1], string);
}
}
@ -1173,7 +1173,7 @@ static void ast_network_puts(const char *string)
{
int x;
for (x = 0; x < AST_MAX_CONNECTS; x++) {
if (consoles[x].fd > -1)
if (consoles[x].fd > -1)
fdprint(consoles[x].p[1], string);
}
}
@ -1262,7 +1262,7 @@ static void *netconsole(void *vconsole)
char tmp[512];
int res;
struct pollfd fds[2];
if (gethostname(hostname, sizeof(hostname)-1))
ast_copy_string(hostname, "<Unknown>", sizeof(hostname));
snprintf(tmp, sizeof(tmp), "%s/%ld/%s\n", hostname, (long)ast_mainpid, ast_get_version());
@ -1311,7 +1311,7 @@ static void *netconsole(void *vconsole)
close(con->p[0]);
close(con->p[1]);
con->fd = -1;
return NULL;
}
@ -1400,14 +1400,14 @@ static int ast_makesocket(void)
uid_t uid = -1;
gid_t gid = -1;
for (x = 0; x < AST_MAX_CONNECTS; x++)
for (x = 0; x < AST_MAX_CONNECTS; x++)
consoles[x].fd = -1;
unlink(ast_config_AST_SOCKET);
ast_socket = socket(PF_LOCAL, SOCK_STREAM, 0);
if (ast_socket < 0) {
ast_log(LOG_WARNING, "Unable to create control socket: %s\n", strerror(errno));
return -1;
}
}
memset(&sunaddr, 0, sizeof(sunaddr));
sunaddr.sun_family = AF_LOCAL;
ast_copy_string(sunaddr.sun_path, ast_config_AST_SOCKET, sizeof(sunaddr.sun_path));
@ -1438,7 +1438,7 @@ static int ast_makesocket(void)
else
uid = pw->pw_uid;
}
if (!ast_strlen_zero(ast_config_AST_CTL_GROUP)) {
struct group *grp;
if ((grp = getgrnam(ast_config_AST_CTL_GROUP)) == NULL)
@ -1486,8 +1486,8 @@ static int ast_tryconnect(void)
/*! \brief Urgent handler
Called by soft_hangup to interrupt the poll, read, or other
system call. We don't actually need to do anything though.
Remember: Cannot EVER ast_log from within a signal handler
system call. We don't actually need to do anything though.
Remember: Cannot EVER ast_log from within a signal handler
*/
static void _urg_handler(int num)
{
@ -1529,7 +1529,7 @@ static void _child_handler(int sig)
*/
for (n = 0; wait4(-1, &status, WNOHANG, NULL) > 0; n++)
;
if (n == 0 && option_debug)
if (n == 0 && option_debug)
printf("Huh? Child handler, but nobody there?\n");
errno = save_errno;
}
@ -1543,22 +1543,22 @@ static struct sigaction child_handler = {
static void set_ulimit(int value)
{
struct rlimit l = {0, 0};
if (value <= 0) {
ast_log(LOG_WARNING, "Unable to change max files open to invalid value %i\n",value);
return;
}
l.rlim_cur = value;
l.rlim_max = value;
if (setrlimit(RLIMIT_NOFILE, &l)) {
ast_log(LOG_WARNING, "Unable to disable core size resource limit: %s\n",strerror(errno));
return;
}
ast_log(LOG_NOTICE, "Setting max files open to %d\n",value);
return;
}
@ -1582,7 +1582,7 @@ int ast_set_priority(int pri)
struct sched_param sched;
memset(&sched, 0, sizeof(sched));
#ifdef __linux__
if (pri) {
if (pri) {
sched.sched_priority = 10;
if (sched_setscheduler(0, SCHED_RR, &sched)) {
ast_log(LOG_WARNING, "Unable to set high priority\n");
@ -1614,7 +1614,7 @@ static void ast_run_atexits(void)
struct ast_atexit *ae;
AST_RWLIST_RDLOCK(&atexits);
AST_RWLIST_TRAVERSE(&atexits, ae, list) {
if (ae->func)
if (ae->func)
ae->func();
}
AST_RWLIST_UNLOCK(&atexits);
@ -1756,7 +1756,7 @@ static void really_quit(int num, shutdown_nice_t niceness, int restart)
/* close logger */
close_logger();
/* If there is a consolethread running send it a SIGHUP
/* If there is a consolethread running send it a SIGHUP
so it can execvp, otherwise we can do it ourselves */
if ((consolethread != AST_PTHREADT_NULL) && (consolethread != pthread_self())) {
pthread_kill(consolethread, SIGHUP);
@ -1764,7 +1764,7 @@ static void really_quit(int num, shutdown_nice_t niceness, int restart)
sleep(2);
} else
execvp(_argv[0], _argv);
} else {
/* close logger */
close_logger();
@ -1846,7 +1846,7 @@ static int ast_all_zeros(char *s)
while (*s) {
if (*s > 32)
return 0;
s++;
s++;
}
return 1;
}
@ -1865,7 +1865,7 @@ static void consolehandler(char *s)
ast_safe_system(s+1);
else
ast_safe_system(getenv("SHELL") ? getenv("SHELL") : "/bin/sh");
} else
} else
ast_cli_command(STDOUT_FILENO, s);
}
@ -1925,7 +1925,7 @@ static char *handle_version(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
switch (cmd) {
case CLI_INIT:
e->command = "core show version";
e->usage =
e->usage =
"Usage: core show version\n"
" Shows Asterisk version information.\n";
return NULL;
@ -1956,7 +1956,7 @@ static char *handle_stop_now(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
switch (cmd) {
case CLI_INIT:
e->command = "core stop now";
e->usage =
e->usage =
"Usage: core stop now\n"
" Shuts down a running Asterisk immediately, hanging up all active calls .\n";
return NULL;
@ -1975,7 +1975,7 @@ static char *handle_stop_gracefully(struct ast_cli_entry *e, int cmd, struct ast
switch (cmd) {
case CLI_INIT:
e->command = "core stop gracefully";
e->usage =
e->usage =
"Usage: core stop gracefully\n"
" Causes Asterisk to not accept new calls, and exit when all\n"
" active calls have terminated normally.\n";
@ -1995,7 +1995,7 @@ static char *handle_stop_when_convenient(struct ast_cli_entry *e, int cmd, struc
switch (cmd) {
case CLI_INIT:
e->command = "core stop when convenient";
e->usage =
e->usage =
"Usage: core stop when convenient\n"
" Causes Asterisk to perform a shutdown when all active calls have ended.\n";
return NULL;
@ -2015,7 +2015,7 @@ static char *handle_restart_now(struct ast_cli_entry *e, int cmd, struct ast_cli
switch (cmd) {
case CLI_INIT:
e->command = "core restart now";
e->usage =
e->usage =
"Usage: core restart now\n"
" Causes Asterisk to hangup all calls and exec() itself performing a cold\n"
" restart.\n";
@ -2035,7 +2035,7 @@ static char *handle_restart_gracefully(struct ast_cli_entry *e, int cmd, struct
switch (cmd) {
case CLI_INIT:
e->command = "core restart gracefully";
e->usage =
e->usage =
"Usage: core restart gracefully\n"
" Causes Asterisk to stop accepting new calls and exec() itself performing a cold\n"
" restart when all active calls have ended.\n";
@ -2055,7 +2055,7 @@ static char *handle_restart_when_convenient(struct ast_cli_entry *e, int cmd, st
switch (cmd) {
case CLI_INIT:
e->command = "core restart when convenient";
e->usage =
e->usage =
"Usage: core restart when convenient\n"
" Causes Asterisk to perform a cold restart when all active calls have ended.\n";
return NULL;
@ -2077,7 +2077,7 @@ static char *handle_abort_shutdown(struct ast_cli_entry *e, int cmd, struct ast_
switch (cmd) {
case CLI_INIT:
e->command = "core abort shutdown";
e->usage =
e->usage =
"Usage: core abort shutdown\n"
" Causes Asterisk to abort an executing shutdown or restart, and resume normal\n"
" call operations.\n";
@ -2107,7 +2107,7 @@ static char *handle_bang(struct ast_cli_entry *e, int cmd, struct ast_cli_args *
switch (cmd) {
case CLI_INIT:
e->command = "!";
e->usage =
e->usage =
"Usage: !<command>\n"
" Executes a given shell command\n";
return NULL;
@ -2147,7 +2147,7 @@ static char *show_warranty(struct ast_cli_entry *e, int cmd, struct ast_cli_args
switch (cmd) {
case CLI_INIT:
e->command = "core show warranty";
e->usage =
e->usage =
"Usage: core show warranty\n"
" Shows the warranty (if any) for this copy of Asterisk.\n";
return NULL;
@ -2184,7 +2184,7 @@ static char *show_license(struct ast_cli_entry *e, int cmd, struct ast_cli_args
switch (cmd) {
case CLI_INIT:
e->command = "core show license";
e->usage =
e->usage =
"Usage: core show license\n"
" Shows the license(s) for this copy of Asterisk.\n";
return NULL;
@ -2206,7 +2206,7 @@ static struct ast_cli_entry cli_asterisk[] = {
AST_CLI_DEFINE(handle_stop_now, "Shut down Asterisk immediately"),
AST_CLI_DEFINE(handle_stop_gracefully, "Gracefully shut down Asterisk"),
AST_CLI_DEFINE(handle_stop_when_convenient, "Shut down Asterisk at empty call volume"),
AST_CLI_DEFINE(handle_restart_now, "Restart Asterisk immediately"),
AST_CLI_DEFINE(handle_restart_now, "Restart Asterisk immediately"),
AST_CLI_DEFINE(handle_restart_gracefully, "Restart Asterisk gracefully"),
AST_CLI_DEFINE(handle_restart_when_convenient, "Restart Asterisk at empty call volume"),
AST_CLI_DEFINE(show_warranty, "Show the warranty (if any) for this copy of Asterisk"),
@ -2300,7 +2300,7 @@ static int ast_el_read_char(EditLine *editline, char *cp)
WELCOME_MESSAGE;
if (!ast_opt_mute)
fdsend(ast_consock, "logger mute silent");
else
else
printf("log and verbose output currently muted ('logger mute' to unmute)\n");
break;
} else
@ -2487,7 +2487,7 @@ static char *cli_prompt(EditLine *editline)
ast_str_set(&prompt, 0, "%s", ASTERISK_PROMPT);
}
return ast_str_buffer(prompt);
return ast_str_buffer(prompt);
}
static char **ast_el_strtoarr(char *buf)
@ -2619,7 +2619,7 @@ static char *cli_complete(EditLine *editline, int ch)
len = lf->cursor - ptr;
if (ast_opt_remote) {
snprintf(buf, sizeof(buf), "_COMMAND NUMMATCHES \"%s\" \"%s\"", lf->buffer, ptr);
snprintf(buf, sizeof(buf), "_COMMAND NUMMATCHES \"%s\" \"%s\"", lf->buffer, ptr);
fdsend(ast_consock, buf);
res = read(ast_consock, buf, sizeof(buf) - 1);
buf[res] = '\0';
@ -2628,19 +2628,19 @@ static char *cli_complete(EditLine *editline, int ch)
if (nummatches > 0) {
char *mbuf;
int mlen = 0, maxmbuf = 2048;
/* Start with a 2048 byte buffer */
/* Start with a 2048 byte buffer */
if (!(mbuf = ast_malloc(maxmbuf))) {
lf->cursor[0] = savechr;
return (char *)(CC_ERROR);
}
snprintf(buf, sizeof(buf), "_COMMAND MATCHESARRAY \"%s\" \"%s\"", lf->buffer, ptr);
snprintf(buf, sizeof(buf), "_COMMAND MATCHESARRAY \"%s\" \"%s\"", lf->buffer, ptr);
fdsend(ast_consock, buf);
res = 0;
mbuf[0] = '\0';
while (!strstr(mbuf, AST_CLI_COMPLETE_EOF) && res != -1) {
if (mlen + 1024 > maxmbuf) {
/* Every step increment buffer 1024 bytes */
maxmbuf += 1024;
maxmbuf += 1024;
if (!(mbuf = ast_realloc(mbuf, maxmbuf))) {
lf->cursor[0] = savechr;
return (char *)(CC_ERROR);
@ -2694,7 +2694,7 @@ static char *cli_complete(EditLine *editline, int ch)
fprintf(stdout, "\n");
ast_cli_display_match_list(matches, nummatches, maxlen);
retval = CC_REDISPLAY;
} else {
} else {
el_insertstr(editline," ");
retval = CC_REFRESH;
}
@ -2728,7 +2728,7 @@ static int ast_el_initialize(void)
el = el_init("asterisk", stdin, stdout, stderr);
el_set(el, EL_PROMPT, cli_prompt);
el_set(el, EL_EDITMODE, 1);
el_set(el, EL_EDITMODE, 1);
el_set(el, EL_EDITOR, editor);
el_hist = history_init();
if (!el || !el_hist)
@ -2928,7 +2928,7 @@ static void ast_remotecontrol(char *data)
ast_verbose("Connected to Asterisk %s currently running on %s (pid = %d)\n", version, hostname, pid);
remotehostname = hostname;
if (getenv("HOME"))
if (getenv("HOME"))
snprintf(filename, sizeof(filename), "%s/.asterisk_history", getenv("HOME"));
if (el_hist == NULL || el == NULL)
ast_el_initialize();
@ -3009,7 +3009,7 @@ static int show_cli_help(void)
return 0;
}
static void ast_readconfig(void)
static void ast_readconfig(void)
{
struct ast_config *cfg;
struct ast_variable *v;
@ -3025,14 +3025,14 @@ static void ast_readconfig(void)
cfg = ast_config_load2(ast_config_AST_CONFIG_FILE, "" /* core, can't reload */, config_flags);
if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID)
ast_log(LOG_WARNING, "Unable to open specified master config file '%s', using built-in defaults\n", ast_config_AST_CONFIG_FILE);
} else
} else
cfg = ast_config_load2(config, "" /* core, can't reload */, config_flags);
/* init with buildtime config */
ast_copy_string(cfg_paths.config_dir, DEFAULT_CONFIG_DIR, sizeof(cfg_paths.config_dir));
ast_copy_string(cfg_paths.spool_dir, DEFAULT_SPOOL_DIR, sizeof(cfg_paths.spool_dir));
ast_copy_string(cfg_paths.module_dir, DEFAULT_MODULE_DIR, sizeof(cfg_paths.module_dir));
snprintf(cfg_paths.monitor_dir, sizeof(cfg_paths.monitor_dir), "%s/monitor", cfg_paths.spool_dir);
snprintf(cfg_paths.monitor_dir, sizeof(cfg_paths.monitor_dir), "%s/monitor", cfg_paths.spool_dir);
ast_copy_string(cfg_paths.var_dir, DEFAULT_VAR_DIR, sizeof(cfg_paths.var_dir));
ast_copy_string(cfg_paths.data_dir, DEFAULT_DATA_DIR, sizeof(cfg_paths.data_dir));
ast_copy_string(cfg_paths.log_dir, DEFAULT_LOG_DIR, sizeof(cfg_paths.log_dir));
@ -3197,15 +3197,15 @@ static void ast_readconfig(void)
ast_language_is_prefix = ast_true(v->value);
} else if (!strcasecmp(v->name, "defaultlanguage")) {
ast_copy_string(defaultlanguage, v->value, MAX_LANGUAGE);
} else if (!strcasecmp(v->name, "lockmode")) {
if (!strcasecmp(v->value, "lockfile")) {
ast_set_lock_type(AST_LOCK_TYPE_LOCKFILE);
} else if (!strcasecmp(v->value, "flock")) {
ast_set_lock_type(AST_LOCK_TYPE_FLOCK);
} else {
} else if (!strcasecmp(v->name, "lockmode")) {
if (!strcasecmp(v->value, "lockfile")) {
ast_set_lock_type(AST_LOCK_TYPE_LOCKFILE);
} else if (!strcasecmp(v->value, "flock")) {
ast_set_lock_type(AST_LOCK_TYPE_FLOCK);
} else {
ast_log(LOG_WARNING, "'%s' is not a valid setting for the lockmode option, "
"defaulting to 'lockfile'\n", v->value);
ast_set_lock_type(AST_LOCK_TYPE_LOCKFILE);
ast_set_lock_type(AST_LOCK_TYPE_LOCKFILE);
}
#if defined(HAVE_SYSINFO)
} else if (!strcasecmp(v->name, "minmemfree")) {
@ -3398,7 +3398,7 @@ int main(int argc, char *argv[])
ast_fd_init();
ast_pbx_init();
if (getenv("HOME"))
if (getenv("HOME"))
snprintf(filename, sizeof(filename), "%s/.asterisk_history", getenv("HOME"));
/* Check for options */
while ((c = getopt(argc, argv, "BC:cde:FfG:ghIiL:M:mnpqRrs:TtU:VvWXx:")) != -1) {
@ -3524,7 +3524,7 @@ int main(int argc, char *argv[])
WELCOME_MESSAGE;
}
if (ast_opt_console && !option_verbose)
if (ast_opt_console && !option_verbose)
ast_verbose("[ Booting...\n");
/* For remote connections, change the name of the remote connection.
@ -3750,7 +3750,7 @@ int main(int argc, char *argv[])
/* custom config setup */
register_config_cli();
read_config_maps();
if (ast_opt_console) {
if (el_hist == NULL || el == NULL)
ast_el_initialize();

View File

@ -142,7 +142,7 @@ static inline size_t __ast_sizeof_region(void *ptr)
int hash = HASH(ptr);
struct ast_region *reg;
size_t len = 0;
ast_mutex_lock(&reglock);
for (reg = regions[hash]; reg; reg = reg->next) {
if (reg->data == ptr) {
@ -191,42 +191,42 @@ static void __ast_free_region(void *ptr, const char *file, int lineno, const cha
}
free(reg);
} else {
astmm_log("WARNING: Freeing unused memory at %p, in %s of %s, line %d\n",
astmm_log("WARNING: Freeing unused memory at %p, in %s of %s, line %d\n",
ptr, func, file, lineno);
}
}
void *__ast_calloc(size_t nmemb, size_t size, const char *file, int lineno, const char *func)
void *__ast_calloc(size_t nmemb, size_t size, const char *file, int lineno, const char *func)
{
void *ptr;
if ((ptr = __ast_alloc_region(size * nmemb, FUNC_CALLOC, file, lineno, func, 0)))
if ((ptr = __ast_alloc_region(size * nmemb, FUNC_CALLOC, file, lineno, func, 0)))
memset(ptr, 0, size * nmemb);
return ptr;
}
void *__ast_calloc_cache(size_t nmemb, size_t size, const char *file, int lineno, const char *func)
void *__ast_calloc_cache(size_t nmemb, size_t size, const char *file, int lineno, const char *func)
{
void *ptr;
if ((ptr = __ast_alloc_region(size * nmemb, FUNC_CALLOC, file, lineno, func, 1)))
if ((ptr = __ast_alloc_region(size * nmemb, FUNC_CALLOC, file, lineno, func, 1)))
memset(ptr, 0, size * nmemb);
return ptr;
}
void *__ast_malloc(size_t size, const char *file, int lineno, const char *func)
void *__ast_malloc(size_t size, const char *file, int lineno, const char *func)
{
return __ast_alloc_region(size, FUNC_MALLOC, file, lineno, func, 0);
}
void __ast_free(void *ptr, const char *file, int lineno, const char *func)
void __ast_free(void *ptr, const char *file, int lineno, const char *func)
{
__ast_free_region(ptr, file, lineno, func);
}
void *__ast_realloc(void *ptr, size_t size, const char *file, int lineno, const char *func)
void *__ast_realloc(void *ptr, size_t size, const char *file, int lineno, const char *func)
{
void *tmp;
size_t len = 0;
@ -246,11 +246,11 @@ void *__ast_realloc(void *ptr, size_t size, const char *file, int lineno, const
memcpy(tmp, ptr, len);
__ast_free_region(ptr, file, lineno, func);
}
return tmp;
}
char *__ast_strdup(const char *s, const char *file, int lineno, const char *func)
char *__ast_strdup(const char *s, const char *file, int lineno, const char *func)
{
size_t len;
void *ptr;
@ -265,7 +265,7 @@ char *__ast_strdup(const char *s, const char *file, int lineno, const char *func
return ptr;
}
char *__ast_strndup(const char *s, size_t n, const char *file, int lineno, const char *func)
char *__ast_strndup(const char *s, size_t n, const char *file, int lineno, const char *func)
{
size_t len;
void *ptr;
@ -303,7 +303,7 @@ int __ast_asprintf(const char *file, int lineno, const char *func, char **strp,
return size;
}
int __ast_vasprintf(char **strp, const char *fmt, va_list ap, const char *file, int lineno, const char *func)
int __ast_vasprintf(char **strp, const char *fmt, va_list ap, const char *file, int lineno, const char *func)
{
int size;
va_list ap2;
@ -355,7 +355,7 @@ static char *handle_memory_show(struct ast_cli_entry *e, int cmd, struct ast_cli
fence = (unsigned int *)(reg->data + reg->len);
if (reg->fence != FENCE_MAGIC) {
astmm_log("WARNING: Low fence violation at %p, "
"in %s of %s, line %d\n", reg->data,
"in %s of %s, line %d\n", reg->data,
reg->func, reg->file, reg->lineno);
}
if (get_unaligned_uint32(fence) != FENCE_MAGIC) {
@ -364,8 +364,8 @@ static char *handle_memory_show(struct ast_cli_entry *e, int cmd, struct ast_cli
}
}
if (!fn || !strcasecmp(fn, reg->file)) {
ast_cli(a->fd, "%10d bytes allocated%s in %20s at line %5d of %s\n",
(int) reg->len, reg->cache ? " (cache)" : "",
ast_cli(a->fd, "%10d bytes allocated%s in %20s at line %5d of %s\n",
(int) reg->len, reg->cache ? " (cache)" : "",
reg->func, reg->lineno, reg->file);
len += reg->len;
if (reg->cache)
@ -375,12 +375,12 @@ static char *handle_memory_show(struct ast_cli_entry *e, int cmd, struct ast_cli
}
}
ast_mutex_unlock(&reglock);
if (cache_len)
ast_cli(a->fd, "%d bytes allocated (%d in caches) in %d allocations\n", len, cache_len, count);
else
ast_cli(a->fd, "%d bytes allocated in %d allocations\n", len, count);
return CLI_SUCCESS;
}
@ -399,7 +399,7 @@ static char *handle_memory_show_summary(struct ast_cli_entry *e, int cmd, struct
int count;
struct file_summary *next;
} *list = NULL, *cur;
switch (cmd) {
case CLI_INIT:
e->command = "memory show summary";
@ -412,7 +412,7 @@ static char *handle_memory_show_summary(struct ast_cli_entry *e, int cmd, struct
return NULL;
}
if (a->argc > 3)
if (a->argc > 3)
fn = a->argv[3];
ast_mutex_lock(&reglock);
@ -440,7 +440,7 @@ static char *handle_memory_show_summary(struct ast_cli_entry *e, int cmd, struct
}
}
ast_mutex_unlock(&reglock);
/* Dump the whole list */
for (cur = list; cur; cur = cur->next) {
len += cur->len;
@ -448,18 +448,18 @@ static char *handle_memory_show_summary(struct ast_cli_entry *e, int cmd, struct
count += cur->count;
if (cur->cache_len) {
if (fn) {
ast_cli(a->fd, "%10d bytes (%10d cache) in %d allocations in function '%s' of '%s'\n",
ast_cli(a->fd, "%10d bytes (%10d cache) in %d allocations in function '%s' of '%s'\n",
cur->len, cur->cache_len, cur->count, cur->fn, fn);
} else {
ast_cli(a->fd, "%10d bytes (%10d cache) in %d allocations in file '%s'\n",
ast_cli(a->fd, "%10d bytes (%10d cache) in %d allocations in file '%s'\n",
cur->len, cur->cache_len, cur->count, cur->fn);
}
} else {
if (fn) {
ast_cli(a->fd, "%10d bytes in %d allocations in function '%s' of '%s'\n",
ast_cli(a->fd, "%10d bytes in %d allocations in function '%s' of '%s'\n",
cur->len, cur->count, cur->fn, fn);
} else {
ast_cli(a->fd, "%10d bytes in %d allocations in file '%s'\n",
ast_cli(a->fd, "%10d bytes in %d allocations in file '%s'\n",
cur->len, cur->count, cur->fn);
}
}
@ -488,11 +488,11 @@ void __ast_mm_init(void)
}
ast_cli_register_multiple(cli_memory, ARRAY_LEN(cli_memory));
snprintf(filename, sizeof(filename), "%s/mmlog", ast_config_AST_LOG_DIR);
ast_verb(1, "Asterisk Malloc Debugger Started (see %s))\n", filename);
if ((mmlog = fopen(filename, "a+"))) {
fprintf(mmlog, "%ld - New session\n", (long)time(NULL));
fflush(mmlog);

View File

@ -226,7 +226,7 @@ static struct ast_frame *audiohook_read_frame_single(struct ast_audiohook *audio
/* Ensure the factory is able to give us the samples we want */
if (samples > ast_slinfactory_available(factory))
return NULL;
/* Read data in from factory */
if (!ast_slinfactory_read(factory, buf, samples))
return NULL;
@ -356,10 +356,10 @@ static struct ast_frame *audiohook_read_frame_helper(struct ast_audiohook *audio
samples_converted = samples * (ast_format_rate(format) / (float) audiohook->hook_internal_samp_rate);
}
if (!(read_frame = (direction == AST_AUDIOHOOK_DIRECTION_BOTH ?
audiohook_read_frame_both(audiohook, samples_converted, read_reference, write_reference) :
audiohook_read_frame_single(audiohook, samples_converted, direction)))) {
return NULL;
if (!(read_frame = (direction == AST_AUDIOHOOK_DIRECTION_BOTH ?
audiohook_read_frame_both(audiohook, samples_converted, read_reference, write_reference) :
audiohook_read_frame_single(audiohook, samples_converted, direction)))) {
return NULL;
}
/* If they don't want signed linear back out, we'll have to send it through the translation path */
@ -536,7 +536,7 @@ int ast_audiohook_detach_list(struct ast_audiohook_list *audiohook_list)
if (audiohook_list->out_translate[i].trans_pvt)
ast_translator_free_path(audiohook_list->out_translate[i].trans_pvt);
}
/* Free ourselves */
ast_free(audiohook_list);
@ -770,7 +770,7 @@ static struct ast_frame *audiohook_list_translate_to_native(struct ast_audiohook
* because no translation to SLINEAR audio was required.
* Part_3: Translate end_frame's audio back into the format of start frame if necessary. This
* is only necessary if manipulation of middle_frame occurred.
*
*
* \param chan Channel that the list is coming off of
* \param audiohook_list List of audiohooks
* \param direction Direction frame is coming in from
@ -929,9 +929,9 @@ void ast_audiohook_trigger_wait(struct ast_audiohook *audiohook)
wait = ast_tvadd(ast_tvnow(), ast_samp2tv(50000, 1000));
ts.tv_sec = wait.tv_sec;
ts.tv_nsec = wait.tv_usec * 1000;
ast_cond_timedwait(&audiohook->trigger, &audiohook->lock, &ts);
return;
}

View File

@ -21,7 +21,7 @@
*
* \brief Automatic channel service routines
*
* \author Mark Spencer <markster@digium.com>
* \author Mark Spencer <markster@digium.com>
* \author Russell Bryant <russell@digium.com>
*/
@ -52,7 +52,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
struct asent {
struct ast_channel *chan;
/*! This gets incremented each time autoservice gets started on the same
* channel. It will ensure that it doesn't actually get stopped until
* channel. It will ensure that it doesn't actually get stopped until
* it gets stopped for the last time. */
unsigned int use_count;
unsigned int orig_end_dtmf_flag:1;
@ -141,11 +141,11 @@ static void *autoservice_run(void *ign)
if (defer_frame) {
for (i = 0; i < x; i++) {
struct ast_frame *dup_f;
if (mons[i] != chan) {
continue;
}
if (defer_frame != f) {
if ((dup_f = ast_frdup(defer_frame))) {
AST_LIST_INSERT_HEAD(&ents[i]->deferred_frames, dup_f, frame_list);
@ -158,7 +158,7 @@ static void *autoservice_run(void *ign)
AST_LIST_INSERT_HEAD(&ents[i]->deferred_frames, dup_f, frame_list);
}
}
break;
}
} else if (f) {
@ -192,7 +192,7 @@ int ast_autoservice_start(struct ast_channel *chan)
if (!(as = ast_calloc(1, sizeof(*as))))
return -1;
/* New entry created */
as->chan = chan;
as->use_count = 1;
@ -247,7 +247,7 @@ int ast_autoservice_stop(struct ast_channel *chan)
/* Find the entry, but do not free it because it still can be in the
autoservice thread array */
AST_LIST_TRAVERSE_SAFE_BEGIN(&aslist, as, list) {
AST_LIST_TRAVERSE_SAFE_BEGIN(&aslist, as, list) {
if (as->chan == chan) {
as->use_count--;
if (as->use_count < 1) {

View File

@ -18,9 +18,9 @@
/*! \file
*
* \brief CallerID Generation support
* \brief CallerID Generation support
*
* \author Mark Spencer <markster@digium.com>
* \author Mark Spencer <markster@digium.com>
*/
#include "asterisk.h"
@ -53,7 +53,7 @@ struct callerid_state {
int sawflag;
int len;
int skipflag;
int skipflag;
unsigned short crc;
};
@ -81,14 +81,14 @@ static inline void gen_tones(unsigned char *buf, int len, struct ast_format *cod
*cr1 = t;
t = 2.0 - (*cr1 * *cr1 + *ci1 * *ci1);
*cr1 *= t;
*ci1 *= t;
*ci1 *= t;
t = *cr2 * ddr2 - *ci2 * ddi2;
*ci2 = *cr2 * ddi2 + *ci2 * ddr2;
*cr2 = t;
t = 2.0 - (*cr2 * *cr2 + *ci2 * *ci2);
*cr2 *= t;
*ci2 *= t;
*ci2 *= t;
buf[x] = AST_LIN2X((*cr1 + *cr2) * 2048.0);
}
}
@ -103,7 +103,7 @@ static inline void gen_tone(unsigned char *buf, int len, struct ast_format *code
*cr1 = t;
t = 2.0 - (*cr1 * *cr1 + *ci1 * *ci1);
*cr1 *= t;
*ci1 *= t;
*ci1 *= t;
buf[x] = AST_LIN2X(*cr1 * 8192.0);
}
}
@ -129,12 +129,12 @@ struct callerid_state *callerid_new(int cid_signalling)
if ((cid = ast_calloc(1, sizeof(*cid)))) {
#ifdef INTEGER_CALLERID
cid->fskd.ispb = 7; /* 1200 baud */
cid->fskd.ispb = 7; /* 1200 baud */
/* Set up for 1200 / 8000 freq *32 to allow ints */
cid->fskd.pllispb = (int)(8000 * 32 / 1200);
cid->fskd.pllids = cid->fskd.pllispb/32;
cid->fskd.pllispb2 = cid->fskd.pllispb/2;
cid->fskd.icont = 0; /* PLL REset */
/* cid->fskd.hdlc = 0; */ /* Async */
cid->fskd.nbit = 8; /* 8 bits */
@ -208,14 +208,14 @@ void callerid_get_dtmf(char *cidstring, char *number, int *flags)
*flags = CID_UNKNOWN_NUMBER;
return;
}
/* Detect protocol and special types */
if (cidstring[0] == 'B') {
/* Handle special codes */
code = atoi(&cidstring[1]);
if (code == 0)
*flags = CID_UNKNOWN_NUMBER;
else if (code == 10)
else if (code == 10)
*flags = CID_PRIVATE_NUMBER;
else
ast_debug(1, "Unknown DTMF code %d\n", code);
@ -286,7 +286,7 @@ static unsigned short calc_crc(unsigned short crc, unsigned char data)
for (i = 0; i < CHAR_BIT; i++) {
org <<= 1;
dst >>= 1;
if (org & 0x100)
if (org & 0x100)
dst |= 0x80;
}
data = (unsigned char) dst;
@ -297,7 +297,7 @@ static unsigned short calc_crc(unsigned short crc, unsigned char data)
else
crc <<= 1 ;
}
return crc;
return crc;
}
int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, struct ast_format *codec)
@ -315,7 +315,7 @@ int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, s
memcpy(buf, cid->oldstuff, cid->oldlen);
mylen += cid->oldlen / 2;
for (x = 0; x < len; x++)
for (x = 0; x < len; x++)
buf[x+cid->oldlen/2] = AST_XLAW(ubuf[x]);
while (mylen >= 160) {
@ -367,24 +367,24 @@ int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, s
}
break;
case 1: /* SOH */
if (b == 0x01)
if (b == 0x01)
cid->sawflag = 2;
break ;
case 2: /* HEADER */
if (b == 0x07)
if (b == 0x07)
cid->sawflag = 3;
break;
case 3: /* STX */
if (b == 0x02)
if (b == 0x02)
cid->sawflag = 4;
break;
case 4: /* SERVICE TYPE */
if (b == 0x40)
if (b == 0x40)
cid->sawflag = 5;
break;
case 5: /* Frame Length */
cid->sawflag = 6;
break;
break;
case 6: /* NUMBER TYPE */
cid->sawflag = 7;
cid->pos = 0;
@ -418,7 +418,7 @@ int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, s
if (cid->crc != 0) {
ast_log(LOG_WARNING, "crc checksum error\n") ;
return -1;
}
}
/* extract caller id data */
for (x = 0; x < cid->pos;) {
switch (cid->rawdata[x++]) {
@ -432,9 +432,9 @@ int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, s
break;
case 0x21: /* additional information */
/* length */
x++;
x++;
/* number type */
switch (cid->rawdata[x]) {
switch (cid->rawdata[x]) {
case 0x00: /* unknown */
case 0x01: /* international number */
case 0x02: /* domestic number */
@ -446,11 +446,11 @@ int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, s
ast_debug(2, "cid info:#1=%X\n", cid->rawdata[x]);
break ;
}
x++;
x++;
/* numbering plan octed 4 */
x++;
x++;
/* numbering plan octed 5 */
switch (cid->rawdata[x]) {
switch (cid->rawdata[x]) {
case 0x00: /* unknown */
case 0x01: /* recommendation E.164 ISDN */
case 0x03: /* recommendation X.121 */
@ -462,11 +462,11 @@ int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, s
ast_debug(2, "cid info:#2=%X\n", cid->rawdata[x]);
break ;
}
x++;
x++;
break ;
case 0x04: /* no callerid reason */
/* length */
x++;
x++;
/* no callerid reason code */
switch (cid->rawdata[x]) {
case 'P': /* caller id denied by user */
@ -477,7 +477,7 @@ int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, s
ast_debug(2, "no cid reason:%c\n", cid->rawdata[x]);
break ;
}
x++;
x++;
break ;
case 0x09: /* dialed number */
/* length */
@ -534,7 +534,7 @@ int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, s
cid->oldlen = mylen * 2;
} else
cid->oldlen = 0;
return 0;
}
@ -553,7 +553,7 @@ int callerid_feed(struct callerid_state *cid, unsigned char *ubuf, int len, stru
memcpy(buf, cid->oldstuff, cid->oldlen);
mylen += cid->oldlen/2;
for (x = 0; x < len; x++)
for (x = 0; x < len; x++)
buf[x+cid->oldlen/2] = AST_XLAW(ubuf[x]);
while (mylen >= 160) {
olen = mylen;
@ -623,7 +623,7 @@ int callerid_feed(struct callerid_state *cid, unsigned char *ubuf, int len, stru
cid->sawflag = 0;
break;
}
cid->number[0] = '\0';
cid->name[0] = '\0';
/* Update flags */
@ -643,7 +643,7 @@ int callerid_feed(struct callerid_state *cid, unsigned char *ubuf, int len, stru
res = cid->rawdata[x];
if (res > 32) {
ast_log(LOG_NOTICE, "Truncating long caller ID number from %d bytes to 32\n", cid->rawdata[x]);
res = 32;
res = 32;
}
if (ast_strlen_zero(cid->number)) {
memcpy(cid->number, cid->rawdata + x + 1, res);
@ -658,7 +658,7 @@ int callerid_feed(struct callerid_state *cid, unsigned char *ubuf, int len, stru
res = cid->rawdata[x];
if (res > 32) {
ast_log(LOG_NOTICE, "Truncating long caller ID name from %d bytes to 32\n", cid->rawdata[x]);
res = 32;
res = 32;
}
memcpy(cid->name, cid->rawdata + x + 1, res);
cid->name[res] = '\0';
@ -682,7 +682,7 @@ int callerid_feed(struct callerid_state *cid, unsigned char *ubuf, int len, stru
ast_log(LOG_NOTICE, "IE %d has bad field length of %d at offset %d\n", cid->rawdata[x-1], cid->rawdata[x], x);
/* Try again */
cid->sawflag = 0;
break; /* Exit the loop */
break; /* Exit the loop */
}
x += cid->rawdata[x];
x++;
@ -743,9 +743,9 @@ static int callerid_genmsg(char *msg, int size, const char *number, const char *
/* Get the time */
ast_localtime(&now, &tm, NULL);
ptr = msg;
/* Format time and message header */
res = snprintf(ptr, size, "\001\010%02d%02d%02d%02d", tm.tm_mon + 1,
tm.tm_mday, tm.tm_hour, tm.tm_min);
@ -801,7 +801,7 @@ static int callerid_genmsg(char *msg, int size, const char *number, const char *
size -= i;
}
return (ptr - msg);
}
int ast_callerid_vmwi_generate(unsigned char *buf, int active, int type, struct ast_format *codec,
@ -815,20 +815,20 @@ int ast_callerid_vmwi_generate(unsigned char *buf, int active, int type, struct
float cr = 1.0;
float ci = 0.0;
float scont = 0.0;
if (type == CID_MWI_TYPE_MDMF_FULL) {
/* MDMF Message waiting with date, number, name and MWI parameter */
msg[0] = 0x82;
/* put date, number info at the right place */
len = callerid_genmsg(msg+2, sizeof(msg)-2, number, name, flags);
len = callerid_genmsg(msg+2, sizeof(msg)-2, number, name, flags);
/* length of MDMF CLI plus Message Waiting Structure */
msg[1] = len+3;
/* Go to the position to write to */
len = len+2;
/* "Message Waiting Parameter" */
msg[len++] = 0x0b;
/* Length of IE is one */
@ -838,7 +838,7 @@ int ast_callerid_vmwi_generate(unsigned char *buf, int active, int type, struct
msg[len++] = 0xff;
else
msg[len++] = 0x00;
} else if (type == CID_MWI_TYPE_MDMF) {
/* MDMF Message waiting only */
/* same as above except that the we only put MWI parameter */
@ -931,7 +931,7 @@ int callerid_generate(unsigned char *buf, const char *number, const char *name,
/* Send 50 more ms of marks */
for (x = 0; x < 50; x++)
PUT_CLID_MARKMS;
return bytes;
}
@ -1076,7 +1076,7 @@ char *ast_callerid_merge(char *buf, int bufsiz, const char *name, const char *nu
unknown = "<unknown>";
if (name && num)
snprintf(buf, bufsiz, "\"%s\" <%s>", name, num);
else if (name)
else if (name)
ast_copy_string(buf, name, bufsiz);
else if (num)
ast_copy_string(buf, num, bufsiz);

View File

@ -49,8 +49,8 @@ static unsigned char cel_enabled;
/*! \brief CEL is off by default */
#define CEL_ENABLED_DEFAULT 0
/*!
* \brief which events we want to track
/*!
* \brief which events we want to track
*
* \note bit field, up to 64 events
*/
@ -62,7 +62,7 @@ static int64_t eventset;
*/
#define CEL_MAX_EVENT_IDS 64
/*!
/*!
* \brief Track no events by default.
*/
#define CEL_DEFAULT_EVENTS 0

View File

@ -100,14 +100,14 @@ unsigned long global_fin, global_fout;
AST_THREADSTORAGE(state2str_threadbuf);
#define STATE2STR_BUFSIZE 32
/*! Default amount of time to use when emulating a digit as a begin and end
/*! Default amount of time to use when emulating a digit as a begin and end
* 100ms */
#define AST_DEFAULT_EMULATE_DTMF_DURATION 100
/*! Minimum allowed digit length - 80ms */
#define AST_MIN_DTMF_DURATION 80
/*! Minimum amount of time between the end of the last digit and the beginning
/*! Minimum amount of time between the end of the last digit and the beginning
* of a new one - 45ms */
#define AST_MIN_DTMF_GAP 45
@ -145,7 +145,7 @@ static AST_RWLIST_HEAD_STATIC(backends, chanlist);
/*! \brief All active channels on the system */
static struct ao2_container *channels;
/*! \brief map AST_CAUSE's to readable string representations
/*! \brief map AST_CAUSE's to readable string representations
*
* \ref causes.h
*/
@ -334,7 +334,7 @@ static char *complete_channeltypes(struct ast_cli_args *a)
}
}
AST_RWLIST_UNLOCK(&backends);
return ret;
}
@ -357,7 +357,7 @@ static char *handle_cli_core_show_channeltype(struct ast_cli_entry *e, int cmd,
if (a->argc != 4)
return CLI_SHOWUSAGE;
AST_RWLIST_RDLOCK(&backends);
AST_RWLIST_TRAVERSE(&backends, cl, list) {
@ -393,7 +393,7 @@ static char *handle_cli_core_show_channeltype(struct ast_cli_entry *e, int cmd,
(cl->tech->send_html) ? "yes" : "no",
(cl->tech->send_image) ? "yes" : "no",
(cl->tech->send_text) ? "yes" : "no"
);
AST_RWLIST_UNLOCK(&backends);
@ -554,17 +554,17 @@ int ast_channel_trace_enable(struct ast_channel *chan)
struct ast_chan_trace_data *traced;
if (!store) {
store = ast_datastore_alloc(&ast_chan_trace_datastore_info, "ChanTrace");
if (!store)
if (!store)
return -1;
traced = ast_calloc(1, sizeof(*traced));
if (!traced) {
ast_datastore_free(store);
return -1;
}
}
store->data = traced;
AST_LIST_HEAD_INIT_NOLOCK(&traced->trace);
ast_channel_datastore_add(chan, store);
}
}
((struct ast_chan_trace_data *)store->data)->enabled = 1;
ast_channel_trace_data_update(chan, store->data);
return 0;
@ -726,7 +726,7 @@ void ast_channel_unregister(const struct ast_channel_tech *tech)
AST_LIST_REMOVE_CURRENT(list);
ast_free(chan);
ast_verb(2, "Unregistered channel type '%s'\n", tech->type);
break;
break;
}
}
AST_LIST_TRAVERSE_SAFE_END;
@ -750,7 +750,7 @@ const struct ast_channel_tech *ast_get_channel_tech(const char *name)
}
AST_RWLIST_UNLOCK(&backends);
return ret;
}
@ -962,7 +962,7 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
return ast_channel_unref(tmp);
}
ast_channel_sched_set(tmp, schedctx);
ast_party_dialed_init(ast_channel_dialed(tmp));
ast_party_caller_init(ast_channel_caller(tmp));
ast_party_connected_line_init(ast_channel_connected(tmp));
@ -1012,15 +1012,15 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
ast_channel_state_set(tmp, state);
ast_channel_streamid_set(tmp, -1);
ast_channel_fin_set(tmp, global_fin);
ast_channel_fout_set(tmp, global_fout);
if (ast_strlen_zero(ast_config_AST_SYSTEM_NAME)) {
ast_channel_uniqueid_build(tmp, "%li.%d", (long) time(NULL),
ast_channel_uniqueid_build(tmp, "%li.%d", (long) time(NULL),
ast_atomic_fetchadd_int(&uniqueint, 1));
} else {
ast_channel_uniqueid_build(tmp, "%s-%li.%d", ast_config_AST_SYSTEM_NAME,
ast_channel_uniqueid_build(tmp, "%s-%li.%d", ast_config_AST_SYSTEM_NAME,
(long) time(NULL), ast_atomic_fetchadd_int(&uniqueint, 1));
}
@ -1035,7 +1035,7 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
/* Almost every channel is calling this function, and setting the name via the ast_string_field_build() call.
* And they all use slightly different formats for their name string.
* This means, to set the name here, we have to accept variable args, and call the string_field_build from here.
* This means, that the stringfields must have a routine that takes the va_lists directly, and
* This means, that the stringfields must have a routine that takes the va_lists directly, and
* uses them to build the string, instead of forming the va_lists internally from the vararg ... list.
* This new function was written so this can be accomplished.
*/
@ -1064,12 +1064,12 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
} else {
ast_channel_amaflags_set(tmp, ast_default_amaflags);
}
if (!ast_strlen_zero(acctcode))
ast_channel_accountcode_set(tmp, acctcode);
else
ast_channel_accountcode_set(tmp, ast_default_accountcode);
ast_channel_context_set(tmp, S_OR(context, "default"));
ast_channel_exten_set(tmp, S_OR(exten, "s"));
ast_channel_priority_set(tmp, 1);
@ -1082,11 +1082,11 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
headp = ast_channel_varshead(tmp);
AST_LIST_HEAD_INIT_NOLOCK(headp);
AST_LIST_HEAD_INIT_NOLOCK(ast_channel_datastores(tmp));
AST_LIST_HEAD_INIT_NOLOCK(ast_channel_autochans(tmp));
ast_channel_language_set(tmp, defaultlanguage);
ast_channel_tech_set(tmp, &null_tech);
@ -1110,8 +1110,8 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
"Exten: %s\r\n"
"Context: %s\r\n"
"Uniqueid: %s\r\n",
ast_channel_name(tmp),
state,
ast_channel_name(tmp),
state,
ast_state2str(state),
S_OR(cid_num, ""),
S_OR(cid_name, ""),
@ -1621,7 +1621,7 @@ int ast_safe_sleep_conditional(struct ast_channel *chan, int ms, int (*cond)(voi
ast_frfree(f);
continue;
}
if ((dup_f = ast_frisolate(f))) {
if (dup_f != f) {
ast_frfree(f);
@ -2222,7 +2222,7 @@ static void ast_channel_destructor(void *obj)
#endif
while ((f = AST_LIST_REMOVE_HEAD(ast_channel_readq(chan), frame_list)))
ast_frfree(f);
/* loop over the variables list, freeing all data and deleting list items */
/* no need to lock the list, as the channel is already locked */
headp = ast_channel_varshead(chan);
@ -2330,7 +2330,7 @@ int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore
struct ast_datastore *ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
{
struct ast_datastore *datastore = NULL;
if (info == NULL)
return NULL;
@ -2369,11 +2369,11 @@ void ast_channel_set_fd(struct ast_channel *chan, int which, int fd)
if (fd > -1) {
if (!aed && (!(aed = ast_calloc(1, sizeof(*aed)))))
return;
ast_channel_internal_epfd_data_set(chan, which, aed);
aed->chan = chan;
aed->which = which;
ev.events = EPOLLIN | EPOLLPRI | EPOLLERR | EPOLLHUP;
ev.data.ptr = aed;
epoll_ctl(ast_channel_epfd(chan), EPOLL_CTL_ADD, fd, &ev);
@ -2946,7 +2946,7 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds,
*outfd = -99999;
if (exception)
*exception = 0;
/* Perform any pending masquerades */
for (x = 0; x < n; x++) {
if (ast_channel_masq(c[x]) && ast_do_masquerade(c[x])) {
@ -3005,7 +3005,7 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds,
if (*ms > 0)
start = ast_tvnow();
if (sizeof(int) == 4) { /* XXX fix timeout > 600000 on linux x86-32 */
do {
int kbrms = rms;
@ -3340,14 +3340,14 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd)
ast_set_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
/* Wait for a digit, no more than ms milliseconds total. */
while (ms) {
struct ast_channel *rchan;
int outfd=-1;
errno = 0;
rchan = ast_waitfor_nandfds(&c, 1, &cmdfd, (cmdfd > -1) ? 1 : 0, NULL, &outfd, &ms);
if (!rchan && outfd < 0 && ms) {
if (errno == 0 || errno == EINTR)
continue;
@ -3456,8 +3456,8 @@ static void ast_read_generator_actions(struct ast_channel *chan, struct ast_fram
* code. 1) this function is only called from within __ast_read() and 2) all generators
* call ast_write() in their generate callback.
*
* The reason this is added is so that when ast_write is called, the lock that occurs
* there will not recursively lock the channel. Doing this will cause intended deadlock
* The reason this is added is so that when ast_write is called, the lock that occurs
* there will not recursively lock the channel. Doing this will cause intended deadlock
* avoidance not to work in deeper functions
*/
ast_channel_unlock(chan);
@ -3502,8 +3502,8 @@ static inline int should_skip_dtmf(struct ast_channel *chan)
* explicitly deferred. Skip this digit, then. */
return 1;
}
if (!ast_tvzero(*ast_channel_dtmf_tv(chan)) &&
if (!ast_tvzero(*ast_channel_dtmf_tv(chan)) &&
ast_tvdiff_ms(ast_tvnow(), *ast_channel_dtmf_tv(chan)) < AST_MIN_DTMF_GAP) {
/* We're not in the middle of a digit, but it hasn't been long enough
* since the last digit, so we'll have to skip DTMF for now. */
@ -3515,7 +3515,7 @@ static inline int should_skip_dtmf(struct ast_channel *chan)
/*!
* \brief calculates the number of samples to jump forward with in a monitor stream.
* \note When using ast_seekstream() with the read and write streams of a monitor,
* the number of samples to seek forward must be of the same sample rate as the stream
* or else the jump will not be calculated correctly.
@ -3627,7 +3627,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
return &ast_null_frame;
case AST_TIMING_EVENT_CONTINUOUS:
if (AST_LIST_EMPTY(ast_channel_readq(chan)) ||
if (AST_LIST_EMPTY(ast_channel_readq(chan)) ||
!AST_LIST_NEXT(AST_LIST_FIRST(ast_channel_readq(chan)), frame_list)) {
ast_timer_disable_continuous(ast_channel_timer(chan));
}
@ -3673,7 +3673,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
break;
}
AST_LIST_TRAVERSE_SAFE_END;
if (!f) {
/* There were no acceptable frames on the readq. */
f = &ast_null_frame;
@ -3789,7 +3789,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
ast_frfree(f);
f = &ast_null_frame;
} else if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_DTMF | AST_FLAG_END_DTMF_ONLY)) {
if (!ast_tvzero(*ast_channel_dtmf_tv(chan)) &&
if (!ast_tvzero(*ast_channel_dtmf_tv(chan)) &&
ast_tvdiff_ms(ast_tvnow(), *ast_channel_dtmf_tv(chan)) < AST_MIN_DTMF_GAP) {
/* If it hasn't been long enough, defer this digit */
queue_dtmf_readq(chan, f);
@ -3805,7 +3805,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
if (f->len) {
if (f->len > AST_MIN_DTMF_DURATION)
ast_channel_emulate_dtmf_duration_set(chan, f->len);
else
else
ast_channel_emulate_dtmf_duration_set(chan, AST_MIN_DTMF_DURATION);
} else
ast_channel_emulate_dtmf_duration_set(chan, AST_DEFAULT_EMULATE_DTMF_DURATION);
@ -3869,8 +3869,8 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
case AST_FRAME_DTMF_BEGIN:
send_dtmf_event(chan, "Received", f->subclass.integer, "Yes", "No");
ast_log(LOG_DTMF, "DTMF begin '%c' received on %s\n", f->subclass.integer, ast_channel_name(chan));
if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF | AST_FLAG_END_DTMF_ONLY | AST_FLAG_EMULATE_DTMF) ||
(!ast_tvzero(*ast_channel_dtmf_tv(chan)) &&
if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF | AST_FLAG_END_DTMF_ONLY | AST_FLAG_EMULATE_DTMF) ||
(!ast_tvzero(*ast_channel_dtmf_tv(chan)) &&
ast_tvdiff_ms(ast_tvnow(), *ast_channel_dtmf_tv(chan)) < AST_MIN_DTMF_GAP) ) {
ast_log(LOG_DTMF, "DTMF begin ignored '%c' on %s\n", f->subclass.integer, ast_channel_name(chan));
ast_frfree(f);
@ -4128,7 +4128,7 @@ static int attribute_const is_visible_indication(enum ast_control_frame_type con
int ast_indicate_data(struct ast_channel *chan, int _condition,
const void *data, size_t datalen)
{
/* By using an enum, we'll get compiler warnings for values not handled
/* By using an enum, we'll get compiler warnings for values not handled
* in switch statements. */
enum ast_control_frame_type condition = _condition;
struct ast_tone_zone_sound *ts = NULL;
@ -4195,7 +4195,7 @@ int ast_indicate_data(struct ast_channel *chan, int _condition,
ast_party_redirecting_free(&redirecting);
}
break;
default:
break;
}
@ -4336,7 +4336,7 @@ char *ast_recvtext(struct ast_channel *chan, int timeout)
{
int res, done = 0;
char *buf = NULL;
while (!done) {
struct ast_frame *f;
if (ast_check_hangup(chan))
@ -4528,7 +4528,7 @@ static void adjust_frame_for_plc(struct ast_channel *chan, struct ast_frame *fra
* offset field indicates the number of bytes that the audio is offset. The plc->samples_buf
* is not an array of bytes, but rather an array of 16-bit integers since it holds SLIN
* samples. So I had two choices to make here with the offset.
*
*
* 1. Make the offset AST_FRIENDLY_OFFSET bytes. The main downside for this is that
* I can't just add AST_FRIENDLY_OFFSET to the plc->samples_buf and have the pointer
* arithmetic come out right. I would have to do some odd casting or division for this to
@ -4536,7 +4536,7 @@ static void adjust_frame_for_plc(struct ast_channel *chan, struct ast_frame *fra
* 2. Make the offset AST_FRIENDLY_OFFSET * 2 bytes. This allows the pointer arithmetic
* to work out better with the plc->samples_buf. The downside here is that the buffer's
* allocation contains an extra 64 bytes of unused space.
*
*
* I decided to go with option 2. This is why in the calloc statement and the statement that
* sets the frame's offset, AST_FRIENDLY_OFFSET is multiplied by 2.
*/
@ -4803,7 +4803,7 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
prev = cur;
}
}
/* If Monitor is running on this channel, then we have to write frames out there too */
/* the translator on chan->writetrans may have returned multiple frames
from the single frame we passed in; if so, feed each one of them to the
@ -5026,7 +5026,7 @@ static int set_format(struct ast_channel *chan,
ast_channel_name(chan),
direction ? "write" : "read",
ast_getformatname(&best_set_fmt));
/* If there is a generator on the channel, it needs to know about this
* change if it is the write format. */
if (direction && ast_channel_generatordata(chan)) {
@ -5293,7 +5293,7 @@ struct ast_channel *__ast_request_and_dial(const char *type, struct ast_format_c
int res = 0;
int last_subclass = 0;
struct ast_party_connected_line connected;
if (outstate)
*outstate = 0;
else
@ -5444,7 +5444,7 @@ struct ast_channel *__ast_request_and_dial(const char *type, struct ast_format_c
ast_channel_context_set(chan, oh->context);
if (!ast_strlen_zero(oh->exten))
ast_channel_exten_set(chan, oh->exten);
if (oh->priority)
if (oh->priority)
ast_channel_priority_set(chan, oh->priority);
}
if (ast_channel_state(chan) == AST_STATE_UP)
@ -5553,7 +5553,7 @@ struct ast_channel *ast_request(const char *type, struct ast_format_cap *request
ast_format_clear(&best_audio_fmt);
/* find the best audio format to use */
if ((tmp_cap = ast_format_cap_get_type(request_cap, AST_FORMAT_TYPE_AUDIO))) {
/* We have audio - is it possible to connect the various calls to each other?
/* We have audio - is it possible to connect the various calls to each other?
(Avoid this check for calls without audio, like text+video calls)
*/
res = ast_translator_best_choice(tmp_cap, chan->tech->capabilities, &tmp_fmt, &best_audio_fmt);
@ -6150,7 +6150,7 @@ static void clone_variables(struct ast_channel *original, struct ast_channel *cl
AST_LIST_APPEND_LIST(ast_channel_varshead(original), ast_channel_varshead(clonechan), entries);
/* then, dup the varshead list into the clone */
AST_LIST_TRAVERSE(ast_channel_varshead(original), current, entries) {
newvar = ast_var_assign(current->name, current->value);
if (newvar)
@ -6432,7 +6432,7 @@ int ast_do_masquerade(struct ast_channel *original)
* reason we're keeping it, it's still awesomely weird. XXX */
/* The reasoning for the channels ao2_container lock here is complex.
*
*
* In order to check for a race condition, the original channel must
* be locked. If it is determined that the masquerade should proceed
* the original channel can absolutely not be unlocked until the end
@ -6560,7 +6560,7 @@ int ast_do_masquerade(struct ast_channel *original)
/* Swap the alertpipes */
ast_channel_internal_alertpipe_swap(original, clonechan);
/*
/*
* Swap the readq's. The end result should be this:
*
* 1) All frames should be on the new (original) channel.
@ -6735,9 +6735,9 @@ int ast_do_masquerade(struct ast_channel *original)
ast_log(LOG_WARNING, "Channel type '%s' does not have a fixup routine (for %s)! Bad things may happen.\n",
ast_channel_tech(original)->type, ast_channel_name(original));
/*
* If an indication is currently playing, maintain it on the channel
* that is taking the place of original
/*
* If an indication is currently playing, maintain it on the channel
* that is taking the place of original
*
* This is needed because the masquerade is swapping out in the internals
* of this channel, and the new channel private data needs to be made
@ -6945,7 +6945,7 @@ static void bridge_playfile(struct ast_channel *chan, struct ast_channel *peer,
sec = remain;
}
}
if (!strcmp(sound,"timeleft")) { /* Queue support */
ast_stream_and_wait(chan, "vm-youhave", "");
if (min) {
@ -7006,8 +7006,8 @@ static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct
if (config->feature_timer > 0 && ast_tvzero(config->nexteventts)) {
/* nexteventts is not set when the bridge is not scheduled to
* break, so calculate when the bridge should possibly break
* if a partial feature match timed out */
* break, so calculate when the bridge should possibly break
* if a partial feature match timed out */
config->nexteventts = ast_tvadd(ast_tvnow(), ast_samp2tv(config->feature_timer, 1000));
}
@ -7038,10 +7038,10 @@ static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct
break;
}
} else {
/* If a feature has been started and the bridge is configured to
* to not break, leave the channel bridge when the feature timer
* time has elapsed so the DTMF will be sent to the other side.
*/
/* If a feature has been started and the bridge is configured to
* to not break, leave the channel bridge when the feature timer
* time has elapsed so the DTMF will be sent to the other side.
*/
if (!ast_tvzero(config->nexteventts)) {
int diff = ast_tvdiff_ms(config->nexteventts, ast_tvnow());
if (diff <= 0) {
@ -7151,7 +7151,7 @@ static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct
/* Write immediately frames, not passed through jb */
if (!frame_put_in_jb)
ast_write(other, f);
/* Check if we have to deliver now */
if (jb_in_use)
ast_jb_get_and_deliver(c0, c1);
@ -7186,7 +7186,7 @@ int ast_channel_early_bridge(struct ast_channel *c0, struct ast_channel *c1)
}
/*! \brief Send manager event for bridge link and unlink events.
* \param onoff Link/Unlinked
* \param onoff Link/Unlinked
* \param type 1 for core, 2 for native
* \param c0 first channel in bridge
* \param c1 second channel in bridge
@ -7298,7 +7298,7 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
ast_channel_name(c1), ast_channel_name(ast_channel_internal_bridged_channel(c1)));
return -1;
}
/* Stop if we're a zombie or need a soft hangup */
if (ast_test_flag(ast_channel_flags(c0), AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) ||
ast_test_flag(ast_channel_flags(c1), AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1))
@ -7658,23 +7658,23 @@ static int tonepair_generator(struct ast_channel *chan, void *data, int len, int
return -1;
}
memset(&ts->f, 0, sizeof(ts->f));
for (x=0;x<len/2;x++) {
ts->v1_1 = ts->v2_1;
ts->v2_1 = ts->v3_1;
ts->v3_1 = (ts->fac1 * ts->v2_1 >> 15) - ts->v1_1;
ts->v1_2 = ts->v2_2;
ts->v2_2 = ts->v3_2;
ts->v3_2 = (ts->fac2 * ts->v2_2 >> 15) - ts->v1_2;
if (ts->modulate) {
int p;
p = ts->v3_2 - 32768;
if (p < 0) p = -p;
p = ((p * 9) / 10) + 1;
ts->data[x] = (ts->v3_1 * p) >> 15;
} else
ts->data[x] = ts->v3_1 + ts->v3_2;
}
for (x=0;x<len/2;x++) {
ts->v1_1 = ts->v2_1;
ts->v2_1 = ts->v3_1;
ts->v3_1 = (ts->fac1 * ts->v2_1 >> 15) - ts->v1_1;
ts->v1_2 = ts->v2_2;
ts->v2_2 = ts->v3_2;
ts->v3_2 = (ts->fac2 * ts->v2_2 >> 15) - ts->v1_2;
if (ts->modulate) {
int p;
p = ts->v3_2 - 32768;
if (p < 0) p = -p;
p = ((p * 9) / 10) + 1;
ts->data[x] = (ts->v3_1 * p) >> 15;
} else
ts->data[x] = ts->v3_1 + ts->v3_2;
}
ts->f.frametype = AST_FRAME_VOICE;
ast_format_set(&ts->f.subclass.format, AST_FORMAT_SLINEAR, 0);
ts->f.datalen = len;
@ -7743,7 +7743,7 @@ ast_group_t ast_get_group(const char *s)
return 0;
c = ast_strdupa(s);
while ((piece = strsep(&c, ","))) {
if (sscanf(piece, "%30d-%30d", &start, &finish) == 2) {
/* Range */
@ -7976,17 +7976,17 @@ char *ast_print_group(char *buf, int buflen, ast_group_t group)
char num[3];
buf[0] = '\0';
if (!group) /* Return empty string if no group */
return buf;
for (i = 0; i <= 63; i++) { /* Max group is 63 */
if (group & ((ast_group_t) 1 << i)) {
if (!first) {
if (!first) {
strncat(buf, ", ", buflen - strlen(buf) - 1);
} else {
first = 0;
}
}
snprintf(num, sizeof(num), "%u", i);
strncat(buf, num, buflen - strlen(buf) - 1);
}
@ -7999,7 +7999,7 @@ void ast_set_variables(struct ast_channel *chan, struct ast_variable *vars)
struct ast_variable *cur;
for (cur = vars; cur; cur = cur->next)
pbx_builtin_setvar_helper(chan, cur->name, cur->value);
pbx_builtin_setvar_helper(chan, cur->name, cur->value);
}
static void *silence_generator_alloc(struct ast_channel *chan, void *data)

View File

@ -20,7 +20,7 @@
*
* \brief Channel Variables
*
* \author Mark Spencer <markster@digium.com>
* \author Mark Spencer <markster@digium.com>
*/
#include "asterisk.h"
@ -36,7 +36,7 @@ struct ast_var_t *_ast_var_assign(const char *name, const char *value, const cha
#else
struct ast_var_t *ast_var_assign(const char *name, const char *value)
#endif
{
{
struct ast_var_t *var;
int name_len = strlen(name) + 1;
int value_len = strlen(value) + 1;
@ -52,10 +52,10 @@ struct ast_var_t *ast_var_assign(const char *name, const char *value)
ast_copy_string(var->name, name, name_len);
var->value = var->name + name_len;
ast_copy_string(var->value, value, value_len);
return var;
}
}
void ast_var_delete(struct ast_var_t *var)
{
if (var)

View File

@ -20,7 +20,7 @@
*
* \brief Standard Command Line Interface
*
* \author Mark Spencer <markster@digium.com>
* \author Mark Spencer <markster@digium.com>
*/
#include "asterisk.h"
@ -116,7 +116,7 @@ void ast_cli(int fd, const char *fmt, ...)
}
}
unsigned int ast_debug_get_by_module(const char *module)
unsigned int ast_debug_get_by_module(const char *module)
{
struct module_level *ml;
unsigned int res = 0;
@ -133,7 +133,7 @@ unsigned int ast_debug_get_by_module(const char *module)
return res;
}
unsigned int ast_verbose_get_by_module(const char *module)
unsigned int ast_verbose_get_by_module(const char *module)
{
struct module_level *ml;
unsigned int res = 0;
@ -231,14 +231,14 @@ static char *complete_fn(const char *word, int state)
snprintf(filename, sizeof(filename), "%s/%s", ast_config_AST_MODULE_DIR, word);
c = d = filename_completion_function(filename, state);
if (c && word[0] != '/')
c += (strlen(ast_config_AST_MODULE_DIR) + 1);
if (c)
c = ast_strdup(c);
free(d);
return c;
}
@ -325,8 +325,8 @@ static char *handle_core_reload(struct ast_cli_entry *e, int cmd, struct ast_cli
return CLI_SUCCESS;
}
/*!
* \brief Find the debug or verbose file setting
/*!
* \brief Find the debug or verbose file setting
* \arg debug 1 for debug, 0 for verbose
*/
static struct module_level *find_module_level(const char *module, unsigned int debug)
@ -569,7 +569,7 @@ static char *handle_logger_mute(struct ast_cli_entry *e, int cmd, struct ast_cli
switch (cmd) {
case CLI_INIT:
e->command = "logger mute";
e->usage =
e->usage =
"Usage: logger mute\n"
" Disables logging output to the current console, making it possible to\n"
" gather information without being disturbed by scrolling lines.\n";
@ -650,7 +650,7 @@ static int modlist_modentry(const char *module, const char *description, int use
if (strcasestr(module, like) ) {
ast_cli(climodentryfd, MODLIST_FORMAT, module, description, usecnt);
return 1;
}
}
return 0;
}
@ -772,7 +772,7 @@ static char *handle_modlist(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
like = a->argv[e->args];
else
return CLI_SHOWUSAGE;
ast_mutex_lock(&climodentrylock);
climodentryfd = a->fd; /* global, protected by climodentrylock */
ast_cli(a->fd, MODLIST_FORMAT2, "Module", "Description", "Use Count");
@ -829,7 +829,7 @@ static char *handle_showcalls(struct ast_cli_entry *e, int cmd, struct ast_cli_a
} else {
ast_cli(a->fd, "%d active call%s\n", ast_active_calls(), ESS(ast_active_calls()));
}
ast_cli(a->fd, "%d call%s processed\n", ast_processed_calls(), ESS(ast_processed_calls()));
if (ast_startuptime.tv_sec && showuptime) {
@ -885,7 +885,7 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
if (!concise && !verbose)
ast_cli(a->fd, FORMAT_STRING2, "Channel", "Location", "State", "Application(Data)");
else if (verbose)
ast_cli(a->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", "PeerAccount", "BridgedTo");
}
@ -911,7 +911,7 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
snprintf(durbuf, sizeof(durbuf), "%02d:%02d:%02d", durh, durm, durs);
} else {
snprintf(durbuf, sizeof(durbuf), "%d", duration);
}
}
}
if (concise) {
ast_cli(a->fd, CONCISE_FORMAT_STRING, ast_channel_name(c), ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c), ast_state2str(ast_channel_state(c)),
@ -920,7 +920,7 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, ""),
S_OR(ast_channel_accountcode(c), ""),
S_OR(ast_channel_peeraccount(c), ""),
ast_channel_amaflags(c),
ast_channel_amaflags(c),
durbuf,
bc ? ast_channel_name(bc) : "(None)",
ast_channel_uniqueid(c));
@ -936,8 +936,8 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
} else {
char locbuf[40] = "(None)";
char appdata[40] = "(None)";
if (!ast_strlen_zero(ast_channel_context(c)) && !ast_strlen_zero(ast_channel_exten(c)))
if (!ast_strlen_zero(ast_channel_context(c)) && !ast_strlen_zero(ast_channel_exten(c)))
snprintf(locbuf, sizeof(locbuf), "%s@%s:%d", ast_channel_exten(c), ast_channel_context(c), ast_channel_priority(c));
if (ast_channel_appl(c))
snprintf(appdata, sizeof(appdata), "%s(%s)", ast_channel_appl(c), S_OR(ast_channel_data(c), ""));
@ -965,7 +965,7 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
}
return CLI_SUCCESS;
#undef FORMAT_STRING
#undef FORMAT_STRING2
#undef CONCISE_FORMAT_STRING
@ -1169,11 +1169,11 @@ static char *handle_commandmatchesarray(struct ast_cli_entry *e, int cmd, struct
int len = 0;
char **matches;
int x, matchlen;
switch (cmd) {
case CLI_INIT:
e->command = "_command matchesarray";
e->usage =
e->usage =
"Usage: _command matchesarray \"<line>\" text \n"
" This function is used internally to help with command completion and should.\n"
" never be called by the user directly.\n";
@ -1194,7 +1194,7 @@ static char *handle_commandmatchesarray(struct ast_cli_entry *e, int cmd, struct
if (len + matchlen >= buflen) {
buflen += matchlen * 3;
obuf = buf;
if (!(buf = ast_realloc(obuf, buflen)))
if (!(buf = ast_realloc(obuf, buflen)))
/* Memory allocation failure... Just free old buffer and be done */
ast_free(obuf);
}
@ -1224,7 +1224,7 @@ static char *handle_commandnummatches(struct ast_cli_entry *e, int cmd, struct a
switch (cmd) {
case CLI_INIT:
e->command = "_command nummatches";
e->usage =
e->usage =
"Usage: _command nummatches \"<line>\" text \n"
" This function is used internally to help with command completion and should.\n"
" never be called by the user directly.\n";
@ -1249,7 +1249,7 @@ static char *handle_commandcomplete(struct ast_cli_entry *e, int cmd, struct ast
switch (cmd) {
case CLI_INIT:
e->command = "_command complete";
e->usage =
e->usage =
"Usage: _command complete \"<line>\" text state\n"
" This function is used internally to help with command completion and should.\n"
" never be called by the user directly.\n";
@ -1380,7 +1380,7 @@ static char *handle_nodebugchan_deprecated(struct ast_cli_entry *e, int cmd, str
return res;
}
static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct ast_channel *c=NULL;
@ -1400,14 +1400,14 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
switch (cmd) {
case CLI_INIT:
e->command = "core show channel";
e->usage =
e->usage =
"Usage: core show channel <channel>\n"
" Shows lots of information about the specified channel.\n";
return NULL;
case CLI_GENERATE:
return ast_complete_channels(a->line, a->word, a->pos, a->n, 3);
}
if (a->argc != 4) {
return CLI_SHOWUSAGE;
}
@ -1481,8 +1481,8 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
S_COR(ast_channel_connected(c)->id.number.valid, ast_channel_connected(c)->id.number.str, "(N/A)"),
S_COR(ast_channel_connected(c)->id.name.valid, ast_channel_connected(c)->id.name.str, "(N/A)"),
S_OR(ast_channel_dialed(c)->number.str, "(N/A)"),
ast_channel_language(c),
ast_state2str(ast_channel_state(c)), ast_channel_state(c), ast_channel_rings(c),
ast_channel_language(c),
ast_state2str(ast_channel_state(c)), ast_channel_state(c), ast_channel_rings(c),
ast_getformatname_multiple(nf, sizeof(nf), ast_channel_nativeformats(c)),
ast_getformatname(ast_channel_writeformat(c)),
ast_getformatname(ast_channel_readformat(c)),
@ -1494,11 +1494,11 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
ast_channel_fin(c) & ~DEBUGCHAN_FLAG, (ast_channel_fin(c) & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
ast_channel_fout(c) & ~DEBUGCHAN_FLAG, (ast_channel_fout(c) & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
(long)ast_channel_whentohangup(c)->tv_sec,
cdrtime, ast_channel_internal_bridged_channel(c) ? ast_channel_name(ast_channel_internal_bridged_channel(c)) : "<none>", ast_bridged_channel(c) ? ast_channel_name(ast_bridged_channel(c)) : "<none>",
cdrtime, ast_channel_internal_bridged_channel(c) ? ast_channel_name(ast_channel_internal_bridged_channel(c)) : "<none>", ast_bridged_channel(c) ? ast_channel_name(ast_bridged_channel(c)) : "<none>",
ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c), ast_channel_callgroup(c), ast_channel_pickupgroup(c), (ast_channel_appl(c) ? ast_channel_appl(c) : "(N/A)" ),
(ast_channel_data(c) ? S_OR(ast_channel_data(c), "(Empty)") : "(None)"),
(ast_test_flag(ast_channel_flags(c), AST_FLAG_BLOCKING) ? ast_channel_blockproc(c) : "(Not Blocking)"));
if (pbx_builtin_serialize_variables(c, &obuf)) {
ast_str_append(&output, 0, " Variables:\n%s\n", ast_str_buffer(obuf));
}
@ -1588,7 +1588,7 @@ static char *group_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cl
switch (cmd) {
case CLI_INIT:
e->command = "group show channels";
e->usage =
e->usage =
"Usage: group show channels [pattern]\n"
" Lists all currently active channels with channel group(s) specified.\n"
" Optional regular expression pattern is matched to group names for each\n"
@ -1600,7 +1600,7 @@ static char *group_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cl
if (a->argc < 3 || a->argc > 4)
return CLI_SHOWUSAGE;
if (a->argc == 4) {
if (regcomp(&regexbuf, a->argv[3], REG_EXTENDED | REG_NOSUB))
return CLI_SHOWUSAGE;
@ -1610,7 +1610,7 @@ static char *group_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cl
ast_cli(a->fd, FORMAT_STRING, "Channel", "Group", "Category");
ast_app_group_list_rdlock();
gi = ast_app_group_list_head();
while (gi) {
if (!havepattern || !regexec(&regexbuf, gi->group, 0, NULL, 0)) {
@ -1619,9 +1619,9 @@ static char *group_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cl
}
gi = AST_LIST_NEXT(gi, group_list);
}
ast_app_group_list_unlock();
if (havepattern)
regfree(&regexbuf);
@ -1806,7 +1806,7 @@ int ast_cli_perms_init(int reload)
AST_RWLIST_WRLOCK(&cli_perms);
AST_LIST_TRAVERSE(&cli_perms, cp_entry, list) {
if ((pw && cp_entry->uid == pw->pw_uid) || (gr && cp_entry->gid == gr->gr_gid)) {
/* if it is duplicated, just added this new settings, to
/* if it is duplicated, just added this new settings, to
the current list. */
user_group = cp_entry;
break;
@ -2080,9 +2080,9 @@ static int __ast_cli_register(struct ast_cli_entry *e, struct ast_cli_entry *ed)
s = ast_skip_blanks(s);
}
*dst++ = NULL;
AST_RWLIST_WRLOCK(&helpers);
if (find_cli(e->cmda, 1)) {
ast_log(LOG_WARNING, "Command '%s' already registered (or something close enough)\n", S_OR(e->_full_cmd, e->command));
goto done;
@ -2096,14 +2096,14 @@ static int __ast_cli_register(struct ast_cli_entry *e, struct ast_cli_entry *ed)
if (lf < len)
len = lf;
if (strncasecmp(e->_full_cmd, cur->_full_cmd, len) < 0) {
AST_RWLIST_INSERT_BEFORE_CURRENT(e, list);
AST_RWLIST_INSERT_BEFORE_CURRENT(e, list);
break;
}
}
AST_RWLIST_TRAVERSE_SAFE_END;
if (!cur)
AST_RWLIST_INSERT_TAIL(&helpers, e, list);
AST_RWLIST_INSERT_TAIL(&helpers, e, list);
ret = 0; /* success */
done:
@ -2342,7 +2342,7 @@ char **ast_cli_completion_matches(const char *text, const char *word)
if (!(retstr = ast_malloc(max_equal + 1)))
return NULL;
ast_copy_string(retstr, match_list[1], max_equal + 1);
match_list[0] = retstr;
@ -2366,7 +2366,7 @@ static int more_words (const char * const *dst)
}
return 0;
}
/*
* generate the entry at position 'state'
*/

View File

@ -117,8 +117,8 @@ static void CB_ADD_LEN(struct ast_str **cb, const char *str, int len)
ast_str_append(cb, 0, "%s", str);
}
static void CB_RESET(struct ast_str *cb, struct ast_str *llb)
{
static void CB_RESET(struct ast_str *cb, struct ast_str *llb)
{
if (cb) {
ast_str_reset(cb);
}
@ -128,7 +128,7 @@ static void CB_RESET(struct ast_str *cb, struct ast_str *llb)
}
static struct ast_comment *ALLOC_COMMENT(struct ast_str *buffer)
{
{
struct ast_comment *x = NULL;
if (!buffer || !ast_str_strlen(buffer)) {
return NULL;
@ -320,12 +320,12 @@ static void ast_variable_move(struct ast_variable *dst_var, struct ast_variable
struct ast_config_include *ast_include_new(struct ast_config *conf, const char *from_file, const char *included_file, int is_exec, const char *exec_file, int from_lineno, char *real_included_file_name, int real_included_file_name_size)
{
/* a file should be included ONCE. Otherwise, if one of the instances is changed,
* then all be changed. -- how do we know to include it? -- Handling modified
* then all be changed. -- how do we know to include it? -- Handling modified
* instances is possible, I'd have
* to create a new master for each instance. */
struct ast_config_include *inc;
struct stat statbuf;
inc = ast_include_find(conf, included_file);
if (inc) {
do {
@ -335,7 +335,7 @@ struct ast_config_include *ast_include_new(struct ast_config *conf, const char *
ast_log(LOG_WARNING,"'%s', line %d: Same File included more than once! This data will be saved in %s if saved back to disk.\n", from_file, from_lineno, real_included_file_name);
} else
*real_included_file_name = 0;
inc = ast_calloc(1,sizeof(struct ast_config_include));
if (!inc) {
return NULL;
@ -346,7 +346,7 @@ struct ast_config_include *ast_include_new(struct ast_config *conf, const char *
inc->included_file = ast_strdup(real_included_file_name);
else
inc->included_file = ast_strdup(included_file);
inc->exec = is_exec;
if (is_exec)
inc->exec_file = ast_strdup(exec_file);
@ -361,7 +361,7 @@ struct ast_config_include *ast_include_new(struct ast_config *conf, const char *
/* attach this new struct to the conf struct */
inc->next = conf->includes;
conf->includes = inc;
return inc;
}
@ -373,10 +373,10 @@ void ast_include_rename(struct ast_config *conf, const char *from_file, const ch
int from_len = strlen(from_file);
int to_len = strlen(to_file);
if (strcmp(from_file, to_file) == 0) /* no use wasting time if the name is the same */
return;
/* the manager code allows you to read in one config file, then
* write it back out under a different name. But, the new arrangement
* ties output lines to the file name. So, before you try to write
@ -620,7 +620,7 @@ static struct ast_variable *variable_clone(const struct ast_variable *old)
return new;
}
static void move_variables(struct ast_category *old, struct ast_category *new)
{
struct ast_variable *var = old->root;
@ -630,7 +630,7 @@ static void move_variables(struct ast_category *old, struct ast_category *new)
ast_variable_append(new, var);
}
struct ast_category *ast_category_new(const char *name, const char *in_file, int lineno)
struct ast_category *ast_category_new(const char *name, const char *in_file, int lineno)
{
struct ast_category *category;
@ -697,7 +697,7 @@ void ast_category_insert(struct ast_config *config, struct ast_category *cat, co
cat->next = config->root;
config->root = cat;
return;
}
}
for (cur_category = config->root; cur_category; cur_category = cur_category->next) {
if (!strcasecmp(cur_category->next->name, match)) {
cat->next = cur_category->next;
@ -731,7 +731,7 @@ void ast_category_destroy(struct ast_category *cat)
static void ast_includes_destroy(struct ast_config_include *incls)
{
struct ast_config_include *incl,*inclnext;
for (incl=incls; incl; incl = inclnext) {
inclnext = incl->next;
ast_free(incl->include_location_file);
@ -764,7 +764,7 @@ struct ast_variable *ast_category_root(struct ast_config *config, char *cat)
}
char *ast_category_browse(struct ast_config *config, const char *prev)
{
{
struct ast_category *cat;
if (!prev) {
@ -801,7 +801,7 @@ char *ast_category_browse(struct ast_config *config, const char *prev)
}
}
}
if (cat)
cat = next_available_category(cat);
@ -841,7 +841,7 @@ static void inherit_category(struct ast_category *new, const struct ast_category
ast_variable_append(new, variable_clone(var));
}
struct ast_config *ast_config_new(void)
struct ast_config *ast_config_new(void)
{
struct ast_config *config;
@ -895,7 +895,7 @@ int ast_variable_delete(struct ast_category *category, const char *variable, con
return res;
}
int ast_variable_update(struct ast_category *category, const char *variable,
int ast_variable_update(struct ast_category *category, const char *variable,
const char *value, const char *match, unsigned int object)
{
struct ast_variable *cur, *prev=NULL, *newer=NULL;
@ -1141,8 +1141,8 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
}
*c++ = '\0';
cur++;
if (*c++ != '(')
c = NULL;
if (*c++ != '(')
c = NULL;
catname = cur;
if (!(*cat = newcat = ast_category_new(catname,
S_OR(suggested_include_file, cfg->include_level == 1 ? "" : configfile),
@ -1152,7 +1152,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
(*cat)->lineno = lineno;
*last_var = 0;
*last_cat = newcat;
/* add comments */
if (ast_test_flag(&flags, CONFIG_FLAG_WITHCOMMENTS))
newcat->precomments = ALLOC_COMMENT(comment_buffer);
@ -1160,15 +1160,15 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
newcat->sameline = ALLOC_COMMENT(lline_buffer);
if (ast_test_flag(&flags, CONFIG_FLAG_WITHCOMMENTS))
CB_RESET(comment_buffer, lline_buffer);
/* If there are options or categories to inherit from, process them now */
if (c) {
if (!(cur = strchr(c, ')'))) {
ast_log(LOG_WARNING, "parse error: no closing ')', line %d of %s\n", lineno, configfile);
return -1;
}
*cur = '\0';
while ((cur = strsep(&c, ","))) {
/* If there are options or categories to inherit from, process them now */
if (c) {
if (!(cur = strchr(c, ')'))) {
ast_log(LOG_WARNING, "parse error: no closing ')', line %d of %s\n", lineno, configfile);
return -1;
}
*cur = '\0';
while ((cur = strsep(&c, ","))) {
if (!strcasecmp(cur, "!")) {
(*cat)->ignored = 1;
} else if (!strcasecmp(cur, "+")) {
@ -1186,7 +1186,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
}
} else {
struct ast_category *base;
base = category_get(cfg, cur, 1);
if (!base) {
ast_log(LOG_WARNING, "Inheritance requested, but category '%s' does not exist, line %d of %s\n", cur, lineno, configfile);
@ -1194,8 +1194,8 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
}
inherit_category(*cat, base);
}
}
}
}
}
if (newcat)
ast_category_append(cfg, *cat);
} else if (cur[0] == '#') { /* A directive - #include or #exec */
@ -1350,7 +1350,7 @@ set_new_variable:
v->sameline = ALLOC_COMMENT(lline_buffer);
if (ast_test_flag(&flags, CONFIG_FLAG_WITHCOMMENTS))
CB_RESET(comment_buffer, lline_buffer);
} else {
return -1;
}
@ -1520,19 +1520,19 @@ static struct ast_config *config_text_file_load(const char *database, const char
CB_ADD(&comment_buffer, ast_str_buffer(lline_buffer)); /* add the current lline buffer to the comment buffer */
ast_str_reset(lline_buffer); /* erase the lline buffer */
}
new_buf = buf;
if (comment)
if (comment)
process_buf = NULL;
else
process_buf = buf;
if (ast_test_flag(&flags, CONFIG_FLAG_WITHCOMMENTS) && comment_buffer && ast_str_strlen(comment_buffer) && (ast_strlen_zero(buf) || strlen(buf) == strspn(buf," \t\n\r"))) {
/* blank line? really? Can we add it to an existing comment and maybe preserve inter- and post- comment spacing? */
CB_ADD(&comment_buffer, "\n"); /* add a newline to the comment buffer */
continue; /* go get a new line, then */
}
while ((comment_p = strchr(new_buf, COMMENT_META))) {
if ((comment_p > new_buf) && (*(comment_p - 1) == '\\')) {
/* Escaped semicolons aren't comments. */
@ -1565,7 +1565,7 @@ static struct ast_config *config_text_file_load(const char *database, const char
CB_ADD(&comment_buffer, ";");
CB_ADD_LEN(&comment_buffer, oldptr+1, new_buf-oldptr-1);
}
memmove(oldptr, new_buf, strlen(new_buf) + 1);
new_buf = oldptr;
} else
@ -1573,12 +1573,12 @@ static struct ast_config *config_text_file_load(const char *database, const char
}
} else {
if (!comment) {
/* If ; is found, and we are not nested in a comment,
/* If ; is found, and we are not nested in a comment,
we immediately stop all comment processing */
if (ast_test_flag(&flags, CONFIG_FLAG_WITHCOMMENTS)) {
CB_ADD(&lline_buffer, comment_p);
}
*comment_p = '\0';
*comment_p = '\0';
new_buf = comment_p;
} else
new_buf = comment_p + 1;
@ -1587,7 +1587,7 @@ static struct ast_config *config_text_file_load(const char *database, const char
if (ast_test_flag(&flags, CONFIG_FLAG_WITHCOMMENTS) && comment && !process_buf ) {
CB_ADD(&comment_buffer, buf); /* the whole line is a comment, store it */
}
if (process_buf) {
char *buffer = ast_strip(process_buf);
if (!ast_strlen_zero(buffer)) {
@ -1645,7 +1645,7 @@ static struct ast_config *config_text_file_load(const char *database, const char
comment_buffer = NULL;
lline_buffer = NULL;
}
if (count == 0)
return NULL;
@ -1656,11 +1656,11 @@ static struct ast_config *config_text_file_load(const char *database, const char
/* NOTE: categories and variables each have a file and lineno attribute. On a save operation, these are used to determine
which file and line number to write out to. Thus, an entire hierarchy of config files (via #include statements) can be
recreated. BUT, care must be taken to make sure that every cat and var has the proper file name stored, or you may
be shocked and mystified as to why things are not showing up in the files!
be shocked and mystified as to why things are not showing up in the files!
Also, All #include/#exec statements are recorded in the "includes" LL in the ast_config structure. The file name
and line number are stored for each include, plus the name of the file included, so that these statements may be
included in the output files on a file_save operation.
included in the output files on a file_save operation.
The lineno's are really just for relative placement in the file. There is no attempt to make sure that blank lines
are included to keep the lineno's the same between input and output. The lineno fields are used mainly to determine
@ -1784,19 +1784,19 @@ static void insert_leading_blank_lines(FILE *fp, struct inclfile *fi, struct ast
} else if (lineno == 0) {
/* Line replacements also mess things up */
return;
} else if (lineno - precomment_lines - fi->lineno < 5) {
/* Only insert less than 5 blank lines; if anything more occurs,
* it's probably due to context deletion. */
for (i = fi->lineno; i < lineno - precomment_lines; i++) {
fprintf(fp, "\n");
}
} else {
/* Deletion occurred - insert a single blank line, for separation of
* contexts. */
fprintf(fp, "\n");
}
fi->lineno = lineno + 1; /* Advance the file lineno */
} else if (lineno - precomment_lines - fi->lineno < 5) {
/* Only insert less than 5 blank lines; if anything more occurs,
* it's probably due to context deletion. */
for (i = fi->lineno; i < lineno - precomment_lines; i++) {
fprintf(fp, "\n");
}
} else {
/* Deletion occurred - insert a single blank line, for separation of
* contexts. */
fprintf(fp, "\n");
}
fi->lineno = lineno + 1; /* Advance the file lineno */
}
int config_text_file_save(const char *configfile, const struct ast_config *cfg, const char *generator)
@ -2060,7 +2060,7 @@ int ast_config_text_file_save(const char *configfile, const struct ast_config *c
return 0;
}
static void clear_config_maps(void)
static void clear_config_maps(void)
{
struct ast_config_map *map;
@ -2071,7 +2071,7 @@ static void clear_config_maps(void)
config_maps = config_maps->next;
ast_free(map);
}
ast_mutex_unlock(&config_lock);
}
@ -2110,7 +2110,7 @@ static int append_mapping(const char *name, const char *driver, const char *data
return 0;
}
int read_config_maps(void)
int read_config_maps(void)
{
struct ast_config *config, *configtmp;
struct ast_variable *v;
@ -2179,15 +2179,15 @@ int read_config_maps(void)
ast_log(LOG_WARNING, "The 'iaxfriends' table is obsolete, update your config to use iaxusers and iaxpeers, though they can point to the same table.\n");
append_mapping("iaxusers", driver, database, table ? table : "iaxfriends", pri);
append_mapping("iaxpeers", driver, database, table ? table : "iaxfriends", pri);
} else
} else
append_mapping(v->name, driver, database, table, pri);
}
ast_config_destroy(config);
return 0;
}
int ast_config_engine_register(struct ast_config_engine *new)
int ast_config_engine_register(struct ast_config_engine *new)
{
struct ast_config_engine *ptr;
@ -2206,7 +2206,7 @@ int ast_config_engine_register(struct ast_config_engine *new)
return 1;
}
int ast_config_engine_deregister(struct ast_config_engine *del)
int ast_config_engine_deregister(struct ast_config_engine *del)
{
struct ast_config_engine *ptr, *last=NULL;
@ -2229,7 +2229,7 @@ int ast_config_engine_deregister(struct ast_config_engine *del)
}
/*! \brief Find realtime engine for realtime family */
static struct ast_config_engine *find_engine(const char *family, int priority, char *database, int dbsiz, char *table, int tabsiz)
static struct ast_config_engine *find_engine(const char *family, int priority, char *database, int dbsiz, char *table, int tabsiz)
{
struct ast_config_engine *eng, *ret = NULL;
struct ast_config_map *map;
@ -2255,7 +2255,7 @@ static struct ast_config_engine *find_engine(const char *family, int priority, c
}
ast_mutex_unlock(&config_lock);
/* if we found a mapping, but the engine is not available, then issue a warning */
if (map && !ret)
ast_log(LOG_WARNING, "Realtime mapping for '%s' found to engine '%s', but the engine is not available\n", map->name, map->driver);
@ -2273,7 +2273,7 @@ struct ast_config *ast_config_internal_load(const char *filename, struct ast_con
char db[256];
char table[256];
struct ast_config_engine *loader = &text_file_engine;
struct ast_config *result;
struct ast_config *result;
/* The config file itself bumps include_level by 1 */
if (cfg->max_include_level > 0 && cfg->include_level == cfg->max_include_level + 1) {
@ -2761,7 +2761,7 @@ int ast_parse_arg(const char *arg, enum ast_parse_flags flags,
"extract inaddr from [%s] gives [%s:%d](%d)\n",
arg, ast_inet_ntoa(sa->sin_addr),
ntohs(sa->sin_port), error);
break;
break;
}
}
va_end(ap);
@ -2783,7 +2783,7 @@ static char *handle_cli_core_show_config_mappings(struct ast_cli_entry *e, int c
case CLI_GENERATE:
return NULL;
}
ast_mutex_lock(&config_lock);
if (!config_engine_list) {
@ -2799,7 +2799,7 @@ static char *handle_cli_core_show_config_mappings(struct ast_cli_entry *e, int c
}
}
}
ast_mutex_unlock(&config_lock);
return CLI_SUCCESS;

View File

@ -7,15 +7,15 @@
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
* channels for your use.
*
* This program is free software, distributed under the terms of
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
/*! \file
* \brief
* \brief
* Loader for Asterisk under Cygwin/windows.
* Open the dll, locate main, run.
*/

View File

@ -21,7 +21,7 @@
*
* \brief Device state management
*
* \author Mark Spencer <markster@digium.com>
* \author Mark Spencer <markster@digium.com>
* \author Russell Bryant <russell@digium.com>
*
* \arg \ref AstExtState
@ -42,12 +42,12 @@
* The device state is basically based on the current calls.
* If the devicestate engine can find a call from or to the
* device, it's in use.
*
* Some channel drivers implement a callback function for
*
* Some channel drivers implement a callback function for
* a better level of reporting device states. The SIP channel
* has a complicated system for this, which is improved
* has a complicated system for this, which is improved
* by adding call limits to the configuration.
*
*
* Functions that want to check the status of an extension
* register themself as a \b watcher.
* Watchers in this system can subscribe either to all extensions
@ -60,11 +60,11 @@
* for app_meetme.c - the conference bridge - and call
* parking (metermaids).
*
* There are manly three subscribers to extension states
* There are manly three subscribers to extension states
* within Asterisk:
* - AMI, the manager interface
* - app_queue.c - the Queue dialplan application
* - SIP subscriptions, a.k.a. "blinking lamps" or
* - SIP subscriptions, a.k.a. "blinking lamps" or
* "buddy lists"
*
* The CLI command "show hints" show last known state
@ -75,24 +75,24 @@
*
* \section AstDevStateArch Architecture for devicestates
*
* When a channel driver or asterisk app changes state for
* When a channel driver or asterisk app changes state for
* a watched object, it alerts the core. The core queues
* a change. When the change is processed, there's a query
* sent to the channel driver/provider if there's a function
* to handle that, otherwise a channel walk is issued to find
* a channel that involves the object.
*
*
* The changes are queued and processed by a separate thread.
* This thread calls the watchers subscribing to status
* changes for the object. For manager, this results
* This thread calls the watchers subscribing to status
* changes for the object. For manager, this results
* in events. For SIP, NOTIFY requests.
*
* - Device states
* \arg \ref devicestate.c
* \arg \ref devicestate.h
* \arg \ref devicestate.c
* \arg \ref devicestate.h
*
* \section AstExtStateArch Architecture for extension states
*
*
* Hints are connected to extension. If an extension changes state
* it checks the hint devices. If there is a hint, the callbacks into
* device states are checked. The aggregated state is set for the hint
@ -100,17 +100,17 @@
*
* - Extension states
* \arg \ref AstENUM ast_extension_states
* \arg \ref pbx.c
* \arg \ref pbx.h
* \arg \ref pbx.c
* \arg \ref pbx.h
* - Structures
* - \ref ast_state_cb struct. Callbacks for watchers
* - Callback ast_state_cb_type
* - \ref ast_hint struct.
* - Functions
* - Functions
* - ast_extension_state_add()
* - ast_extension_state_del()
* - ast_get_hint()
*
*
*/
#include "asterisk.h"
@ -206,13 +206,13 @@ static struct {
static int getproviderstate(const char *provider, const char *address);
/*! \brief Find devicestate as text message for output */
const char *ast_devstate2str(enum ast_device_state devstate)
const char *ast_devstate2str(enum ast_device_state devstate)
{
return devstatestring[devstate][0];
}
/* Deprecated interface (not prefixed with ast_) */
const char *devstate2str(enum ast_device_state devstate)
const char *devstate2str(enum ast_device_state devstate)
{
return devstatestring[devstate][0];
}
@ -257,9 +257,9 @@ enum ast_device_state ast_devstate_val(const char *val)
return AST_DEVICE_UNKNOWN;
}
/*! \brief Find out if device is active in a call or not
/*! \brief Find out if device is active in a call or not
\note find channels with the device's name in it
This function is only used for channels that does not implement
This function is only used for channels that does not implement
devicestate natively
*/
enum ast_device_state ast_parse_device_state(const char *device)
@ -275,7 +275,7 @@ enum ast_device_state ast_parse_device_state(const char *device)
}
res = (ast_channel_state(chan) == AST_STATE_RINGING) ? AST_DEVICE_RINGING : AST_DEVICE_INUSE;
chan = ast_channel_unref(chan);
return res;
@ -464,9 +464,9 @@ int ast_devstate_changed_literal(enum ast_device_state state, const char *device
{
struct state_change *change;
/*
/*
* If we know the state change (how nice of the caller of this function!)
* then we can just generate a device state event.
* then we can just generate a device state event.
*
* Otherwise, we do the following:
* - Queue an event up to another thread that the state has changed
@ -503,7 +503,7 @@ int ast_device_state_changed_literal(const char *dev)
return ast_devstate_changed_literal(AST_DEVICE_UNKNOWN, dev);
}
int ast_devstate_changed(enum ast_device_state state, const char *fmt, ...)
int ast_devstate_changed(enum ast_device_state state, const char *fmt, ...)
{
char buf[AST_MAX_EXTENSION];
va_list ap;
@ -515,7 +515,7 @@ int ast_devstate_changed(enum ast_device_state state, const char *fmt, ...)
return ast_devstate_changed_literal(state, buf);
}
int ast_device_state_changed(const char *fmt, ...)
int ast_device_state_changed(const char *fmt, ...)
{
char buf[AST_MAX_EXTENSION];
va_list ap;
@ -598,7 +598,7 @@ static void process_collection(const char *device, struct change_collection *col
ast_devstate_aggregate_init(&agg);
for (i = 0; i < collection->num_states; i++) {
ast_debug(1, "Adding per-server state of '%s' for '%s'\n",
ast_debug(1, "Adding per-server state of '%s' for '%s'\n",
ast_devstate2str(collection->states[i].state), device);
ast_devstate_aggregate_add(&agg, collection->states[i].state);
}
@ -611,12 +611,12 @@ static void process_collection(const char *device, struct change_collection *col
event = ast_event_get_cached(AST_EVENT_DEVICE_STATE,
AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, device,
AST_EVENT_IE_END);
if (event) {
enum ast_device_state old_state;
old_state = ast_event_get_ie_uint(event, AST_EVENT_IE_STATE);
ast_event_destroy(event);
if (state == old_state) {

View File

@ -91,7 +91,7 @@ static void *answer_exec_enable(void *data)
/* Create new data structure */
if (!(answer_exec = ast_calloc(1, sizeof(*answer_exec))))
return NULL;
/* Parse out application and arguments */
if ((args = strchr(app, ','))) {
*args++ = '\0';
@ -568,7 +568,7 @@ static enum ast_dial_result monitor_dial(struct ast_dial *dial, struct ast_chann
set_state(dial, AST_DIAL_RESULT_RINGING);
if (chan)
ast_indicate(chan, AST_CONTROL_RINGING);
} else if (chan && dial->options[AST_DIAL_OPTION_MUSIC] &&
} else if (chan && dial->options[AST_DIAL_OPTION_MUSIC] &&
!ast_strlen_zero(dial->options[AST_DIAL_OPTION_MUSIC])) {
char *original_moh = ast_strdupa(ast_channel_musicclass(chan));
ast_indicate(chan, -1);
@ -680,7 +680,7 @@ static enum ast_dial_result monitor_dial(struct ast_dial *dial, struct ast_chann
channel->is_running_app = 0;
}
if (chan && dial->options[AST_DIAL_OPTION_MUSIC] &&
if (chan && dial->options[AST_DIAL_OPTION_MUSIC] &&
!ast_strlen_zero(dial->options[AST_DIAL_OPTION_MUSIC])) {
ast_moh_stop(chan);
}
@ -850,7 +850,7 @@ void ast_dial_hangup(struct ast_dial *dial)
if (!dial)
return;
AST_LIST_LOCK(&dial->channels);
AST_LIST_TRAVERSE(&dial->channels, channel, list) {
if (channel->owner) {
@ -875,7 +875,7 @@ int ast_dial_destroy(struct ast_dial *dial)
if (!dial)
return -1;
/* Hangup and deallocate all the dialed channels */
AST_LIST_LOCK(&dial->channels);
AST_LIST_TRAVERSE_SAFE_BEGIN(&dial->channels, channel, list) {
@ -900,7 +900,7 @@ int ast_dial_destroy(struct ast_dial *dial)
}
AST_LIST_TRAVERSE_SAFE_END;
AST_LIST_UNLOCK(&dial->channels);
/* Disable any enabled options globally */
for (i = 0; i < AST_DIAL_OPTION_MAX; i++) {
if (!dial->options[i])
@ -957,7 +957,7 @@ static struct ast_dial_channel *find_dial_channel(struct ast_dial *dial, int num
break;
}
AST_LIST_UNLOCK(&dial->channels);
return channel;
}

View File

@ -64,7 +64,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
* -
* Copyright (c) 1983, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -75,12 +75,12 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@ -94,14 +94,14 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
* SUCH DAMAGE.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
@ -248,7 +248,7 @@ static int dns_parse_answer(void *context,
AST_MUTEX_DEFINE_STATIC(res_lock);
#endif
/*! \brief Lookup record in DNS
/*! \brief Lookup record in DNS
\note Asterisk DNS is synchronus at this time. This means that if your DNS does
not work properly, Asterisk might not start properly or a channel may lock.
*/

View File

@ -20,7 +20,7 @@
*
* \brief Background DNS update manager
*
* \author Kevin P. Fleming <kpfleming@digium.com>
* \author Kevin P. Fleming <kpfleming@digium.com>
*
* \bug There is a minor race condition. In the event that an IP address
* of a dnsmgr managed host changes, there is the potential for the consumer

View File

@ -663,7 +663,7 @@ static int dtmf_detect(struct ast_dsp *dsp, digit_detect_state_t *s, int16_t amp
} else {
limit = samples;
}
/* The following unrolled loop takes only 35% (rough estimate) of the
/* The following unrolled loop takes only 35% (rough estimate) of the
time of a rolled loop on the machine on which it was developed */
for (j = sample; j < limit; j++) {
famp = amp[j];
@ -787,7 +787,7 @@ static int dtmf_detect(struct ast_dsp *dsp, digit_detect_state_t *s, int16_t amp
}
static int mf_detect(struct ast_dsp *dsp, digit_detect_state_t *s, int16_t amp[],
int samples, int squelch, int relax)
int samples, int squelch, int relax)
{
float energy[6];
int best;
@ -813,7 +813,7 @@ static int mf_detect(struct ast_dsp *dsp, digit_detect_state_t *s, int16_t amp[]
} else {
limit = samples;
}
/* The following unrolled loop takes only 35% (rough estimate) of the
/* The following unrolled loop takes only 35% (rough estimate) of the
time of a rolled loop on the machine on which it was developed */
for (j = sample; j < limit; j++) {
/* With GCC 2.95, the following unrolled code seems to take about 35%
@ -1781,7 +1781,7 @@ static int _dsp_init(int reload)
for (v = ast_variable_browse(cfg, "default"); v; v = v->next) {
if (!strcasecmp(v->name, "silencethreshold")) {
if (sscanf(v->value, "%30d", &cfg_threshold) < 1) {
ast_log(LOG_WARNING, "Unable to convert '%s' to a numeric value.\n", v->value);
ast_log(LOG_WARNING, "Unable to convert '%s' to a numeric value.\n", v->value);
} else if (cfg_threshold < 0) {
ast_log(LOG_WARNING, "Invalid silence threshold '%d' specified, using default\n", cfg_threshold);
} else {

View File

@ -1,15 +1,15 @@
/* ecdisa.h: Generated from frequency 2100
by gentone. 80 samples */
static unsigned char ecdisa[80] = {
255, 143, 58, 16, 171, 146, 34, 20,
156, 151, 25, 26, 149, 159, 19, 38,
145, 177, 16, 73, 143, 73, 16, 177,
145, 38, 19, 159, 149, 26, 25, 151,
156, 20, 34, 146, 171, 16, 58, 143,
255, 15, 186, 144, 43, 18, 162, 148,
28, 23, 153, 154, 21, 31, 147, 166,
17, 49, 144, 201, 15, 201, 144, 49,
17, 166, 147, 31, 21, 154, 153, 23,
28, 148, 162, 18, 43, 144, 186, 15,
255, 143, 58, 16, 171, 146, 34, 20,
156, 151, 25, 26, 149, 159, 19, 38,
145, 177, 16, 73, 143, 73, 16, 177,
145, 38, 19, 159, 149, 26, 25, 151,
156, 20, 34, 146, 171, 16, 58, 143,
255, 15, 186, 144, 43, 18, 162, 148,
28, 23, 153, 154, 21, 31, 147, 166,
17, 49, 144, 201, 15, 201, 144, 49,
17, 166, 147, 31, 21, 154, 153, 23,
28, 148, 162, 18, 43, 144, 186, 15,
};

View File

@ -35,7 +35,7 @@
* - ENUM SIP: http://www.ietf.org/rfc/rfc3764.txt
* - IANA ENUM Services: http://www.iana.org/assignments/enum-services
*
* - I-ENUM:
* - I-ENUM:
* http://tools.ietf.org/wg/enum/draft-ietf-enum-combined/
* http://tools.ietf.org/wg/enum/draft-ietf-enum-branch-location-record/
*
@ -84,7 +84,7 @@ static char ienum_branchlabel[32] = "i";
#define ENUMLOOKUP_BLR_TXT 1
#define ENUMLOOKUP_BLR_EBL 2
static int ebl_alg = ENUMLOOKUP_BLR_CC;
/* EBL record provisional type code */
#define T_EBL 65300
@ -95,7 +95,7 @@ AST_MUTEX_DEFINE_STATIC(enumlock);
* Input: E.164 number w/o leading +
*
* Output: number of digits in the country code
* 0 on invalid number
* 0 on invalid number
*
* Algorithm:
* 3 digits is the default length of a country code.
@ -113,13 +113,13 @@ static int cclen(const char *number)
}
strncpy(digits, number, 2);
if (!sscanf(digits, "%30d", &cc)) {
return 0;
}
if (cc / 10 == 1 || cc / 10 == 7)
return 1;
return 1;
if (cc == 20 || cc == 27 || (cc >= 30 && cc <= 34) || cc == 36 ||
cc == 39 || cc == 40 || cc == 41 || (cc >= 40 && cc <= 41) ||
@ -150,7 +150,7 @@ static int txt_callback(void *context, unsigned char *answer, int len, unsigned
return 0;
}
/* RFC1035:
/* RFC1035:
*
* <character-string> is a single length octet followed by that number of characters.
* TXT-DATA One or more <character-string>s.
@ -181,11 +181,11 @@ static int txt_callback(void *context, unsigned char *answer, int len, unsigned
/*
* Input: CC code
*
* Output: number of digits in the number before the i-enum branch
* Output: number of digits in the number before the i-enum branch
*
* Algorithm: Build <ienum_branchlabel>.c.c.<suffix> and look for a TXT lookup.
* Return atoi(TXT-record).
* Return -1 on not found.
* Return atoi(TXT-record).
* Return -1 on not found.
*
*/
static int blr_txt(const char *cc, const char *suffix)
@ -228,7 +228,7 @@ static int blr_txt(const char *cc, const char *suffix)
return ret;
}
}
ast_verb(3, "blr_txt() BLR TXT record for %s not found (apex: %s)\n", cc, suffix);
return -1;
@ -251,7 +251,7 @@ static int ebl_callback(void *context, unsigned char *answer, int len, unsigned
c->pos = 0; /* default to empty */
c->separator[0] = 0;
c->sep_len = 0;
c->apex[0] = 0;
c->apex[0] = 0;
c->apex_len = 0;
if (answer == NULL) {
@ -270,8 +270,8 @@ static int ebl_callback(void *context, unsigned char *answer, int len, unsigned
* +--+--+--+--+--+--+--+--+
*
* where POSITION is a single byte, SEPARATOR is a <character-string>
* and APEX is a <domain-name>.
*
* and APEX is a <domain-name>.
*
*/
c->pos = *answer++;
@ -295,7 +295,7 @@ static int ebl_callback(void *context, unsigned char *answer, int len, unsigned
answer += i;
len -= i;
if ((i = dn_expand((unsigned char *)fullanswer, (unsigned char *)answer + len,
if ((i = dn_expand((unsigned char *)fullanswer, (unsigned char *)answer + len,
(unsigned char *)answer, c->apex, sizeof(c->apex) - 1)) < 0) {
ast_log(LOG_WARNING, "Failed to expand hostname\n");
return 0;
@ -310,11 +310,11 @@ static int ebl_callback(void *context, unsigned char *answer, int len, unsigned
/*
* Input: CC code
*
* Output: number of digits in the number before the i-enum branch
* Output: number of digits in the number before the i-enum branch
*
* Algorithm: Build <ienum_branchlabel>.c.c.<suffix> and look for an EBL record
* Return pos and fill in separator and apex.
* Return -1 on not found.
* Algorithm: Build <ienum_branchlabel>.c.c.<suffix> and look for an EBL record
* Return pos and fill in separator and apex.
* Return -1 on not found.
*
*/
static int blr_ebl(const char *cc, const char *suffix, char *separator, int sep_len, char* apex, int apex_len)
@ -481,7 +481,7 @@ static int parse_naptr(unsigned char *dst, int dstsize, char *tech, int techsize
return -1;
}
/* this takes the first character of the regexp (which is a delimiter)
/* this takes the first character of the regexp (which is a delimiter)
* and uses that character to find the index of the second delimiter */
delim = regexp[0];
delim2 = strchr(regexp + 1, delim);
@ -690,10 +690,10 @@ int ast_get_enum(struct ast_channel *chan, const char *number, char *dst, int ds
/*
* Process options:
*
* c Return count, not URI
* i Use infrastructure ENUM
* s Do ISN transformation
* d Direct DNS query: no reversing.
* c Return count, not URI
* i Use infrastructure ENUM
* s Do ISN transformation
* d Direct DNS query: no reversing.
*
*/
if (options != NULL) {
@ -716,7 +716,7 @@ int ast_get_enum(struct ast_channel *chan, const char *number, char *dst, int ds
number, tech, suffix, context->options, context->position);
/*
* This code does more than simple RFC3261 ENUM. All these rewriting
* This code does more than simple RFC3261 ENUM. All these rewriting
* schemes have in common that they build the FQDN for the NAPTR lookup
* by concatenating
* - a number which needs be flipped and "."-seperated (left)
@ -734,7 +734,7 @@ int ast_get_enum(struct ast_channel *chan, const char *number, char *dst, int ds
ast_copy_string(left, number, sizeof(left));
middle[0] = '\0';
/*
* I-ENUM can change the apex, thus we copy it
* I-ENUM can change the apex, thus we copy it
*/
ast_copy_string(apex, suffix, sizeof(apex));
/* ISN rewrite */
@ -931,7 +931,7 @@ int ast_get_txt(struct ast_channel *chan, const char *number, char *txt, int txt
if (chan && ast_autoservice_start(chan) < 0) {
return -1;
}
if (pos > 128) {
pos = 128;
}
@ -982,11 +982,11 @@ static int private_enum_init(int reload)
ebl_alg = ENUMLOOKUP_BLR_CC; /* default */
if (!strcasecmp(string, "txt"))
ebl_alg = ENUMLOOKUP_BLR_TXT;
ebl_alg = ENUMLOOKUP_BLR_TXT;
else if (!strcasecmp(string, "ebl"))
ebl_alg = ENUMLOOKUP_BLR_EBL;
ebl_alg = ENUMLOOKUP_BLR_EBL;
else if (!strcasecmp(string, "cc"))
ebl_alg = ENUMLOOKUP_BLR_CC;
ebl_alg = ENUMLOOKUP_BLR_CC;
else
ast_log(LOG_WARNING, "No valid parameter for ienum/ebl_alg.\n");
}

View File

@ -150,7 +150,7 @@ static int ast_event_hash_devstate_change(const void *obj, const int flags);
* \brief Event types that are kept in the cache.
*/
static struct {
/*!
/*!
* \brief Container of cached events
*
* \details This gets allocated in ast_event_init() when Asterisk starts

View File

@ -20,7 +20,7 @@
*
* \brief Routines implementing call features as call pickup, parking and transfer
*
* \author Mark Spencer <markster@digium.com>
* \author Mark Spencer <markster@digium.com>
*/
/*** MODULEINFO
@ -152,7 +152,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
<variable name="LIMIT_PLAYAUDIO_CALLER">
<para>Play sounds to the caller. yes|no (default yes)</para>
</variable>
<variable name="LIMIT_PLAYAUDIO_CALLEE">
<variable name="LIMIT_PLAYAUDIO_CALLEE">
<para>Play sounds to the callee. yes|no</para>
</variable>
<variable name="LIMIT_TIMEOUT_FILE">
@ -734,30 +734,30 @@ static void set_new_chan_name(struct ast_channel *chan)
static void *dial_features_duplicate(void *data)
{
struct ast_dial_features *df = data, *df_copy;
if (!(df_copy = ast_calloc(1, sizeof(*df)))) {
return NULL;
}
memcpy(df_copy, df, sizeof(*df));
return df_copy;
if (!(df_copy = ast_calloc(1, sizeof(*df)))) {
return NULL;
}
memcpy(df_copy, df, sizeof(*df));
return df_copy;
}
static void dial_features_destroy(void *data)
{
struct ast_dial_features *df = data;
if (df) {
ast_free(df);
}
struct ast_dial_features *df = data;
if (df) {
ast_free(df);
}
}
static const struct ast_datastore_info dial_features_info = {
.type = "dial-features",
.destroy = dial_features_destroy,
.duplicate = dial_features_duplicate,
.type = "dial-features",
.destroy = dial_features_destroy,
.duplicate = dial_features_duplicate,
};
/* Forward declarations */
static struct ast_parkinglot *parkinglot_addref(struct ast_parkinglot *parkinglot);
static void parkinglot_unref(struct ast_parkinglot *parkinglot);
@ -809,7 +809,7 @@ const char *ast_pickup_ext(void)
return pickup_ext;
}
struct ast_bridge_thread_obj
struct ast_bridge_thread_obj
{
struct ast_bridge_config bconfig;
struct ast_channel *chan;
@ -833,7 +833,7 @@ static int parkinglot_cmp_cb(void *obj, void *arg, int flags)
}
/*!
* \brief store context, extension and priority
* \brief store context, extension and priority
* \param chan, context, ext, pri
*/
static void set_c_e_p(struct ast_channel *chan, const char *context, const char *ext, int pri)
@ -849,9 +849,9 @@ static void set_c_e_p(struct ast_channel *chan, const char *context, const char
*
* Check if channel has 'GOTO_ON_BLINDXFR' set, if not exit.
* When found make sure the types are compatible. Check if channel is valid
* if so start the new channel else hangup the call.
* if so start the new channel else hangup the call.
*/
static void check_goto_on_transfer(struct ast_channel *chan)
static void check_goto_on_transfer(struct ast_channel *chan)
{
struct ast_channel *xferchan;
const char *val;
@ -892,7 +892,7 @@ static void check_goto_on_transfer(struct ast_channel *chan)
}
ast_parseable_goto(xferchan, goto_on_transfer);
ast_channel_state_set(xferchan, AST_STATE_UP);
ast_clear_flag(ast_channel_flags(xferchan), AST_FLAGS_ALL);
ast_clear_flag(ast_channel_flags(xferchan), AST_FLAGS_ALL);
ast_channel_clear_softhangup(xferchan, AST_SOFTHANGUP_ALL);
if (ast_do_masquerade(xferchan) || ast_pbx_start(xferchan)) {
@ -907,7 +907,7 @@ static struct ast_channel *feature_request_and_dial(struct ast_channel *caller,
int timeout, int *outstate, const char *language);
/*!
* \brief bridge the call
* \brief bridge the call
* \param data thread bridge.
*
* Set Last Data for respective channels, reset cdr for channels
@ -957,7 +957,7 @@ static void *bridge_call_thread(void *data)
*
* Create thread and attributes, call bridge_call_thread
*/
static void bridge_call_thread_launch(void *data)
static void bridge_call_thread_launch(void *data)
{
pthread_t thread;
pthread_attr_t attr;
@ -1416,7 +1416,7 @@ static int park_call_full(struct ast_channel *chan, struct ast_channel *peer, st
!ast_strlen_zero(pu->parkinglot->cfg.mohclass) ? strlen(pu->parkinglot->cfg.mohclass) + 1 : 0);
}
}
pu->start = ast_tvnow();
pu->parkingtime = (args->timeout > 0) ? args->timeout : pu->parkinglot->cfg.parkingtime;
if (args->extout)
@ -1471,13 +1471,13 @@ static int park_call_full(struct ast_channel *chan, struct ast_channel *peer, st
* context. Information on extension options is lost here, so
* we set a flag
*/
ast_copy_string(pu->context,
S_OR(args->return_con, S_OR(ast_channel_macrocontext(chan), ast_channel_context(chan))),
ast_copy_string(pu->context,
S_OR(args->return_con, S_OR(ast_channel_macrocontext(chan), ast_channel_context(chan))),
sizeof(pu->context));
ast_copy_string(pu->exten,
S_OR(args->return_ext, S_OR(ast_channel_macroexten(chan), ast_channel_exten(chan))),
ast_copy_string(pu->exten,
S_OR(args->return_ext, S_OR(ast_channel_macroexten(chan), ast_channel_exten(chan))),
sizeof(pu->exten));
pu->priority = args->return_pri ? args->return_pri :
pu->priority = args->return_pri ? args->return_pri :
(ast_channel_macropriority(chan) ? ast_channel_macropriority(chan) : ast_channel_priority(chan));
/*
@ -1595,7 +1595,7 @@ int ast_park_call_exten(struct ast_channel *park_me, struct ast_channel *parker,
}
parse = ast_strdupa(app_data);
AST_STANDARD_APP_ARGS(app_args, parse);
if (!ast_strlen_zero(app_args.pl_name)) {
/* Find the specified exclusive parking lot */
args.parkinglot = find_parkinglot(app_args.pl_name);
@ -1746,7 +1746,7 @@ int ast_masq_park_call_exten(struct ast_channel *park_me, struct ast_channel *pa
}
parse = ast_strdupa(app_data);
AST_STANDARD_APP_ARGS(app_args, parse);
if (!ast_strlen_zero(app_args.pl_name)) {
/* Find the specified exclusive parking lot */
args.parkinglot = find_parkinglot(app_args.pl_name);
@ -2038,7 +2038,7 @@ static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *pee
return -1;
}
}
if (ast_channel_monitor(callee_chan)) {
ast_verb(4, "User hit '%s' to stop recording call.\n", code);
if (!ast_strlen_zero(automon_message_stop)) {
@ -2058,10 +2058,10 @@ static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *pee
if (!touch_monitor)
touch_monitor = pbx_builtin_getvar_helper(callee_chan, "TOUCH_MONITOR");
if (!touch_monitor_prefix)
touch_monitor_prefix = pbx_builtin_getvar_helper(callee_chan, "TOUCH_MONITOR_PREFIX");
if (touch_monitor) {
len = strlen(touch_monitor) + 50;
args = alloca(len);
@ -2084,7 +2084,7 @@ static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *pee
if (args[x] == '/')
args[x] = '-';
}
ast_verb(4, "User hit '%s' to record call. filename: %s\n", code, args);
pbx_exec(callee_chan, monitor_app, args);
@ -2094,11 +2094,11 @@ static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *pee
if (!ast_strlen_zero(automon_message_start)) { /* Play start message for both channels */
play_message_in_bridged_call(caller_chan, callee_chan, automon_message_start);
}
return AST_FEATURE_RETURN_SUCCESS;
}
ast_log(LOG_NOTICE,"Cannot record the call. One or both channels have gone away.\n");
ast_log(LOG_NOTICE,"Cannot record the call. One or both channels have gone away.\n");
return -1;
}
@ -2143,7 +2143,7 @@ static int builtin_automixmonitor(struct ast_channel *chan, struct ast_channel *
/* This means a mixmonitor is attached to the channel, running or not is unknown. */
if (count > 0) {
ast_verb(3, "User hit '%s' to stop recording call.\n", code);
/* Make sure they are running */
@ -2164,9 +2164,9 @@ static int builtin_automixmonitor(struct ast_channel *chan, struct ast_channel *
return AST_FEATURE_RETURN_SUCCESS;
}
}
ast_log(LOG_WARNING,"Stopped MixMonitors are attached to the channel.\n");
}
ast_log(LOG_WARNING,"Stopped MixMonitors are attached to the channel.\n");
}
if (caller_chan && callee_chan) {
const char *touch_format = pbx_builtin_getvar_helper(caller_chan, "TOUCH_MIXMONITOR_FORMAT");
@ -2207,7 +2207,7 @@ static int builtin_automixmonitor(struct ast_channel *chan, struct ast_channel *
pbx_builtin_setvar_helper(callee_chan, "TOUCH_MIXMONITOR_OUTPUT", touch_filename);
pbx_builtin_setvar_helper(caller_chan, "TOUCH_MIXMONITOR_OUTPUT", touch_filename);
return AST_FEATURE_RETURN_SUCCESS;
}
ast_log(LOG_NOTICE,"Cannot record the call. One or both channels have gone away.\n");
@ -2225,7 +2225,7 @@ static int builtin_disconnect(struct ast_channel *chan, struct ast_channel *peer
* \brief Find the context for the transfer
* \param transferer
* \param transferee
*
*
* Grab the TRANSFER_CONTEXT, if fails try grabbing macrocontext.
* \return a context string
*/
@ -2241,7 +2241,7 @@ static const char *real_ctx(struct ast_channel *transferer, struct ast_channel *
if (ast_strlen_zero(s)) {
s = ast_channel_context(transferer);
}
return s;
return s;
}
/*!
@ -2252,7 +2252,7 @@ static const char *real_ctx(struct ast_channel *transferer, struct ast_channel *
* \param code
* \param data
* \param sense feature options
*
*
* Place chan on hold, check if transferred to parkinglot extension,
* otherwise check extension exists and transfer caller.
* \retval AST_FEATURE_RETURN_SUCCESS.
@ -2864,7 +2864,7 @@ void ast_register_feature(struct ast_call_feature *feature)
ast_log(LOG_NOTICE,"You didn't pass a feature!\n");
return;
}
AST_RWLIST_WRLOCK(&feature_list);
AST_RWLIST_INSERT_HEAD(&feature_list,feature,feature_entry);
AST_RWLIST_UNLOCK(&feature_list);
@ -2872,7 +2872,7 @@ void ast_register_feature(struct ast_call_feature *feature)
ast_verb(2, "Registered Feature '%s'\n",feature->sname);
}
/*!
/*!
* \brief Add new feature group
* \param fgname feature group name.
*
@ -2901,14 +2901,14 @@ static struct feature_group *register_group(const char *fgname)
return fg;
}
/*!
/*!
* \brief Add feature to group
* \param fg feature group
* \param exten
* \param feature feature to add.
*
* Check fg and feature specified, add feature to list
* \note This function MUST be called while feature_groups is locked.
* \note This function MUST be called while feature_groups is locked.
*/
static void register_group_feature(struct feature_group *fg, const char *exten, struct ast_call_feature *feature)
{
@ -2996,8 +2996,8 @@ static void ast_unregister_groups(void)
AST_RWLIST_UNLOCK(&feature_groups);
}
/*!
* \brief Find a group by name
/*!
* \brief Find a group by name
* \param name feature name
* \retval feature group on success.
* \retval NULL on failure.
@ -3036,7 +3036,7 @@ struct ast_call_feature *ast_find_call_feature(const char *name)
}
/*!
* \brief exec an app by feature
* \brief exec an app by feature
* \param chan,peer,config,code,sense,data
*
* Find a feature, determine which channel activated
@ -3053,7 +3053,7 @@ static int feature_exec_app(struct ast_channel *chan, struct ast_channel *peer,
if (!feature) { /* shouldn't ever happen! */
ast_log(LOG_NOTICE, "Found feature before, but at execing we've lost it??\n");
return -1;
return -1;
}
if (sense == FEATURE_SENSE_CHAN) {
@ -3085,7 +3085,7 @@ static int feature_exec_app(struct ast_channel *chan, struct ast_channel *peer,
ast_autoservice_start(idle);
ast_autoservice_ignore(idle, AST_FRAME_DTMF_END);
if(work && idle) {
pbx_builtin_setvar_helper(work, "DYNAMIC_PEERNAME", ast_channel_name(idle));
pbx_builtin_setvar_helper(idle, "DYNAMIC_PEERNAME", ast_channel_name(work));
@ -3908,7 +3908,7 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a
if (!(monitor_app = pbx_findapp("Monitor")))
monitor_ok=0;
}
if ((monitor_exec = pbx_builtin_getvar_helper(chan, "AUTO_MONITOR")))
if ((monitor_exec = pbx_builtin_getvar_helper(chan, "AUTO_MONITOR")))
src = chan;
else if ((monitor_exec = pbx_builtin_getvar_helper(peer, "AUTO_MONITOR")))
src = peer;
@ -4005,10 +4005,10 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a
/* Another case where the peer cdr's time will be set, is when
A self-parks by pickup up phone and dialing 700, then B
picks up A by dialing its parking slot; there may be more
picks up A by dialing its parking slot; there may be more
practical paths that get the same result, tho... in which
case you get the previous answer time from the Park... which
is before the bridge's start time, so I added in the
is before the bridge's start time, so I added in the
tvcmp check to the if below */
if (peer_cdr && !ast_tvzero(peer_cdr->answer) && ast_tvcmp(peer_cdr->answer, bridge_cdr->start) >= 0) {
@ -4048,7 +4048,7 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a
for (;;) {
struct ast_channel *other; /* used later */
res = ast_channel_bridge(chan, peer, config, &f, &who);
if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE)
@ -4064,7 +4064,7 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a
/* When frame is not set, we are probably involved in a situation
where we've timed out.
When frame is set, we'll come this code twice; once for DTMF_BEGIN
and also for DTMF_END. If we flow into the following 'if' for both, then
and also for DTMF_END. If we flow into the following 'if' for both, then
our wait times are cut in half, as both will subtract from the
feature_timer. Not good!
*/
@ -4108,7 +4108,7 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a
* However, we don't think the feature has quite yet timed out, so just
* go back into the bridge. */
continue;
}
}
} else {
if (config->feature_timer <=0) {
/* We ran out of time */
@ -4127,7 +4127,7 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a
}
goto before_you_go;
}
if (!f || (f->frametype == AST_FRAME_CONTROL &&
(f->subclass.integer == AST_CONTROL_HANGUP || f->subclass.integer == AST_CONTROL_BUSY ||
f->subclass.integer == AST_CONTROL_CONGESTION))) {
@ -4179,14 +4179,14 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a
* they are useful. I haven't deleted them entirely because I
* just am not sure of the ramifications of removing them. */
if (aoh && aoh->flag == AST_OPTION_FLAG_REQUEST) {
switch (ntohs(aoh->option)) {
switch (ntohs(aoh->option)) {
case AST_OPTION_TONE_VERIFY:
case AST_OPTION_TDD:
case AST_OPTION_RELAXDTMF:
case AST_OPTION_AUDIO_MODE:
case AST_OPTION_DIGIT_DETECT:
case AST_OPTION_FAX_DETECT:
ast_channel_setoption(other, ntohs(aoh->option), aoh->data,
ast_channel_setoption(other, ntohs(aoh->option), aoh->data,
f->datalen - sizeof(struct ast_option_header), 0);
}
}
@ -4247,7 +4247,7 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a
sendingdtmfdigit = 0;
} else {
/*! append the event to featurecode. we rely on the string being zero-filled, and
* not overflowing it.
* not overflowing it.
* \todo XXX how do we guarantee the latter ?
*/
featurecode[strlen(featurecode)] = f->subclass.integer;
@ -4313,7 +4313,7 @@ before_you_go:
config->end_bridge_callback(config->end_bridge_callback_data);
}
/* run the hangup exten on the chan object IFF it was NOT involved in a parking situation
/* run the hangup exten on the chan object IFF it was NOT involved in a parking situation
* if it were, then chan belongs to a different thread now, and might have been hung up long
* ago.
*/
@ -4405,7 +4405,7 @@ before_you_go:
}
ast_set2_flag(ast_channel_flags(chan), autoloopflag, AST_FLAG_IN_AUTOLOOP);
}
/* obey the NoCDR() wishes. -- move the DISABLED flag to the bridge CDR if it was set on the channel during the bridge... */
new_chan_cdr = pick_unlocked_cdr(ast_channel_cdr(chan)); /* the proper chan cdr, if there are forked cdrs */
/* If the channel CDR has been modified during the call, record the changes in the bridge cdr,
@ -4426,17 +4426,17 @@ before_you_go:
ast_cdr_end(bridge_cdr);
ast_cdr_detach(bridge_cdr);
}
/* do a specialized reset on the beginning channel
CDR's, if they still exist, so as not to mess up
issues in future bridges;
Here are the rules of the game:
1. The chan and peer channel pointers will not change
during the life of the bridge.
2. But, in transfers, the channel names will change.
between the time the bridge is started, and the
time the channel ends.
time the channel ends.
Usually, when a channel changes names, it will
also change CDR pointers.
3. Usually, only one of the two channels (chan or peer)
@ -4454,7 +4454,7 @@ before_you_go:
if (new_chan_cdr) {
struct ast_channel *chan_ptr = NULL;
if (strcasecmp(orig_channame, ast_channel_name(chan)) != 0) {
if (strcasecmp(orig_channame, ast_channel_name(chan)) != 0) {
/* old channel */
if ((chan_ptr = ast_channel_get_by_name(orig_channame))) {
ast_channel_lock(chan_ptr);
@ -4484,7 +4484,7 @@ before_you_go:
new_peer_cdr = pick_unlocked_cdr(ast_channel_cdr(peer)); /* the proper chan cdr, if there are forked cdrs */
if (new_chan_cdr && ast_test_flag(new_chan_cdr, AST_CDR_FLAG_POST_DISABLED) && new_peer_cdr && !ast_test_flag(new_peer_cdr, AST_CDR_FLAG_POST_DISABLED))
ast_set_flag(new_peer_cdr, AST_CDR_FLAG_POST_DISABLED); /* DISABLED is viral-- it will propagate across a bridge */
if (strcasecmp(orig_peername, ast_channel_name(peer)) != 0) {
if (strcasecmp(orig_peername, ast_channel_name(peer)) != 0) {
/* old channel */
if ((chan_ptr = ast_channel_get_by_name(orig_peername))) {
ast_channel_lock(chan_ptr);
@ -4513,7 +4513,7 @@ before_you_go:
ast_cdr_specialized_reset(ast_channel_cdr(peer), 0); /* nothing changed, reset the peer cdr */
}
}
return res;
}
@ -4529,7 +4529,7 @@ static void post_manager_event(const char *s, struct parkeduser *pu)
"ConnectedLineNum: %s\r\n"
"ConnectedLineName: %s\r\n"
"UniqueID: %s\r\n",
pu->parkingexten,
pu->parkingexten,
ast_channel_name(pu->chan),
pu->parkinglot->name,
S_COR(ast_channel_caller(pu->chan)->id.number.valid, ast_channel_caller(pu->chan)->id.number.str, "<unknown>"),
@ -4855,10 +4855,10 @@ static void manage_parkinglot(struct ast_parkinglot *curlot, const struct pollfd
AST_LIST_UNLOCK(&curlot->parkings);
}
/*!
* \brief Take care of parked calls and unpark them if needed
/*!
* \brief Take care of parked calls and unpark them if needed
* \param ignore unused var.
*
*
* Start inf loop, lock parking lot, check if any parked channels have gone above timeout
* if so, remove channel from parking lot and return it to the extension that parked it.
* Check if parked channel decided to hangup, wait until next FD via select().
@ -5319,7 +5319,7 @@ static int parked_call_exec(struct ast_channel *chan, const char *data)
/*!
* \brief Unreference parkinglot object.
*/
static void parkinglot_unref(struct ast_parkinglot *parkinglot)
static void parkinglot_unref(struct ast_parkinglot *parkinglot)
{
ast_debug(3, "Multiparking: %s refcount now %d\n", parkinglot->name,
ao2_ref(parkinglot, 0) - 1);
@ -5361,7 +5361,7 @@ static struct ast_parkinglot *create_parkinglot(const char *name)
newlot = ao2_alloc(sizeof(*newlot), parkinglot_destroy);
if (!newlot)
return NULL;
ast_copy_string(newlot->name, name, sizeof(newlot->name));
newlot->cfg.is_invalid = 1;/* No config is set yet. */
AST_LIST_HEAD_INIT(&newlot->parkings);
@ -5369,7 +5369,7 @@ static struct ast_parkinglot *create_parkinglot(const char *name)
return newlot;
}
/*!
/*!
* \brief Add parking hints for all defined parking spaces.
* \param context Dialplan context to add the hints.
* \param start Starting space in parkinglot.
@ -5777,8 +5777,8 @@ static int process_config(struct ast_config *cfg)
int i;
struct ast_variable *var = NULL;
struct feature_group *fg = NULL;
char *ctg;
static const char * const categories[] = {
char *ctg;
static const char * const categories[] = {
/* Categories in features.conf that are not
* to be parsed as group categories
*/
@ -5920,7 +5920,7 @@ static int process_config(struct ast_config *cfg)
struct ast_call_feature *feature;
AST_RWLIST_RDLOCK(&feature_list);
if (!(feature = find_dynamic_feature(var->name)) &&
if (!(feature = find_dynamic_feature(var->name)) &&
!(feature = ast_find_call_feature(var->name))) {
AST_RWLIST_UNLOCK(&feature_list);
ast_log(LOG_WARNING, "Feature '%s' was not found.\n", var->name);
@ -6711,7 +6711,7 @@ static char *handle_feature_show(struct ast_cli_entry *e, int cmd, struct ast_cl
#define HFS_FORMAT "%-25s %-7s %-7s\n"
switch (cmd) {
case CLI_INIT:
e->command = "features show";
e->usage =
@ -6817,7 +6817,7 @@ int ast_features_reload(void)
static char *handle_features_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
switch (cmd) {
switch (cmd) {
case CLI_INIT:
e->command = "features reload";
e->usage =
@ -6836,7 +6836,7 @@ static char *handle_features_reload(struct ast_cli_entry *e, int cmd, struct ast
* \brief Actual bridge
* \param chan
* \param tmpchan
*
*
* Stop hold music, lock both channels, masq channels,
* after bridge return channel to next priority.
*/
@ -6863,13 +6863,13 @@ static void do_bridge_masquerade(struct ast_channel *chan, struct ast_channel *t
* \brief Bridge channels together
* \param s
* \param m
*
* Make sure valid channels were specified,
*
* Make sure valid channels were specified,
* send errors if any of the channels could not be found/locked, answer channels if needed,
* create the placeholder channels and grab the other channels
* make the channels compatible, send error if we fail doing so
* create the placeholder channels and grab the other channels
* make the channels compatible, send error if we fail doing so
* setup the bridge thread object and start the bridge.
*
*
* \retval 0 on success or on incorrect use.
* \retval 1 on failure to bridge channels.
*/
@ -6904,7 +6904,7 @@ static int action_bridge(struct mansession *s, const struct message *m)
ast_answer(chana);
/* create the placeholder channels and grab the other channels */
if (!(tmpchana = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, NULL,
if (!(tmpchana = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, NULL,
NULL, NULL, ast_channel_linkedid(chana), 0, "Bridge/%s", ast_channel_name(chana)))) {
astman_send_error(s, m, "Unable to create temporary channel!");
chana = ast_channel_unref(chana);
@ -6931,7 +6931,7 @@ static int action_bridge(struct mansession *s, const struct message *m)
ast_answer(chanb);
/* create the placeholder channels and grab the other channels */
if (!(tmpchanb = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, NULL,
if (!(tmpchanb = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, NULL,
NULL, NULL, ast_channel_linkedid(chanb), 0, "Bridge/%s", ast_channel_name(chanb)))) {
astman_send_error(s, m, "Unable to create temporary channels!");
ast_hangup(tmpchana);
@ -6989,10 +6989,10 @@ static int action_bridge(struct mansession *s, const struct message *m)
/*!
* \brief CLI command to list parked calls
* \param e
* \param e
* \param cmd
* \param a
*
*
* Check right usage, lock parking lot, display parked calls, unlock parking lot list.
* \retval CLI_SUCCESS on success.
* \retval CLI_SHOWUSAGE on incorrect number of arguments.
@ -7060,13 +7060,13 @@ static struct ast_cli_entry cli_features[] = {
AST_CLI_DEFINE(handle_parkedcalls, "List currently parked calls"),
};
/*!
/*!
* \brief Dump parking lot status
* \param s
* \param m
*
*
* Lock parking lot, iterate list and append parked calls status, unlock parking lot.
* \return Always RESULT_SUCCESS
* \return Always RESULT_SUCCESS
*/
static int manager_parking_status(struct mansession *s, const struct message *m)
{
@ -7224,7 +7224,7 @@ static int manager_park(struct mansession *s, const struct message *m)
* attempting to pickup the same channel.
*/
static const struct ast_datastore_info pickup_active = {
.type = "pickup-active",
.type = "pickup-active",
};
int ast_can_pickup(struct ast_channel *chan)
@ -7353,7 +7353,7 @@ int ast_do_pickup(struct ast_channel *chan, struct ast_channel *target)
ast_log(LOG_WARNING, "Unable to queue answer on '%s'\n", chan_name);
goto pickup_failed;
}
/* setting this flag to generate a reason header in the cancel message to the ringing channel */
ast_set_flag(ast_channel_flags(chan), AST_FLAG_ANSWERED_ELSEWHERE);
@ -7398,7 +7398,7 @@ enum {
OPT_CALLER_PARK = (1 << 10),
OPT_CALLEE_KILL = (1 << 11),
};
enum {
OPT_ARG_DURATION_LIMIT = 0,
OPT_ARG_DURATION_STOP,
@ -7470,7 +7470,7 @@ int ast_bridge_timelimit(struct ast_channel *chan, struct ast_bridge_config *con
config->play_warning = config->warning_freq = 0;
}
}
ast_channel_lock(chan);
var = pbx_builtin_getvar_helper(chan, "LIMIT_PLAYAUDIO_CALLER");
@ -7534,7 +7534,7 @@ int ast_bridge_timelimit(struct ast_channel *chan, struct ast_bridge_config *con
* \brief Bridge channels
* \param chan
* \param data channel to bridge with.
*
*
* Split data, check we aren't bridging with ourself, check valid channel,
* answer call if not already, check compatible channels, setup bridge config
* now bridge call, if transfered party hangs up return to PBX extension.
@ -7552,7 +7552,7 @@ static int bridge_exec(struct ast_channel *chan, const char *data)
AST_APP_ARG(dest_chan);
AST_APP_ARG(options);
);
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Bridge require at least 1 argument specifying the other end of the bridge\n");
return -1;
@ -7596,7 +7596,7 @@ static int bridge_exec(struct ast_channel *chan, const char *data)
}
/* try to allocate a place holder where current_dest_chan will be placed */
if (!(final_dest_chan = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, NULL,
if (!(final_dest_chan = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, NULL,
NULL, NULL, ast_channel_linkedid(current_dest_chan), 0, "Bridge/%s", ast_channel_name(current_dest_chan)))) {
ast_log(LOG_WARNING, "Cannot create placeholder channel for chan %s\n", args.dest_chan);
ast_manager_event(chan, EVENT_FLAG_CALL, "BridgeExec",
@ -7632,16 +7632,16 @@ static int bridge_exec(struct ast_channel *chan, const char *data)
"Channel1: %s\r\n"
"Channel2: %s\r\n", ast_channel_name(chan), ast_channel_name(final_dest_chan));
/* we have 2 valid channels to bridge, now it is just a matter of setting up the bridge config and starting the bridge */
/* we have 2 valid channels to bridge, now it is just a matter of setting up the bridge config and starting the bridge */
if (ast_test_flag(&opts, BRIDGE_OPT_PLAYTONE) && !ast_strlen_zero(xfersound)) {
if (!ast_streamfile(final_dest_chan, xfersound, ast_channel_language(final_dest_chan))) {
if (ast_waitstream(final_dest_chan, "") < 0)
ast_log(LOG_WARNING, "Failed to play courtesy tone on %s\n", ast_channel_name(final_dest_chan));
}
}
current_dest_chan = ast_channel_unref(current_dest_chan);
if (ast_test_flag(&opts, OPT_DURATION_LIMIT) && !ast_strlen_zero(opt_args[OPT_ARG_DURATION_LIMIT])) {
if (ast_bridge_timelimit(chan, &bconfig, opt_args[OPT_ARG_DURATION_LIMIT], &calldurationlimit))
goto done;

View File

@ -20,7 +20,7 @@
*
* \brief Generic File Format Support.
*
* \author Mark Spencer <markster@digium.com>
* \author Mark Spencer <markster@digium.com>
*/
#include "asterisk.h"
@ -89,7 +89,7 @@ int __ast_format_def_register(const struct ast_format_def *f, struct ast_module
int align = (char *)&p.b - (char *)&p.a;
tmp->buf_size = ((f->buf_size + align - 1) / align) * align;
}
memset(&tmp->list, 0, sizeof(tmp->list));
AST_RWLIST_INSERT_HEAD(&formats, tmp, list);
@ -159,7 +159,7 @@ int ast_writestream(struct ast_filestream *fs, struct ast_frame *f)
if (fs->vfs)
return ast_writestream(fs->vfs, f);
/* else ignore */
return 0;
return 0;
}
} else if (f->frametype != AST_FRAME_VOICE) {
ast_log(LOG_WARNING, "Tried to write non-voice frame\n");
@ -167,7 +167,7 @@ int ast_writestream(struct ast_filestream *fs, struct ast_frame *f)
}
if (ast_format_cmp(&f->subclass.format, &fs->fmt->format) != AST_FORMAT_CMP_NOT_EQUAL) {
res = fs->fmt->write(fs, f);
if (res < 0)
if (res < 0)
ast_log(LOG_WARNING, "Natural write failed\n");
else if (res > 0)
ast_log(LOG_WARNING, "Huh??\n");
@ -178,7 +178,7 @@ int ast_writestream(struct ast_filestream *fs, struct ast_frame *f)
ast_translator_free_path(fs->trans);
fs->trans = NULL;
}
if (!fs->trans)
if (!fs->trans)
fs->trans = ast_translator_build_path(&fs->fmt->format, &f->subclass.format);
if (!fs->trans)
ast_log(LOG_WARNING, "Unable to translate to format %s, source format %s\n",
@ -426,7 +426,7 @@ enum file_action {
* unused for DELETE
* optional ast_format_cap holding all the formats found for a file, for EXISTS.
* destination file name (const char *) for COPY and RENAME
* struct ast_channel * for OPEN
* struct ast_channel * for OPEN
* if fmt is NULL, OPEN will return the first matching entry,
* whereas other functions will run on all matching entries.
*/
@ -593,7 +593,7 @@ static int fileexists_test(const char *filename, const char *fmt, const char *la
/*!
* \brief helper routine to locate a file with a given format
* and language preference.
*
*
* \note Try preflang, preflang with stripped '_' suffices, or NULL.
*
* \note The last parameter(s) point to a buffer of sufficient size,
@ -666,7 +666,7 @@ struct ast_filestream *ast_openstream(struct ast_channel *chan, const char *file
struct ast_filestream *ast_openstream_full(struct ast_channel *chan, const char *filename, const char *preflang, int asis)
{
/*
/*
* Use fileexists_core() to find a file in a compatible
* language and format, set up a suitable translator,
* and open the stream.
@ -830,7 +830,7 @@ static enum fsread_res ast_readaudio_callback(struct ast_filestream *s)
ast_frfree(fr);
}
goto return_failure;
}
}
if (fr) {
ast_frfree(fr);
@ -868,7 +868,7 @@ static int ast_fsread_audio(const void *data)
if (res == FSREAD_SUCCESS_SCHED)
return 1;
return 0;
}
@ -913,7 +913,7 @@ static int ast_fsread_video(const void *data)
if (res == FSREAD_SUCCESS_SCHED)
return 1;
return 0;
}
@ -1060,7 +1060,7 @@ struct ast_filestream *ast_readfile(const char *filename, const char *type, cons
struct ast_format_def *f;
struct ast_filestream *fs = NULL;
char *fn;
int format_found = 0;
int format_found = 0;
AST_RWLIST_RDLOCK(&formats);
@ -1068,7 +1068,7 @@ struct ast_filestream *ast_readfile(const char *filename, const char *type, cons
fs = NULL;
if (!exts_compare(f->exts, type))
continue;
else
else
format_found = 1;
fn = build_filename(filename, type);
@ -1083,7 +1083,7 @@ struct ast_filestream *ast_readfile(const char *filename, const char *type, cons
fs = NULL;
bfile = NULL;
ast_free(fn);
break;
break;
}
/* found it */
fs->trans = NULL;
@ -1117,12 +1117,12 @@ struct ast_filestream *ast_writefile(const char *filename, const char *type, con
/* set the O_TRUNC flag if and only if there is no O_APPEND specified */
/* We really can't use O_APPEND as it will break WAV header updates */
if (flags & O_APPEND) {
if (flags & O_APPEND) {
flags &= ~O_APPEND;
} else {
myflags = O_TRUNC;
}
myflags |= O_WRONLY | O_CREAT;
/* XXX need to fix this - we should just do the fopen,
@ -1149,7 +1149,7 @@ struct ast_filestream *ast_writefile(const char *filename, const char *type, con
fd = -1;
}
}
if (ast_opt_cache_record_files && (fd > -1)) {
char *c;
@ -1334,7 +1334,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
ast_frfree(fr);
ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return res;
}
}
}
break;
case AST_FRAME_CONTROL:
@ -1428,7 +1428,7 @@ int ast_stream_and_wait(struct ast_channel *chan, const char *file, const char *
}
}
return res;
}
}
char *ast_format_str_reduce(char *fmts)
{

View File

@ -18,10 +18,10 @@
* this code.
*/
/*! \file
*
/*! \file
*
* \brief Jitterbuffering algorithm.
*
*
* \author Slav Klenov <slav@securax.org>
*/
@ -73,7 +73,7 @@ static inline void release_jb_frame(struct fixed_jb *jb, struct fixed_jb_frame *
static void get_jb_head(struct fixed_jb *jb, struct fixed_jb_frame *frame)
{
struct fixed_jb_frame *fr;
/* unlink the frame */
fr = jb->frames;
jb->frames = fr->next;
@ -83,13 +83,13 @@ static void get_jb_head(struct fixed_jb *jb, struct fixed_jb_frame *frame)
/* the jb is empty - update tail */
jb->tail = NULL;
}
/* update next */
jb->next_delivery = fr->delivery + fr->ms;
/* copy the destination */
memcpy(frame, fr, sizeof(struct fixed_jb_frame));
/* and release the frame */
release_jb_frame(jb, fr);
}
@ -98,26 +98,26 @@ static void get_jb_head(struct fixed_jb *jb, struct fixed_jb_frame *frame)
struct fixed_jb *fixed_jb_new(struct fixed_jb_conf *conf)
{
struct fixed_jb *jb;
if (!(jb = ast_calloc(1, sizeof(*jb))))
return NULL;
/* First copy our config */
memcpy(&jb->conf, conf, sizeof(struct fixed_jb_conf));
/* we don't need the passed config anymore - continue working with the saved one */
conf = &jb->conf;
/* validate the configuration */
if (conf->jbsize < 1)
conf->jbsize = FIXED_JB_SIZE_DEFAULT;
if (conf->resync_threshold < 1)
conf->resync_threshold = FIXED_JB_RESYNCH_THRESHOLD_DEFAULT;
/* Set the constant delay to the jitterbuf */
jb->delay = conf->jbsize;
return jb;
}
@ -126,7 +126,7 @@ void fixed_jb_destroy(struct fixed_jb *jb)
{
/* jitterbuf MUST be empty before it can be destroyed */
ASSERT(jb->frames == NULL);
ast_free(jb);
}
@ -135,32 +135,32 @@ static int resynch_jb(struct fixed_jb *jb, void *data, long ms, long ts, long no
{
long diff, offset;
struct fixed_jb_frame *frame;
/* If jb is empty, just reinitialize the jb */
if (!jb->frames) {
/* debug check: tail should also be NULL */
ASSERT(jb->tail == NULL);
return fixed_jb_put_first(jb, data, ms, ts, now);
}
/* Adjust all jb state just as the new frame is with delivery = the delivery of the last
frame (e.g. this one with max delivery) + the length of the last frame. */
/* Get the diff in timestamps */
diff = ts - jb->tail->ts;
/* Ideally this should be just the length of the last frame. The deviation is the desired
offset */
offset = diff - jb->tail->ms;
/* Do we really need to resynch, or this is just a frame for dropping? */
if (!jb->force_resynch && (offset < jb->conf.resync_threshold && offset > -jb->conf.resync_threshold))
return FIXED_JB_DROP;
/* Reset the force resynch flag */
jb->force_resynch = 0;
/* apply the offset to the jb state */
jb->rxcore -= offset;
frame = jb->frames;
@ -168,7 +168,7 @@ static int resynch_jb(struct fixed_jb *jb, void *data, long ms, long ts, long no
frame->ts += offset;
frame = frame->next;
}
/* now jb_put() should add the frame at a last position */
return fixed_jb_put(jb, data, ms, ts, now);
}
@ -184,10 +184,10 @@ int fixed_jb_put_first(struct fixed_jb *jb, void *data, long ms, long ts, long n
{
/* this is our first frame - set the base of the receivers time */
jb->rxcore = now - ts;
/* init next for a first time - it should be the time the first frame should be played */
jb->next_delivery = now + jb->delay;
/* put the frame */
return fixed_jb_put(jb, data, ms, ts, now);
}
@ -197,23 +197,23 @@ int fixed_jb_put(struct fixed_jb *jb, void *data, long ms, long ts, long now)
{
struct fixed_jb_frame *frame, *next, *newframe;
long delivery;
/* debug check the validity of the input params */
ASSERT(data != NULL);
/* do not allow frames shorter than 2 ms */
ASSERT(ms >= 2);
ASSERT(ts >= 0);
ASSERT(now >= 0);
delivery = jb->rxcore + jb->delay + ts;
/* check if the new frame is not too late */
if (delivery < jb->next_delivery) {
/* should drop the frame, but let first resynch_jb() check if this is not a jump in ts, or
the force resynch flag was not set. */
return resynch_jb(jb, data, ms, ts, now);
}
/* what if the delivery time is bigger than next + delay? Seems like a frame for the future.
However, allow more resync_threshold ms in advance */
if (delivery > jb->next_delivery + jb->delay + jb->conf.resync_threshold) {
@ -227,7 +227,7 @@ int fixed_jb_put(struct fixed_jb *jb, void *data, long ms, long ts, long now)
while (frame && frame->delivery > delivery) {
frame = frame->prev;
}
/* Check if the new delivery time is not covered already by the chosen frame */
if (frame && (frame->delivery == delivery ||
delivery < frame->delivery + frame->ms ||
@ -235,22 +235,22 @@ int fixed_jb_put(struct fixed_jb *jb, void *data, long ms, long ts, long now)
{
/* TODO: Should we check for resynch here? Be careful to do not allow threshold smaller than
the size of the jb */
/* should drop the frame, but let first resynch_jb() check if this is not a jump in ts, or
the force resynch flag was not set. */
return resynch_jb(jb, data, ms, ts, now);
}
/* Reset the force resynch flag */
jb->force_resynch = 0;
/* Get a new frame */
newframe = alloc_jb_frame(jb);
newframe->data = data;
newframe->ts = ts;
newframe->ms = ms;
newframe->delivery = delivery;
/* and insert it right on place */
if (frame) {
next = frame->next;
@ -264,7 +264,7 @@ int fixed_jb_put(struct fixed_jb *jb, void *data, long ms, long ts, long now)
newframe->next = NULL;
}
newframe->prev = frame;
return FIXED_JB_OK;
} else if (!jb->frames) {
/* the frame list is empty or thats just the first frame ever */
@ -273,7 +273,7 @@ int fixed_jb_put(struct fixed_jb *jb, void *data, long ms, long ts, long now)
jb->frames = jb->tail = newframe;
newframe->next = NULL;
newframe->prev = NULL;
return FIXED_JB_OK;
} else {
/* insert on a first position - should update frames head */
@ -281,7 +281,7 @@ int fixed_jb_put(struct fixed_jb *jb, void *data, long ms, long ts, long now)
newframe->prev = NULL;
jb->frames->prev = newframe;
jb->frames = newframe;
return FIXED_JB_OK;
}
}
@ -291,41 +291,41 @@ int fixed_jb_get(struct fixed_jb *jb, struct fixed_jb_frame *frame, long now, lo
{
ASSERT(now >= 0);
ASSERT(interpl >= 2);
if (now < jb->next_delivery) {
/* too early for the next frame */
return FIXED_JB_NOFRAME;
}
/* Is the jb empty? */
if (!jb->frames) {
/* should interpolate a frame */
/* update next */
jb->next_delivery += interpl;
return FIXED_JB_INTERP;
}
/* Isn't it too late for the first frame available in the jb? */
if (now > jb->frames->delivery + jb->frames->ms) {
/* yes - should drop this frame and update next to point the next frame (get_jb_head() does it) */
get_jb_head(jb, frame);
return FIXED_JB_DROP;
}
/* isn't it too early to play the first frame available? */
if (now < jb->frames->delivery) {
/* yes - should interpolate one frame */
/* update next */
jb->next_delivery += interpl;
return FIXED_JB_INTERP;
}
/* we have a frame for playing now (get_jb_head() updates next) */
get_jb_head(jb, frame);
return FIXED_JB_OK;
}
@ -340,8 +340,8 @@ int fixed_jb_remove(struct fixed_jb *jb, struct fixed_jb_frame *frameout)
{
if (!jb->frames)
return FIXED_JB_NOFRAME;
get_jb_head(jb, frameout);
return FIXED_JB_OK;
}

View File

@ -17,10 +17,10 @@
* at the top of the source tree.
*/
/*! \file
*
/*! \file
*
* \brief Jitterbuffering algorithm.
*
*
*/
#ifndef _FIXEDJITTERBUF_H_
@ -49,7 +49,7 @@ enum {
struct fixed_jb_conf
{
long jbsize;
long resync_threshold;
long resync_threshold;
};

View File

@ -20,7 +20,7 @@
*
* \brief Frame and codec manipulation routines
*
* \author Mark Spencer <markster@digium.com>
* \author Mark Spencer <markster@digium.com>
*/
#include "asterisk.h"
@ -46,15 +46,15 @@ static void frame_cache_cleanup(void *data);
/*! \brief A per-thread cache of frame headers */
AST_THREADSTORAGE_CUSTOM(frame_cache, NULL, frame_cache_cleanup);
/*!
/*!
* \brief Maximum ast_frame cache size
*
* In most cases where the frame header cache will be useful, the size
* of the cache will stay very small. However, it is not always the case that
* the same thread that allocates the frame will be the one freeing them, so
* sometimes a thread will never have any frames in its cache, or the cache
* will never be pulled from. For the latter case, we limit the maximum size.
*/
* will never be pulled from. For the latter case, we limit the maximum size.
*/
#define FRAME_CACHE_MAX_SIZE 10
/*! \brief This is just so ast_frames, a list head struct for holding a list of
@ -285,7 +285,7 @@ static struct ast_frame *ast_frame_header_new(void)
#endif
f->mallocd_hdr_len = sizeof(*f);
return f;
}
@ -297,7 +297,7 @@ static void frame_cache_cleanup(void *data)
while ((f = AST_LIST_REMOVE_HEAD(&frames->list, frame_list)))
ast_free(f);
ast_free(frames);
}
#endif
@ -309,7 +309,7 @@ static void __frame_free(struct ast_frame *fr, int cache)
#if !defined(LOW_MEMORY)
if (cache && fr->mallocd == AST_MALLOCD_HDR) {
/* Cool, only the header is malloc'd, let's just cache those for now
/* Cool, only the header is malloc'd, let's just cache those for now
* to keep things simple... */
struct ast_frame_cache *frames;
@ -321,9 +321,9 @@ static void __frame_free(struct ast_frame *fr, int cache)
}
}
#endif
if (fr->mallocd & AST_MALLOCD_DATA) {
if (fr->data.ptr)
if (fr->data.ptr)
ast_free(fr->data.ptr - fr->offset);
}
if (fr->mallocd & AST_MALLOCD_SRC) {
@ -390,7 +390,7 @@ struct ast_frame *ast_frisolate(struct ast_frame *fr)
} else {
out = fr;
}
if (!(fr->mallocd & AST_MALLOCD_SRC) && fr->src) {
if (!(out->src = ast_strdup(fr->src))) {
if (out != fr) {
@ -403,7 +403,7 @@ struct ast_frame *ast_frisolate(struct ast_frame *fr)
fr->src = NULL;
fr->mallocd &= ~AST_MALLOCD_SRC;
}
if (!(fr->mallocd & AST_MALLOCD_DATA)) {
if (!fr->datalen) {
out->data.uint32 = fr->data.uint32;
@ -431,7 +431,7 @@ struct ast_frame *ast_frisolate(struct ast_frame *fr)
}
out->mallocd = AST_MALLOCD_HDR | AST_MALLOCD_SRC | AST_MALLOCD_DATA;
return out;
}
@ -456,7 +456,7 @@ struct ast_frame *ast_frdup(const struct ast_frame *f)
srclen = strlen(f->src);
if (srclen > 0)
len += srclen + 1;
#if !defined(LOW_MEMORY)
if ((frames = ast_threadstorage_get(&frame_cache, sizeof(*frames)))) {
AST_LIST_TRAVERSE_SAFE_BEGIN(&frames->list, out, frame_list) {
@ -493,7 +493,7 @@ struct ast_frame *ast_frdup(const struct ast_frame *f)
out->offset = AST_FRIENDLY_OFFSET;
if (out->datalen) {
out->data.ptr = buf + sizeof(*out) + AST_FRIENDLY_OFFSET;
memcpy(out->data.ptr, f->data.ptr, out->datalen);
memcpy(out->data.ptr, f->data.ptr, out->datalen);
} else {
out->data.uint32 = f->data.uint32;
}
@ -541,9 +541,9 @@ void ast_frame_dump(const char *name, struct ast_frame *f, char *prefix)
if (!f) {
ast_verbose("%s [ %s (NULL) ] [%s]\n",
ast_verbose("%s [ %s (NULL) ] [%s]\n",
term_color(cp, prefix, COLOR_BRMAGENTA, COLOR_BLACK, sizeof(cp)),
term_color(cft, "HANGUP", COLOR_BRRED, COLOR_BLACK, sizeof(cft)),
term_color(cft, "HANGUP", COLOR_BRRED, COLOR_BLACK, sizeof(cft)),
term_color(cn, name, COLOR_YELLOW, COLOR_BLACK, sizeof(cn)));
return;
}
@ -710,25 +710,25 @@ void ast_frame_dump(const char *name, struct ast_frame *f, char *prefix)
snprintf(ftype, sizeof(ftype), "Unknown Frametype '%d'", f->frametype);
}
if (!ast_strlen_zero(moreinfo))
ast_verbose("%s [ TYPE: %s (%d) SUBCLASS: %s (%d) '%s' ] [%s]\n",
ast_verbose("%s [ TYPE: %s (%d) SUBCLASS: %s (%d) '%s' ] [%s]\n",
term_color(cp, prefix, COLOR_BRMAGENTA, COLOR_BLACK, sizeof(cp)),
term_color(cft, ftype, COLOR_BRRED, COLOR_BLACK, sizeof(cft)),
f->frametype,
f->frametype,
term_color(csub, subclass, COLOR_BRCYAN, COLOR_BLACK, sizeof(csub)),
f->subclass.integer,
f->subclass.integer,
term_color(cmn, moreinfo, COLOR_BRGREEN, COLOR_BLACK, sizeof(cmn)),
term_color(cn, name, COLOR_YELLOW, COLOR_BLACK, sizeof(cn)));
else
ast_verbose("%s [ TYPE: %s (%d) SUBCLASS: %s (%d) ] [%s]\n",
ast_verbose("%s [ TYPE: %s (%d) SUBCLASS: %s (%d) ] [%s]\n",
term_color(cp, prefix, COLOR_BRMAGENTA, COLOR_BLACK, sizeof(cp)),
term_color(cft, ftype, COLOR_BRRED, COLOR_BLACK, sizeof(cft)),
f->frametype,
f->frametype,
term_color(csub, subclass, COLOR_BRCYAN, COLOR_BLACK, sizeof(csub)),
f->subclass.integer,
f->subclass.integer,
term_color(cn, name, COLOR_YELLOW, COLOR_BLACK, sizeof(cn)));
}
int ast_parse_allow_disallow(struct ast_codec_pref *pref, struct ast_format_cap *cap, const char *list, int allowing)
int ast_parse_allow_disallow(struct ast_codec_pref *pref, struct ast_format_cap *cap, const char *list, int allowing)
{
int errors = 0, framems = 0, all = 0, iter_allowing;
char *parse = NULL, *this = NULL, *psize = NULL;
@ -835,7 +835,7 @@ static unsigned char get_n_bits_at(unsigned char *data, int n, int bit)
int byte = bit / 8; /* byte containing first bit */
int rem = 8 - (bit % 8); /* remaining bits in first byte */
unsigned char ret = 0;
if (n <= 0 || n > 8)
return 0;
@ -858,17 +858,17 @@ static int speex_get_wb_sz_at(unsigned char *data, int len, int bit)
unsigned char c;
/* skip up to two wideband frames */
if (((len * 8 - off) >= 5) &&
if (((len * 8 - off) >= 5) &&
get_n_bits_at(data, 1, off)) {
c = get_n_bits_at(data, 3, off + 1);
off += SpeexWBSubModeSz[c];
if (((len * 8 - off) >= 5) &&
if (((len * 8 - off) >= 5) &&
get_n_bits_at(data, 1, off)) {
c = get_n_bits_at(data, 3, off + 1);
off += SpeexWBSubModeSz[c];
if (((len * 8 - off) >= 5) &&
if (((len * 8 - off) >= 5) &&
get_n_bits_at(data, 1, off)) {
ast_log(LOG_WARNING, "Encountered corrupt speex frame; too many wideband frames in a row.\n");
return -1;
@ -883,10 +883,10 @@ static int speex_samples(unsigned char *data, int len)
{
static const int SpeexSubModeSz[] = {
5, 43, 119, 160,
220, 300, 364, 492,
220, 300, 364, 492,
79, 0, 0, 0,
0, 0, 0, 0 };
static const int SpeexInBandSz[] = {
static const int SpeexInBandSz[] = {
1, 1, 4, 4,
4, 4, 4, 4,
8, 8, 16, 16,
@ -912,9 +912,9 @@ static int speex_samples(unsigned char *data, int len)
c = get_n_bits_at(data, 5, bit);
bit += 5;
if (c == 15) {
if (c == 15) {
/* terminator */
break;
break;
} else if (c == 14) {
/* in-band signal; next 4 bits contain signal id */
c = get_n_bits_at(data, 4, bit);
@ -1030,7 +1030,7 @@ int ast_codec_get_len(struct ast_format *format, int samples)
{
int len = 0;
/* XXX Still need speex, and lpc10 XXX */
/* XXX Still need speex, and lpc10 XXX */
switch(format->id) {
case AST_FORMAT_G723_1:
len = (samples / 240) * 20;

View File

@ -4,7 +4,7 @@
* Copyright (C) 1999 - 2005, Digium, Inc.
*
* Mark Spencer <markster@digium.com>
*
*
* Includes code and algorithms from the Zapata library.
*
* See http://www.asterisk.org for more information about
@ -20,7 +20,7 @@
/*! \file
*
* \brief FSK Modulator/Demodulator
* \brief FSK Modulator/Demodulator
*
* \author Mark Spencer <markster@digium.com>
*
@ -58,23 +58,23 @@ static inline float get_sample(short **buffer, int *len)
#define GET_SAMPLE get_sample(&buffer, len)
/*! \brief Coefficients for input filters
* Coefficients table, generated by program "mkfilter"
* Coefficients table, generated by program "mkfilter"
* mkfilter is part of the zapatatelephony.org distribution
* Format: coef[IDX_FREC][IDX_BW][IDX_COEF]
* IDX_COEF = 0 => 1/GAIN
* IDX_COEF = 1-6 => Coefficientes y[n]
* IDX_COEF = 0 => 1/GAIN
* IDX_COEF = 1-6 => Coefficientes y[n]
*/
static double coef_in[NF][NBW][8] = {
{
{ 1.8229206611e-04,-7.8997325866e-01,2.2401819940e+00,-4.6751353581e+00,5.5080745712e+00,-5.0571565772e+00,2.6215820004e+00,0.0000000000e+00, },
{ 9.8532175289e-02,-5.6297236492e-02,3.3146713415e-01,-9.2239200436e-01,1.4844365184e+00,-2.0183258642e+00,2.0074154497e+00,0.0000000000e+00, },
},
{
{ 1.8229206610e-04,-7.8997325866e-01,7.7191410839e-01,-2.8075643964e+00,1.6948618347e+00,-3.0367273700e+00,9.0333559408e-01,0.0000000000e+00, } ,
{ 9.8531161839e-02,-5.6297236492e-02,1.1421579050e-01,-4.8122536483e-01,4.0121072432e-01,-7.4834487567e-01,6.9170822332e-01,0.0000000000e+00, },
{ 1.8229206611e-04,-7.8997325866e-01,2.2401819940e+00,-4.6751353581e+00,5.5080745712e+00,-5.0571565772e+00,2.6215820004e+00,0.0000000000e+00, },
{ 9.8532175289e-02,-5.6297236492e-02,3.3146713415e-01,-9.2239200436e-01,1.4844365184e+00,-2.0183258642e+00,2.0074154497e+00,0.0000000000e+00, },
},
{
{ 1.8229206611e-04,-7.8997325866e-01,2.9003821430e+00,-6.1082779024e+00,7.7169345751e+00,-6.6075999680e+00,3.3941838836e+00,0.0000000000e+00, },
{ 1.8229206610e-04,-7.8997325866e-01,7.7191410839e-01,-2.8075643964e+00,1.6948618347e+00,-3.0367273700e+00,9.0333559408e-01,0.0000000000e+00, },
{ 9.8531161839e-02,-5.6297236492e-02,1.1421579050e-01,-4.8122536483e-01,4.0121072432e-01,-7.4834487567e-01,6.9170822332e-01,0.0000000000e+00, },
},
{
{ 1.8229206611e-04,-7.8997325866e-01,2.9003821430e+00,-6.1082779024e+00,7.7169345751e+00,-6.6075999680e+00,3.3941838836e+00,0.0000000000e+00, },
{ 9.8539686961e-02,-5.6297236492e-02,4.2915323820e-01,-1.2609358633e+00,2.2399213250e+00,-2.9928879142e+00,2.5990173742e+00,0.0000000000e+00, },
},
{
@ -82,24 +82,24 @@ static double coef_in[NF][NBW][8] = {
{ 9.8531161839e-02,-5.6297236492e-02,-1.1421579050e-01,-4.8122536483e-01,-4.0121072432e-01,-7.4834487567e-01,-6.9170822332e-01,0.0000000000e+00, },
},
{
{ 1.8229206611e-04,-7.8997325866e-01,2.5782298908e+00,-5.3629717478e+00,6.5890882172e+00,-5.8012914776e+00,3.0171839130e+00,0.0000000000e+00, },
{ 9.8534230718e-02,-5.6297236492e-02,3.8148618075e-01,-1.0848760410e+00,1.8441165168e+00,-2.4860666655e+00,2.3103384142e+00,0.0000000000e+00, },
{ 1.8229206611e-04,-7.8997325866e-01,2.5782298908e+00,-5.3629717478e+00,6.5890882172e+00,-5.8012914776e+00,3.0171839130e+00,0.0000000000e+00, },
{ 9.8534230718e-02,-5.6297236492e-02,3.8148618075e-01,-1.0848760410e+00,1.8441165168e+00,-2.4860666655e+00,2.3103384142e+00,0.0000000000e+00, },
},
{
{ 1.8229206610e-04,-7.8997325866e-01,-3.8715051001e-01,-2.6192408538e+00,-8.3977994034e-01,-2.8329897913e+00,-4.5306444352e-01,0.0000000000e+00, },
{ 9.8531160936e-02,-5.6297236492e-02,-5.7284484199e-02,-4.3673866734e-01,-1.9564766257e-01,-6.2028156584e-01,-3.4692356122e-01,0.0000000000e+00, },
},
},
};
/*! \brief Coefficients for output filter
* Coefficients table, generated by program "mkfilter"
* Format: coef[IDX_BW][IDX_COEF]
* IDX_COEF = 0 => 1/GAIN
* Format: coef[IDX_BW][IDX_COEF]
* IDX_COEF = 0 => 1/GAIN
* IDX_COEF = 1-6 => Coefficientes y[n]
*/
static double coef_out[NBW][8] = {
{ 1.3868644653e-08,-6.3283665042e-01,4.0895057217e+00,-1.1020074592e+01,1.5850766191e+01,-1.2835109292e+01,5.5477477340e+00,0.0000000000e+00, },
{ 3.1262119724e-03,-7.8390522307e-03,8.5209627801e-02,-4.0804129163e-01,1.1157139955e+00,-1.8767603680e+00,1.8916395224e+00,0.0000000000e+00, },
{ 3.1262119724e-03,-7.8390522307e-03,8.5209627801e-02,-4.0804129163e-01,1.1157139955e+00,-1.8767603680e+00,1.8916395224e+00,0.0000000000e+00, },
};
@ -109,12 +109,12 @@ static inline float filterM(fsk_data *fskd,float in)
int i, j;
double s;
double *pc;
pc = &coef_in[fskd->f_mark_idx][fskd->bw][0];
fskd->fmxv[(fskd->fmp+6)&7] = in*(*pc++);
s = (fskd->fmxv[(fskd->fmp + 6) & 7] - fskd->fmxv[fskd->fmp]) + 3 * (fskd->fmxv[(fskd->fmp + 2) & 7] - fskd->fmxv[(fskd->fmp + 4) & 7]);
for (i = 0, j = fskd->fmp; i < 6; i++, j++)
for (i = 0, j = fskd->fmp; i < 6; i++, j++)
s += fskd->fmyv[j&7]*(*pc++);
fskd->fmyv[j&7] = s;
fskd->fmp++;
@ -128,12 +128,12 @@ static inline float filterS(fsk_data *fskd,float in)
int i, j;
double s;
double *pc;
pc = &coef_in[fskd->f_space_idx][fskd->bw][0];
fskd->fsxv[(fskd->fsp+6)&7] = in*(*pc++);
s = (fskd->fsxv[(fskd->fsp + 6) & 7] - fskd->fsxv[fskd->fsp]) + 3 * (fskd->fsxv[(fskd->fsp + 2) & 7] - fskd->fsxv[(fskd->fsp + 4) & 7]);
for (i = 0, j = fskd->fsp; i < 6; i++, j++)
for (i = 0, j = fskd->fsp; i < 6; i++, j++)
s += fskd->fsyv[j&7]*(*pc++);
fskd->fsyv[j&7] = s;
fskd->fsp++;
@ -147,15 +147,15 @@ static inline float filterL(fsk_data *fskd,float in)
int i, j;
double s;
double *pc;
pc = &coef_out[fskd->bw][0];
fskd->flxv[(fskd->flp + 6) & 7] = in * (*pc++);
fskd->flxv[(fskd->flp + 6) & 7] = in * (*pc++);
s = (fskd->flxv[fskd->flp] + fskd->flxv[(fskd->flp+6)&7]) +
6 * (fskd->flxv[(fskd->flp+1)&7] + fskd->flxv[(fskd->flp+5)&7]) +
15 * (fskd->flxv[(fskd->flp+2)&7] + fskd->flxv[(fskd->flp+4)&7]) +
20 * fskd->flxv[(fskd->flp+3)&7];
20 * fskd->flxv[(fskd->flp+3)&7];
for (i = 0,j = fskd->flp;i<6;i++,j++)
s += fskd->flyv[j&7]*(*pc++);
fskd->flyv[j&7] = s;
@ -169,14 +169,14 @@ static inline int demodulator(fsk_data *fskd, float *retval, float x)
float xS,xM;
fskd->cola_in[fskd->pcola] = x;
xS = filterS(fskd,x);
xM = filterM(fskd,x);
fskd->cola_filter[fskd->pcola] = xM-xS;
x = filterL(fskd,xM*xM - xS*xS);
fskd->cola_demod[fskd->pcola++] = x;
fskd->pcola &= (NCOLA-1);
@ -190,7 +190,7 @@ static int get_bit_raw(fsk_data *fskd, short *buffer, int *len)
float x,spb,spb2,ds;
int f;
spb = fskd->spb;
spb = fskd->spb;
if (fskd->spb == 7)
spb = 8000.0 / 1200.0;
ds = spb/32.;
@ -257,7 +257,7 @@ int fsk_serial(fsk_data *fskd, short *buffer, int *len, int *outbyte)
return -1;
samples++;
for (;;) {
search_startbit2:
search_startbit2:
if (*len <= 0) {
fskd->state = STATE_SEARCH_STARTBIT2;
return 0;
@ -267,11 +267,11 @@ search_startbit2:
return(-1);
#if 0
printf("x2 = %5.5f ", fskd->x2);
#endif
#endif
if (fskd->x2 < -0.5)
break;
break;
}
search_startbit3:
search_startbit3:
/* We await for 0.5 bits before using DPLL */
i = fskd->spb/2;
if (*len < i) {
@ -280,14 +280,14 @@ search_startbit3:
}
for (; i>0; i--) {
if (demodulator(fskd, &fskd->x1, GET_SAMPLE))
return(-1);
return(-1);
#if 0
printf("x1 = %5.5f ", fskd->x1);
#endif
#endif
samples++;
}
/* x1 must be negative (start bit confirmation) */
/* x1 must be negative (start bit confirmation) */
} while (fskd->x1 > 0);
fskd->state = STATE_GET_BYTE;
@ -322,7 +322,7 @@ getbyte:
/* We read parity bit (if exists) and check parity */
if (fskd->parity) {
olen = *len;
i = get_bit_raw(fskd, buffer, len);
i = get_bit_raw(fskd, buffer, len);
buffer += (olen - *len);
if (i == -1)
return(-1);
@ -336,9 +336,9 @@ getbyte:
a |= 0x100; /* error */
}
}
/* We read STOP bits. All of them must be 1 */
for (j = fskd->nstop;j;j--) {
r = get_bit_raw(fskd, buffer, len);
if (r == -1)

View File

@ -4,7 +4,7 @@
* Copyright (C) 1999 - 2005, Digium, Inc.
*
* Mark Spencer <markster@digium.com>
*
*
* Includes code and algorithms from the Zapata library.
*
* See http://www.asterisk.org for more information about
@ -20,7 +20,7 @@
/*! \file
*
* \brief FSK Modulator/Demodulator
* \brief FSK Modulator/Demodulator
*
* \author Mark Spencer <markster@digium.com>
*
@ -55,11 +55,11 @@ static inline int iget_sample(short **buffer, int *len)
#define IGET_SAMPLE iget_sample(&buffer, len)
/*! \brief Coefficients for input filters
* Coefficients table, generated by program "mkfilter"
* Coefficients table, generated by program "mkfilter"
* mkfilter is part of the zapatatelephony.org distribution
* Format: coef[IDX_FREC][IDX_BW][IDX_COEF]
* IDX_COEF = 0 => 1/GAIN
* IDX_COEF = 1-6 => Coefficientes y[n]
* IDX_COEF = 0 => 1/GAIN
* IDX_COEF = 1-6 => Coefficientes y[n]
*/
static double coef_in[NF][NBW][8]={
{ { 1.8229206611e-04,-7.8997325866e-01,2.2401819940e+00,-4.6751353581e+00,5.5080745712e+00,-5.0571565772e+00,2.6215820004e+00,0.0000000000e+00,
@ -74,19 +74,19 @@ static double coef_in[NF][NBW][8]={
}, { 9.8534230718e-02,-5.6297236492e-02,3.8148618075e-01,-1.0848760410e+00,1.8441165168e+00,-2.4860666655e+00,2.3103384142e+00,0.0000000000e+00,
}, }, { { 1.8229206610e-04,-7.8997325866e-01,-3.8715051001e-01,-2.6192408538e+00,-8.3977994034e-01,-2.8329897913e+00,-4.5306444352e-01,0.0000000000e+00,
}, { 9.8531160936e-02,-5.6297236492e-02,-5.7284484199e-02,-4.3673866734e-01,-1.9564766257e-01,-6.2028156584e-01,-3.4692356122e-01,0.0000000000e+00,
}, },
}, },
};
/*! \brief Coefficients for output filter
* Coefficients table, generated by program "mkfilter"
* Format: coef[IDX_BW][IDX_COEF]
* IDX_COEF = 0 => 1/GAIN
* Format: coef[IDX_BW][IDX_COEF]
* IDX_COEF = 0 => 1/GAIN
* IDX_COEF = 1-6 => Coefficientes y[n]
*/
static double coef_out[NBW][8]={
{ 1.3868644653e-08,-6.3283665042e-01,4.0895057217e+00,-1.1020074592e+01,1.5850766191e+01,-1.2835109292e+01,5.5477477340e+00,0.0000000000e+00,
}, { 3.1262119724e-03,-7.8390522307e-03,8.5209627801e-02,-4.0804129163e-01,1.1157139955e+00,-1.8767603680e+00,1.8916395224e+00,0.0000000000e+00
},
}, { 3.1262119724e-03,-7.8390522307e-03,8.5209627801e-02,-4.0804129163e-01,1.1157139955e+00,-1.8767603680e+00,1.8916395224e+00,0.0000000000e+00
},
};
/*! Integer Pass Band demodulator filter */
@ -95,19 +95,19 @@ static inline int ibpdfilter(struct filter_struct * fs, int in)
int i,j;
int s;
int64_t s_interim;
/* integer filter */
s = in * fs->icoefs[0];
fs->ixv[(fs->ip + 6) & 7] = s;
s = (fs->ixv[fs->ip] + fs->ixv[(fs->ip + 6) & 7]) +
6 * (fs->ixv[(fs->ip + 1) & 7] + fs->ixv[(fs->ip + 5) & 7]) +
15 * (fs->ixv[(fs->ip + 2) & 7] + fs->ixv[(fs->ip + 4) & 7]) +
20 * fs->ixv[(fs->ip + 3) & 7];
for (i = 1, j = fs->ip; i < 7; i++, j++) {
/* Promote operation to 64 bit to prevent overflow that occurred in 32 bit) */
s_interim = (int64_t)(fs->iyv[j & 7]) *
s_interim = (int64_t)(fs->iyv[j & 7]) *
(int64_t)(fs->icoefs[i]) /
(int64_t)(1024);
s += (int) s_interim;
@ -124,17 +124,17 @@ static inline int ibpfilter(struct filter_struct * fs, int in)
int i, j;
int s;
int64_t s_interim;
/* integer filter */
s = in * fs->icoefs[0] / 256;
fs->ixv[(fs->ip + 6) & 7] = s;
s = (fs->ixv[(fs->ip + 6) & 7] - fs->ixv[fs->ip])
+ 3 * (fs->ixv[(fs->ip + 2) & 7] - fs->ixv[(fs->ip + 4) & 7]);
for (i = 1, j = fs->ip; i < 7; i++, j++) {
s_interim = (int64_t)(fs->iyv[j & 7]) *
(int64_t)(fs->icoefs[i]) /
for (i = 1, j = fs->ip; i < 7; i++, j++) {
s_interim = (int64_t)(fs->iyv[j & 7]) *
(int64_t)(fs->icoefs[i]) /
(int64_t)(256);
s += (int) s_interim;
}
@ -148,14 +148,14 @@ static inline int idemodulator(fsk_data *fskd, int *retval, int x)
{
int is, im, id;
int ilin2;
is = ibpfilter(&fskd->space_filter, x);
im = ibpfilter(&fskd->mark_filter, x);
ilin2 = ((im * im) - (is * is)) / (256 * 256);
id = ibpdfilter(&fskd->demod_filter, ilin2);
*retval = id;
return 0;
}
@ -172,7 +172,7 @@ static int get_bit_raw(fsk_data *fskd, short *buffer, int *len)
if ((ix * fskd->xi0) < 0) { /* Transicion */
if (!f) {
if (fskd->icont < (fskd->pllispb2)) {
fskd->icont += fskd->pllids;
fskd->icont += fskd->pllids;
} else {
fskd->icont -= fskd->pllids;
}
@ -199,17 +199,17 @@ int fskmodem_init(fsk_data *fskd)
fskd->demod_filter.ip = 0;
for ( i = 0 ; i < 7 ; i++ ) {
fskd->space_filter.icoefs[i] =
fskd->space_filter.icoefs[i] =
coef_in[fskd->f_space_idx][fskd->bw][i] * 256;
fskd->space_filter.ixv[i] = 0;;
fskd->space_filter.iyv[i] = 0;;
fskd->mark_filter.icoefs[i] =
fskd->mark_filter.icoefs[i] =
coef_in[fskd->f_mark_idx][fskd->bw][i] * 256;
fskd->mark_filter.ixv[i] = 0;;
fskd->mark_filter.iyv[i] = 0;;
fskd->demod_filter.icoefs[i] =
fskd->demod_filter.icoefs[i] =
coef_out[fskd->bw][i] * 1024;
fskd->demod_filter.ixv[i] = 0;;
fskd->demod_filter.iyv[i] = 0;;
@ -225,7 +225,7 @@ int fsk_serial(fsk_data *fskd, short *buffer, int *len, int *outbyte)
int olen;
int beginlen = *len;
int beginlenx;
switch (fskd->state) {
/* Pick up where we left off */
case STATE_SEARCH_STARTBIT2:
@ -242,10 +242,10 @@ int fsk_serial(fsk_data *fskd, short *buffer, int *len, int *outbyte)
just start sending a start bit with nothing preceding it at the beginning
of a transmission (what a LOSING design), we cant do it this elegantly */
/* NOT USED
if (demodulator(zap,&x1))
if (demodulator(zap,&x1))
return -1;
for(;;) {
if (demodulator(zap,&x2))
if (demodulator(zap,&x2))
return -1;
if (x1>0 && x2<0) break;
x1=x2;
@ -260,22 +260,22 @@ int fsk_serial(fsk_data *fskd, short *buffer, int *len, int *outbyte)
return -1;
samples++;
for(;;) {
search_startbit2:
search_startbit2:
if (*len <= 0) {
fskd->state = STATE_SEARCH_STARTBIT2;
return 0;
}
samples++;
if (idemodulator(fskd, &fskd->xi2, IGET_SAMPLE))
if (idemodulator(fskd, &fskd->xi2, IGET_SAMPLE))
return -1;
#if 0
printf("xi2 = %d ", fskd->xi2);
#endif
#endif
if (fskd->xi2 < 512) {
break;
}
}
search_startbit3:
search_startbit3:
/* We await for 0.5 bits before using DPLL */
i = fskd->ispb / 2;
if (*len < i) {
@ -284,11 +284,11 @@ search_startbit3:
}
for (; i > 0; i--) {
if (idemodulator(fskd, &fskd->xi1, IGET_SAMPLE))
return(-1);
return(-1);
#if 0
printf("xi1 = %d ", fskd->xi1);
#endif
samples++;
samples++;
}
/* x1 must be negative (start bit confirmation) */
@ -314,11 +314,11 @@ getbyte:
olen = *len;
i = get_bit_raw(fskd, buffer, len);
buffer += (olen - *len);
if (i == -1)
if (i == -1)
return -1;
if (i)
if (i)
n1++;
a >>= 1;
a >>= 1;
a |= i;
}
j = 8 - fskd->nbit;
@ -327,36 +327,36 @@ getbyte:
/* We read parity bit (if exists) and check parity */
if (fskd->parity) {
olen = *len;
i = get_bit_raw(fskd, buffer, len);
i = get_bit_raw(fskd, buffer, len);
buffer += (olen - *len);
if (i == -1)
if (i == -1)
return -1;
if (i)
if (i)
n1++;
if (fskd->parity == 1) { /* parity=1 (even) */
if (n1 & 1)
if (n1 & 1)
a |= 0x100; /* error */
} else { /* parity=2 (odd) */
if (!(n1 & 1))
if (!(n1 & 1))
a |= 0x100; /* error */
}
}
/* We read STOP bits. All of them must be 1 */
for (j = fskd->instop; j; j--) {
r = get_bit_raw(fskd, buffer, len);
if (r == -1)
if (r == -1)
return -1;
if (!r)
if (!r)
a |= 0x200;
}
/* And finally we return
* Bit 8 : Parity error
/* And finally we return
* Bit 8 : Parity error
* Bit 9 : Framming error
*/
*outbyte = a;
fskd->state = STATE_SEARCH_STARTBIT;
return 1;

View File

@ -20,7 +20,7 @@
*
* \brief Image Management
*
* \author Mark Spencer <markster@digium.com>
* \author Mark Spencer <markster@digium.com>
*/
#include "asterisk.h"
@ -106,7 +106,7 @@ struct ast_frame *ast_read_image(const char *filename, const char *preflang, str
int fd;
int len=0;
struct ast_frame *f = NULL;
AST_RWLIST_RDLOCK(&imagers);
AST_RWLIST_TRAVERSE(&imagers, i, list) {
/* if NULL image format, just pick the first one, otherwise match it. */
@ -130,7 +130,7 @@ struct ast_frame *ast_read_image(const char *filename, const char *preflang, str
}
}
if (found)
break;
break;
}
if (found) {
@ -139,7 +139,7 @@ struct ast_frame *ast_read_image(const char *filename, const char *preflang, str
if (!found->identify || found->identify(fd)) {
/* Reset file pointer */
lseek(fd, 0, SEEK_SET);
f = found->read_image(fd, len);
f = found->read_image(fd, len);
} else
ast_log(LOG_WARNING, "%s does not appear to be a %s file\n", buf, found->name);
close(fd);
@ -147,9 +147,9 @@ struct ast_frame *ast_read_image(const char *filename, const char *preflang, str
ast_log(LOG_WARNING, "Unable to open '%s': %s\n", buf, strerror(errno));
} else
ast_log(LOG_WARNING, "Image file '%s' not found\n", filename);
AST_RWLIST_UNLOCK(&imagers);
return f;
}

View File

@ -257,13 +257,13 @@ static struct ast_generator playtones = {
int ast_tone_zone_part_parse(const char *s, struct ast_tone_zone_part *tone_data)
{
if (sscanf(s, "%30u+%30u/%30u", &tone_data->freq1, &tone_data->freq2,
if (sscanf(s, "%30u+%30u/%30u", &tone_data->freq1, &tone_data->freq2,
&tone_data->time) == 3) {
/* f1+f2/time format */
} else if (sscanf(s, "%30u+%30u", &tone_data->freq1, &tone_data->freq2) == 2) {
/* f1+f2 format */
tone_data->time = 0;
} else if (sscanf(s, "%30u*%30u/%30u", &tone_data->freq1, &tone_data->freq2,
} else if (sscanf(s, "%30u*%30u/%30u", &tone_data->freq1, &tone_data->freq2,
&tone_data->time) == 3) {
/* f1*f2/time format */
tone_data->modulate = 1;
@ -278,7 +278,7 @@ int ast_tone_zone_part_parse(const char *s, struct ast_tone_zone_part *tone_data
/* f1 format */
tone_data->freq2 = 0;
tone_data->time = 0;
} else if (sscanf(s, "M%30u+M%30u/%30u", &tone_data->freq1, &tone_data->freq2,
} else if (sscanf(s, "M%30u+M%30u/%30u", &tone_data->freq1, &tone_data->freq2,
&tone_data->time) == 3) {
/* Mf1+Mf2/time format */
tone_data->midinote = 1;
@ -286,7 +286,7 @@ int ast_tone_zone_part_parse(const char *s, struct ast_tone_zone_part *tone_data
/* Mf1+Mf2 format */
tone_data->time = 0;
tone_data->midinote = 1;
} else if (sscanf(s, "M%30u*M%30u/%30u", &tone_data->freq1, &tone_data->freq2,
} else if (sscanf(s, "M%30u*M%30u/%30u", &tone_data->freq1, &tone_data->freq2,
&tone_data->time) == 3) {
/* Mf1*Mf2/time format */
tone_data->modulate = 1;
@ -416,7 +416,7 @@ struct ao2_iterator ast_tone_zone_iterator_init(void)
return ao2_iterator_init(ast_tone_zones, 0);
}
/*! \brief Set global indication country
/*! \brief Set global indication country
If no country is specified or we are unable to find the zone, then return not found */
static int ast_set_indication_country(const char *country)
{

View File

@ -36,7 +36,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#ifdef DEBUG_IO
#define DEBUG DEBUG_M
#else
#define DEBUG(a)
#define DEBUG(a)
#endif
/*! \brief
@ -44,8 +44,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
*/
struct io_rec {
ast_io_cb callback; /*!< What is to be called */
void *data; /*!< Data to be passed */
int *id; /*!< ID number */
void *data; /*!< Data to be passed */
int *id; /*!< ID number */
};
/* These two arrays are keyed with
@ -75,12 +75,12 @@ struct io_context *io_context_create(void)
if (!(tmp = ast_malloc(sizeof(*tmp))))
return NULL;
tmp->needshrink = 0;
tmp->fdcnt = 0;
tmp->maxfdcnt = GROW_SHRINK_SIZE/2;
tmp->current_ioc = -1;
if (!(tmp->fds = ast_calloc(1, (GROW_SHRINK_SIZE / 2) * sizeof(*tmp->fds)))) {
ast_free(tmp);
tmp = NULL;
@ -107,7 +107,7 @@ void io_context_destroy(struct io_context *ioc)
}
/*! \brief
* Grow the size of our arrays.
* Grow the size of our arrays.
* \return 0 on success or -1 on failure
*/
static int io_grow(struct io_context *ioc)
@ -134,7 +134,7 @@ static int io_grow(struct io_context *ioc)
}
} else {
/*
* Memory allocation failure. We return to the old size, and
* Memory allocation failure. We return to the old size, and
* return a failure
*/
ioc->maxfdcnt -= GROW_SHRINK_SIZE;
@ -147,7 +147,7 @@ static int io_grow(struct io_context *ioc)
/*! \brief
* Add a new I/O entry for this file descriptor
* with the given event mask, to call callback with
* data as an argument.
* data as an argument.
* \return Returns NULL on failure.
*/
int *ast_io_add(struct io_context *ioc, int fd, ast_io_cb callback, short events, void *data)
@ -157,7 +157,7 @@ int *ast_io_add(struct io_context *ioc, int fd, ast_io_cb callback, short events
DEBUG(ast_debug(1, "ast_io_add()\n"));
if (ioc->fdcnt >= ioc->maxfdcnt) {
/*
/*
* We don't have enough space for this entry. We need to
* reallocate maxfdcnt poll fd's and io_rec's, or back out now.
*/
@ -210,9 +210,9 @@ static int io_shrink(struct io_context *ioc)
{
int getfrom, putto = 0;
/*
/*
* Bring the fields from the very last entry to cover over
* the entry we are removing, then decrease the size of the
* the entry we are removing, then decrease the size of the
* arrays by one.
*/
for (getfrom = 0; getfrom < ioc->fdcnt; getfrom++) {
@ -255,7 +255,7 @@ int ast_io_remove(struct io_context *ioc, int *_id)
return 0;
}
}
ast_log(LOG_NOTICE, "Unable to remove unknown id %p\n", _id);
return -1;
@ -313,7 +313,7 @@ void ast_io_dump(struct io_context *ioc)
ast_debug(1, "| ID FD Callback Data Events |\n");
ast_debug(1, "+------+------+-----------+-----------+--------+\n");
for (x = 0; x < ioc->fdcnt; x++) {
ast_debug(1, "| %.4d | %.4d | %p | %p | %.6x |\n",
ast_debug(1, "| %.4d | %.4d | %p | %p | %.6x |\n",
*ioc->ior[x].id,
ioc->fds[x].fd,
ioc->ior[x].callback,

View File

@ -50,24 +50,24 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
static jb_output_function_t warnf, errf, dbgf;
void jb_setoutput(jb_output_function_t err, jb_output_function_t warn, jb_output_function_t dbg)
void jb_setoutput(jb_output_function_t err, jb_output_function_t warn, jb_output_function_t dbg)
{
errf = err;
warnf = warn;
dbgf = dbg;
}
static void increment_losspct(jitterbuf *jb)
static void increment_losspct(jitterbuf *jb)
{
jb->info.losspct = (100000 + 499 * jb->info.losspct)/500;
jb->info.losspct = (100000 + 499 * jb->info.losspct)/500;
}
static void decrement_losspct(jitterbuf *jb)
static void decrement_losspct(jitterbuf *jb)
{
jb->info.losspct = (499 * jb->info.losspct)/500;
jb->info.losspct = (499 * jb->info.losspct)/500;
}
void jb_reset(jitterbuf *jb)
void jb_reset(jitterbuf *jb)
{
/* only save settings */
jb_conf s = jb->info.conf;
@ -76,14 +76,14 @@ void jb_reset(jitterbuf *jb)
/* initialize length, using the default value */
jb->info.current = jb->info.target = jb->info.conf.target_extra = JB_TARGET_EXTRA;
jb->info.silence_begin_ts = -1;
jb->info.silence_begin_ts = -1;
}
jitterbuf * jb_new()
jitterbuf * jb_new()
{
jitterbuf *jb;
if (!(jb = ast_malloc(sizeof(*jb))))
if (!(jb = ast_malloc(sizeof(*jb))))
return NULL;
jb_reset(jb);
@ -92,9 +92,9 @@ jitterbuf * jb_new()
return jb;
}
void jb_destroy(jitterbuf *jb)
void jb_destroy(jitterbuf *jb)
{
jb_frame *frame;
jb_frame *frame;
jb_dbg2("jb_destroy(%x)\n", jb);
/* free all the frames on the "free list" */
@ -105,7 +105,7 @@ void jb_destroy(jitterbuf *jb)
frame = next;
}
/* free ourselves! */
/* free ourselves! */
ast_free(jb);
}
@ -170,13 +170,13 @@ static int history_put(jitterbuf *jb, long ts, long now, long ms, long delay)
/* optimization; the max/min buffers don't need to be recalculated, if this packet's
* entry doesn't change them. This happens if this packet is not involved, _and_ any packet
* that got kicked out of the history is also not involved
* that got kicked out of the history is also not involved
* We do a number of comparisons, but it's probably still worthwhile, because it will usually
* succeed, and should be a lot faster than going through all 500 packets in history */
if (!jb->hist_maxbuf_valid)
return 0;
/* don't do this until we've filled history
/* don't do this until we've filled history
* (reduces some edge cases below) */
if (jb->hist_ptr < JB_HISTORY_SZ)
goto invalidate;
@ -190,13 +190,13 @@ static int history_put(jitterbuf *jb, long ts, long now, long ms, long delay)
goto invalidate;
/* or the kicked delay would be in min */
if (kicked <= jb->hist_minbuf[JB_HISTORY_MAXBUF_SZ-1])
if (kicked <= jb->hist_minbuf[JB_HISTORY_MAXBUF_SZ-1])
goto invalidate;
if (kicked >= jb->hist_maxbuf[JB_HISTORY_MAXBUF_SZ-1])
if (kicked >= jb->hist_maxbuf[JB_HISTORY_MAXBUF_SZ-1])
goto invalidate;
/* if we got here, we don't need to invalidate, 'cause this delay didn't
/* if we got here, we don't need to invalidate, 'cause this delay didn't
* affect things */
return 0;
/* end optimization */
@ -207,11 +207,11 @@ invalidate:
return 0;
}
static void history_calc_maxbuf(jitterbuf *jb)
static void history_calc_maxbuf(jitterbuf *jb)
{
int i,j;
if (jb->hist_ptr == 0)
if (jb->hist_ptr == 0)
return;
@ -229,7 +229,7 @@ static void history_calc_maxbuf(jitterbuf *jb)
/* we want it to be the top "n" values, in order */
/* start at the beginning, or JB_HISTORY_SZ frames ago */
i = (jb->hist_ptr > JB_HISTORY_SZ) ? (jb->hist_ptr - JB_HISTORY_SZ) : 0;
i = (jb->hist_ptr > JB_HISTORY_SZ) ? (jb->hist_ptr - JB_HISTORY_SZ) : 0;
for (;i<jb->hist_ptr;i++) {
long toins = jb->history[i % JB_HISTORY_SZ];
@ -268,14 +268,14 @@ static void history_calc_maxbuf(jitterbuf *jb)
}
}
if (0) {
if (0) {
int k;
fprintf(stderr, "toins = %ld\n", toins);
fprintf(stderr, "maxbuf =");
for (k=0;k<JB_HISTORY_MAXBUF_SZ;k++)
for (k=0;k<JB_HISTORY_MAXBUF_SZ;k++)
fprintf(stderr, "%ld ", jb->hist_maxbuf[k]);
fprintf(stderr, "\nminbuf =");
for (k=0;k<JB_HISTORY_MAXBUF_SZ;k++)
for (k=0;k<JB_HISTORY_MAXBUF_SZ;k++)
fprintf(stderr, "%ld ", jb->hist_minbuf[k]);
fprintf(stderr, "\n");
}
@ -284,13 +284,13 @@ static void history_calc_maxbuf(jitterbuf *jb)
jb->hist_maxbuf_valid = 1;
}
static void history_get(jitterbuf *jb)
static void history_get(jitterbuf *jb)
{
long max, min, jitter;
int idx;
int count;
if (!jb->hist_maxbuf_valid)
if (!jb->hist_maxbuf_valid)
history_calc_maxbuf(jb);
/* count is how many items in history we're examining */
@ -300,7 +300,7 @@ static void history_get(jitterbuf *jb)
idx = count * JB_HISTORY_DROPPCT / 100;
/* sanity checks for idx */
if (idx > (JB_HISTORY_MAXBUF_SZ - 1))
if (idx > (JB_HISTORY_MAXBUF_SZ - 1))
idx = JB_HISTORY_MAXBUF_SZ - 1;
if (idx < 0) {
@ -326,7 +326,7 @@ static void history_get(jitterbuf *jb)
}
/* returns 1 if frame was inserted into head of queue, 0 otherwise */
static int queue_put(jitterbuf *jb, void *data, const enum jb_frame_type type, long ms, long ts)
static int queue_put(jitterbuf *jb, void *data, const enum jb_frame_type type, long ms, long ts)
{
jb_frame *frame;
jb_frame *p;
@ -347,8 +347,8 @@ static int queue_put(jitterbuf *jb, void *data, const enum jb_frame_type type, l
frame->ms = ms;
frame->type = type;
/*
* frames are a circular list, jb-frames points to to the lowest ts,
/*
* frames are a circular list, jb-frames points to to the lowest ts,
* jb->frames->prev points to the highest ts
*/
@ -369,13 +369,13 @@ static int queue_put(jitterbuf *jb, void *data, const enum jb_frame_type type, l
jb->frames = frame;
head = 1;
} else {
} else {
p = jb->frames;
/* frame is out of order */
if (resync_ts < p->prev->ts) jb->info.frames_ooo++;
while (resync_ts < p->prev->ts && p->prev != jb->frames)
while (resync_ts < p->prev->ts && p->prev != jb->frames)
p = p->prev;
frame->next = p;
@ -387,23 +387,23 @@ static int queue_put(jitterbuf *jb, void *data, const enum jb_frame_type type, l
return head;
}
static long queue_next(jitterbuf *jb)
static long queue_next(jitterbuf *jb)
{
if (jb->frames)
if (jb->frames)
return jb->frames->ts;
else
else
return -1;
}
static long queue_last(jitterbuf *jb)
static long queue_last(jitterbuf *jb)
{
if (jb->frames)
if (jb->frames)
return jb->frames->prev->ts;
else
else
return -1;
}
static jb_frame *_queue_get(jitterbuf *jb, long ts, int all)
static jb_frame *_queue_get(jitterbuf *jb, long ts, int all)
{
jb_frame *frame;
frame = jb->frames;
@ -430,52 +430,52 @@ static jb_frame *_queue_get(jitterbuf *jb, long ts, int all)
jb->info.frames_cur--;
/* we return the frame pointer, even though it's on free list,
/* we return the frame pointer, even though it's on free list,
* but caller must copy data */
return frame;
}
}
return NULL;
}
static jb_frame *queue_get(jitterbuf *jb, long ts)
static jb_frame *queue_get(jitterbuf *jb, long ts)
{
return _queue_get(jb,ts,0);
}
static jb_frame *queue_getall(jitterbuf *jb)
static jb_frame *queue_getall(jitterbuf *jb)
{
return _queue_get(jb,0,1);
}
#if 0
/* some diagnostics */
static void jb_dbginfo(jitterbuf *jb)
static void jb_dbginfo(jitterbuf *jb)
{
if (dbgf == NULL)
if (dbgf == NULL)
return;
jb_dbg("\njb info: fin=%ld fout=%ld flate=%ld flost=%ld fdrop=%ld fcur=%ld\n",
jb->info.frames_in, jb->info.frames_out, jb->info.frames_late, jb->info.frames_lost, jb->info.frames_dropped, jb->info.frames_cur);
jb_dbg("jitter=%ld current=%ld target=%ld min=%ld sil=%d len=%d len/fcur=%ld\n",
jb->info.jitter, jb->info.current, jb->info.target, jb->info.min, jb->info.silence_begin_ts, jb->info.current - jb->info.min,
jb->info.jitter, jb->info.current, jb->info.target, jb->info.min, jb->info.silence_begin_ts, jb->info.current - jb->info.min,
jb->info.frames_cur ? (jb->info.current - jb->info.min)/jb->info.frames_cur : -8);
if (jb->info.frames_in > 0)
if (jb->info.frames_in > 0)
jb_dbg("jb info: Loss PCT = %ld%%, Late PCT = %ld%%\n",
jb->info.frames_lost * 100/(jb->info.frames_in + jb->info.frames_lost),
jb->info.frames_lost * 100/(jb->info.frames_in + jb->info.frames_lost),
jb->info.frames_late * 100/jb->info.frames_in);
jb_dbg("jb info: queue %d -> %d. last_ts %d (queue len: %d) last_ms %d\n",
queue_next(jb),
queue_next(jb),
queue_last(jb),
jb->info.next_voice_ts,
jb->info.next_voice_ts,
queue_last(jb) - queue_next(jb),
jb->info.last_voice_ms);
}
#endif
#ifdef DEEP_DEBUG
static void jb_chkqueue(jitterbuf *jb)
static void jb_chkqueue(jitterbuf *jb)
{
int i=0;
jb_frame *p = jb->frames;
@ -486,14 +486,14 @@ static void jb_chkqueue(jitterbuf *jb)
do {
if (p->next == NULL) {
jb_err("Queue is BROKEN at item [%d]", i);
jb_err("Queue is BROKEN at item [%d]", i);
}
i++;
p=p->next;
} while (p->next != jb->frames);
}
static void jb_dbgqueue(jitterbuf *jb)
static void jb_dbgqueue(jitterbuf *jb)
{
int i=0;
jb_frame *p = jb->frames;
@ -514,7 +514,7 @@ static void jb_dbgqueue(jitterbuf *jb)
}
#endif
enum jb_return_code jb_put(jitterbuf *jb, void *data, const enum jb_frame_type type, long ms, long ts, long now)
enum jb_return_code jb_put(jitterbuf *jb, void *data, const enum jb_frame_type type, long ms, long ts, long now)
{
long delay = now - (ts - jb->info.resync_offset);
jb_dbg2("jb_put(%x,%x,%ld,%ld,%ld)\n", jb, data, ms, ts, now);
@ -539,7 +539,7 @@ enum jb_return_code jb_put(jitterbuf *jb, void *data, const enum jb_frame_type t
}
static enum jb_return_code _jb_get(jitterbuf *jb, jb_frame *frameout, long now, long interpl)
static enum jb_return_code _jb_get(jitterbuf *jb, jb_frame *frameout, long now, long interpl)
{
jb_frame *frame;
long diff;
@ -554,7 +554,7 @@ static enum jb_return_code _jb_get(jitterbuf *jb, jb_frame *frameout, long now,
dbg_cnt++;
/* target */
jb->info.target = jb->info.jitter + jb->info.min + jb->info.conf.target_extra;
jb->info.target = jb->info.jitter + jb->info.min + jb->info.conf.target_extra;
/* if a hard clamp was requested, use it */
if ((jb->info.conf.max_jitterbuf) && ((jb->info.target - jb->info.min) > jb->info.conf.max_jitterbuf)) {
@ -568,11 +568,11 @@ static enum jb_return_code _jb_get(jitterbuf *jb, jb_frame *frameout, long now,
/* jb->info.last_voice_ms, jb->info.last_adjustment, now); */
/* let's work on non-silent case first */
if (!jb->info.silence_begin_ts) {
if (!jb->info.silence_begin_ts) {
/* we want to grow */
if ((diff > 0) &&
if ((diff > 0) &&
/* we haven't grown in the delay length */
(((jb->info.last_adjustment + JB_ADJUST_DELAY) < now) ||
(((jb->info.last_adjustment + JB_ADJUST_DELAY) < now) ||
/* we need to grow more than the "length" we have left */
(diff > queue_last(jb) - queue_next(jb)) ) ) {
/* grow by interp frame length */
@ -608,7 +608,7 @@ static enum jb_return_code _jb_get(jitterbuf *jb, jb_frame *frameout, long now,
if (frame && frame->ts + jb->info.current < jb->info.next_voice_ts) {
if (frame->ts + jb->info.current > jb->info.next_voice_ts - jb->info.last_voice_ms) {
/* either we interpolated past this frame in the last jb_get */
/* or the frame is still in order, but came a little too quick */
/* or the frame is still in order, but came a little too quick */
*frameout = *frame;
/* reset expectation for next frame */
jb->info.next_voice_ts = frame->ts + jb->info.current + frame->ms;
@ -638,8 +638,8 @@ static enum jb_return_code _jb_get(jitterbuf *jb, jb_frame *frameout, long now,
/* unless we don't have a frame, then shrink 1 frame */
/* every 80ms (though perhaps we can shrink even faster */
/* in this case) */
if (diff < -jb->info.conf.target_extra &&
((!frame && jb->info.last_adjustment + 80 < now) ||
if (diff < -jb->info.conf.target_extra &&
((!frame && jb->info.last_adjustment + 80 < now) ||
(jb->info.last_adjustment + 500 < now))) {
jb->info.last_adjustment = now;
@ -672,16 +672,16 @@ static enum jb_return_code _jb_get(jitterbuf *jb, jb_frame *frameout, long now,
* otherwise, we presently get into a pattern where we return
* INTERP for the lost frame, then it shows up next, and we
* throw it away because it's late */
/* I've recently only been able to replicate this using
/* I've recently only been able to replicate this using
* iaxclient talking to app_echo on asterisk. In this case,
* my outgoing packets go through asterisk's (old)
* jitterbuffer, and then might get an unusual increasing delay
* jitterbuffer, and then might get an unusual increasing delay
* there if it decides to grow?? */
/* Update: that might have been a different bug, that has been fixed..
* But, this still seemed like a good idea, except that it ended up making a single actual
* lost frame get interpolated two or more times, when there was "room" to grow, so it might
* be a bit of a bad idea overall */
/*if (diff > -1 * jb->info.last_voice_ms) {
/*if (diff > -1 * jb->info.last_voice_ms) {
jb->info.current += jb->info.last_voice_ms;
jb->info.last_adjustment = now;
jb_warn("g");
@ -707,7 +707,7 @@ static enum jb_return_code _jb_get(jitterbuf *jb, jb_frame *frameout, long now,
decrement_losspct(jb);
jb_dbg("v");
return JB_OK;
} else {
} else {
/* TODO: after we get the non-silent case down, we'll make the
* silent case -- basically, we'll just grow and shrink faster
* here, plus handle next_voice_ts a bit differently */
@ -715,12 +715,12 @@ static enum jb_return_code _jb_get(jitterbuf *jb, jb_frame *frameout, long now,
/* to disable silent special case altogether, just uncomment this: */
/* jb->info.silence_begin_ts = 0; */
/* shrink interpl len every 10ms during silence */
if (diff < -jb->info.conf.target_extra &&
jb->info.last_adjustment + 10 <= now) {
jb->info.current -= interpl;
jb->info.last_adjustment = now;
}
/* shrink interpl len every 10ms during silence */
if (diff < -jb->info.conf.target_extra &&
jb->info.last_adjustment + 10 <= now) {
jb->info.current -= interpl;
jb->info.last_adjustment = now;
}
frame = queue_get(jb, now - jb->info.current);
if (!frame) {
@ -756,7 +756,7 @@ static enum jb_return_code _jb_get(jitterbuf *jb, jb_frame *frameout, long now,
}
}
long jb_next(jitterbuf *jb)
long jb_next(jitterbuf *jb)
{
if (jb->info.silence_begin_ts) {
if (jb->frames) {
@ -767,14 +767,14 @@ long jb_next(jitterbuf *jb)
return jb->info.last_adjustment + 10;
return next + jb->info.target;
}
else
else
return JB_LONGMAX;
} else {
return jb->info.next_voice_ts;
}
}
enum jb_return_code jb_get(jitterbuf *jb, jb_frame *frameout, long now, long interpl)
enum jb_return_code jb_get(jitterbuf *jb, jb_frame *frameout, long now, long interpl)
{
enum jb_return_code ret = _jb_get(jb, frameout, now, interpl);
#if 0
@ -784,13 +784,13 @@ enum jb_return_code jb_get(jitterbuf *jb, jb_frame *frameout, long now, long int
if (thists && thists < lastts) jb_warn("XXXX timestamp roll-back!!!\n");
lastts = thists;
#endif
if (ret == JB_INTERP)
if (ret == JB_INTERP)
frameout->ms = jb->info.last_voice_ms;
return ret;
}
enum jb_return_code jb_getall(jitterbuf *jb, jb_frame *frameout)
enum jb_return_code jb_getall(jitterbuf *jb, jb_frame *frameout)
{
jb_frame *frame;
frame = queue_getall(jb);
@ -804,7 +804,7 @@ enum jb_return_code jb_getall(jitterbuf *jb, jb_frame *frameout)
}
enum jb_return_code jb_getinfo(jitterbuf *jb, jb_info *stats)
enum jb_return_code jb_getinfo(jitterbuf *jb, jb_info *stats)
{
history_get(jb);
@ -814,12 +814,12 @@ enum jb_return_code jb_getinfo(jitterbuf *jb, jb_info *stats)
return JB_OK;
}
enum jb_return_code jb_setconf(jitterbuf *jb, jb_conf *conf)
enum jb_return_code jb_setconf(jitterbuf *jb, jb_conf *conf)
{
/* take selected settings from the struct */
jb->info.conf.max_jitterbuf = conf->max_jitterbuf;
jb->info.conf.resync_threshold = conf->resync_threshold;
jb->info.conf.resync_threshold = conf->resync_threshold;
jb->info.conf.max_contig_interp = conf->max_contig_interp;
/* -1 indicates use of the default JB_TARGET_EXTRA value */
@ -827,7 +827,7 @@ enum jb_return_code jb_setconf(jitterbuf *jb, jb_conf *conf)
? JB_TARGET_EXTRA
: conf->target_extra
;
/* update these to match new target_extra setting */
jb->info.current = jb->info.conf.target_extra;
jb->info.target = jb->info.conf.target_extra;

View File

@ -829,7 +829,7 @@ static enum ast_module_load_result start_resource(struct ast_module *mod)
*
* If the ast_heap is provided (not NULL) the module is found and added to the
* heap without running the module's load() function. By doing this, modules
* added to the resource_heap can be initialized later in order by priority.
* added to the resource_heap can be initialized later in order by priority.
*
* If the ast_heap is not provided, the module's load function will be executed
* immediately */
@ -917,7 +917,7 @@ static struct load_order_entry *add_to_load_order(const char *resource, struct l
AST_LIST_TRAVERSE(load_order, order, entry) {
if (!resource_name_match(order->resource, resource)) {
/* Make sure we have the proper setting for the required field
/* Make sure we have the proper setting for the required field
(we might have both load= and required= lines in modules.conf) */
order->required |= required;
return NULL;
@ -950,7 +950,7 @@ static int mod_load_cmp(void *a, void *b)
return res;
}
/*! loads modules in order by load_pri, updates mod_count
/*! loads modules in order by load_pri, updates mod_count
\return -1 on failure to load module, -2 on failure to load required module, otherwise 0
*/
static int load_resource_list(struct load_order *load_order, unsigned int global_symbols, int *mod_count)
@ -1154,12 +1154,12 @@ done:
}
AST_LIST_UNLOCK(&module_list);
/* Tell manager clients that are aggressive at logging in that we're done
loading modules. If there's a DNS problem in chan_sip, we might not
even reach this */
manager_event(EVENT_FLAG_SYSTEM, "ModuleLoadReport", "ModuleLoadStatus: Done\r\nModuleSelection: %s\r\nModuleCount: %d\r\n", preload_only ? "Preload" : "All", modulecount);
return res;
}
@ -1184,7 +1184,7 @@ int ast_update_module_list(int (*modentry)(const char *module, const char *descr
if (AST_LIST_TRYLOCK(&module_list))
unlock = 0;
AST_LIST_TRAVERSE(&module_list, cur, entry) {
total_mod_loaded += modentry(cur->resource, cur->info->description, cur->usecount, like);
}

View File

@ -154,7 +154,7 @@ int __ast_pthread_mutex_destroy(const char *filename, int lineno, const char *fu
}
int __ast_pthread_mutex_lock(const char *filename, int lineno, const char *func,
const char* mutex_name, ast_mutex_t *t)
const char* mutex_name, ast_mutex_t *t)
{
int res;
@ -286,7 +286,7 @@ int __ast_pthread_mutex_lock(const char *filename, int lineno, const char *func,
}
int __ast_pthread_mutex_trylock(const char *filename, int lineno, const char *func,
const char* mutex_name, ast_mutex_t *t)
const char* mutex_name, ast_mutex_t *t)
{
int res;

View File

@ -832,17 +832,17 @@ static char *handle_logger_rotate(struct ast_cli_entry *e, int cmd, struct ast_c
switch (cmd) {
case CLI_INIT:
e->command = "logger rotate";
e->usage =
e->usage =
"Usage: logger rotate\n"
" Rotates and Reopens the log files.\n";
return NULL;
case CLI_GENERATE:
return NULL;
return NULL;
}
if (reload_logger(1, NULL)) {
ast_cli(a->fd, "Failed to reload the logger and rotate log files\n");
return CLI_FAILURE;
}
}
return CLI_SUCCESS;
}
@ -855,7 +855,7 @@ static char *handle_logger_set_level(struct ast_cli_entry *e, int cmd, struct as
switch (cmd) {
case CLI_INIT:
e->command = "logger set level {DEBUG|NOTICE|WARNING|ERROR|VERBOSE|DTMF} {on|off}";
e->usage =
e->usage =
"Usage: logger set level {DEBUG|NOTICE|WARNING|ERROR|VERBOSE|DTMF} {on|off}\n"
" Set a specific log level to enabled/disabled for this console.\n";
return NULL;
@ -896,12 +896,12 @@ static char *handle_logger_show_channels(struct ast_cli_entry *e, int cmd, struc
switch (cmd) {
case CLI_INIT:
e->command = "logger show channels";
e->usage =
e->usage =
"Usage: logger show channels\n"
" List configured logger channels.\n";
return NULL;
case CLI_GENERATE:
return NULL;
return NULL;
}
ast_cli(a->fd, FORMATL, "Channel", "Type", "Status");
ast_cli(a->fd, "Configuration\n");
@ -1291,7 +1291,7 @@ void ast_log(int level, const char *file, int line, const char *function, const
#ifdef HAVE_BKTR
struct ast_bt *ast_bt_create(void)
struct ast_bt *ast_bt_create(void)
{
struct ast_bt *bt = ast_calloc(1, sizeof(*bt));
if (!bt) {
@ -1574,7 +1574,7 @@ void ast_verbose(const char *fmt, ...)
va_end(ap);
}
int ast_register_verbose(void (*v)(const char *string))
int ast_register_verbose(void (*v)(const char *string))
{
struct verb *verb;
@ -1586,7 +1586,7 @@ int ast_register_verbose(void (*v)(const char *string))
AST_RWLIST_WRLOCK(&verbosers);
AST_RWLIST_INSERT_HEAD(&verbosers, verb, list);
AST_RWLIST_UNLOCK(&verbosers);
return 0;
}
@ -1604,7 +1604,7 @@ int ast_unregister_verbose(void (*v)(const char *string))
}
AST_RWLIST_TRAVERSE_SAFE_END;
AST_RWLIST_UNLOCK(&verbosers);
return cur ? 0 : -1;
}

View File

@ -1319,7 +1319,7 @@ static int strings_to_mask(const char *string)
static struct mansession_session *unref_mansession(struct mansession_session *s)
{
int refcount = ao2_ref(s, -1);
if (manager_debug) {
if (manager_debug) {
ast_debug(1, "Mansession: %p refcount now %d\n", s, refcount - 1);
}
return s;
@ -2015,7 +2015,7 @@ static int send_string(struct mansession *s, char *string)
s->hook->helper(EVENT_FLAG_HOOKRESPONSE, "HookResponse", string);
return 0;
}
if ((res = ast_careful_fwrite(f, fd, string, strlen(string), s->session->writetimeout))) {
s->write_error = 1;
}
@ -3185,7 +3185,7 @@ static int action_setvar(struct mansession *s, const struct message *m)
const char *varname = astman_get_header(m, "Variable");
const char *varval = astman_get_header(m, "Value");
int res = 0;
if (ast_strlen_zero(varname)) {
astman_send_error(s, m, "No variable specified");
return 0;
@ -3204,7 +3204,7 @@ static int action_setvar(struct mansession *s, const struct message *m)
c = ast_channel_unref(c);
}
if (res == 0) {
astman_send_ack(s, m, "Variable Set");
astman_send_ack(s, m, "Variable Set");
} else {
astman_send_error(s, m, "Variable not set");
}
@ -4310,10 +4310,10 @@ static int blackfilter_cmp_fn(void *obj, void *arg, void *data, int flags)
static int action_filter(struct mansession *s, const struct message *m)
{
const char *filter = astman_get_header(m, "Filter");
const char *operation = astman_get_header(m, "Operation");
int res;
const char *operation = astman_get_header(m, "Operation");
int res;
if (!strcasecmp(operation, "Add")) {
if (!strcasecmp(operation, "Add")) {
res = manager_add_filter(filter, s->session->whitefilters, s->session->blackfilters);
if (res != FILTER_SUCCESS) {
@ -4330,8 +4330,8 @@ static int action_filter(struct mansession *s, const struct message *m)
}
astman_send_ack(s, m, "Success");
return 0;
}
return 0;
}
astman_send_error(s, m, "Unknown operation");
return 0;
@ -4382,7 +4382,7 @@ static enum add_filter_result manager_add_filter(const char *filter_pattern, str
ao2_t_link(whitefilters, new_filter, "link new filter into white user container");
}
return FILTER_SUCCESS;
return FILTER_SUCCESS;
}
static int match_filter(struct mansession *s, char *eventdata)
@ -4394,16 +4394,16 @@ static int match_filter(struct mansession *s, char *eventdata)
return 1; /* no filtering means match all */
} else if (ao2_container_count(s->session->whitefilters) && !ao2_container_count(s->session->blackfilters)) {
/* white filters only: implied black all filter processed first, then white filters */
ao2_t_callback_data(s->session->whitefilters, OBJ_NODATA, whitefilter_cmp_fn, eventdata, &result, "find filter in session filter container");
ao2_t_callback_data(s->session->whitefilters, OBJ_NODATA, whitefilter_cmp_fn, eventdata, &result, "find filter in session filter container");
} else if (!ao2_container_count(s->session->whitefilters) && ao2_container_count(s->session->blackfilters)) {
/* black filters only: implied white all filter processed first, then black filters */
ao2_t_callback_data(s->session->blackfilters, OBJ_NODATA, blackfilter_cmp_fn, eventdata, &result, "find filter in session filter container");
ao2_t_callback_data(s->session->blackfilters, OBJ_NODATA, blackfilter_cmp_fn, eventdata, &result, "find filter in session filter container");
} else {
/* white and black filters: implied black all filter processed first, then white filters, and lastly black filters */
ao2_t_callback_data(s->session->whitefilters, OBJ_NODATA, whitefilter_cmp_fn, eventdata, &result, "find filter in session filter container");
ao2_t_callback_data(s->session->whitefilters, OBJ_NODATA, whitefilter_cmp_fn, eventdata, &result, "find filter in session filter container");
if (result) {
result = 0;
ao2_t_callback_data(s->session->blackfilters, OBJ_NODATA, blackfilter_cmp_fn, eventdata, &result, "find filter in session filter container");
ao2_t_callback_data(s->session->blackfilters, OBJ_NODATA, blackfilter_cmp_fn, eventdata, &result, "find filter in session filter container");
}
}
@ -4453,7 +4453,7 @@ static int action_userevent(struct mansession *s, const struct message *m)
}
}
astman_send_ack(s, m, "Event Sent");
astman_send_ack(s, m, "Event Sent");
manager_event(EVENT_FLAG_USER, "UserEvent", "UserEvent: %s\r\n%s", event, ast_str_buffer(body));
return 0;
}
@ -5227,7 +5227,7 @@ int __ast_manager_event_multichan(int category, const char *event, int chancount
if (!(sessions && ao2_container_count(sessions)) && AST_RWLIST_EMPTY(&manager_hooks)) {
return 0;
}
if (!(buf = ast_str_thread_get(&manager_event_buf, MANAGER_EVENT_BUF_INITSIZE))) {
return -1;
}
@ -6983,7 +6983,7 @@ static int __init_manager(int reload)
}
} else if (!strcasecmp(var->name, "eventfilter")) {
const char *value = var->value;
manager_add_filter(value, user->whitefilters, user->blackfilters);
manager_add_filter(value, user->whitefilters, user->blackfilters);
} else {
ast_debug(1, "%s is an unknown option.\n", var->name);
}

View File

@ -116,7 +116,7 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
}
/*
* Final wrapup - pad to 64-byte boundary with the bit pattern
* Final wrapup - pad to 64-byte boundary with the bit pattern
* 1 0* (64-bit count of bits processed, MSB-first)
*/
void MD5Final(unsigned char digest[16], struct MD5Context *ctx)

View File

@ -167,7 +167,7 @@ struct ast_msg {
struct ast_msg_tech_holder {
const struct ast_msg_tech *tech;
/*!
/*!
* \brief A rwlock for this object
*
* a read/write lock must be used to protect the wrapper instead
@ -757,7 +757,7 @@ int ast_msg_queue(struct ast_msg *msg)
/*!
* \internal
* \brief Find or create a message datastore on a channel
*
*
* \pre chan is locked
*
* \param chan the relevant channel

View File

@ -292,7 +292,7 @@ int ast_str_to_eid(struct ast_eid *eid, const char *s)
if (sscanf(s, "%2x:%2x:%2x:%2x:%2x:%2x", &eid_int[0], &eid_int[1], &eid_int[2],
&eid_int[3], &eid_int[4], &eid_int[5]) != 6)
return -1;
return -1;
for (x = 0; x < 6; x++)
eid->eid[x] = eid_int[x];

View File

@ -1404,7 +1404,7 @@ int check_contexts(char *file, int line )
ast_unlock_contexts();
}
/* loop thru all contexts, and verify the exten structure compares to the
/* loop thru all contexts, and verify the exten structure compares to the
hashtab structure */
for(c2=contexts;c2;c2=c2->next) {
c1 = find_context_locked(c2->name);
@ -1430,7 +1430,7 @@ int check_contexts(char *file, int line )
}
}
/* is every entry in the root_table also in the root list? */
/* is every entry in the root_table also in the root list? */
if (!c2->root_table) {
if (c2->root) {
ast_log(LOG_NOTICE,"Called from: %s:%d: No c2->root_table for context %s!\n", file, line, c2->name);
@ -2025,7 +2025,7 @@ static void insert_in_next_chars_alt_char_list(struct match_char **parent_ptr, s
node->alt_char = (*parent_ptr);
*parent_ptr = node;
return;
}
}
lcurr = *parent_ptr;
for (curr = (*parent_ptr)->alt_char; curr; curr = curr->alt_char) {
@ -5403,7 +5403,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
/*!
* \brief Increase call count for channel
* \retval 0 on success
* \retval non-zero if a configured limit (maxcalls, maxload, minmemfree) was reached
* \retval non-zero if a configured limit (maxcalls, maxload, minmemfree) was reached
*/
static int increase_call_count(const struct ast_channel *c)
{
@ -7499,7 +7499,7 @@ static void context_merge(struct ast_context **extcontexts, struct ast_hashtab *
dupdstr = ast_strdup(prio_item->data);
res1 = ast_add_extension2(new, 0, prio_item->exten, prio_item->priority, prio_item->label,
res1 = ast_add_extension2(new, 0, prio_item->exten, prio_item->priority, prio_item->label,
prio_item->matchcid ? prio_item->cidmatch : NULL, prio_item->app, dupdstr, prio_item->datad, prio_item->registrar);
if (!res1 && new_exten_item && new_prio_item){
ast_verb(3,"Dropping old dialplan item %s/%s/%d [%s(%s)] (registrar=%s) due to conflict with new dialplan\n",
@ -9827,7 +9827,7 @@ static int pbx_builtin_waitexten(struct ast_channel *chan, const char *data)
ast_app_parse_options(waitexten_opts, &flags, opts, args.options);
if (ast_test_flag(&flags, WAITEXTEN_MOH) && !opts[0] ) {
ast_log(LOG_WARNING, "The 'm' option has been specified for WaitExten without a class.\n");
ast_log(LOG_WARNING, "The 'm' option has been specified for WaitExten without a class.\n");
} else if (ast_test_flag(&flags, WAITEXTEN_MOH)) {
ast_indicate_data(chan, AST_CONTROL_HOLD, S_OR(opts[0], NULL), strlen(opts[0]));
} else if (ast_test_flag(&flags, WAITEXTEN_DIALTONE)) {

View File

@ -182,13 +182,13 @@ int plc_fillin(plc_state_t *s, int16_t amp[], int len)
orig_len = len;
if (s->missing_samples == 0) {
/* As the gap in real speech starts we need to assess the last known pitch,
and prepare the synthetic data we will use for fill-in */
and prepare the synthetic data we will use for fill-in */
normalise_history(s);
s->pitch = amdf_pitch(PLC_PITCH_MIN, PLC_PITCH_MAX, s->history + PLC_HISTORY_LEN - CORRELATION_SPAN - PLC_PITCH_MIN, CORRELATION_SPAN);
/* We overlap a 1/4 wavelength */
pitch_overlap = s->pitch >> 2;
/* Cook up a single cycle of pitch, using a single of the real signal with 1/4
cycle OLA'ed to make the ends join up nicely */
cycle OLA'ed to make the ends join up nicely */
/* The first 3/4 of the cycle is a simple copy */
for (i = 0; i < s->pitch - pitch_overlap; i++)
s->pitchbuf[i] = s->history[PLC_HISTORY_LEN - s->pitch + i];
@ -200,11 +200,11 @@ int plc_fillin(plc_state_t *s, int16_t amp[], int len)
new_weight += new_step;
}
/* We should now be ready to fill in the gap with repeated, decaying cycles
of what is in pitchbuf */
of what is in pitchbuf */
/* We need to OLA the first 1/4 wavelength of the synthetic data, to smooth
it into the previous real data. To avoid the need to introduce a delay
in the stream, reverse the last 1/4 wavelength, and OLA with that. */
it into the previous real data. To avoid the need to introduce a delay
in the stream, reverse the last 1/4 wavelength, and OLA with that. */
gain = 1.0;
new_step = 1.0 / pitch_overlap;
old_step = new_step;

View File

@ -20,7 +20,7 @@
*
* \brief Privacy Routines
*
* \author Mark Spencer <markster@digium.com>
* \author Mark Spencer <markster@digium.com>
*/
#include "asterisk.h"
@ -96,7 +96,7 @@ int ast_privacy_set(char *dest, char *cid, int status)
return 0;
}
snprintf(key, sizeof(key), "%s/%s", dest, trimcid);
if (status == AST_PRIVACY_UNKNOWN)
if (status == AST_PRIVACY_UNKNOWN)
res = ast_db_del("privacy", key);
else if (status == AST_PRIVACY_ALLOW)
res = ast_db_put("privacy", key, "allow");

View File

@ -1508,9 +1508,9 @@ void ast_rtp_instance_early_bridge_make_compatible(struct ast_channel *c0, struc
ast_rtp_codecs_payloads_copy(&tinstance0->codecs, &tinstance1->codecs, tinstance1);
}
if (glue0->update_peer(c0, instance1, vinstance1, tinstance1, cap1, 0)) {
ast_log(LOG_WARNING, "Channel '%s' failed to setup early bridge to '%s'\n", ast_channel_name(c0), c1 ? ast_channel_name(c1) : "<unspecified>");
}
if (glue0->update_peer(c0, instance1, vinstance1, tinstance1, cap1, 0)) {
ast_log(LOG_WARNING, "Channel '%s' failed to setup early bridge to '%s'\n", ast_channel_name(c0), c1 ? ast_channel_name(c1) : "<unspecified>");
}
res = 0;

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
DEBUG_M(a) \
} while (0)
#else
#define DEBUG(a)
#define DEBUG(a)
#endif
#include <sys/time.h>
@ -49,7 +49,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/heap.h"
#include "asterisk/threadstorage.h"
/*!
/*!
* \brief Max num of schedule structs
*
* \note The max number of schedule structs to keep around
@ -282,7 +282,7 @@ static void sched_release(struct ast_sched_context *con, struct sched *tmp)
* already have too many cache entries
*/
#ifdef SCHED_MAX_CACHE
#ifdef SCHED_MAX_CACHE
if (con->schedccnt < SCHED_MAX_CACHE) {
AST_LIST_INSERT_HEAD(&con->schedc, tmp, list);
con->schedccnt++;
@ -292,7 +292,7 @@ static void sched_release(struct ast_sched_context *con, struct sched *tmp)
}
/*! \brief
* Return the number of milliseconds
* Return the number of milliseconds
* until the next scheduled event
*/
int ast_sched_wait(struct ast_sched_context *con)
@ -320,7 +320,7 @@ int ast_sched_wait(struct ast_sched_context *con)
/*! \brief
* Take a sched structure and put it in the
* queue, such that the soonest event is
* first in the list.
* first in the list.
*/
static void schedule(struct ast_sched_context *con, struct sched *s)
{
@ -500,7 +500,7 @@ void ast_sched_report(struct ast_sched_context *con, struct ast_str **buf, struc
struct sched *cur;
int countlist[cbnames->numassocs + 1];
size_t heap_size;
memset(countlist, 0, sizeof(countlist));
ast_str_set(buf, 0, " Highwater = %d\n schedcnt = %d\n", con->highwater, con->schedcnt);
@ -530,7 +530,7 @@ void ast_sched_report(struct ast_sched_context *con, struct ast_str **buf, struc
ast_str_append(buf, 0, " <unknown> : %d\n", countlist[cbnames->numassocs]);
}
/*! \brief Dump the contents of the scheduler to LOG_DEBUG */
void ast_sched_dump(struct ast_sched_context *con)
{
@ -553,7 +553,7 @@ void ast_sched_dump(struct ast_sched_context *con)
struct timeval delta;
q = ast_heap_peek(con->sched_heap, x);
delta = ast_tvsub(q->when, when);
ast_debug(1, "|%.4d | %-15p | %-15p | %.6ld : %.6ld |\n",
ast_debug(1, "|%.4d | %-15p | %-15p | %.6ld : %.6ld |\n",
q->id,
q->callback,
q->data,
@ -602,7 +602,7 @@ int ast_sched_runq(struct ast_sched_context *con)
* have removed the first event and the rest is still there,
* so it's permissible for the callback to add new events, but
* trying to delete itself won't work because it isn't in
* the schedule queue. If that's what it wants to do, it
* the schedule queue. If that's what it wants to do, it
* should return 0.
*/

View File

@ -1,7 +1,7 @@
/*! \file
*
* \brief Based on the RFC 6234
*
*
* Copyright (c) 2011 IETF Trust and the persons identified as
* authors of the code. All rights reserved.
*

View File

@ -32,7 +32,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/slinfactory.h"
#include "asterisk/translate.h"
void ast_slinfactory_init(struct ast_slinfactory *sf)
void ast_slinfactory_init(struct ast_slinfactory *sf)
{
memset(sf, 0, sizeof(*sf));
sf->offset = sf->hold;
@ -51,7 +51,7 @@ int ast_slinfactory_init_with_format(struct ast_slinfactory *sf, const struct as
return 0;
}
void ast_slinfactory_destroy(struct ast_slinfactory *sf)
void ast_slinfactory_destroy(struct ast_slinfactory *sf)
{
struct ast_frame *f;
@ -100,7 +100,7 @@ int ast_slinfactory_feed(struct ast_slinfactory *sf, struct ast_frame *f)
if (!(begin_frame = ast_translate(sf->trans, f, 0))) {
return 0;
}
if (!(duped_frame = ast_frisolate(begin_frame))) {
return 0;
}
@ -132,7 +132,7 @@ int ast_slinfactory_feed(struct ast_slinfactory *sf, struct ast_frame *f)
return x;
}
int ast_slinfactory_read(struct ast_slinfactory *sf, short *buf, size_t samples)
int ast_slinfactory_read(struct ast_slinfactory *sf, short *buf, size_t samples)
{
struct ast_frame *frame_ptr;
unsigned int sofar = 0, ineed, remain;
@ -157,10 +157,10 @@ int ast_slinfactory_read(struct ast_slinfactory *sf, short *buf, size_t samples)
}
continue;
}
if ((frame_ptr = AST_LIST_REMOVE_HEAD(&sf->queue, frame_list))) {
frame_data = frame_ptr->data.ptr;
if (frame_ptr->samples <= ineed) {
memcpy(offset, frame_data, frame_ptr->samples * sizeof(*offset));
sofar += frame_ptr->samples;

View File

@ -23,7 +23,7 @@
* \brief DNS SRV Record Lookup Support for Asterisk
*
* \author Mark Spencer <markster@digium.com>
*
*
* \arg See also \ref AstENUM
*
* \note Funding provided by nic.at
@ -99,14 +99,14 @@ static int parse_srv(unsigned char *answer, int len, unsigned char *msg, struct
if (!(entry = ast_calloc(1, sizeof(*entry) + strlen(repl))))
return -1;
entry->priority = ntohs(srv->priority);
entry->weight = ntohs(srv->weight);
entry->port = ntohs(srv->port);
strcpy(entry->host, repl);
*result = entry;
return 0;
}

View File

@ -1290,7 +1290,7 @@ static int tzparse(const char *name, struct state *sp, const int lastditch)
for (year = EPOCH_YEAR;
sp->timecnt + 2 <= TZ_MAX_TIMES;
++year) {
time_t newfirst;
time_t newfirst;
starttime = transtime(janfirst, year, &start,
stdoffset);
@ -1578,23 +1578,23 @@ struct ast_tm *ast_localtime(const struct timeval *timep, struct ast_tm *tmp, co
}
/*
** This function provides informaton about daylight savings time
** for the given timezone. This includes whether it can determine
** if daylight savings is used for this timezone, the UTC times for
** when daylight savings transitions, and the offset in seconds from
** UTC.
** This function provides informaton about daylight savings time
** for the given timezone. This includes whether it can determine
** if daylight savings is used for this timezone, the UTC times for
** when daylight savings transitions, and the offset in seconds from
** UTC.
*/
void ast_get_dst_info(const time_t * const timep, int *dst_enabled, time_t *dst_start, time_t *dst_end, int *gmt_off, const char * const zone)
{
int i;
int i;
int transition1 = -1;
int transition2 = -1;
time_t seconds;
int bounds_exceeded = 0;
time_t t = *timep;
const struct state *sp;
if (NULL == dst_enabled)
return;
*dst_enabled = 0;
@ -1602,17 +1602,17 @@ void ast_get_dst_info(const time_t * const timep, int *dst_enabled, time_t *dst_
if (NULL == dst_start || NULL == dst_end || NULL == gmt_off)
return;
*gmt_off = 0;
*gmt_off = 0;
sp = ast_tzset(zone);
if (NULL == sp)
if (NULL == sp)
return;
/* If the desired time exceeds the bounds of the defined time transitions
* then give give up on determining DST info and simply look for gmt offset
* This requires that I adjust the given time using increments of Gregorian
* repeats to place the time within the defined time transitions in the
* timezone structure.
/* If the desired time exceeds the bounds of the defined time transitions
* then give give up on determining DST info and simply look for gmt offset
* This requires that I adjust the given time using increments of Gregorian
* repeats to place the time within the defined time transitions in the
* timezone structure.
*/
if ((sp->goback && t < sp->ats[0]) ||
(sp->goahead && t > sp->ats[sp->timecnt - 1])) {
@ -1635,7 +1635,7 @@ void ast_get_dst_info(const time_t * const timep, int *dst_enabled, time_t *dst_
t += seconds;
else
t -= seconds;
if (t < sp->ats[0] || t > sp->ats[sp->timecnt - 1])
return; /* "cannot happen" */
@ -1654,26 +1654,26 @@ void ast_get_dst_info(const time_t * const timep, int *dst_enabled, time_t *dst_
}
*gmt_off = sp->ttis[i].tt_gmtoff;
return;
}
}
for (i = 1; i < sp->timecnt; ++i) {
if (t < sp->ats[i]) {
transition1 = sp->types[i - 1];
transition2 = sp->types[i];
break;
}
}
}
/* if I found transition times that do not bounded the given time and these correspond to
/* if I found transition times that do not bounded the given time and these correspond to
or the bounding zones do not reflect a changes in day light savings, then I do not have dst active */
if (i >= sp->timecnt || 0 > transition1 || 0 > transition2 ||
(sp->ttis[transition1].tt_isdst == sp->ttis[transition2].tt_isdst)) {
*dst_enabled = 0;
*gmt_off = sp->ttis[sp->types[sp->timecnt -1]].tt_gmtoff;
*gmt_off = sp->ttis[sp->types[sp->timecnt -1]].tt_gmtoff;
} else {
/* I have valid daylight savings information. */
if(sp->ttis[transition2].tt_isdst)
if(sp->ttis[transition2].tt_isdst)
*gmt_off = sp->ttis[transition1].tt_gmtoff;
else
else
*gmt_off = sp->ttis[transition2].tt_gmtoff;
/* If I adjusted the time earlier, indicate that the dst is invalid */
@ -1688,7 +1688,7 @@ void ast_get_dst_info(const time_t * const timep, int *dst_enabled, time_t *dst_
*dst_end = sp->ats[i];
}
}
}
}
return;
}

View File

@ -1,4 +1,4 @@
/*! \file
/*! \file
\brief Testing localtime functionality */
#include "localtime.c"

View File

@ -16,7 +16,7 @@
/*! \file
*
* \brief Compatibility functions for strsep and strtoq missing on Solaris
* \brief Compatibility functions for strsep and strtoq missing on Solaris
*/
#include "asterisk.h"
@ -203,7 +203,7 @@ void timersub(struct timeval *tvend, struct timeval *tvstart, struct timeval *tv
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#if !defined(HAVE_ASPRINTF) && !defined(__AST_DEBUG_MALLOC)
#if !defined(HAVE_ASPRINTF) && !defined(__AST_DEBUG_MALLOC)
int asprintf(char **str, const char *fmt, ...)
{
va_list ap;

View File

@ -143,7 +143,7 @@ static struct tps_task *tps_task_alloc(int (*task_exe)(void *datap), void *datap
return t;
}
/* release task resources */
/* release task resources */
static void *tps_task_free(struct tps_task *task)
{
if (task) {
@ -153,7 +153,7 @@ static void *tps_task_free(struct tps_task *task)
}
/* taskprocessor tab completion */
static char *tps_taskprocessor_tab_complete(struct ast_taskprocessor *p, struct ast_cli_args *a)
static char *tps_taskprocessor_tab_complete(struct ast_taskprocessor *p, struct ast_cli_args *a)
{
int tklen;
int wordnum = 0;
@ -198,7 +198,7 @@ static char *cli_tps_ping(struct ast_cli_entry *e, int cmd, struct ast_cli_args
switch (cmd) {
case CLI_INIT:
e->command = "core ping taskprocessor";
e->usage =
e->usage =
"Usage: core ping taskprocessor <taskprocessor>\n"
" Displays the time required for a task to be processed\n";
return NULL;
@ -230,7 +230,7 @@ static char *cli_tps_ping(struct ast_cli_entry *e, int cmd, struct ast_cli_args
delta = ast_tvsub(end, begin);
ast_cli(a->fd, "\n\t%24s ping time: %.1ld.%.6ld sec\n\n", name, (long)delta.tv_sec, (long int)delta.tv_usec);
ao2_ref(tps, -1);
return CLI_SUCCESS;
return CLI_SUCCESS;
}
static char *cli_tps_report(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
@ -246,12 +246,12 @@ static char *cli_tps_report(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
switch (cmd) {
case CLI_INIT:
e->command = "core show taskprocessors";
e->usage =
e->usage =
"Usage: core show taskprocessors\n"
" Shows a list of instantiated task processors and their statistics\n";
return NULL;
case CLI_GENERATE:
return NULL;
return NULL;
}
if (a->argc != e->args)
@ -268,9 +268,9 @@ static char *cli_tps_report(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
ao2_ref(p, -1);
}
ao2_iterator_destroy(&i);
tcount = ao2_container_count(tps_singletons);
tcount = ao2_container_count(tps_singletons);
ast_cli(a->fd, "\n\t+---------------------+-----------------+------------+-------------+\n\t%d taskprocessors\n\n", tcount);
return CLI_SUCCESS;
return CLI_SUCCESS;
}
/* this is the task processing worker function */
@ -286,42 +286,42 @@ static void *tps_processing_function(void *data)
}
while (i->poll_thread_run) {
ast_mutex_lock(&i->taskprocessor_lock);
if (!i->poll_thread_run) {
ast_mutex_unlock(&i->taskprocessor_lock);
break;
}
if (!(size = tps_taskprocessor_depth(i))) {
ast_cond_wait(&i->poll_cond, &i->taskprocessor_lock);
if (!i->poll_thread_run) {
ast_mutex_unlock(&i->taskprocessor_lock);
break;
ast_mutex_lock(&i->taskprocessor_lock);
if (!i->poll_thread_run) {
ast_mutex_unlock(&i->taskprocessor_lock);
break;
}
if (!(size = tps_taskprocessor_depth(i))) {
ast_cond_wait(&i->poll_cond, &i->taskprocessor_lock);
if (!i->poll_thread_run) {
ast_mutex_unlock(&i->taskprocessor_lock);
break;
}
}
ast_mutex_unlock(&i->taskprocessor_lock);
/* stuff is in the queue */
if (!(t = tps_taskprocessor_pop(i))) {
ast_log(LOG_ERROR, "Wtf?? %d tasks in the queue, but we're popping blanks!\n", size);
continue;
}
if (!t->execute) {
ast_log(LOG_WARNING, "Task is missing a function to execute!\n");
tps_task_free(t);
continue;
}
t->execute(t->datap);
ast_mutex_lock(&i->taskprocessor_lock);
if (i->stats) {
i->stats->_tasks_processed_count++;
if (size > i->stats->max_qsize) {
i->stats->max_qsize = size;
}
}
ast_mutex_unlock(&i->taskprocessor_lock);
tps_task_free(t);
}
}
ast_mutex_unlock(&i->taskprocessor_lock);
/* stuff is in the queue */
if (!(t = tps_taskprocessor_pop(i))) {
ast_log(LOG_ERROR, "Wtf?? %d tasks in the queue, but we're popping blanks!\n", size);
continue;
}
if (!t->execute) {
ast_log(LOG_WARNING, "Task is missing a function to execute!\n");
tps_task_free(t);
continue;
}
t->execute(t->datap);
ast_mutex_lock(&i->taskprocessor_lock);
if (i->stats) {
i->stats->_tasks_processed_count++;
if (size > i->stats->max_qsize) {
i->stats->max_qsize = size;
}
}
ast_mutex_unlock(&i->taskprocessor_lock);
tps_task_free(t);
}
while ((t = tps_taskprocessor_pop(i))) {
tps_task_free(t);
}
@ -404,14 +404,14 @@ 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
* 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(const char *name, enum ast_tps_options create)
{
struct ast_taskprocessor *p, tmp_tps = {
.name = name,
};
if (ast_strlen_zero(name)) {
ast_log(LOG_ERROR, "requesting a nameless taskprocessor!!!\n");
return NULL;
@ -480,7 +480,7 @@ void *ast_taskprocessor_unreference(struct ast_taskprocessor *tps)
return NULL;
}
/* push the task into the taskprocessor queue */
/* push the task into the taskprocessor queue */
int ast_taskprocessor_push(struct ast_taskprocessor *tps, int (*task_exe)(void *datap), void *datap)
{
struct tps_task *t;

View File

@ -20,7 +20,7 @@
/*! \file
*
* \brief TTY/TDD Generation support
* \brief TTY/TDD Generation support
*
* \author Mark Spencer <markster@digium.com>
*
@ -168,7 +168,7 @@ int tdd_feed(struct tdd_state *tdd, unsigned char *ubuf, int len)
}
memcpy(buf, tdd->oldstuff, tdd->oldlen);
mylen += tdd->oldlen / 2;
for (x = 0; x < len; x++)
for (x = 0; x < len; x++)
buf[x + tdd->oldlen / 2] = AST_MULAW(ubuf[x]);
c = res = 0;
while (mylen >= 1320) { /* has to have enough to work on */
@ -202,7 +202,7 @@ int tdd_feed(struct tdd_state *tdd, unsigned char *ubuf, int len)
tdd->oldlen = 0;
free(obuf);
if (res) {
tdd->mode = 2;
tdd->mode = 2;
/* put it in mode where it
reliably puts teleprinter in correct shift mode */
return(c);
@ -222,12 +222,12 @@ static inline float tdd_getcarrier(float *cr, float *ci, int bit)
t = *cr * dr[bit] - *ci * di[bit];
*ci = *cr * di[bit] + *ci * dr[bit];
*cr = t;
t = 2.0 - (*cr * *cr + *ci * *ci);
*cr *= t;
*ci *= t;
return *cr;
}
}
#define PUT_BYTE(a) do { \
*(buf++) = (a); \
@ -239,7 +239,7 @@ static inline float tdd_getcarrier(float *cr, float *ci, int bit)
*(buf++) = AST_LIN2MU(__pas_idx); \
bytes++; \
} while(0)
#define PUT_TDD_MARKMS do { \
int x; \
for (x = 0; x < 8; x++) \
@ -266,13 +266,13 @@ static inline float tdd_getcarrier(float *cr, float *ci, int bit)
#define PUT_TDD(byte) do { \
int z; \
unsigned char b = (byte); \
PUT_TDD_BAUD(0); /* Start bit */ \
PUT_TDD_BAUD(0); /* Start bit */ \
for (z = 0; z < 5; z++) { \
PUT_TDD_BAUD(b & 1); \
b >>= 1; \
} \
PUT_TDD_STOP; /* Stop bit */ \
} while(0);
} while(0);
/*! Generate TDD hold tone
* \param buf Result buffer
@ -304,7 +304,7 @@ int tdd_generate(struct tdd_state *tdd, unsigned char *buf, const char *str)
for(x = 0; str[x]; x++) {
/* Do synch for each 72th character */
if ( (tdd->charnum++) % 72 == 0)
if ( (tdd->charnum++) % 72 == 0)
PUT_TDD(tdd->mode ? 27 /* FIGS */ : 31 /* LTRS */);
c = toupper(str[x]);

View File

@ -342,7 +342,7 @@ void term_filter_escapes(char *line)
if ((i < (len - 2)) &&
(line[i + 1] == 0x5B)) {
switch (line[i + 2]) {
case 0x30:
case 0x30:
case 0x31:
case 0x33:
continue;

View File

@ -68,7 +68,7 @@ static int timing_holder_cmp(void *_h1, void *_h2)
}
}
void *_ast_register_timing_interface(struct ast_timing_interface *funcs,
void *_ast_register_timing_interface(struct ast_timing_interface *funcs,
struct ast_module *mod)
{
struct timing_holder *h;
@ -237,7 +237,7 @@ static char *timing_test(struct ast_cli_entry *e, int cmd, struct ast_cli_args *
if (sscanf(a->argv[2], "%30u", &rate) == 1) {
test_rate = rate;
} else {
ast_cli(a->fd, "Invalid rate '%s', using default of %u\n", a->argv[2], test_rate);
ast_cli(a->fd, "Invalid rate '%s', using default of %u\n", a->argv[2], test_rate);
}
}
@ -275,7 +275,7 @@ static char *timing_test(struct ast_cli_entry *e, int cmd, struct ast_cli_args *
ast_timer_close(timer);
ast_cli(a->fd, "It has been %" PRIi64 " milliseconds, and we got %d timer ticks\n",
ast_cli(a->fd, "It has been %" PRIi64 " milliseconds, and we got %d timer ticks\n",
ast_tvdiff_ms(end, start), count);
return CLI_SUCCESS;

View File

@ -20,7 +20,7 @@
*
* \brief Translate via the use of pseudo channels
*
* \author Mark Spencer <markster@digium.com>
* \author Mark Spencer <markster@digium.com>
*/
#include "asterisk.h"
@ -141,7 +141,7 @@ static int add_format2index(enum ast_format_id id)
return 0;
}
/*!
/*!
* \internal
* \brief converts index value back to format id
*/

View File

@ -2,7 +2,7 @@
* Asterisk -- A telephony toolkit for Linux.
*
* UDPTL support for T.38
*
*
* Copyright (C) 2005, Steve Underwood, partly based on RTP code which is
* Copyright (C) 1999-2009, Digium, Inc.
*
@ -23,16 +23,16 @@
* this code.
*/
/*!
* \file
/*!
* \file
*
* \brief UDPTL support for T.38 faxing
*
*
*
* \author Mark Spencer <markster@digium.com>
* \author Steve Underwood <steveu@coppice.org>
* \author Kevin P. Fleming <kpfleming@digium.com>
*
*
* \page T38fax_udptl T.38 support :: UDPTL
*
* Asterisk supports T.38 fax passthrough, origination and termination. It does
@ -41,7 +41,7 @@
*
* UDPTL is handled very much like RTP. It can be reinvited to go directly between
* the endpoints, without involving Asterisk in the media stream.
*
*
* \b References:
* - chan_sip.c
* - udptl.c
@ -478,7 +478,7 @@ static int udptl_rx_packet(struct ast_udptl *s, uint8_t *buf, unsigned int len)
//fprintf(stderr, "Fixed packet %d, len %d\n", j, l);
s->f[ifp_no].frametype = AST_FRAME_MODEM;
s->f[ifp_no].subclass.integer = AST_MODEM_T38;
s->f[ifp_no].mallocd = 0;
s->f[ifp_no].seqno = j;
s->f[ifp_no].datalen = s->rx[l].buf_len;
@ -499,7 +499,7 @@ static int udptl_rx_packet(struct ast_udptl *s, uint8_t *buf, unsigned int len)
/* Decode the primary IFP packet */
s->f[ifp_no].frametype = AST_FRAME_MODEM;
s->f[ifp_no].subclass.integer = AST_MODEM_T38;
s->f[ifp_no].mallocd = 0;
s->f[ifp_no].seqno = seq_no;
s->f[ifp_no].datalen = ifp_len;
@ -541,7 +541,7 @@ static int udptl_build_packet(struct ast_udptl *s, uint8_t *buf, unsigned int bu
redundancy sets later on. */
s->tx[entry].buf_len = ifp_len;
memcpy(s->tx[entry].buf, ifp, ifp_len);
/* Build the UDPTLPacket */
len = 0;
@ -928,7 +928,7 @@ struct ast_udptl *ast_udptl_new_with_bindaddr(struct ast_sched_context *sched, s
udptl->error_correction_span = udptlfecspan;
udptl->error_correction_entries = udptlfecentries;
udptl->far_max_datagram = -1;
udptl->far_max_ifp = -1;
udptl->local_max_ifp = -1;
@ -1059,7 +1059,7 @@ int ast_udptl_write(struct ast_udptl *s, struct ast_frame *f)
/* If there is no data length, return immediately */
if (f->datalen == 0)
return 0;
if ((f->frametype != AST_FRAME_MODEM) ||
(f->subclass.integer != AST_MODEM_T38)) {
ast_log(LOG_WARNING, "UDPTL (%s): UDPTL can only send T.38 data.\n",
@ -1091,7 +1091,7 @@ int ast_udptl_write(struct ast_udptl *s, struct ast_frame *f)
LOG_TAG(s), ast_sockaddr_stringify(&s->them), seq, len);
}
}
return 0;
}
@ -1149,7 +1149,7 @@ int ast_udptl_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags,
void *pvt0;
void *pvt1;
int to;
ast_channel_lock(c0);
while (ast_channel_trylock(c1)) {
ast_channel_unlock(c0);
@ -1211,16 +1211,16 @@ int ast_udptl_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags,
ast_udptl_get_peer(p1, &t1);
ast_udptl_get_peer(p0, &t0);
if (ast_sockaddr_cmp(&t1, &ac1)) {
ast_debug(1, "Oooh, '%s' changed end address to %s\n",
ast_debug(1, "Oooh, '%s' changed end address to %s\n",
ast_channel_name(c1), ast_sockaddr_stringify(&t1));
ast_debug(1, "Oooh, '%s' was %s\n",
ast_debug(1, "Oooh, '%s' was %s\n",
ast_channel_name(c1), ast_sockaddr_stringify(&ac1));
ast_sockaddr_copy(&ac1, &t1);
}
if (ast_sockaddr_cmp(&t0, &ac0)) {
ast_debug(1, "Oooh, '%s' changed end address to %s\n",
ast_debug(1, "Oooh, '%s' changed end address to %s\n",
ast_channel_name(c0), ast_sockaddr_stringify(&t0));
ast_debug(1, "Oooh, '%s' was %s\n",
ast_debug(1, "Oooh, '%s' was %s\n",
ast_channel_name(c0), ast_sockaddr_stringify(&ac0));
ast_sockaddr_copy(&ac0, &t0);
}
@ -1263,7 +1263,7 @@ static char *handle_cli_udptl_set_debug(struct ast_cli_entry *e, int cmd, struct
switch (cmd) {
case CLI_INIT:
e->command = "udptl set debug {on|off|ip}";
e->usage =
e->usage =
"Usage: udptl set debug {on|off|ip host[:port]}\n"
" Enable or disable dumping of UDPTL packets.\n"
" If ip is specified, limit the dumped packets to those to and from\n"

View File

@ -20,7 +20,7 @@
*
* \brief u-Law to Signed linear conversion
*
* \author Mark Spencer <markster@digium.com>
* \author Mark Spencer <markster@digium.com>
*/
#include "asterisk.h"
@ -68,25 +68,25 @@ static unsigned char linear2ulaw(short sample)
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 };
int sign, exponent, mantissa;
unsigned char ulawbyte;
/* Get the sample into sign-magnitude. */
sign = (sample >> 8) & 0x80; /* set aside the sign */
if (sign != 0)
sample = -sample; /* get magnitude */
if (sample > CLIP)
sample = CLIP; /* clip the magnitude */
/* Convert from 16 bit linear to ulaw. */
sample = sample + BIAS;
exponent = exp_lut[(sample >> 7) & 0xFF];
mantissa = (sample >> (exponent + 3)) & 0x0F;
ulawbyte = ~(sign | (exponent << 4) | mantissa);
#ifdef ZEROTRAP
if (ulawbyte == 0)
ulawbyte = 0x02; /* optional CCITT trap */
#endif
return ulawbyte;
}
@ -116,23 +116,23 @@ static unsigned char linear2ulaw(short sample, int full_coding)
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 };
unsigned sign, exponent, mantissa, mag;
unsigned char ulawbyte;
/* Get the sample into sign-magnitude. */
ast_ulaw_get_sign_mag(sample, &sign, &mag);
if (mag > CLIP)
mag = CLIP; /* clip the magnitude */
sign = (sample >> 8) & 0x80; /* set aside the sign */
if (sign != 0)
if (sign != 0)
sample = -sample; /* get magnitude */
if (sample > CLIP)
sample = CLIP; /* clip the magnitude */
/* Convert from 16 bit linear to ulaw. */
mag += BIAS;
exponent = exp_lut[(mag >> 7) & 0xFF];
mantissa = (mag >> (exponent + 3)) & 0x0F;
if (full_coding) {
/* full encoding, with sign and xform */
ulawbyte = ~(sign | (exponent << 4) | mantissa);
@ -147,13 +147,13 @@ static unsigned char linear2ulaw(short sample, int full_coding)
return ulawbyte;
}
static inline short ulaw2linear(unsigned char ulawbyte)
{
unsigned exponent, mantissa;
short sample;
static const short etab[]={0,132,396,924,1980,4092,8316,16764};
ulawbyte = ~ulawbyte;
exponent = (ulawbyte & 0x70) >> 4;
mantissa = ulawbyte & 0x0f;
@ -171,7 +171,7 @@ static inline short ulaw2linear(unsigned char ulawbyte)
void ast_ulaw_init(void)
{
int i;
/*
* Set up mu-law conversion table
*/
@ -179,7 +179,7 @@ void ast_ulaw_init(void)
for (i = 0;i < 256;i++) {
short mu,e,f,y;
static const short etab[]={0,132,396,924,1980,4092,8316,16764};
mu = 255-i;
e = (mu & 0x70)/16;
f = mu & 0x0f;
@ -193,7 +193,7 @@ void ast_ulaw_init(void)
__ast_lin2mu[((unsigned short)i) >> 2] = linear2ulaw(i);
}
#else
for (i = 0; i < 256; i++) {
__ast_mulaw[i] = ulaw2linear(i);
}
@ -202,7 +202,7 @@ void ast_ulaw_init(void)
AST_LIN2MU_LOOKUP(i) = linear2ulaw(i, 0 /* half-cooked */);
}
#endif
#ifdef TEST_CODING_TABLES
for (i = -32768; i < 32768; ++i) {
#ifndef G711_NEW_ALGORITHM
@ -214,7 +214,7 @@ void ast_ulaw_init(void)
unsigned char e2 = AST_LIN2MU(i);
short d2 = ulaw2linear(e2);
short d3 = AST_MULAW(e1);
if (e1 != e2 || d1 != d3 || d2 != d3) {
ast_log(LOG_WARNING, "u-Law coding tables test failed on %d: e1=%u, e2=%u, d1=%d, d2=%d\n",
i, (unsigned)e1, (unsigned)e2, (int)d1, (int)d2);
@ -222,7 +222,7 @@ void ast_ulaw_init(void)
}
ast_log(LOG_NOTICE, "u-Law coding table test complete.\n");
#endif /* TEST_CODING_TABLES */
#ifdef TEST_TANDEM_TRANSCODING
/* tandem transcoding test */
for (i = -32768; i < 32768; ++i) {
@ -232,10 +232,10 @@ void ast_ulaw_init(void)
short d2 = AST_MULAW(e2);
unsigned char e3 = AST_LIN2MU(d2);
short d3 = AST_MULAW(e3);
if (i < 0 && e1 == 0x7f && e2 == 0xff && e3 == 0xff)
continue; /* known and normal negative 0 case */
if (e1 != e2 || e2 != e3 || d1 != d2 || d2 != d3) {
ast_log(LOG_WARNING, "u-Law tandem transcoding test failed on %d: e1=%u, e2=%u, d1=%d, d2=%d, d3=%d\n",
i, (unsigned)e1, (unsigned)e2, (int)d1, (int)d2, (int)d3);

View File

@ -84,12 +84,12 @@ AST_MUTEX_DEFINE_STATIC(__mutex);
/*! \brief Reentrant replacement for gethostbyname for BSD-based systems.
\note This
routine is derived from code originally written and placed in the public
routine is derived from code originally written and placed in the public
domain by Enzo Michelangeli <em@em.no-ip.com> */
static int gethostbyname_r (const char *name, struct hostent *ret, char *buf,
size_t buflen, struct hostent **result,
int *h_errnop)
size_t buflen, struct hostent **result,
int *h_errnop)
{
int hsave;
struct hostent *ph;
@ -184,7 +184,7 @@ static int gethostbyname_r (const char *name, struct hostent *ret, char *buf,
#endif
/*! \brief Re-entrant (thread safe) version of gethostbyname that replaces the
/*! \brief Re-entrant (thread safe) version of gethostbyname that replaces the
standard gethostbyname (which is not thread safe)
*/
struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp)
@ -220,7 +220,7 @@ struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp)
if (inet_pton(AF_INET, host, hp->hp.h_addr) > 0)
return &hp->hp;
return NULL;
}
#ifdef HAVE_GETHOSTBYNAME_R_5
result = gethostbyname_r(host, &hp->hp, hp->buf, sizeof(hp->buf), &herrno);
@ -261,7 +261,7 @@ void ast_sha1_hash(char *output, const char *input)
uint8_t Message_Digest[20];
SHA1Reset(&sha);
SHA1Input(&sha, (const unsigned char *) input, strlen(input));
SHA1Result(&sha, Message_Digest);
@ -284,7 +284,7 @@ int ast_base64decode(unsigned char *dst, const char *src, int max)
bits += 6;
src++;
incnt++;
/* If we have at least 8 bits left over, take that character
/* If we have at least 8 bits left over, take that character
off the top */
if (bits >= 8) {
bits -= 8;
@ -329,7 +329,7 @@ int ast_base64encode_full(char *dst, const unsigned char *src, int srclen, int m
}
}
if (bits && (cnt + 4 <= max)) {
/* Add one last character for the remaining bits,
/* Add one last character for the remaining bits,
padding the rest with 0 */
byte <<= 24 - bits;
*dst++ = base64[(byte >> 18) & 0x3f];
@ -502,8 +502,8 @@ static int dev_urandom_fd;
#undef pthread_mutex_init
#undef pthread_mutex_destroy
/*!
* \brief Keep track of which locks a thread holds
/*!
* \brief Keep track of which locks a thread holds
*
* There is an instance of this struct for every active thread
*/
@ -531,18 +531,18 @@ struct thr_lock_info {
* The index (num_locks - 1) has the info on the last one in the
* locks member */
unsigned int num_locks;
/*! Protects the contents of the locks member
/*! Protects the contents of the locks member
* Intentionally not ast_mutex_t */
pthread_mutex_t lock;
AST_LIST_ENTRY(thr_lock_info) entry;
};
/*!
* \brief Locked when accessing the lock_infos list
/*!
* \brief Locked when accessing the lock_infos list
*/
AST_MUTEX_DEFINE_STATIC(lock_infos_lock);
/*!
* \brief A list of each thread's lock info
* \brief A list of each thread's lock info
*/
static AST_LIST_HEAD_NOLOCK_STATIC(lock_infos, thr_lock_info);
@ -568,8 +568,8 @@ static void lock_info_destroy(void *data)
break;
}
ast_log(LOG_ERROR,
"Thread '%s' still has a lock! - '%s' (%p) from '%s' in %s:%d!\n",
ast_log(LOG_ERROR,
"Thread '%s' still has a lock! - '%s' (%p) from '%s' in %s:%d!\n",
lock_info->thread_name,
lock_info->locks[i].lock_name,
lock_info->locks[i].lock_addr,
@ -745,7 +745,7 @@ void ast_remove_lock_info(void *lock_addr)
if (i < lock_info->num_locks - 1) {
/* Not the last one ... *should* be rare! */
memmove(&lock_info->locks[i], &lock_info->locks[i + 1],
memmove(&lock_info->locks[i], &lock_info->locks[i + 1],
(lock_info->num_locks - (i + 1)) * sizeof(lock_info->locks[0]));
}
@ -780,7 +780,7 @@ static void append_backtrace_information(struct ast_str **str, struct ast_bt *bt
if ((symbols = ast_bt_get_symbols(bt->addresses, bt->num_frames))) {
int frame_iterator;
for (frame_iterator = 0; frame_iterator < bt->num_frames; ++frame_iterator) {
ast_str_append(str, 0, "\t%s\n", symbols[frame_iterator]);
}
@ -797,27 +797,27 @@ static void append_lock_information(struct ast_str **str, struct thr_lock_info *
int j;
ast_mutex_t *lock;
struct ast_lock_track *lt;
ast_str_append(str, 0, "=== ---> %sLock #%d (%s): %s %d %s %s %p (%d)\n",
lock_info->locks[i].pending > 0 ? "Waiting for " :
ast_str_append(str, 0, "=== ---> %sLock #%d (%s): %s %d %s %s %p (%d)\n",
lock_info->locks[i].pending > 0 ? "Waiting for " :
lock_info->locks[i].pending < 0 ? "Tried and failed to get " : "", i,
lock_info->locks[i].file,
lock_info->locks[i].file,
locktype2str(lock_info->locks[i].type),
lock_info->locks[i].line_num,
lock_info->locks[i].func, lock_info->locks[i].lock_name,
lock_info->locks[i].lock_addr,
lock_info->locks[i].lock_addr,
lock_info->locks[i].times_locked);
#ifdef HAVE_BKTR
append_backtrace_information(str, lock_info->locks[i].backtrace);
#endif
if (!lock_info->locks[i].pending || lock_info->locks[i].pending == -1)
return;
/* We only have further details for mutexes right now */
if (lock_info->locks[i].type != AST_MUTEX)
return;
lock = lock_info->locks[i].lock_addr;
lt = lock->track;
ast_reentrancy_lock(lt);
@ -825,14 +825,14 @@ static void append_lock_information(struct ast_str **str, struct thr_lock_info *
ast_str_append(str, 0, "=== --- ---> Locked Here: %s line %d (%s)\n",
lt->file[j], lt->lineno[j], lt->func[j]);
}
ast_reentrancy_unlock(lt);
ast_reentrancy_unlock(lt);
}
/*! This function can help you find highly temporal locks; locks that happen for a
/*! This function can help you find highly temporal locks; locks that happen for a
short time, but at unexpected times, usually at times that create a deadlock,
Why is this thing locked right then? Who is locking it? Who am I fighting
with for this lock?
with for this lock?
To answer such questions, just call this routine before you would normally try
to aquire a lock. It doesn't do anything if the lock is not acquired. If the
@ -857,7 +857,7 @@ void log_show_lock(void *this_lock_addr)
ast_log(LOG_NOTICE,"Could not create str\n");
return;
}
pthread_mutex_lock(&lock_infos_lock.mutex);
AST_LIST_TRAVERSE(&lock_infos, lock_info, entry) {
@ -900,7 +900,7 @@ static char *handle_show_locks(struct ast_cli_entry *e, int cmd, struct ast_cli_
return NULL;
}
ast_str_append(&str, 0, "\n"
ast_str_append(&str, 0, "\n"
"=======================================================================\n"
"=== Currently Held Locks ==============================================\n"
"=======================================================================\n"
@ -1081,7 +1081,7 @@ int ast_pthread_create_detached_stack(pthread_t *thread, pthread_attr_t *attr, v
if ((errno = pthread_attr_setdetachstate(attr, PTHREAD_CREATE_DETACHED)))
ast_log(LOG_WARNING, "pthread_attr_setdetachstate: %s\n", strerror(errno));
res = ast_pthread_create_stack(thread, attr, start_routine, data,
res = ast_pthread_create_stack(thread, attr, start_routine, data,
stacksize, file, caller, line, start_fn);
if (attr_destroy)
@ -1152,7 +1152,7 @@ static int ast_wait_for_output(int fd, int timeoutms)
* If the descriptor is blocking, all assumptions on the guaranteed
* detail do not apply anymore.
*/
int ast_carefulwrite(int fd, char *s, int len, int timeoutms)
int ast_carefulwrite(int fd, char *s, int len, int timeoutms)
{
struct timeval start = ast_tvnow();
int res = 0;
@ -1183,7 +1183,7 @@ int ast_carefulwrite(int fd, char *s, int len, int timeoutms)
elapsed = ast_tvdiff_ms(ast_tvnow(), start);
if (elapsed >= timeoutms) {
/* We've taken too long to write
/* We've taken too long to write
* This is only an error condition if we haven't finished writing. */
res = len ? -1 : 0;
break;
@ -1226,7 +1226,7 @@ int ast_careful_fwrite(FILE *f, int fd, const char *src, size_t len, int timeout
elapsed = ast_tvdiff_ms(ast_tvnow(), start);
if (elapsed >= timeoutms) {
/* We've taken too long to write
/* We've taken too long to write
* This is only an error condition if we haven't finished writing. */
n = len ? -1 : 0;
break;
@ -1466,7 +1466,7 @@ long int ast_random(void)
char *ast_process_quotes_and_slashes(char *start, char find, char replace_with)
{
char *dataPut = start;
char *dataPut = start;
int inEscape = 0;
int inQuotes = 0;
@ -1818,7 +1818,7 @@ void *__ast_calloc_with_stringfields(unsigned int num_structs, size_t struct_siz
void *allocation;
unsigned int x;
#if defined(__AST_DEBUG_MALLOC)
#if defined(__AST_DEBUG_MALLOC)
if (!(allocation = __ast_calloc(num_structs, size_to_alloc, file, lineno, func))) {
return NULL;
}
@ -1925,7 +1925,7 @@ void ast_enable_packet_fragmentation(int sock)
{
#if defined(HAVE_IP_MTU_DISCOVER)
int val = IP_PMTUDISC_DONT;
if (setsockopt(sock, IPPROTO_IP, IP_MTU_DISCOVER, &val, sizeof(val)))
ast_log(LOG_WARNING, "Unable to disable PMTU discovery. Large UDP packets may fail to be delivered when sent from this socket.\n");
#endif /* HAVE_IP_MTU_DISCOVER */

View File

@ -1996,7 +1996,7 @@ int ast_xmldoc_load_documentation(void)
}
}
if (duplicate || strchr(globbuf.gl_pathv[i], '*')) {
/* skip duplicates as well as pathnames not found
/* skip duplicates as well as pathnames not found
* (due to use of GLOB_NOCHECK in xml_pathmatch) */
continue;
}