mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Flush out app stuff, make profiling easier to turn on/off
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5150 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
2
Makefile
2
Makefile
@@ -199,7 +199,7 @@ CFLAGS+= $(TRACE_FRAMES)
|
||||
CFLAGS+= $(MALLOC_DEBUG)
|
||||
CFLAGS+= $(BUSYDETECT)
|
||||
CFLAGS+= $(OPTIONS)
|
||||
CFLAGS+=# -fomit-frame-pointer
|
||||
CFLAGS+= -fomit-frame-pointer
|
||||
SUBDIRS=res channels pbx apps codecs formats agi cdr utils stdtime
|
||||
ifeq (${OSARCH},Linux)
|
||||
LIBS=-ldl -lpthread
|
||||
|
47
app.c
47
app.c
@@ -1227,6 +1227,10 @@ static int ast_ivr_menu_run_internal(struct ast_channel *chan, struct ast_ivr_me
|
||||
static int ivr_dispatch(struct ast_channel *chan, struct ast_ivr_option *option, char *exten, void *cbdata)
|
||||
{
|
||||
int res;
|
||||
int (*ivr_func)(struct ast_channel *, void *);
|
||||
char *c;
|
||||
char *n;
|
||||
|
||||
switch(option->action) {
|
||||
case AST_ACTION_UPONE:
|
||||
return RES_UPONE;
|
||||
@@ -1258,13 +1262,33 @@ static int ivr_dispatch(struct ast_channel *chan, struct ast_ivr_option *option,
|
||||
return res;
|
||||
case AST_ACTION_MENU:
|
||||
res = ast_ivr_menu_run_internal(chan, (struct ast_ivr_menu *)option->adata, cbdata);
|
||||
/* Do not pass entry errors back up, treaat ast though ti was an "UPONE" */
|
||||
if (res == -2)
|
||||
res = 0;
|
||||
return res;
|
||||
case AST_ACTION_WAITOPTION:
|
||||
res = ast_waitfordigit(chan, 1000 * (chan->pbx ? chan->pbx->rtimeout : 10));
|
||||
if (!res)
|
||||
return 't';
|
||||
return res;
|
||||
case AST_ACTION_CALLBACK:
|
||||
case AST_ACTION_PLAYLIST:
|
||||
ivr_func = option->adata;
|
||||
res = ivr_func(chan, cbdata);
|
||||
return res;
|
||||
case AST_ACTION_TRANSFER:
|
||||
case AST_ACTION_WAITOPTION:
|
||||
ast_log(LOG_NOTICE, "Unimplemented dispatch function %d, ignoring!\n", option->action);
|
||||
res = ast_parseable_goto(chan, option->adata);
|
||||
return 0;
|
||||
case AST_ACTION_PLAYLIST:
|
||||
case AST_ACTION_BACKLIST:
|
||||
res = 0;
|
||||
c = ast_strdupa(option->adata);
|
||||
if (c) {
|
||||
while((n = strsep(&c, ";")))
|
||||
if ((res = ast_streamfile(chan, n, chan->language)) || (res = ast_waitstream(chan, (option->action == AST_ACTION_BACKLIST) ? AST_DIGIT_ANY : "")))
|
||||
break;
|
||||
ast_stopstream(chan);
|
||||
}
|
||||
return res;
|
||||
default:
|
||||
ast_log(LOG_NOTICE, "Unknown dispatch function %d, ignoring!\n", option->action);
|
||||
return 0;
|
||||
@@ -1326,6 +1350,7 @@ static int ast_ivr_menu_run_internal(struct ast_channel *chan, struct ast_ivr_me
|
||||
while(menu->options[pos].option) {
|
||||
if (!strcasecmp(menu->options[pos].option, exten)) {
|
||||
res = ivr_dispatch(chan, menu->options + pos, exten, cbdata);
|
||||
ast_log(LOG_DEBUG, "IVR Dispatch of '%s' (pos %d) yields %d\n", exten, pos, res);
|
||||
if (res < 0)
|
||||
break;
|
||||
else if (res & RES_UPONE)
|
||||
@@ -1334,29 +1359,32 @@ static int ast_ivr_menu_run_internal(struct ast_channel *chan, struct ast_ivr_me
|
||||
return res;
|
||||
else if (res & RES_REPEAT) {
|
||||
int maxretries = res & 0xffff;
|
||||
if (res & RES_RESTART)
|
||||
if ((res & RES_RESTART) == RES_RESTART) {
|
||||
retries = 0;
|
||||
else
|
||||
} else
|
||||
retries++;
|
||||
if (!maxretries)
|
||||
maxretries = 3;
|
||||
if ((maxretries > 0) && (retries >= maxretries))
|
||||
if ((maxretries > 0) && (retries >= maxretries)) {
|
||||
ast_log(LOG_DEBUG, "Max retries %d exceeded\n", maxretries);
|
||||
return -2;
|
||||
else {
|
||||
} else {
|
||||
if (option_exists(menu, "g") > -1)
|
||||
strcpy(exten, "g");
|
||||
else if (option_exists(menu, "s") > -1)
|
||||
strcpy(exten, "s");
|
||||
}
|
||||
pos=0;
|
||||
continue;
|
||||
} else if (res && strchr(AST_DIGIT_ANY, res)) {
|
||||
ast_log(LOG_DEBUG, "Got start of extension, %c\n", res);
|
||||
exten[1] = '\0';
|
||||
exten[0] = res;
|
||||
if ((res = read_newoption(chan, menu, exten, sizeof(exten))))
|
||||
break;
|
||||
if (!option_exists(menu, exten)) {
|
||||
if (option_exists(menu, exten) < 0) {
|
||||
if (option_exists(menu, "i")) {
|
||||
ast_log(LOG_DEBUG, "Invalid extension entered, going to 'i'!\n");
|
||||
strcpy(exten, "i");
|
||||
pos = 0;
|
||||
continue;
|
||||
@@ -1366,6 +1394,7 @@ static int ast_ivr_menu_run_internal(struct ast_channel *chan, struct ast_ivr_me
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
ast_log(LOG_DEBUG, "New existing extension: %s\n", exten);
|
||||
pos = 0;
|
||||
continue;
|
||||
}
|
||||
@@ -1377,8 +1406,6 @@ static int ast_ivr_menu_run_internal(struct ast_channel *chan, struct ast_ivr_me
|
||||
pos = 0;
|
||||
if (!strcasecmp(exten, "s"))
|
||||
strcpy(exten, "g");
|
||||
else if (strcasecmp(exten, "t"))
|
||||
strcpy(exten, "t");
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
@@ -37,10 +37,13 @@ static int ivr_demo_func(struct ast_channel *chan, void *data)
|
||||
AST_IVR_DECLARE_MENU(ivr_submenu, "IVR Demo Sub Menu", 0,
|
||||
{
|
||||
{ "s", AST_ACTION_BACKGROUND, "demo-abouttotry" },
|
||||
{ "s", AST_ACTION_WAITOPTION },
|
||||
{ "1", AST_ACTION_PLAYBACK, "digits/1" },
|
||||
{ "1", AST_ACTION_PLAYBACK, "digits/1" },
|
||||
{ "1", AST_ACTION_RESTART },
|
||||
{ "2", AST_ACTION_PLAYLIST, "digits/2;digits/3" },
|
||||
{ "3", AST_ACTION_CALLBACK, ivr_demo_func },
|
||||
{ "4", AST_ACTION_TRANSFER, "demo|s|1" },
|
||||
{ "*", AST_ACTION_REPEAT },
|
||||
{ "#", AST_ACTION_UPONE },
|
||||
{ NULL }
|
||||
@@ -56,7 +59,7 @@ AST_IVR_DECLARE_MENU(ivr_demo, "IVR Demo Main Menu", 0,
|
||||
{ "2", AST_ACTION_MENU, &ivr_submenu },
|
||||
{ "2", AST_ACTION_RESTART },
|
||||
{ "i", AST_ACTION_PLAYBACK, "invalid" },
|
||||
{ "i", AST_ACTION_REPEAT, (void *)2 },
|
||||
{ "i", AST_ACTION_REPEAT, (void *)(unsigned long)2 },
|
||||
{ "#", AST_ACTION_EXIT },
|
||||
{ NULL },
|
||||
});
|
||||
|
@@ -61,7 +61,7 @@ endif
|
||||
#So we go lowest common available by gcc and go a step down, still a step up from
|
||||
#the default as we now have a better instruction set to work with. - Belgarath
|
||||
ifeq (${PROC},ultrasparc)
|
||||
OPTIMIZE+=-mcpu=v8 -mtune=$(PROC) -O3 -fomit-frame-pointer
|
||||
OPTIMIZE+=-mcpu=v8 -mtune=$(PROC) -O3
|
||||
endif
|
||||
|
||||
PG =
|
||||
@@ -82,7 +82,7 @@ PG =
|
||||
# CCFLAGS = -c -O
|
||||
|
||||
CC ?= gcc
|
||||
CCFLAGS += -c -DNeedFunctionPrototypes=1 -funroll-loops -fPIC $(OPTIMIZE) -fomit-frame-pointer
|
||||
CCFLAGS += -c -DNeedFunctionPrototypes=1 -funroll-loops -fPIC $(OPTIMIZE)
|
||||
|
||||
LD = $(CC)
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
ARCH=$(PROC)
|
||||
CFLAGS+=-Wall -fPIC -O3 -funroll-loops -fomit-frame-pointer
|
||||
CFLAGS+=-Wall -fPIC -O3 -funroll-loops
|
||||
LIB=libilbc.a
|
||||
|
||||
OBJS= anaFilter.o iCBSearch.o packing.o \
|
||||
|
@@ -38,6 +38,7 @@ typedef enum {
|
||||
AST_ACTION_TRANSFER, /* adata is a string with exten[@context] */
|
||||
AST_ACTION_WAITOPTION, /* adata is a timeout, or 0 for defaults */
|
||||
AST_ACTION_NOOP, /* adata is unused */
|
||||
AST_ACTION_BACKLIST, /* adata is list of files separated by ; allows interruption */
|
||||
} ast_ivr_action;
|
||||
|
||||
struct ast_ivr_option {
|
||||
@@ -62,6 +63,8 @@ struct ast_ivr_menu {
|
||||
struct ast_ivr_option *options; /* All options */
|
||||
};
|
||||
|
||||
#define AST_IVR_FLAG_AUTORESTART (1 << 0)
|
||||
|
||||
#define AST_IVR_DECLARE_MENU(holder,title,flags,foo...) \
|
||||
static struct ast_ivr_option __options_##holder[] = foo;\
|
||||
static struct ast_ivr_menu holder = { title, flags, __options_##holder }
|
||||
|
Reference in New Issue
Block a user