[asterisk-commits] oej: branch oej/adb-appleraision-1.8-mark-2 r415054 - in /team/oej/adb-appler...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jun 3 08:37:09 CDT 2014
Author: oej
Date: Tue Jun 3 08:37:01 2014
New Revision: 415054
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=415054
Log:
I wonder why svnmerge removes the svnmerge-integrated property
Modified:
team/oej/adb-appleraision-1.8-mark-2/ (props changed)
team/oej/adb-appleraision-1.8-mark-2/main/abstract_jb.c
team/oej/adb-appleraision-1.8-mark-2/main/app.c
team/oej/adb-appleraision-1.8-mark-2/main/asterisk.c
team/oej/adb-appleraision-1.8-mark-2/main/astmm.c
team/oej/adb-appleraision-1.8-mark-2/main/bridging.c
team/oej/adb-appleraision-1.8-mark-2/main/channel.c
team/oej/adb-appleraision-1.8-mark-2/main/config.c
team/oej/adb-appleraision-1.8-mark-2/main/data.c
team/oej/adb-appleraision-1.8-mark-2/main/db.c
team/oej/adb-appleraision-1.8-mark-2/main/dsp.c
team/oej/adb-appleraision-1.8-mark-2/main/event.c
team/oej/adb-appleraision-1.8-mark-2/main/features.c
team/oej/adb-appleraision-1.8-mark-2/main/http.c
team/oej/adb-appleraision-1.8-mark-2/main/jitterbuf.c
team/oej/adb-appleraision-1.8-mark-2/main/loader.c
team/oej/adb-appleraision-1.8-mark-2/main/manager.c
team/oej/adb-appleraision-1.8-mark-2/main/slinfactory.c
team/oej/adb-appleraision-1.8-mark-2/main/stdtime/localtime.c
team/oej/adb-appleraision-1.8-mark-2/main/test.c
team/oej/adb-appleraision-1.8-mark-2/main/translate.c
team/oej/adb-appleraision-1.8-mark-2/main/utils.c
Propchange: team/oej/adb-appleraision-1.8-mark-2/
------------------------------------------------------------------------------
automerge = Is-there-life-off-net?
Propchange: team/oej/adb-appleraision-1.8-mark-2/
('svnmerge-integrated' removed)
Modified: team/oej/adb-appleraision-1.8-mark-2/main/abstract_jb.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/adb-appleraision-1.8-mark-2/main/abstract_jb.c?view=diff&rev=415054&r1=415053&r2=415054
==============================================================================
--- team/oej/adb-appleraision-1.8-mark-2/main/abstract_jb.c (original)
+++ team/oej/adb-appleraision-1.8-mark-2/main/abstract_jb.c Tue Jun 3 08:37:01 2014
@@ -326,7 +326,7 @@
/* We consider an enabled jitterbuffer should receive frames with valid timing info. */
if (!ast_test_flag(f, AST_FRFLAG_HAS_TIMING_INFO) || f->len < 2 || f->ts < 0) {
ast_log(LOG_WARNING, "%s received frame with invalid timing info: "
- "has_timing_info=%d, len=%ld, ts=%ld, src=%s\n",
+ "has_timing_info=%u, len=%ld, ts=%ld, src=%s\n",
chan->name, ast_test_flag(f, AST_FRFLAG_HAS_TIMING_INFO), f->len, f->ts, f->src);
return -1;
}
@@ -488,7 +488,7 @@
char safe_logfile[30] = "/tmp/logfile-XXXXXX";
int safe_fd;
snprintf(name2, sizeof(name2), "%s", chan->name);
- if ((tmp = strchr(name2, '/'))) {
+ while ((tmp = strchr(name2, '/'))) {
*tmp = '#';
}
@@ -497,7 +497,7 @@
ast_assert(bridged != NULL);
snprintf(name1, sizeof(name1), "%s", bridged->name);
- if ((tmp = strchr(name1, '/'))) {
+ while ((tmp = strchr(name1, '/'))) {
*tmp = '#';
}
Modified: team/oej/adb-appleraision-1.8-mark-2/main/app.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/adb-appleraision-1.8-mark-2/main/app.c?view=diff&rev=415054&r1=415053&r2=415054
==============================================================================
--- team/oej/adb-appleraision-1.8-mark-2/main/app.c (original)
+++ team/oej/adb-appleraision-1.8-mark-2/main/app.c Tue Jun 3 08:37:01 2014
@@ -1340,7 +1340,7 @@
s = ast_alloca(lp + 10);
fs = ast_alloca(lp + 20);
- snprintf(fs, strlen(path) + 19, "%s/.lock-%08lx", path, ast_random());
+ snprintf(fs, strlen(path) + 19, "%s/.lock-%08lx", path, (unsigned long)ast_random());
fd = open(fs, O_WRONLY | O_CREAT | O_EXCL, AST_FILE_MODE);
if (fd < 0) {
ast_log(LOG_ERROR, "Unable to create lock file '%s': %s\n", path, strerror(errno));
@@ -1718,7 +1718,7 @@
ast_stopstream(chan);
return res;
default:
- ast_log(LOG_NOTICE, "Unknown dispatch function %d, ignoring!\n", option->action);
+ ast_log(LOG_NOTICE, "Unknown dispatch function %u, ignoring!\n", option->action);
return 0;
}
return -1;
@@ -2196,7 +2196,9 @@
return -1;
}
- if ((res = sscanf(timestr, FMT, &amount, u)) == 0) {
+ res = sscanf(timestr, FMT, &amount, u);
+
+ if (res == 0 || res == EOF) {
#undef FMT
return -1;
} else if (res == 2) {
Modified: team/oej/adb-appleraision-1.8-mark-2/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/adb-appleraision-1.8-mark-2/main/asterisk.c?view=diff&rev=415054&r1=415053&r2=415054
==============================================================================
--- team/oej/adb-appleraision-1.8-mark-2/main/asterisk.c (original)
+++ team/oej/adb-appleraision-1.8-mark-2/main/asterisk.c Tue Jun 3 08:37:01 2014
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2012, Digium, Inc.
+ * Copyright (C) 1999 - 2013, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
*
@@ -23,25 +23,25 @@
*
* \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
*
- * Copyright (C) 1999 - 2012, Digium, Inc.
+ * Copyright (C) 1999 - 2013, Digium, Inc.
* Asterisk is a <a href="http://www.digium.com/en/company/view-policy.php?id=Trademark-Policy">registered trademark</a>
- * of <a href="http://www.digium.com">Digium, Inc</a>.
+ * of <a rel="nofollow" href="http://www.digium.com">Digium, Inc</a>.
*
* \author Mark Spencer <markster at digium.com>
* Also see \ref AstCREDITS
@@ -56,7 +56,7 @@
/*! \file
\brief Top level source file for Asterisk - the Open Source PBX. Implementation
of PBX core functions and CLI interface.
-
+
*/
/*** MODULEINFO
@@ -160,7 +160,7 @@
/*! \brief Welcome message when starting a CLI interface */
#define WELCOME_MESSAGE \
- ast_verbose("Asterisk %s, Copyright (C) 1999 - 2012 Digium, Inc. and others.\n" \
+ ast_verbose("Asterisk %s, Copyright (C) 1999 - 2013 Digium, Inc. and others.\n" \
"Created by Mark Spencer <markster at digium.com>\n" \
"Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.\n" \
"This is free software, with components licensed under the GNU General Public\n" \
@@ -171,7 +171,7 @@
/*! \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 @@
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 @@
if (iterator)
return iterator->version;
return NULL;
-}
-
+}
+
struct thread_list_t {
@@ -398,7 +398,7 @@
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 @@
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);
@@ -484,7 +484,6 @@
ast_cli(a->fd, " User name and group: %s/%s\n", ast_config_AST_RUN_USER, ast_config_AST_RUN_GROUP);
ast_cli(a->fd, " Executable includes: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_EXEC_INCLUDES) ? "Enabled" : "Disabled");
ast_cli(a->fd, " Transcode via SLIN: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSCODE_VIA_SLIN) ? "Enabled" : "Disabled");
- ast_cli(a->fd, " Internal timing: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_INTERNAL_TIMING) ? "Enabled" : "Disabled");
ast_cli(a->fd, " Transmit silence during rec: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSMIT_SILENCE) ? "Enabled" : "Disabled");
ast_cli(a->fd, " Generic PLC: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC) ? "Enabled" : "Disabled");
@@ -522,7 +521,7 @@
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;
@@ -670,14 +669,14 @@
ast_cli(a->fd, "\nSystem Statistics\n");
ast_cli(a->fd, "-----------------\n");
- ast_cli(a->fd, " System Uptime: %lu hours\n", uptime);
+ ast_cli(a->fd, " System Uptime: %ld hours\n", uptime);
ast_cli(a->fd, " Total RAM: %" PRIu64 " KiB\n", physmem / 1024);
ast_cli(a->fd, " Free RAM: %" PRIu64 " KiB\n", freeram);
#if defined(HAVE_SYSINFO)
ast_cli(a->fd, " Buffer RAM: %" PRIu64 " KiB\n", ((uint64_t) sys_info.bufferram * sys_info.mem_unit) / 1024);
#endif
#if defined (HAVE_SYSCTL) || defined(HAVE_SWAPCTL)
- ast_cli(a->fd, " Total Swap Space: %u KiB\n", totalswap);
+ ast_cli(a->fd, " Total Swap Space: %d KiB\n", totalswap);
ast_cli(a->fd, " Free Swap Space: %" PRIu64 " KiB\n\n", freeswap);
#endif
ast_cli(a->fd, " Number of Processes: %d \n\n", nprocs);
@@ -754,7 +753,7 @@
#elif defined(linux)
static __inline uint64_t
rdtsc(void)
-{
+{
uint64_t rv;
__asm __volatile(".byte 0x0f, 0x31" : "=A" (rv));
@@ -877,7 +876,7 @@
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";
@@ -1074,7 +1073,7 @@
pid = fork();
#else
pid = vfork();
-#endif
+#endif
if (pid == 0) {
#ifdef HAVE_CAP
@@ -1100,7 +1099,7 @@
if (res > -1) {
res = WIFEXITED(status) ? WEXITSTATUS(status) : -1;
break;
- } else if (errno != EINTR)
+ } else if (errno != EINTR)
break;
}
} else {
@@ -1172,7 +1171,7 @@
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);
}
}
@@ -1196,7 +1195,7 @@
{
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);
}
}
@@ -1362,7 +1361,7 @@
close(con->p[0]);
close(con->p[1]);
con->fd = -1;
-
+
return NULL;
}
@@ -1451,14 +1450,14 @@
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));
@@ -1493,7 +1492,7 @@
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)
@@ -1506,7 +1505,7 @@
ast_log(LOG_WARNING, "Unable to change ownership of %s: %s\n", ast_config_AST_SOCKET, strerror(errno));
if (!ast_strlen_zero(ast_config_AST_CTL_PERMISSIONS)) {
- int p1;
+ unsigned int p1;
mode_t p;
sscanf(ast_config_AST_CTL_PERMISSIONS, "%30o", &p1);
p = p1;
@@ -1541,8 +1540,8 @@
/*! \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)
{
@@ -1557,7 +1556,7 @@
static void _hup_handler(int num)
{
int a = 0, save_errno = errno;
- if (option_verbose > 1)
+ if (option_verbose > 1)
printf("Received HUP signal -- Reloading configs\n");
if (restartnow)
execvp(_argv[0], _argv);
@@ -1585,7 +1584,7 @@
*/
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;
}
@@ -1599,22 +1598,22 @@
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;
}
@@ -1638,7 +1637,7 @@
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");
@@ -1800,11 +1799,17 @@
close(ast_socket);
ast_socket = -1;
unlink(ast_config_AST_SOCKET);
+ pthread_kill(lthread, SIGURG);
+ pthread_join(lthread, NULL);
}
if (ast_consock > -1)
close(ast_consock);
if (!ast_opt_remote)
unlink(ast_config_AST_PID);
+ if (sig_alert_pipe[0])
+ close(sig_alert_pipe[0]);
+ if (sig_alert_pipe[1])
+ close(sig_alert_pipe[1]);
printf("%s", term_quit());
if (restart) {
int i;
@@ -1822,7 +1827,7 @@
close_logger();
clean_time_zones();
- /* 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);
@@ -1830,7 +1835,7 @@
sleep(2);
} else
execvp(_argv[0], _argv);
-
+
} else {
/* close logger */
close_logger();
@@ -1894,7 +1899,7 @@
}
fflush(stdout);
-
+
/* Wake up a poll()ing console */
if (ast_opt_console && consolethread != AST_PTHREADT_NULL)
pthread_kill(consolethread, SIGURG);
@@ -1905,7 +1910,7 @@
while (*s) {
if (*s > 32)
return 0;
- s++;
+ s++;
}
return 1;
}
@@ -1924,7 +1929,7 @@
ast_safe_system(s+1);
else
ast_safe_system(getenv("SHELL") ? getenv("SHELL") : "/bin/sh");
- } else
+ } else
ast_cli_command(STDOUT_FILENO, s);
}
@@ -1943,6 +1948,10 @@
ast_safe_system(getenv("SHELL") ? getenv("SHELL") : "/bin/sh");
ret = 1;
}
+ while (isspace(*s)) {
+ s++;
+ }
+
if ((strncasecmp(s, "quit", 4) == 0 || strncasecmp(s, "exit", 4) == 0) &&
(s[4] == '\0' || isspace(s[4]))) {
quit_handler(0, SHUTDOWN_FAST, 0);
@@ -1957,7 +1966,7 @@
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;
@@ -1988,7 +1997,7 @@
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;
@@ -2007,7 +2016,7 @@
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";
@@ -2027,7 +2036,7 @@
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;
@@ -2047,7 +2056,7 @@
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";
@@ -2067,7 +2076,7 @@
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";
@@ -2087,7 +2096,7 @@
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;
@@ -2109,7 +2118,7 @@
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";
@@ -2139,7 +2148,7 @@
switch (cmd) {
case CLI_INIT:
e->command = "!";
- e->usage =
+ e->usage =
"Usage: !<command>\n"
" Executes a given shell command\n";
return NULL;
@@ -2179,7 +2188,7 @@
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;
@@ -2216,7 +2225,7 @@
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;
@@ -2245,7 +2254,7 @@
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"),
};
@@ -2301,7 +2310,7 @@
num_read = read(STDIN_FILENO, cp, 1);
if (num_read < 1) {
break;
- } else
+ } else
return (num_read);
}
if (fds[0].revents) {
@@ -2323,7 +2332,7 @@
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
@@ -2493,48 +2502,65 @@
ast_str_set(&prompt, 0, "%s", ASTERISK_PROMPT);
}
- return ast_str_buffer(prompt);
+ return ast_str_buffer(prompt);
+}
+
+static void destroy_match_list(char **match_list, int matches)
+{
+ if (match_list) {
+ int idx;
+
+ for (idx = 0; idx < matches; ++idx) {
+ ast_free(match_list[idx]);
+ }
+ ast_free(match_list);
+ }
}
static char **ast_el_strtoarr(char *buf)
{
- char **match_list = NULL, **match_list_tmp, *retstr;
- size_t match_list_len;
+ char *retstr;
+ char **match_list = NULL;
+ char **new_list;
+ size_t match_list_len = 1;
int matches = 0;
- match_list_len = 1;
- while ( (retstr = strsep(&buf, " ")) != NULL) {
-
- if (!strcmp(retstr, AST_CLI_COMPLETE_EOF))
+ while ((retstr = strsep(&buf, " "))) {
+ if (!strcmp(retstr, AST_CLI_COMPLETE_EOF)) {
break;
+ }
if (matches + 1 >= match_list_len) {
match_list_len <<= 1;
- if ((match_list_tmp = ast_realloc(match_list, match_list_len * sizeof(char *)))) {
- match_list = match_list_tmp;
- } else {
- if (match_list)
- ast_free(match_list);
- return (char **) NULL;
- }
- }
-
- match_list[matches++] = ast_strdup(retstr);
- }
-
- if (!match_list)
- return (char **) NULL;
+ new_list = ast_realloc(match_list, match_list_len * sizeof(char *));
+ if (!new_list) {
+ destroy_match_list(match_list, matches);
+ return NULL;
+ }
+ match_list = new_list;
+ }
+
+ retstr = ast_strdup(retstr);
+ if (!retstr) {
+ destroy_match_list(match_list, matches);
+ return NULL;
+ }
+ match_list[matches++] = retstr;
+ }
+
+ if (!match_list) {
+ return NULL;
+ }
if (matches >= match_list_len) {
- if ((match_list_tmp = ast_realloc(match_list, (match_list_len + 1) * sizeof(char *)))) {
- match_list = match_list_tmp;
- } else {
- if (match_list)
- ast_free(match_list);
- return (char **) NULL;
- }
- }
-
- match_list[matches] = (char *) NULL;
+ new_list = ast_realloc(match_list, (match_list_len + 1) * sizeof(char *));
+ if (!new_list) {
+ destroy_match_list(match_list, matches);
+ return NULL;
+ }
+ match_list = new_list;
+ }
+
+ match_list[matches] = NULL;
return match_list;
}
@@ -2625,7 +2651,7 @@
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);
if ((res = read(ast_consock, buf, sizeof(buf) - 1)) < 0) {
return (char*)(CC_ERROR);
@@ -2635,24 +2661,29 @@
if (nummatches > 0) {
char *mbuf;
+ char *new_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;
- if (!(mbuf = ast_realloc(mbuf, maxmbuf))) {
+ maxmbuf += 1024;
+ new_mbuf = ast_realloc(mbuf, maxmbuf);
+ if (!new_mbuf) {
+ ast_free(mbuf);
lf->cursor[0] = savechr;
return (char *)(CC_ERROR);
}
+ mbuf = new_mbuf;
}
/* Only read 1024 bytes at a time */
res = read(ast_consock, mbuf + mlen, 1024);
@@ -2702,7 +2733,7 @@
fprintf(stdout, "\n");
ast_cli_display_match_list(matches, nummatches, maxlen);
retval = CC_REDISPLAY;
- } else {
+ } else {
el_insertstr(editline," ");
retval = CC_REFRESH;
}
@@ -2730,8 +2761,8 @@
el = el_init("asterisk", stdin, stdout, stderr);
el_set(el, EL_PROMPT, cli_prompt);
- el_set(el, EL_EDITMODE, 1);
- el_set(el, EL_EDITOR, editor ? editor : "emacs");
+ el_set(el, EL_EDITMODE, 1);
+ el_set(el, EL_EDITOR, editor ? editor : "emacs");
el_hist = history_init();
if (!el || !el_hist)
return -1;
@@ -2856,7 +2887,7 @@
fdsend(ast_consock, tmp);
if (!ast_opt_mute)
fdsend(ast_consock, "logger mute silent");
- else
+ else
printf("log and verbose output currently muted ('logger mute' to unmute)\n");
}
@@ -2904,7 +2935,7 @@
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();
@@ -2955,7 +2986,7 @@
static int show_cli_help(void)
{
- printf("Asterisk %s, Copyright (C) 1999 - 2012, Digium, Inc. and others.\n", ast_get_version());
+ printf("Asterisk %s, Copyright (C) 1999 - 2013, Digium, Inc. and others.\n", ast_get_version());
printf("Usage: asterisk [OPTIONS]\n");
printf("Valid Options:\n");
printf(" -V Display version number and exit\n");
@@ -2971,7 +3002,6 @@
printf(" -g Dump core in case of a crash\n");
printf(" -h This help screen\n");
printf(" -i Initialize crypto keys at startup\n");
- printf(" -I Enable internal timing if DAHDI timer is available\n");
printf(" -L <load> Limit the maximum load average before rejecting new calls\n");
printf(" -M <value> Limit the maximum number of calls to the specified value\n");
printf(" -m Mute debugging and console output on the console\n");
@@ -2993,7 +3023,7 @@
return 0;
}
-static void ast_readconfig(void)
+static void ast_readconfig(void)
{
struct ast_config *cfg;
struct ast_variable *v;
@@ -3004,6 +3034,8 @@
unsigned int dbdir:1;
unsigned int keydir:1;
} found = { 0, 0 };
+ /* Default to true for backward compatibility */
+ int live_dangerously = 1;
if (ast_opt_override_config) {
cfg = ast_config_load2(ast_config_AST_CONFIG_FILE, "" /* core, can't reload */, config_flags);
@@ -3139,7 +3171,11 @@
ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_TRANSMIT_SILENCE);
/* Enable internal timing */
} else if (!strcasecmp(v->name, "internal_timing")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_INTERNAL_TIMING);
+ if (!ast_opt_remote) {
+ fprintf(stderr,
+ "NOTICE: The internal_timing option is no longer needed.\n"
+ " It will always be enabled if you have a timing module loaded.\n");
+ }
} else if (!strcasecmp(v->name, "maxcalls")) {
if ((sscanf(v->value, "%30d", &option_maxcalls) != 1) || (option_maxcalls < 0)) {
option_maxcalls = 0;
@@ -3213,7 +3249,12 @@
ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_HIDE_CONSOLE_CONNECT);
} else if (!strcasecmp(v->name, "lockconfdir")) {
ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_LOCK_CONFIG_DIR);
- }
+ } else if (!strcasecmp(v->name, "live_dangerously")) {
+ live_dangerously = ast_true(v->value);
+ }
+ }
+ if (!ast_opt_remote) {
+ pbx_live_dangerously(live_dangerously);
}
for (v = ast_variable_browse(cfg, "compat"); v; v = v->next) {
float version;
@@ -3393,7 +3434,7 @@
ast_copy_string(hostname, "<Unknown>", sizeof(hostname));
ast_mainpid = getpid();
- 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) {
@@ -3444,7 +3485,9 @@
show_cli_help();
exit(0);
case 'I':
- ast_set_flag(&ast_options, AST_OPT_FLAG_INTERNAL_TIMING);
+ fprintf(stderr,
+ "NOTICE: The -I option is no longer needed.\n"
+ " It will always be enabled if you have a timing module loaded.\n");
break;
case 'i':
ast_set_flag(&ast_options, AST_OPT_FLAG_INIT_KEYS);
@@ -3839,6 +3882,8 @@
register_config_cli();
read_config_maps();
+ astobj2_init();
+
if (ast_opt_console) {
if (el_hist == NULL || el == NULL)
ast_el_initialize();
@@ -3914,8 +3959,6 @@
threadstorage_init();
- astobj2_init();
-
ast_autoservice_init();
if (ast_timing_init()) {
Modified: team/oej/adb-appleraision-1.8-mark-2/main/astmm.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/adb-appleraision-1.8-mark-2/main/astmm.c?view=diff&rev=415054&r1=415053&r2=415054
==============================================================================
--- team/oej/adb-appleraision-1.8-mark-2/main/astmm.c (original)
+++ team/oej/adb-appleraision-1.8-mark-2/main/astmm.c Tue Jun 3 08:37:01 2014
@@ -70,7 +70,7 @@
#undef vasprintf
#undef asprintf
-#define FENCE_MAGIC 0xdeadbeef /*!< Allocated memory high/low fence overwrite check. */
+#define FENCE_MAGIC 0xfeedbabe /*!< Allocated memory high/low fence overwrite check. */
#define FREED_MAGIC 0xdeaddead /*!< Freed memory wipe filler. */
#define MALLOC_FILLER 0x55 /*!< Malloced memory filler. Must not be zero. */
@@ -156,6 +156,31 @@
fflush(mmlog); \
} \
} while (0)
+
+void *ast_std_malloc(size_t size)
+{
+ return malloc(size);
+}
+
+void *ast_std_calloc(size_t nmemb, size_t size)
+{
+ return calloc(nmemb, size);
+}
+
+void *ast_std_realloc(void *ptr, size_t size)
+{
+ return realloc(ptr, size);
+}
+
+void ast_std_free(void *ptr)
+{
+ free(ptr);
+}
+
+void ast_free_ptr(void *ptr)
+{
+ ast_free(ptr);
+}
/*!
* \internal
Modified: team/oej/adb-appleraision-1.8-mark-2/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/adb-appleraision-1.8-mark-2/main/bridging.c?view=diff&rev=415054&r1=415053&r2=415054
==============================================================================
--- team/oej/adb-appleraision-1.8-mark-2/main/bridging.c (original)
+++ team/oej/adb-appleraision-1.8-mark-2/main/bridging.c Tue Jun 3 08:37:01 2014
@@ -389,7 +389,7 @@
AST_RWLIST_RDLOCK(&bridge_technologies);
AST_RWLIST_TRAVERSE(&bridge_technologies, current, entry) {
- ast_debug(1, "Bridge technology %s has capabilities %d and we want %d\n", current->name, current->capabilities, capabilities);
+ ast_debug(1, "Bridge technology %s has capabilities %d and we want %u\n", current->name, current->capabilities, capabilities);
if (current->suspended) {
ast_debug(1, "Bridge technology %s is suspended. Skipping.\n", current->name);
continue;
@@ -399,7 +399,7 @@
continue;
}
if (best && best->preference < current->preference) {
- ast_debug(1, "Bridge technology %s has preference %d while %s has preference %d. Skipping.\n", current->name, current->preference, best->name, best->preference);
+ ast_debug(1, "Bridge technology %s has preference %u while %s has preference %u. Skipping.\n", current->name, current->preference, best->name, best->preference);
continue;
}
best = current;
@@ -468,7 +468,7 @@
/* If no bridge technology was found we can't possibly do bridging so fail creation of the bridge */
if (!bridge_technology) {
- ast_debug(1, "Failed to find a bridge technology to satisfy capabilities %d\n", capabilities);
+ ast_debug(1, "Failed to find a bridge technology to satisfy capabilities %u\n", capabilities);
return NULL;
}
@@ -622,7 +622,7 @@
/* Attempt to find a new bridge technology to satisfy the capabilities */
if (!(new_technology = find_best_technology(new_capabilities))) {
- ast_debug(1, "Smart bridge operation was unable to find new bridge technology with capabilities %d to satisfy bridge %p\n", new_capabilities, bridge);
+ ast_debug(1, "Smart bridge operation was unable to find new bridge technology with capabilities %u to satisfy bridge %p\n", new_capabilities, bridge);
return -1;
}
@@ -1299,7 +1299,7 @@
dtmf = builtin_features_dtmf[feature];
/* If no DTMF is still available (ie: it has been disabled) then error out now */
if (ast_strlen_zero(dtmf)) {
- ast_debug(1, "Failed to enable built in feature %d on %p, no DTMF string is available for it.\n", feature, features);
+ ast_debug(1, "Failed to enable built in feature %u on %p, no DTMF string is available for it.\n", feature, features);
return -1;
}
}
Modified: team/oej/adb-appleraision-1.8-mark-2/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/adb-appleraision-1.8-mark-2/main/channel.c?view=diff&rev=415054&r1=415053&r2=415054
==============================================================================
--- team/oej/adb-appleraision-1.8-mark-2/main/channel.c (original)
+++ team/oej/adb-appleraision-1.8-mark-2/main/channel.c Tue Jun 3 08:37:01 2014
@@ -1032,7 +1032,7 @@
default:
if (!(buf = ast_threadstorage_get(&state2str_threadbuf, STATE2STR_BUFSIZE)))
return "Unknown";
- snprintf(buf, STATE2STR_BUFSIZE, "Unknown (%d)", state);
+ snprintf(buf, STATE2STR_BUFSIZE, "Unknown (%u)", state);
return buf;
}
}
@@ -1541,7 +1541,7 @@
memset(blah, 1, sizeof(blah));
if (write(chan->alertpipe[1], &blah, sizeof(blah)) != (sizeof(blah))) {
- ast_log(LOG_WARNING, "Unable to write to alert pipe on %s (qlen = %d): %s!\n",
+ ast_log(LOG_WARNING, "Unable to write to alert pipe on %s (qlen = %u): %s!\n",
chan->name, queued_frames, strerror(errno));
}
} else if (chan->timingfd > -1) {
@@ -3014,7 +3014,7 @@
break;
}
if (ms == 0) {
- ast_debug(2, "Didn't receive a media frame from %s within %d ms of answering. Continuing anyway\n", chan->name, MAX(delay, 500));
+ ast_debug(2, "Didn't receive a media frame from %s within %u ms of answering. Continuing anyway\n", chan->name, MAX(delay, 500));
break;
}
cur = ast_read(chan);
@@ -3088,18 +3088,26 @@
return __ast_answer(chan, 0, 1);
}
-void ast_deactivate_generator(struct ast_channel *chan)
-{
- ast_channel_lock(chan);
+static void deactivate_generator_nolock(struct ast_channel *chan)
+{
if (chan->generatordata) {
- if (chan->generator && chan->generator->release)
- chan->generator->release(chan, chan->generatordata);
+ struct ast_generator *generator = chan->generator;
+
+ if (generator && generator->release) {
+ generator->release(chan, chan->generatordata);
+ }
chan->generatordata = NULL;
chan->generator = NULL;
ast_channel_set_fd(chan, AST_GENERATOR_FD, -1);
ast_clear_flag(chan, AST_FLAG_WRITE_INT);
ast_settimeout(chan, 0, NULL, NULL);
}
+}
+
+void ast_deactivate_generator(struct ast_channel *chan)
+{
+ ast_channel_lock(chan);
+ deactivate_generator_nolock(chan);
ast_channel_unlock(chan);
}
@@ -3143,8 +3151,11 @@
ast_channel_lock(chan);
if (chan->generatordata) {
- if (chan->generator && chan->generator->release)
- chan->generator->release(chan, chan->generatordata);
+ struct ast_generator *generator_old = chan->generator;
+
+ if (generator_old && generator_old->release) {
+ generator_old->release(chan, chan->generatordata);
+ }
chan->generatordata = NULL;
}
if (gen->alloc && !(chan->generatordata = gen->alloc(chan, params))) {
@@ -3545,6 +3556,11 @@
int ast_settimeout(struct ast_channel *c, unsigned int rate, int (*func)(const void *data), void *data)
{
+ return ast_settimeout_full(c, rate, func, data, 0);
+}
+
+int ast_settimeout_full(struct ast_channel *c, unsigned int rate, int (*func)(const void *data), void *data, unsigned int is_ao2_obj)
+{
int res;
unsigned int real_rate = rate, max_rate;
@@ -3568,8 +3584,19 @@
res = ast_timer_set_rate(c->timer, real_rate);
+ if (c->timingdata && ast_test_flag(c, AST_FLAG_TIMINGDATA_IS_AO2_OBJ)) {
+ ao2_ref(c->timingdata, -1);
+ }
+
c->timingfunc = func;
c->timingdata = data;
+
+ if (data && is_ao2_obj) {
+ ao2_ref(data, 1);
+ ast_set_flag(c, AST_FLAG_TIMINGDATA_IS_AO2_OBJ);
+ } else {
+ ast_clear_flag(c, AST_FLAG_TIMINGDATA_IS_AO2_OBJ);
+ }
if (func == NULL && rate == 0 && c->fdno == AST_TIMING_FD) {
/* Clearing the timing func and setting the rate to 0
@@ -3694,48 +3721,56 @@
static void ast_read_generator_actions(struct ast_channel *chan, struct ast_frame *f)
{
- if (chan->generator && chan->generator->generate && chan->generatordata && !ast_internal_timing_enabled(chan)) {
- void *tmp = chan->generatordata;
- int (*generate)(struct ast_channel *chan, void *tmp, int datalen, int samples) = chan->generator->generate;
- int res;
- int samples;
-
- if (chan->timingfunc) {
- ast_debug(1, "Generator got voice, switching to phase locked mode\n");
- ast_settimeout(chan, 0, NULL, NULL);
- }
-
- chan->generatordata = NULL; /* reset, to let writes go through */
-
- if (f->subclass.codec != chan->writeformat) {
- float factor;
- factor = ((float) ast_format_rate(chan->writeformat)) / ((float) ast_format_rate(f->subclass.codec));
- samples = (int) ( ((float) f->samples) * factor );
- } else {
- samples = f->samples;
- }
-
- /* This unlock is here based on two assumptions that hold true at this point in the
- * 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
- * avoidance not to work in deeper functions
- */
- ast_channel_unlock(chan);
- res = generate(chan, tmp, f->datalen, samples);
- ast_channel_lock(chan);
- chan->generatordata = tmp;
+ struct ast_generator *generator;
+ void *gendata;
+ int res;
+ int samples;
+
+ generator = chan->generator;
+ if (!generator
+ || !generator->generate
+ || f->frametype != AST_FRAME_VOICE
+ || !chan->generatordata
+ || chan->timingfunc) {
+ return;
+ }
+
+ /*
+ * We must generate frames in phase locked mode since
+ * we have no internal timer available.
+ */
+
+ if (f->subclass.codec != chan->writeformat) {
+ float factor;
+
+ factor = ((float) ast_format_rate(chan->writeformat)) / ((float) ast_format_rate(f->subclass.codec));
+ samples = (int) (((float) f->samples) * factor);
+ } else {
+ samples = f->samples;
+ }
+
+ gendata = chan->generatordata;
+ chan->generatordata = NULL; /* reset, to let writes go through */
+
+ /*
+ * This unlock is here based on two assumptions that hold true at
+ * this point in the 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 allow deadlock avoidance to work in
+ * deeper functions.
+ */
+ ast_channel_unlock(chan);
+ res = generator->generate(chan, gendata, f->datalen, samples);
+ ast_channel_lock(chan);
+ if (generator == chan->generator) {
+ chan->generatordata = gendata;
if (res) {
ast_debug(1, "Auto-deactivating generator\n");
ast_deactivate_generator(chan);
- }
-
- } else if (f->frametype == AST_FRAME_CNG) {
- if (chan->generator && !chan->timingfunc && (chan->timingfd > -1)) {
- ast_debug(1, "Generator got CNG, switching to timed mode\n");
- ast_settimeout(chan, 50, generator_force, chan);
}
}
}
@@ -3877,9 +3912,17 @@
/* save a copy of func/data before unlocking the channel */
int (*func)(const void *) = chan->timingfunc;
void *data = chan->timingdata;
+ int got_ref = 0;
+ if (data && ast_test_flag(chan, AST_FLAG_TIMINGDATA_IS_AO2_OBJ)) {
+ ao2_ref(data, 1);
+ got_ref = 1;
+ }
chan->fdno = -1;
ast_channel_unlock(chan);
func(data);
+ if (got_ref) {
+ ao2_ref(data, -1);
+ }
} else {
ast_timer_set_rate(chan->timer, 0);
chan->fdno = -1;
@@ -4334,7 +4377,7 @@
int ast_internal_timing_enabled(struct ast_channel *chan)
{
[... 2007 lines stripped ...]
More information about the asterisk-commits
mailing list