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