Fix build of new IVR stuff for GCC 2.96 and later gcc's too (bug #3639)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5091 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2005-02-26 19:06:09 +00:00
parent c021ec56e3
commit 6a79d3a18f
2 changed files with 20 additions and 15 deletions

View File

@@ -34,8 +34,8 @@ static int ivr_demo_func(struct ast_channel *chan, void *data)
return 0; return 0;
} }
static struct ast_ivr_menu ivr_submenu = { AST_IVR_DECLARE_MENU(ivr_submenu, "IVR Demo Sub Menu", 0,
"IVR Demo Sub Menu", 0, { {
{ "s", AST_ACTION_BACKGROUND, "demo-abouttotry" }, { "s", AST_ACTION_BACKGROUND, "demo-abouttotry" },
{ "1", AST_ACTION_PLAYBACK, "digits/1" }, { "1", AST_ACTION_PLAYBACK, "digits/1" },
{ "1", AST_ACTION_PLAYBACK, "digits/1" }, { "1", AST_ACTION_PLAYBACK, "digits/1" },
@@ -43,11 +43,11 @@ static struct ast_ivr_menu ivr_submenu = {
{ "2", AST_ACTION_PLAYLIST, "digits/2;digits/3" }, { "2", AST_ACTION_PLAYLIST, "digits/2;digits/3" },
{ "*", AST_ACTION_REPEAT }, { "*", AST_ACTION_REPEAT },
{ "#", AST_ACTION_UPONE }, { "#", AST_ACTION_UPONE },
{ NULL }, { NULL }
}}; });
static struct ast_ivr_menu ivr_demo = { AST_IVR_DECLARE_MENU(ivr_demo, "IVR Demo Main Menu", 0,
"IVR Demo Main Menu", 0, { {
{ "s", AST_ACTION_BACKGROUND, "demo-congrats" }, { "s", AST_ACTION_BACKGROUND, "demo-congrats" },
{ "g", AST_ACTION_BACKGROUND, "demo-instruct" }, { "g", AST_ACTION_BACKGROUND, "demo-instruct" },
{ "g", AST_ACTION_WAITOPTION }, { "g", AST_ACTION_WAITOPTION },
@@ -59,7 +59,7 @@ static struct ast_ivr_menu ivr_demo = {
{ "i", AST_ACTION_REPEAT, (void *)2 }, { "i", AST_ACTION_REPEAT, (void *)2 },
{ "#", AST_ACTION_EXIT }, { "#", AST_ACTION_EXIT },
{ NULL }, { NULL },
}}; });
STANDARD_LOCAL_USER; STANDARD_LOCAL_USER;

View File

@@ -59,9 +59,14 @@ struct ast_ivr_option {
struct ast_ivr_menu { struct ast_ivr_menu {
char *title; /* Title of menu */ char *title; /* Title of menu */
unsigned int flags; /* Flags */ unsigned int flags; /* Flags */
struct ast_ivr_option options[]; /* All options */ struct ast_ivr_option *options; /* All options */
}; };
#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 }
/*! Runs an IVR menu, returns 0 on successful completion, -1 on hangup, or -2 on user error in menu */ /*! Runs an IVR menu, returns 0 on successful completion, -1 on hangup, or -2 on user error in menu */
extern int ast_ivr_menu_run(struct ast_channel *c, struct ast_ivr_menu *menu, void *cbdata); extern int ast_ivr_menu_run(struct ast_channel *c, struct ast_ivr_menu *menu, void *cbdata);