summaryrefslogtreecommitdiff
path: root/main/asterisk.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/asterisk.c')
-rw-r--r--main/asterisk.c88
1 files changed, 27 insertions, 61 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index bec992f68..36b1b54a1 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -199,7 +199,6 @@ int daemon(int, int); /* defined in libresolv of all places */
#include "asterisk/channel.h"
#include "asterisk/translate.h"
#include "asterisk/pickup.h"
-#include "asterisk/features.h"
#include "asterisk/acl.h"
#include "asterisk/ulaw.h"
#include "asterisk/alaw.h"
@@ -209,11 +208,7 @@ int daemon(int, int); /* defined in libresolv of all places */
#include "asterisk/term.h"
#include "asterisk/manager.h"
#include "asterisk/cdr.h"
-#include "asterisk/cel.h"
#include "asterisk/pbx.h"
-#include "asterisk/enum.h"
-#include "asterisk/http.h"
-#include "asterisk/udptl.h"
#include "asterisk/app.h"
#include "asterisk/lock.h"
#include "asterisk/utils.h"
@@ -225,11 +220,9 @@ int daemon(int, int); /* defined in libresolv of all places */
#include "asterisk/devicestate.h"
#include "asterisk/presencestate.h"
#include "asterisk/module.h"
-#include "asterisk/dsp.h"
#include "asterisk/buildinfo.h"
#include "asterisk/xmldoc.h"
#include "asterisk/poll-compat.h"
-#include "asterisk/ccss.h"
#include "asterisk/test.h"
#include "asterisk/rtp_engine.h"
#include "asterisk/format.h"
@@ -606,6 +599,7 @@ static char *handle_show_settings(struct ast_cli_entry *e, int cmd, struct ast_c
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, " 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");
+ ast_cli(a->fd, " Generic PLC on equal codecs: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS) ? "Enabled" : "Disabled");
ast_cli(a->fd, " Min DTMF duration:: %u\n", option_dtmfminduration);
#if !defined(LOW_MEMORY)
ast_cli(a->fd, " Cache media frames: %s\n", ast_opt_cache_media_frames ? "Enabled" : "Disabled");
@@ -2732,10 +2726,14 @@ static void send_rasterisk_connect_commands(void)
}
#ifdef HAVE_LIBEDIT_IS_UNICODE
-static int ast_el_read_char(EditLine *editline, wchar_t *cp)
+#define CHAR_T_LIBEDIT wchar_t
+#define CHAR_TO_LIBEDIT(c) btowc(c)
#else
-static int ast_el_read_char(EditLine *editline, char *cp)
+#define CHAR_T_LIBEDIT char
+#define CHAR_TO_LIBEDIT(c) c
#endif
+
+static int ast_el_read_char(EditLine *editline, CHAR_T_LIBEDIT *cp)
{
int num_read = 0;
int lastpos = 0;
@@ -2756,28 +2754,29 @@ static int ast_el_read_char(EditLine *editline, char *cp)
}
res = ast_poll(fds, max, -1);
if (res < 0) {
- if (sig_flags.need_quit || sig_flags.need_quit_handler)
+ if (sig_flags.need_quit || sig_flags.need_quit_handler) {
break;
- if (errno == EINTR)
+ }
+ if (errno == EINTR) {
continue;
+ }
fprintf(stderr, "poll failed: %s\n", strerror(errno));
break;
}
if (!ast_opt_exec && fds[1].revents) {
char c = '\0';
+
num_read = read(STDIN_FILENO, &c, 1);
if (num_read < 1) {
break;
- } else {
-#ifdef HAVE_LIBEDIT_IS_UNICODE
- *cp = btowc(c);
-#else
- *cp = c;
-#endif
- return (num_read);
}
+
+ *cp = CHAR_TO_LIBEDIT(c);
+
+ return num_read;
}
+
if (fds[0].revents) {
res = read(ast_consock, buf, sizeof(buf) - 1);
/* if the remote side disappears exit */
@@ -2788,6 +2787,7 @@ static int ast_el_read_char(EditLine *editline, char *cp)
} else {
int tries;
int reconnects_per_second = 20;
+
fprintf(stderr, "Attempting to reconnect for 30 seconds\n");
for (tries = 0; tries < 30 * reconnects_per_second; tries++) {
if (ast_tryconnect()) {
@@ -2796,8 +2796,9 @@ static int ast_el_read_char(EditLine *editline, char *cp)
WELCOME_MESSAGE;
send_rasterisk_connect_commands();
break;
- } else
- usleep(1000000 / reconnects_per_second);
+ }
+
+ usleep(1000000 / reconnects_per_second);
}
if (tries >= 30 * reconnects_per_second) {
fprintf(stderr, "Failed to reconnect for 30 seconds. Quitting.\n");
@@ -2818,25 +2819,17 @@ static int ast_el_read_char(EditLine *editline, char *cp)
console_print(buf);
if ((res < EL_BUF_SIZE - 1) && ((buf[res-1] == '\n') || (res >= 2 && buf[res-2] == '\n'))) {
-#ifdef HAVE_LIBEDIT_IS_UNICODE
- *cp = btowc(CC_REFRESH);
-#else
- *cp = CC_REFRESH;
-#endif
- return(1);
- } else {
- lastpos = 1;
+ *cp = CHAR_TO_LIBEDIT(CC_REFRESH);
+
+ return 1;
}
+ lastpos = 1;
}
}
-#ifdef HAVE_LIBEDIT_IS_UNICODE
- *cp = btowc('\0');
-#else
- *cp = '\0';
-#endif
+ *cp = CHAR_TO_LIBEDIT('\0');
- return (0);
+ return 0;
}
static struct ast_str *prompt = NULL;
@@ -4445,12 +4438,7 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou
print_intro_message(runuser, rungroup);
- if (ast_opt_console) {
- ast_verb(0, "[ Initializing Custom Configuration Options ]\n");
- }
- /* custom config setup */
register_config_cli();
- read_config_maps();
check_init(astobj2_init(), "AO2");
check_init(ast_named_locks_init(), "Named Locks");
@@ -4565,32 +4553,10 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou
/* We should avoid most config loads before this point as they can't use realtime. */
check_init(load_modules(1), "Module Preload");
- /* Initialize core modules that have config files. These should be converted to
- * built-in modules with load priority after realtime, that way users will not
- * need to 'preload' realtime modules. */
- check_init(ast_features_init(), "Call Features");
- check_init(dnsmgr_init(), "DNS manager");
- check_init(ast_named_acl_init(), "Named ACL system");
- ast_http_init();
- check_init(ast_indications_init(), "Indication Tone Handling");
- check_init(ast_cdr_engine_init(), "CDR Engine");
- ast_dsp_init();
- ast_udptl_init();
- check_init(ast_cel_engine_init(), "CEL Engine");
- check_init(init_manager(), "Asterisk Manager Interface");
- check_init(ast_enum_init(), "ENUM Support");
- check_init(ast_cc_init(), "Call Completion Supplementary Services");
-
/* Load remaining modules */
check_init(load_modules(0), "Module");
/*
- * This is initialized after the dynamic modules load to avoid repeatedly
- * reindexing sounds for every format module load.
- */
- check_init(ast_sounds_index_init(), "Sounds Indexer");
-
- /*
* This has to load after the dynamic modules load, as items in the media
* cache can't be constructed from items in the AstDB without their
* bucket backends.