00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "asterisk.h"
00034
00035 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 328209 $")
00036
00037 #include "asterisk/file.h"
00038 #include "asterisk/channel.h"
00039 #include "asterisk/pbx.h"
00040 #include "asterisk/module.h"
00041 #include "asterisk/lock.h"
00042 #include "asterisk/app.h"
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 static char *app = "IVRDemo";
00060
00061 static int ivr_demo_func(struct ast_channel *chan, void *data)
00062 {
00063 ast_verbose("IVR Demo, data is %s!\n", (char *) data);
00064 return 0;
00065 }
00066
00067 AST_IVR_DECLARE_MENU(ivr_submenu, "IVR Demo Sub Menu", 0,
00068 {
00069 { "s", AST_ACTION_BACKGROUND, "demo-abouttotry" },
00070 { "s", AST_ACTION_WAITOPTION },
00071 { "1", AST_ACTION_PLAYBACK, "digits/1" },
00072 { "1", AST_ACTION_PLAYBACK, "digits/1" },
00073 { "1", AST_ACTION_RESTART },
00074 { "2", AST_ACTION_PLAYLIST, "digits/2;digits/3" },
00075 { "3", AST_ACTION_CALLBACK, ivr_demo_func },
00076 { "4", AST_ACTION_TRANSFER, "demo|s|1" },
00077 { "*", AST_ACTION_REPEAT },
00078 { "#", AST_ACTION_UPONE },
00079 { NULL }
00080 });
00081
00082 AST_IVR_DECLARE_MENU(ivr_demo, "IVR Demo Main Menu", 0,
00083 {
00084 { "s", AST_ACTION_BACKGROUND, "demo-congrats" },
00085 { "g", AST_ACTION_BACKGROUND, "demo-instruct" },
00086 { "g", AST_ACTION_WAITOPTION },
00087 { "1", AST_ACTION_PLAYBACK, "digits/1" },
00088 { "1", AST_ACTION_RESTART },
00089 { "2", AST_ACTION_MENU, &ivr_submenu },
00090 { "2", AST_ACTION_RESTART },
00091 { "i", AST_ACTION_PLAYBACK, "invalid" },
00092 { "i", AST_ACTION_REPEAT, (void *)(unsigned long)2 },
00093 { "#", AST_ACTION_EXIT },
00094 { NULL },
00095 });
00096
00097 static int skel_exec(struct ast_channel *chan, const char *data)
00098 {
00099 int res=0;
00100 char *tmp;
00101
00102 if (ast_strlen_zero(data)) {
00103 ast_log(LOG_WARNING, "skel requires an argument (filename)\n");
00104 return -1;
00105 }
00106
00107 tmp = ast_strdupa(data);
00108
00109
00110
00111 if (chan->_state != AST_STATE_UP)
00112 res = ast_answer(chan);
00113 if (!res)
00114 res = ast_ivr_menu_run(chan, &ivr_demo, tmp);
00115
00116 return res;
00117 }
00118
00119 static int unload_module(void)
00120 {
00121 return ast_unregister_application(app);
00122 }
00123
00124 static int load_module(void)
00125 {
00126 return ast_register_application_xml(app, skel_exec);
00127 }
00128
00129 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "IVR Demo Application");