[asterisk-commits] branch crichter/0.3.0 - r8334 in
/team/crichter/0.3.0: ./ apps/ channels/ res/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Jan 20 04:56:48 MST 2006
Author: crichter
Date: Fri Jan 20 05:56:39 2006
New Revision: 8334
URL: http://svn.digium.com/view/asterisk?rev=8334&view=rev
Log:
Merged revisions 8112,8122,8124,8134,8140,8162,8173,8194,8232,8242,8276,8281,8320 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r8112 | kpfleming | 2006-01-17 00:51:37 +0100 (Di, 17 Jan 2006) | 2 lines
do rlimit check _after_ reading config file, in case 'dumpcore' is specified there
........
r8122 | kpfleming | 2006-01-17 14:11:55 +0100 (Di, 17 Jan 2006) | 2 lines
update CLI copyright notice
........
r8124 | mogorman | 2006-01-17 17:55:30 +0100 (Di, 17 Jan 2006) | 3 lines
Fixed code ordering of logger_init and queue_log_init
bug 6263
........
r8134 | mattf | 2006-01-17 19:29:57 +0100 (Di, 17 Jan 2006) | 2 lines
Backport of fix for #6094
........
r8140 | mogorman | 2006-01-17 21:10:29 +0100 (Di, 17 Jan 2006) | 3 lines
Stop any generators running on a channel when
festival is called as described in 5996
........
r8162 | mogorman | 2006-01-18 01:47:04 +0100 (Mi, 18 Jan 2006) | 4 lines
Changed order of autoload so that pbx_ comes before
channels, and in doing so cause bug 6002 to not
be an issue
........
r8173 | russell | 2006-01-18 03:49:21 +0100 (Mi, 18 Jan 2006) | 2 lines
remove ChangeLog from the 1.2 branch. It will only be present in the tags.
........
r8194 | mogorman | 2006-01-18 22:02:06 +0100 (Mi, 18 Jan 2006) | 3 lines
Solves issue with the login proccess in meetme
patch from 6136
........
r8232 | russell | 2006-01-19 05:17:45 +0100 (Do, 19 Jan 2006) | 3 lines
fix a seg fault due to assuming that space gets allocatted on the stack in the
same order that we declare the variables (issue #6290)
........
r8242 | russell | 2006-01-19 05:56:48 +0100 (Do, 19 Jan 2006) | 3 lines
fix Message-Account header to use the ip address if the fromdomain
isn't set (issue #6278)
........
r8276 | tilghman | 2006-01-19 20:14:37 +0100 (Do, 19 Jan 2006) | 2 lines
Bug 6072 - Memory leaks in the expression parser
........
r8281 | oej | 2006-01-19 20:40:28 +0100 (Do, 19 Jan 2006) | 2 lines
Enable "musicclass" setting for sip peers as per the config sample.
........
r8320 | mogorman | 2006-01-20 02:00:46 +0100 (Fr, 20 Jan 2006) | 3 lines
solved problem with delayreject and iax trunking
bug 4291
........
Removed:
team/crichter/0.3.0/ChangeLog
Modified:
team/crichter/0.3.0/ (props changed)
team/crichter/0.3.0/apps/app_festival.c
team/crichter/0.3.0/apps/app_meetme.c
team/crichter/0.3.0/apps/app_milliwatt.c
team/crichter/0.3.0/ast_expr2.fl
team/crichter/0.3.0/ast_expr2.y
team/crichter/0.3.0/asterisk.c
team/crichter/0.3.0/channels/chan_iax2.c
team/crichter/0.3.0/channels/chan_sip.c
team/crichter/0.3.0/loader.c
team/crichter/0.3.0/logger.c
team/crichter/0.3.0/res/res_features.c
Propchange: team/crichter/0.3.0/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Jan 20 05:56:39 2006
@@ -1,1 +1,1 @@
-/branches/1.2:1-7496,7498-7914,7916-7959,7961-7964,7966-7969,7971-7975,7977-8093
+/branches/1.2:1-7496,7498-7914,7916-7959,7961-7964,7966-7969,7971-7975,7977-8333
Modified: team/crichter/0.3.0/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/apps/app_festival.c?rev=8334&r1=8333&r2=8334&view=diff
==============================================================================
--- team/crichter/0.3.0/apps/app_festival.c (original)
+++ team/crichter/0.3.0/apps/app_festival.c Fri Jan 20 05:56:39 2006
@@ -177,7 +177,8 @@
if (chan->_state != AST_STATE_UP)
ast_answer(chan);
ast_stopstream(chan);
-
+ ast_indicate(chan, -1);
+
owriteformat = chan->writeformat;
res = ast_set_write_format(chan, AST_FORMAT_SLINEAR);
if (res < 0) {
Modified: team/crichter/0.3.0/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/apps/app_meetme.c?rev=8334&r1=8333&r2=8334&view=diff
==============================================================================
--- team/crichter/0.3.0/apps/app_meetme.c (original)
+++ team/crichter/0.3.0/apps/app_meetme.c Fri Jan 20 05:56:39 2006
@@ -1762,7 +1762,8 @@
if (dynamic_pin) {
if (dynamic_pin[0] == 'q') {
/* Query the user to enter a PIN */
- ast_app_getdata(chan, "conf-getpin", dynamic_pin, AST_MAX_EXTENSION - 1, 0);
+ if (ast_app_getdata(chan, "conf-getpin", dynamic_pin, AST_MAX_EXTENSION - 1, 0) < 0)
+ return NULL;
}
cnf = build_conf(confno, dynamic_pin, "", make, dynamic);
} else {
Modified: team/crichter/0.3.0/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/apps/app_milliwatt.c?rev=8334&r1=8333&r2=8334&view=diff
==============================================================================
--- team/crichter/0.3.0/apps/app_milliwatt.c (original)
+++ team/crichter/0.3.0/apps/app_milliwatt.c Fri Jan 20 05:56:39 2006
@@ -75,30 +75,29 @@
static int milliwatt_generate(struct ast_channel *chan, void *data, int len, int samples)
{
struct ast_frame wf;
- unsigned char waste[AST_FRIENDLY_OFFSET];
- unsigned char buf[640];
+ unsigned char buf[AST_FRIENDLY_OFFSET + 640];
int i,*indexp = (int *) data;
- if (len > sizeof(buf))
+ if (len + AST_FRIENDLY_OFFSET > sizeof(buf))
{
- ast_log(LOG_WARNING,"Only doing %d bytes (%d bytes requested)\n",(int)sizeof(buf),len);
- len = sizeof(buf);
+ ast_log(LOG_WARNING,"Only doing %d bytes (%d bytes requested)\n",(int)(sizeof(buf) - AST_FRIENDLY_OFFSET),len);
+ len = sizeof(buf) - AST_FRIENDLY_OFFSET;
}
- waste[0] = 0; /* make compiler happy */
wf.frametype = AST_FRAME_VOICE;
wf.subclass = AST_FORMAT_ULAW;
wf.offset = AST_FRIENDLY_OFFSET;
wf.mallocd = 0;
- wf.data = buf;
+ wf.data = buf + AST_FRIENDLY_OFFSET;
wf.datalen = len;
wf.samples = wf.datalen;
wf.src = "app_milliwatt";
wf.delivery.tv_sec = 0;
wf.delivery.tv_usec = 0;
+ wf.prev = wf.next = NULL;
/* create a buffer containing the digital milliwatt pattern */
for(i = 0; i < len; i++)
{
- buf[i] = digital_milliwatt[(*indexp)++];
+ buf[AST_FRIENDLY_OFFSET + i] = digital_milliwatt[(*indexp)++];
*indexp &= 7;
}
if (ast_write(chan,&wf) < 0)
Modified: team/crichter/0.3.0/ast_expr2.fl
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/ast_expr2.fl?rev=8334&r1=8333&r2=8334&view=diff
==============================================================================
--- team/crichter/0.3.0/ast_expr2.fl (original)
+++ team/crichter/0.3.0/ast_expr2.fl Fri Jan 20 05:56:39 2006
@@ -1,22 +1,4 @@
%{
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 1999 - 2006, Digium, Inc.
- *
- * Mark Spencer <markster at digium.com>
- *
- * See http://www.asterisk.org for more information about
- * 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.
- *
- * 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 Dialplan Expression Parser
@@ -67,7 +49,7 @@
void ast_yyset_column(int column_no, yyscan_t yyscanner);
int ast_yyget_column(yyscan_t yyscanner);
-
+static int curlycount = 0;
%}
%option prefix="ast_yy"
@@ -77,6 +59,7 @@
%option bison-bridge
%option bison-locations
%option noyywrap
+%x var trail
%%
@@ -98,6 +81,8 @@
\:\: { SET_COLUMNS; SET_STRING; return TOK_COLONCOLON;}
\( { SET_COLUMNS; SET_STRING; return TOK_LP;}
\) { SET_COLUMNS; SET_STRING; return TOK_RP;}
+\$\{ {/* gather the contents of ${} expressions, with trailing stuff, into a single TOKEN. They are much more complex now than they used to be */
+ curlycount = 0; BEGIN(var); yymore();}
[ \r] {}
\"[^"]*\" {SET_COLUMNS; SET_STRING; return TOKEN;}
@@ -106,7 +91,14 @@
[0-9]+ { SET_COLUMNS; /* the original behavior of the expression parser was to bring in numbers as a numeric string */
SET_NUMERIC_STRING;
return TOKEN;}
-[a-zA-Z0-9,.';{}\\_^%$#@!]+ {SET_COLUMNS; SET_STRING; return TOKEN;}
+[a-zA-Z0-9,.';\\_^%$#@!]+ {SET_COLUMNS; SET_STRING; return TOKEN;}
+
+<var>[^{}]*\} {curlycount--; if(curlycount < 0){ BEGIN(trail); yymore();} else { yymore();}}
+<var>[^{}]*\{ {curlycount++; yymore(); }
+<trail>[^-\t\r \n$():?%/+=*<>!|&]* {BEGIN(0); SET_COLUMNS; SET_STRING; return TOKEN;}
+<trail>[-\t\r \n$():?%/+=*<>!|&] {char c = yytext[yyleng-1]; BEGIN(0); unput(c); SET_COLUMNS; SET_STRING; return TOKEN;}
+<trail>\$\{ {curlycount = 0; BEGIN(var); yymore(); }
+<trail><<EOF>> {BEGIN(0); SET_COLUMNS; SET_STRING; return TOKEN; /* actually, if an expr is only a variable ref, this could happen a LOT */}
%%
@@ -153,6 +145,7 @@
ast_copy_string(buf, io.val->u.s, length);
#endif /* STANDALONE */
return_value = strlen(buf);
+ free(io.val->u.s);
}
free(io.val);
}
@@ -167,15 +160,6 @@
int i=0;
spacebuf[0] = 0;
-#ifdef WHEN_LOC_MEANS_SOMETHING
- if( loc->first_column > 7990 ) /* if things get out of whack, why crash? */
- loc->first_column = 7990;
- if( loc->last_column > 7990 )
- loc->last_column = 7990;
- for(i=0;i<loc->first_column;i++) spacebuf[i] = ' ';
- for( ;i<loc->last_column;i++) spacebuf[i] = '^';
- spacebuf[i] = 0;
-#endif
for(i=0;i< (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);i++) spacebuf2[i] = ' '; /* uh... assuming yyg is defined, then I can use the yycolumn macro,
which is the same thing as... get this:
yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]->yy_bs_column
Modified: team/crichter/0.3.0/ast_expr2.y
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/ast_expr2.y?rev=8334&r1=8333&r2=8334&view=diff
==============================================================================
--- team/crichter/0.3.0/ast_expr2.y (original)
+++ team/crichter/0.3.0/ast_expr2.y Fri Jan 20 05:56:39 2006
@@ -124,7 +124,12 @@
some useful info about the error. Not as easy as it looks, but it
is possible. */
#define ast_yyerror(x) ast_yyerror(x,&yyloc,parseio)
-
+#define DESTROY(x) { \
+if ((x)->type == AST_EXPR_numeric_string || (x)->type == AST_EXPR_string) \
+ free((x)->u.s); \
+ (x)->u.s = 0; \
+ free(x); \
+}
%}
%pure-parser
@@ -158,69 +163,91 @@
%%
start: expr { ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
- ((struct parse_io *)parseio)->val->type = $$->type;
- if( $$->type == AST_EXPR_integer )
- ((struct parse_io *)parseio)->val->u.i = $$->u.i;
+ ((struct parse_io *)parseio)->val->type = $1->type;
+ if( $1->type == AST_EXPR_integer )
+ ((struct parse_io *)parseio)->val->u.i = $1->u.i;
else
- ((struct parse_io *)parseio)->val->u.s = $$->u.s; }
+ ((struct parse_io *)parseio)->val->u.s = $1->u.s;
+ free($1);
+ }
;
expr: TOKEN { $$= $1;}
| TOK_LP expr TOK_RP { $$ = $2;
@$.first_column = @1.first_column; @$.last_column = @3.last_column;
- @$.first_line=0; @$.last_line=0;}
+ @$.first_line=0; @$.last_line=0;
+ DESTROY($1); DESTROY($3); }
| expr TOK_OR expr { $$ = op_or ($1, $3);
+ DESTROY($2);
@$.first_column = @1.first_column; @$.last_column = @3.last_column;
@$.first_line=0; @$.last_line=0;}
| expr TOK_AND expr { $$ = op_and ($1, $3);
+ DESTROY($2);
@$.first_column = @1.first_column; @$.last_column = @3.last_column;
@$.first_line=0; @$.last_line=0;}
| expr TOK_EQ expr { $$ = op_eq ($1, $3);
+ DESTROY($2);
@$.first_column = @1.first_column; @$.last_column = @3.last_column;
@$.first_line=0; @$.last_line=0;}
| expr TOK_GT expr { $$ = op_gt ($1, $3);
+ DESTROY($2);
@$.first_column = @1.first_column; @$.last_column = @3.last_column;
@$.first_line=0; @$.last_line=0;}
| expr TOK_LT expr { $$ = op_lt ($1, $3);
+ DESTROY($2);
@$.first_column = @1.first_column; @$.last_column = @3.last_column;
@$.first_line=0; @$.last_line=0;}
| expr TOK_GE expr { $$ = op_ge ($1, $3);
+ DESTROY($2);
@$.first_column = @1.first_column; @$.last_column = @3.last_column;
@$.first_line=0; @$.last_line=0;}
| expr TOK_LE expr { $$ = op_le ($1, $3);
+ DESTROY($2);
@$.first_column = @1.first_column; @$.last_column = @3.last_column;
@$.first_line=0; @$.last_line=0;}
| expr TOK_NE expr { $$ = op_ne ($1, $3);
+ DESTROY($2);
@$.first_column = @1.first_column; @$.last_column = @3.last_column;
@$.first_line=0; @$.last_line=0;}
| expr TOK_PLUS expr { $$ = op_plus ($1, $3);
+ DESTROY($2);
@$.first_column = @1.first_column; @$.last_column = @3.last_column;
@$.first_line=0; @$.last_line=0;}
| expr TOK_MINUS expr { $$ = op_minus ($1, $3);
+ DESTROY($2);
@$.first_column = @1.first_column; @$.last_column = @3.last_column;
@$.first_line=0; @$.last_line=0;}
| TOK_MINUS expr %prec TOK_COMPL { $$ = op_negate ($2);
+ DESTROY($1);
@$.first_column = @1.first_column; @$.last_column = @2.last_column;
@$.first_line=0; @$.last_line=0;}
| TOK_COMPL expr { $$ = op_compl ($2);
+ DESTROY($1);
@$.first_column = @1.first_column; @$.last_column = @2.last_column;
@$.first_line=0; @$.last_line=0;}
| expr TOK_MULT expr { $$ = op_times ($1, $3);
+ DESTROY($2);
@$.first_column = @1.first_column; @$.last_column = @3.last_column;
@$.first_line=0; @$.last_line=0;}
| expr TOK_DIV expr { $$ = op_div ($1, $3);
+ DESTROY($2);
@$.first_column = @1.first_column; @$.last_column = @3.last_column;
@$.first_line=0; @$.last_line=0;}
| expr TOK_MOD expr { $$ = op_rem ($1, $3);
+ DESTROY($2);
@$.first_column = @1.first_column; @$.last_column = @3.last_column;
@$.first_line=0; @$.last_line=0;}
| expr TOK_COLON expr { $$ = op_colon ($1, $3);
+ DESTROY($2);
@$.first_column = @1.first_column; @$.last_column = @3.last_column;
@$.first_line=0; @$.last_line=0;}
| expr TOK_EQTILDE expr { $$ = op_eqtilde ($1, $3);
+ DESTROY($2);
@$.first_column = @1.first_column; @$.last_column = @3.last_column;
@$.first_line=0; @$.last_line=0;}
| expr TOK_COND expr TOK_COLONCOLON expr { $$ = op_cond ($1, $3, $5);
+ DESTROY($2);
+ DESTROY($4);
@$.first_column = @1.first_column; @$.last_column = @3.last_column;
@$.first_line=0; @$.last_line=0;}
;
@@ -281,6 +308,7 @@
}
if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string)
free (vp->u.s);
+ free(vp);
}
Modified: team/crichter/0.3.0/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/asterisk.c?rev=8334&r1=8333&r2=8334&view=diff
==============================================================================
--- team/crichter/0.3.0/asterisk.c (original)
+++ team/crichter/0.3.0/asterisk.c Fri Jan 20 05:56:39 2006
@@ -127,7 +127,7 @@
/*! \brief Welcome message when starting a CLI interface */
#define WELCOME_MESSAGE \
- ast_verbose("Asterisk " ASTERISK_VERSION ", Copyright (C) 1999 - 2005 Digium, Inc. and others.\n"); \
+ ast_verbose("Asterisk " ASTERISK_VERSION ", Copyright (C) 1999 - 2006 Digium, Inc. and others.\n"); \
ast_verbose("Created by Mark Spencer <markster at digium.com>\n"); \
ast_verbose("Asterisk comes with ABSOLUTELY NO WARRANTY; type 'show warranty' for details.\n"); \
ast_verbose("This is free software, with components licensed under the GNU General Public\n"); \
@@ -141,17 +141,32 @@
Some of them can be changed in the CLI
*/
/*! @{ */
-
-struct ast_flags ast_options = { AST_OPT_FLAG_TRANSCODE_VIA_SLIN };
-
-int option_verbose = 0; /*!< Verbosity level */
-int option_debug = 0; /*!< Debug level */
-
+int option_verbose=0; /*!< Verbosity level */
+int option_debug=0; /*!< Debug level */
+int option_exec_includes=0; /*!< Allow \#exec in config files? */
+int option_nofork=0; /*!< Do not fork */
+int option_quiet=0; /*!< Keep quiet */
+int option_console=0; /*!< Console mode, no background */
+int option_highpriority=0; /*!< Run in realtime Linux priority */
+int option_remote=0; /*!< Remote CLI */
+int option_exec=0; /*!< */
+int option_initcrypto=0; /*!< Initialize crypto keys for RSA auth */
+int option_nocolor; /*!< Don't use termcap colors */
+int option_dumpcore = 0; /*!< Dump core when failing */
+int option_cache_record_files = 0; /*!< Cache sound files */
+int option_timestamp = 0; /*!< Timestamp in logging */
+int option_overrideconfig = 0; /*!< */
+int option_reconnect = 0; /*!< */
+int option_transcode_slin = 1; /*!< */
+int option_maxcalls = 0; /*!< */
double option_maxload = 0.0; /*!< Max load avg on system */
-int option_maxcalls = 0; /*!< Max number of active calls */
+int option_dontwarn = 0; /*!< */
+int option_priority_jumping = 1; /*!< Enable priority jumping as result value for apps */
+int option_transmit_silence_during_record = 0; /*!< Transmit silence during record() app */
/*! @} */
+int fully_booted = 0;
char record_cache_dir[AST_CACHE_DIR_LEN] = AST_TMP_DIR;
char debug_filename[AST_FILENAME_MAX] = "";
@@ -210,8 +225,6 @@
static int shuttingdown = 0;
static int restartnow = 0;
static pthread_t consolethread = AST_PTHREADT_NULL;
-
-static char randompool[256];
#if !defined(LOW_MEMORY)
struct file_version {
@@ -825,7 +838,7 @@
if (!nice) {
/* Begin shutdown routine, hanging up active channels */
ast_begin_shutdown(1);
- if (option_verbose && ast_opt_console)
+ if (option_verbose && option_console)
ast_verbose("Beginning asterisk %s....\n", restart ? "restart" : "shutdown");
time(&s);
for(;;) {
@@ -843,7 +856,7 @@
} else {
if (nice < 2)
ast_begin_shutdown(0);
- if (option_verbose && ast_opt_console)
+ if (option_verbose && option_console)
ast_verbose("Waiting for inactivity to perform %s...\n", restart ? "restart" : "halt");
for(;;) {
if (!ast_active_channels())
@@ -855,12 +868,12 @@
}
if (!shuttingdown) {
- if (option_verbose && ast_opt_console)
+ if (option_verbose && option_console)
ast_verbose("Asterisk %s cancelled.\n", restart ? "restart" : "shutdown");
return;
}
}
- if (ast_opt_console || ast_opt_remote) {
+ if (option_console || option_remote) {
if (getenv("HOME"))
snprintf(filename, sizeof(filename), "%s/.asterisk_history", getenv("HOME"));
if (!ast_strlen_zero(filename))
@@ -874,7 +887,7 @@
ast_verbose("Executing last minute cleanups\n");
ast_run_atexits();
/* Called on exit */
- if (option_verbose && ast_opt_console)
+ if (option_verbose && option_console)
ast_verbose("Asterisk %s ending (%d).\n", ast_active_channels() ? "uncleanly" : "cleanly", num);
else if (option_debug)
ast_log(LOG_DEBUG, "Asterisk ending (%d).\n", num);
@@ -886,18 +899,17 @@
if (ast_consock > -1)
close(ast_consock);
if (ast_socket > -1)
- unlink(ast_config_AST_SOCKET);
- if (!ast_opt_remote)
- unlink(ast_config_AST_PID);
+ unlink((char *)ast_config_AST_SOCKET);
+ if (!option_remote) unlink((char *)ast_config_AST_PID);
printf(term_quit());
if (restart) {
- if (option_verbose || ast_opt_console)
+ if (option_verbose || option_console)
ast_verbose("Preparing for Asterisk restart...\n");
/* Mark all FD's for closing on exec */
for (x=3;x<32768;x++) {
fcntl(x, F_SETFD, FD_CLOEXEC);
}
- if (option_verbose || ast_opt_console)
+ if (option_verbose || option_console)
ast_verbose("Restarting Asterisk NOW...\n");
restartnow = 1;
@@ -956,7 +968,7 @@
fflush(stdout);
if (complete) {
/* Wake up a poll()ing console */
- if (ast_opt_console && consolethread != AST_PTHREADT_NULL)
+ if (option_console && consolethread != AST_PTHREADT_NULL)
pthread_kill(consolethread, SIGURG);
}
}
@@ -1242,7 +1254,7 @@
max = 1;
fds[0].fd = ast_consock;
fds[0].events = POLLIN;
- if (!ast_opt_exec) {
+ if (!option_exec) {
fds[1].fd = STDIN_FILENO;
fds[1].events = POLLIN;
max++;
@@ -1255,7 +1267,7 @@
break;
}
- if (!ast_opt_exec && fds[1].revents) {
+ if (!option_exec && fds[1].revents) {
num_read = read(STDIN_FILENO, cp, 1);
if (num_read < 1) {
break;
@@ -1267,7 +1279,7 @@
/* if the remote side disappears exit */
if (res < 1) {
fprintf(stderr, "\nDisconnected from Asterisk server\n");
- if (!ast_opt_reconnect) {
+ if (!option_reconnect) {
quit_handler(0, 0, 0, 0);
} else {
int tries;
@@ -1292,7 +1304,7 @@
buf[res] = '\0';
- if (!ast_opt_exec && !lastpos)
+ if (!option_exec && !lastpos)
write(STDOUT_FILENO, "\r", 1);
write(STDOUT_FILENO, buf, res);
if ((buf[res-1] == '\n') || (buf[res-2] == '\n')) {
@@ -1413,7 +1425,7 @@
}
break;
case '#': /* process console or remote? */
- if (!ast_opt_remote) {
+ if (! option_remote) {
strncat(p, "#", sizeof(prompt) - strlen(prompt) - 1);
} else {
strncat(p, ">", sizeof(prompt) - strlen(prompt) - 1);
@@ -1513,7 +1525,7 @@
idx = 1;
- qsort(&matches[0], (size_t)(len), sizeof(char *), ast_el_sort_compare);
+ qsort(&matches[0], (size_t)(len + 1), sizeof(char *), ast_el_sort_compare);
for (; count > 0; count--) {
numoutputline = 0;
@@ -1567,7 +1579,7 @@
len = lf->cursor - ptr;
- if (ast_opt_remote) {
+ if (option_remote) {
snprintf(buf, sizeof(buf),"_COMMAND NUMMATCHES \"%s\" \"%s\"", lf->buffer, ptr);
fdprint(ast_consock, buf);
res = read(ast_consock, buf, sizeof(buf));
@@ -1604,15 +1616,12 @@
free(mbuf);
} else
matches = (char **) NULL;
+
+
} else {
- char **p, *oldbuf=NULL;
- nummatches = 0;
+
+ nummatches = ast_cli_generatornummatches((char *)lf->buffer,ptr);
matches = ast_cli_completion_matches((char *)lf->buffer,ptr);
- for (p = matches; p && *p; p++) {
- if (!oldbuf || strcmp(*p,oldbuf))
- nummatches++;
- oldbuf = *p;
- }
}
if (matches) {
@@ -1646,7 +1655,7 @@
retval = CC_REFRESH;
}
}
- free(matches);
+ free(matches);
}
return (char *)(long)retval;
@@ -1780,7 +1789,7 @@
if (!ast_strlen_zero(filename))
ast_el_read_history(filename);
- if (ast_opt_exec && data) { /* hack to print output then exit if asterisk -rx is used */
+ if (option_exec && data) { /* hack to print output then exit if asterisk -rx is used */
char tempchar;
struct pollfd fds[0];
fds[0].fd = ast_consock;
@@ -1847,7 +1856,7 @@
struct ast_variable *v;
char *config = AST_CONFIG_FILE;
- if (ast_opt_override_config) {
+ if (option_overrideconfig == 1) {
cfg = ast_config_load(ast_config_AST_CONFIG_FILE);
if (!cfg)
ast_log(LOG_WARNING, "Unable to open specified master config file '%s', using built-in defaults\n", ast_config_AST_CONFIG_FILE);
@@ -1916,10 +1925,10 @@
option_verbose = atoi(v->value);
/* whether or not to force timestamping. (-T at startup) */
} else if (!strcasecmp(v->name, "timestamp")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_TIMESTAMP);
+ option_timestamp = ast_true(v->value);
/* whether or not to support #exec in config files */
} else if (!strcasecmp(v->name, "execincludes")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_EXEC_INCLUDES);
+ option_exec_includes = ast_true(v->value);
/* debug level (-d at startup) */
} else if (!strcasecmp(v->name, "debug")) {
option_debug = 0;
@@ -1928,40 +1937,40 @@
}
/* Disable forking (-f at startup) */
} else if (!strcasecmp(v->name, "nofork")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_NO_FORK);
+ option_nofork = ast_true(v->value);
/* Run quietly (-q at startup ) */
} else if (!strcasecmp(v->name, "quiet")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_QUIET);
+ option_quiet = ast_true(v->value);
/* Run as console (-c at startup, implies nofork) */
} else if (!strcasecmp(v->name, "console")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_CONSOLE);
+ option_console = ast_true(v->value);
/* Run with highg priority if the O/S permits (-p at startup) */
} else if (!strcasecmp(v->name, "highpriority")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_HIGH_PRIORITY);
+ option_highpriority = ast_true(v->value);
/* Initialize RSA auth keys (IAX2) (-i at startup) */
} else if (!strcasecmp(v->name, "initcrypto")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_INIT_KEYS);
+ option_initcrypto = ast_true(v->value);
/* Disable ANSI colors for console (-c at startup) */
} else if (!strcasecmp(v->name, "nocolor")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_NO_COLOR);
+ option_nocolor = ast_true(v->value);
/* Disable some usage warnings for picky people :p */
} else if (!strcasecmp(v->name, "dontwarn")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_DONT_WARN);
+ option_dontwarn = ast_true(v->value);
/* Dump core in case of crash (-g) */
} else if (!strcasecmp(v->name, "dumpcore")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_DUMP_CORE);
+ option_dumpcore = ast_true(v->value);
/* Cache recorded sound files to another directory during recording */
} else if (!strcasecmp(v->name, "cache_record_files")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_CACHE_RECORD_FILES);
+ option_cache_record_files = ast_true(v->value);
/* Specify cache directory */
} else if (!strcasecmp(v->name, "record_cache_dir")) {
ast_copy_string(record_cache_dir, v->value, AST_CACHE_DIR_LEN);
/* Build transcode paths via SLINEAR, instead of directly */
} else if (!strcasecmp(v->name, "transcode_via_sln")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_TRANSCODE_VIA_SLIN);
+ option_transcode_slin = ast_true(v->value);
/* Transmit SLINEAR silence while a channel is being recorded */
} else if (!strcasecmp(v->name, "transmit_silence_during_record")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_TRANSMIT_SILENCE);
+ option_transmit_silence_during_record = ast_true(v->value);
} else if (!strcasecmp(v->name, "maxcalls")) {
if ((sscanf(v->value, "%d", &option_maxcalls) != 1) || (option_maxcalls < 0)) {
option_maxcalls = 0;
@@ -2013,7 +2022,8 @@
/* if the progname is rasterisk consider it a remote console */
if (argv[0] && (strstr(argv[0], "rasterisk")) != NULL) {
- ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE);
+ option_remote++;
+ option_nofork++;
}
if (gethostname(hostname, sizeof(hostname)-1))
ast_copy_string(hostname, "<Unknown>", sizeof(hostname));
@@ -2042,29 +2052,33 @@
switch(c) {
case 'd':
option_debug++;
- ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK);
+ option_nofork++;
break;
case 'c':
- ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_CONSOLE);
+ option_console++;
+ option_nofork++;
break;
case 'f':
- ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK);
+ option_nofork++;
break;
case 'n':
- ast_set_flag(&ast_options, AST_OPT_FLAG_NO_COLOR);
+ option_nocolor++;
break;
case 'r':
- ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE);
+ option_remote++;
+ option_nofork++;
break;
case 'R':
- ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE | AST_OPT_FLAG_RECONNECT);
+ option_remote++;
+ option_nofork++;
+ option_reconnect++;
break;
case 'p':
- ast_set_flag(&ast_options, AST_OPT_FLAG_HIGH_PRIORITY);
+ option_highpriority++;
break;
case 'v':
option_verbose++;
- ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK);
+ option_nofork++;
break;
case 'M':
if ((sscanf(optarg, "%d", &option_maxcalls) != 1) || (option_maxcalls < 0))
@@ -2075,27 +2089,27 @@
option_maxload = 0.0;
break;
case 'q':
- ast_set_flag(&ast_options, AST_OPT_FLAG_QUIET);
+ option_quiet++;
break;
case 't':
- ast_set_flag(&ast_options, AST_OPT_FLAG_CACHE_RECORD_FILES);
+ option_cache_record_files++;
break;
case 'T':
- ast_set_flag(&ast_options, AST_OPT_FLAG_TIMESTAMP);
+ option_timestamp++;
break;
case 'x':
- ast_set_flag(&ast_options, AST_OPT_FLAG_EXEC);
+ option_exec++;
xarg = optarg;
break;
case 'C':
- ast_copy_string(ast_config_AST_CONFIG_FILE, optarg, sizeof(ast_config_AST_CONFIG_FILE));
- ast_set_flag(&ast_options, AST_OPT_FLAG_OVERRIDE_CONFIG);
+ ast_copy_string((char *)ast_config_AST_CONFIG_FILE,optarg,sizeof(ast_config_AST_CONFIG_FILE));
+ option_overrideconfig++;
break;
case 'i':
- ast_set_flag(&ast_options, AST_OPT_FLAG_INIT_KEYS);
+ option_initcrypto++;
break;
case'g':
- ast_set_flag(&ast_options, AST_OPT_FLAG_DUMP_CORE);
+ option_dumpcore++;
break;
case 'h':
show_cli_help();
@@ -2117,14 +2131,18 @@
/* For remote connections, change the name of the remote connection.
* We do this for the benefit of init scripts (which need to know if/when
* the main asterisk process has died yet). */
- if (ast_opt_remote) {
+ if (option_remote) {
strcpy(argv[0], "rasterisk");
for (x = 1; x < argc; x++) {
argv[x] = argv[0] + 10;
}
}
- if (ast_opt_dump_core) {
+ if (option_console && !option_verbose)
+ ast_verbose("[ Reading Master Configuration ]");
+ ast_readconfig();
+
+ if (option_dumpcore) {
struct rlimit l;
memset(&l, 0, sizeof(l));
l.rlim_cur = RLIM_INFINITY;
@@ -2134,10 +2152,6 @@
}
}
- if (ast_opt_console && !option_verbose)
- ast_verbose("[ Reading Master Configuration ]");
- ast_readconfig();
-
if ((!rungroup) && !ast_strlen_zero(ast_config_AST_RUN_GROUP))
rungroup = ast_config_AST_RUN_GROUP;
if ((!runuser) && !ast_strlen_zero(ast_config_AST_RUN_USER))
@@ -2145,7 +2159,7 @@
#ifndef __CYGWIN__
if (!is_child_of_nonroot)
- ast_set_priority(ast_opt_high_priority);
+ ast_set_priority(option_highpriority);
if (!is_child_of_nonroot && rungroup) {
struct group *gr;
@@ -2198,14 +2212,14 @@
printf(term_end());
fflush(stdout);
- if (ast_opt_console && !option_verbose)
+ if (option_console && !option_verbose)
ast_verbose("[ Initializing Custom Configuration Options ]");
/* custom config setup */
register_config_cli();
read_config_maps();
- if (ast_opt_console) {
+ if (option_console) {
if (el_hist == NULL || el == NULL)
ast_el_initialize();
@@ -2215,8 +2229,8 @@
if (ast_tryconnect()) {
/* One is already running */
- if (ast_opt_remote) {
- if (ast_opt_exec) {
+ if (option_remote) {
+ if (option_exec) {
ast_remotecontrol(xarg);
quit_handler(0, 0, 0, 0);
exit(0);
@@ -2228,34 +2242,34 @@
quit_handler(0, 0, 0, 0);
exit(0);
} else {
- ast_log(LOG_ERROR, "Asterisk already running on %s. Use 'asterisk -r' to connect.\n", ast_config_AST_SOCKET);
+ ast_log(LOG_ERROR, "Asterisk already running on %s. Use 'asterisk -r' to connect.\n", (char *)ast_config_AST_SOCKET);
printf(term_quit());
exit(1);
}
- } else if (ast_opt_remote || ast_opt_exec) {
+ } else if (option_remote || option_exec) {
ast_log(LOG_ERROR, "Unable to connect to remote asterisk (does %s exist?)\n",ast_config_AST_SOCKET);
printf(term_quit());
exit(1);
}
/* Blindly write pid file since we couldn't connect */
- unlink(ast_config_AST_PID);
- f = fopen(ast_config_AST_PID, "w");
+ unlink((char *)ast_config_AST_PID);
+ f = fopen((char *)ast_config_AST_PID, "w");
if (f) {
fprintf(f, "%d\n", getpid());
fclose(f);
} else
- ast_log(LOG_WARNING, "Unable to open pid file '%s': %s\n", ast_config_AST_PID, strerror(errno));
-
- if (!option_verbose && !option_debug && !ast_opt_no_fork && !ast_opt_console) {
+ ast_log(LOG_WARNING, "Unable to open pid file '%s': %s\n", (char *)ast_config_AST_PID, strerror(errno));
+
+ if (!option_verbose && !option_debug && !option_nofork && !option_console) {
daemon(0,0);
/* Blindly re-write pid file since we are forking */
- unlink(ast_config_AST_PID);
- f = fopen(ast_config_AST_PID, "w");
+ unlink((char *)ast_config_AST_PID);
+ f = fopen((char *)ast_config_AST_PID, "w");
if (f) {
fprintf(f, "%d\n", getpid());
fclose(f);
} else
- ast_log(LOG_WARNING, "Unable to open pid file '%s': %s\n", ast_config_AST_PID, strerror(errno));
+ ast_log(LOG_WARNING, "Unable to open pid file '%s': %s\n", (char *)ast_config_AST_PID, strerror(errno));
}
/* Test recursive mutex locking. */
@@ -2270,13 +2284,13 @@
sigaddset(&sigs, SIGPIPE);
sigaddset(&sigs, SIGWINCH);
pthread_sigmask(SIG_BLOCK, &sigs, NULL);
- if (ast_opt_console || option_verbose || ast_opt_remote)
+ if (option_console || option_verbose || option_remote)
ast_register_verbose(console_verboser);
/* Print a welcome message if desired */
- if (option_verbose || ast_opt_console) {
+ if (option_verbose || option_console) {
WELCOME_MESSAGE;
}
- if (ast_opt_console && !option_verbose)
+ if (option_console && !option_verbose)
ast_verbose("[ Booting...");
signal(SIGURG, urg_handler);
@@ -2290,7 +2304,7 @@
Asterisk is started
*/
srand((unsigned int) getpid() + (unsigned int) time(NULL));
- initstate((unsigned int) getpid() * 65536 + (unsigned int) time(NULL), randompool, sizeof(randompool));
+ srandom((unsigned int) getpid() + (unsigned int) time(NULL));
if (init_logger()) {
printf(term_quit());
@@ -2363,20 +2377,20 @@
/* We might have the option of showing a console, but for now just
do nothing... */
- if (ast_opt_console && !option_verbose)
+ if (option_console && !option_verbose)
ast_verbose(" ]\n");
- if (option_verbose || ast_opt_console)
+ if (option_verbose || option_console)
ast_verbose(term_color(tmp, "Asterisk Ready.\n", COLOR_BRWHITE, COLOR_BLACK, sizeof(tmp)));
- if (ast_opt_no_fork)
+ if (option_nofork)
consolethread = pthread_self();
- ast_set_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED);
+ fully_booted = 1;
pthread_sigmask(SIG_UNBLOCK, &sigs, NULL);
#ifdef __AST_DEBUG_MALLOC
__ast_mm_init();
#endif
time(&ast_startuptime);
ast_cli_register_multiple(core_cli, sizeof(core_cli) / sizeof(core_cli[0]));
- if (ast_opt_console) {
+ if (option_console) {
/* Console stuff now... */
/* Register our quit function */
char title[256];
Modified: team/crichter/0.3.0/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/chan_iax2.c?rev=8334&r1=8333&r2=8334&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/chan_iax2.c (original)
+++ team/crichter/0.3.0/channels/chan_iax2.c Fri Jan 20 05:56:39 2006
@@ -4888,6 +4888,8 @@
fh.iseqno = 0;
fh.type = AST_FRAME_IAX;
fh.csub = compress_subclass(IAX_COMMAND_INVAL);
+ if (iaxdebug)
+ iax_showframe(NULL, &fh, 0, sin, 0);
#if 0
if (option_debug)
#endif
@@ -6753,6 +6755,10 @@
break;
if (ies.provverpres && ies.serviceident && sin.sin_addr.s_addr)
check_provisioning(&sin, fd, ies.serviceident, ies.provver);
+ /* If we're in trunk mode, do it now, and update the trunk number in our frame before continuing */
+ if (ast_test_flag(iaxs[fr.callno], IAX_TRUNK)) {
+ fr.callno = make_trunk(fr.callno, 1);
+ }
/* For security, always ack immediately */
if (delayreject)
send_command_immediate(iaxs[fr.callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr.ts, NULL, 0,fr.iseqno);
@@ -6762,10 +6768,6 @@
if (authdebug)
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, who was trying to reach '%s@%s'\n", ast_inet_ntoa(iabuf, sizeof(iabuf), sin.sin_addr), iaxs[fr.callno]->exten, iaxs[fr.callno]->context);
break;
- }
- /* If we're in trunk mode, do it now, and update the trunk number in our frame before continuing */
- if (ast_test_flag(iaxs[fr.callno], IAX_TRUNK)) {
- fr.callno = make_trunk(fr.callno, 1);
}
/* This might re-enter the IAX code and need the lock */
if (strcasecmp(iaxs[fr.callno]->exten, "TBD")) {
Modified: team/crichter/0.3.0/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/chan_sip.c?rev=8334&r1=8333&r2=8334&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/chan_sip.c (original)
+++ team/crichter/0.3.0/channels/chan_sip.c Fri Jan 20 05:56:39 2006
@@ -5192,13 +5192,14 @@
char tmp[500];
char *t = tmp;
size_t maxbytes = sizeof(tmp);
+ char iabuf[INET_ADDRSTRLEN];
initreqprep(&req, p, SIP_NOTIFY);
add_header(&req, "Event", "message-summary");
add_header(&req, "Content-Type", default_notifymime);
ast_build_string(&t, &maxbytes, "Messages-Waiting: %s\r\n", newmsgs ? "yes" : "no");
- ast_build_string(&t, &maxbytes, "Message-Account: sip:%s@%s\r\n", !ast_strlen_zero(vmexten) ? vmexten : global_vmexten, p->fromdomain);
+ ast_build_string(&t, &maxbytes, "Message-Account: sip:%s@%s\r\n", !ast_strlen_zero(vmexten) ? vmexten : global_vmexten, ast_strlen_zero(p->fromdomain) ? ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip) : p->fromdomain);
ast_build_string(&t, &maxbytes, "Voice-Message: %d/%d (0/0)\r\n", newmsgs, oldmsgs);
if (t > tmp + sizeof(tmp))
@@ -12224,7 +12225,7 @@
}
} else if (!strcasecmp(v->name, "accountcode")) {
ast_copy_string(peer->accountcode, v->value, sizeof(peer->accountcode));
- } else if (!strcasecmp(v->name, "musiconhold")) {
+ } else if (!strcasecmp(v->name, "musicclass") || !strcasecmp(v->name, "musiconhold")) {
ast_copy_string(peer->musicclass, v->value, sizeof(peer->musicclass));
} else if (!strcasecmp(v->name, "mailbox")) {
ast_copy_string(peer->mailbox, v->value, sizeof(peer->mailbox));
Modified: team/crichter/0.3.0/loader.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/loader.c?rev=8334&r1=8333&r2=8334&view=diff
==============================================================================
--- team/crichter/0.3.0/loader.c (original)
+++ team/crichter/0.3.0/loader.c Fri Jan 20 05:56:39 2006
@@ -458,8 +458,8 @@
static const char *loadorder[] =
{
"res_",
+ "pbx_",
"chan_",
- "pbx_",
NULL,
};
Modified: team/crichter/0.3.0/logger.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/logger.c?rev=8334&r1=8333&r2=8334&view=diff
==============================================================================
--- team/crichter/0.3.0/logger.c (original)
+++ team/crichter/0.3.0/logger.c Fri Jan 20 05:56:39 2006
@@ -466,8 +466,8 @@
filesize_reload_needed = 0;
+ init_logger_chain();
queue_log_init();
- init_logger_chain();
if (logfiles.event_log) {
if (eventlog) {
@@ -594,11 +594,11 @@
ast_cli_register(&rotate_logger_cli);
ast_cli_register(&logger_show_channels_cli);
+ /* create log channels */
+ init_logger_chain();
+
/* initialize queue logger */
queue_log_init();
-
- /* create log channels */
- init_logger_chain();
/* create the eventlog */
if (logfiles.event_log) {
Modified: team/crichter/0.3.0/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/res/res_features.c?rev=8334&r1=8333&r2=8334&view=diff
==============================================================================
[... 324 lines stripped ...]
More information about the asterisk-commits
mailing list