Optionally display the value of several variables within the Status command.
[asterisk-bristuff.git] / apps / app_ivrdemo.c
blob6dbbe7191e9b2aaa706bbf825e10b273fcababe0
1 /*
2 * Asterisk -- An open source telephony toolkit.
4 * Copyright (C) 1999 - 2005, Digium, Inc.
6 * Mark Spencer <markster@digium.com>
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
19 /*! \file
21 * \brief IVR Demo application
23 * \author Mark Spencer <markster@digium.com>
25 * \ingroup applications
28 /*** MODULEINFO
29 <defaultenabled>no</defaultenabled>
30 ***/
32 #include "asterisk.h"
34 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
36 #include "asterisk/file.h"
37 #include "asterisk/channel.h"
38 #include "asterisk/pbx.h"
39 #include "asterisk/module.h"
40 #include "asterisk/lock.h"
41 #include "asterisk/app.h"
43 static char *tdesc = "IVR Demo Application";
44 static char *app = "IVRDemo";
45 static char *synopsis =
46 " This is a skeleton application that shows you the basic structure to create your\n"
47 "own asterisk applications and demonstrates the IVR demo.\n";
49 static int ivr_demo_func(struct ast_channel *chan, void *data)
51 ast_verbose("IVR Demo, data is %s!\n", (char *)data);
52 return 0;
55 AST_IVR_DECLARE_MENU(ivr_submenu, "IVR Demo Sub Menu", 0,
57 { "s", AST_ACTION_BACKGROUND, "demo-abouttotry" },
58 { "s", AST_ACTION_WAITOPTION },
59 { "1", AST_ACTION_PLAYBACK, "digits/1" },
60 { "1", AST_ACTION_PLAYBACK, "digits/1" },
61 { "1", AST_ACTION_RESTART },
62 { "2", AST_ACTION_PLAYLIST, "digits/2;digits/3" },
63 { "3", AST_ACTION_CALLBACK, ivr_demo_func },
64 { "4", AST_ACTION_TRANSFER, "demo|s|1" },
65 { "*", AST_ACTION_REPEAT },
66 { "#", AST_ACTION_UPONE },
67 { NULL }
68 });
70 AST_IVR_DECLARE_MENU(ivr_demo, "IVR Demo Main Menu", 0,
72 { "s", AST_ACTION_BACKGROUND, "demo-congrats" },
73 { "g", AST_ACTION_BACKGROUND, "demo-instruct" },
74 { "g", AST_ACTION_WAITOPTION },
75 { "1", AST_ACTION_PLAYBACK, "digits/1" },
76 { "1", AST_ACTION_RESTART },
77 { "2", AST_ACTION_MENU, &ivr_submenu },
78 { "2", AST_ACTION_RESTART },
79 { "i", AST_ACTION_PLAYBACK, "invalid" },
80 { "i", AST_ACTION_REPEAT, (void *)(unsigned long)2 },
81 { "#", AST_ACTION_EXIT },
82 { NULL },
83 });
86 static int skel_exec(struct ast_channel *chan, void *data)
88 int res=0;
90 if (ast_strlen_zero(data)) {
91 ast_log(LOG_WARNING, "skel requires an argument (filename)\n");
92 return -1;
95 /* Do our thing here */
97 if (chan->_state != AST_STATE_UP)
98 res = ast_answer(chan);
99 if (!res)
100 res = ast_ivr_menu_run(chan, &ivr_demo, data);
102 return res;
105 static int unload_module(void)
107 return ast_unregister_application(app);
110 static int load_module(void)
112 return ast_register_application(app, skel_exec, tdesc, synopsis);
115 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "IVR Demo Application");