aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xMakefile2
-rwxr-xr-xapp.c47
-rwxr-xr-xapps/app_ivrdemo.c21
-rwxr-xr-xcodecs/gsm/Makefile4
-rwxr-xr-xcodecs/ilbc/Makefile2
-rwxr-xr-xinclude/asterisk/app.h3
6 files changed, 56 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index 378a935f3..38e776705 100755
--- a/Makefile
+++ b/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
diff --git a/app.c b/app.c
index cfcb27f6d..5251c3a48 100755
--- a/app.c
+++ b/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;
}
diff --git a/apps/app_ivrdemo.c b/apps/app_ivrdemo.c
index 4dc64f38f..f1a9f086f 100755
--- a/apps/app_ivrdemo.c
+++ b/apps/app_ivrdemo.c
@@ -36,14 +36,17 @@ 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" },
- { "1", AST_ACTION_PLAYBACK, "digits/1" },
- { "1", AST_ACTION_PLAYBACK, "digits/1" },
- { "1", AST_ACTION_RESTART },
- { "2", AST_ACTION_PLAYLIST, "digits/2;digits/3" },
- { "*", AST_ACTION_REPEAT },
- { "#", AST_ACTION_UPONE },
- { NULL }
+ { "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 }
});
AST_IVR_DECLARE_MENU(ivr_demo, "IVR Demo Main Menu", 0,
@@ -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 },
});
diff --git a/codecs/gsm/Makefile b/codecs/gsm/Makefile
index 0bf4c0f8a..5aeb11b84 100755
--- a/codecs/gsm/Makefile
+++ b/codecs/gsm/Makefile
@@ -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)
diff --git a/codecs/ilbc/Makefile b/codecs/ilbc/Makefile
index edb3e63e1..8bccc4a9a 100755
--- a/codecs/ilbc/Makefile
+++ b/codecs/ilbc/Makefile
@@ -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 \
diff --git a/include/asterisk/app.h b/include/asterisk/app.h
index 5dc5fbc51..269980309 100755
--- a/include/asterisk/app.h
+++ b/include/asterisk/app.h
@@ -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 }