Asterisk - The Open Source Telephony Project GIT-master-8f1982c
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
Functions | Variables
app_ivrdemo.c File Reference

IVR Demo application. More...

#include "asterisk.h"
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/lock.h"
#include "asterisk/app.h"
Include dependency graph for app_ivrdemo.c:

Go to the source code of this file.

Functions

 AST_MODULE_INFO_STANDARD_EXTENDED (ASTERISK_GPL_KEY, "IVR Demo Application")
 
static int ivr_demo_func (struct ast_channel *chan, void *data)
 
static int load_module (void)
 
static int skel_exec (struct ast_channel *chan, const char *data)
 
static int unload_module (void)
 

Variables

static struct ast_ivr_option __options_ivr_demo [] = { { "s", AST_ACTION_BACKGROUND, "demo-congrats" }, { "g", AST_ACTION_BACKGROUND, "demo-instruct" }, { "g", AST_ACTION_WAITOPTION }, { "1", AST_ACTION_PLAYBACK, "digits/1" }, { "1", AST_ACTION_RESTART }, { "2", AST_ACTION_MENU, &ivr_submenu }, { "2", AST_ACTION_RESTART }, { "i", AST_ACTION_PLAYBACK, "invalid" }, { "i", AST_ACTION_REPEAT, (void *)(unsigned long)2 }, { "#", AST_ACTION_EXIT }, { NULL }, }
 
static struct ast_ivr_option __options_ivr_submenu [] = { { "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 } }
 
static char * app = "IVRDemo"
 
static struct ast_ivr_menu ivr_demo = { "IVR Demo Main Menu" , 0 , __options_ivr_demo }
 
static struct ast_ivr_menu ivr_submenu = { "IVR Demo Sub Menu" , 0 , __options_ivr_submenu }
 

Detailed Description

IVR Demo application.

Author
Mark Spencer marks.nosp@m.ter@.nosp@m.digiu.nosp@m.m.co.nosp@m.m

Definition in file app_ivrdemo.c.

Function Documentation

◆ AST_MODULE_INFO_STANDARD_EXTENDED()

AST_MODULE_INFO_STANDARD_EXTENDED ( ASTERISK_GPL_KEY  ,
"IVR Demo Application"   
)

◆ ivr_demo_func()

static int ivr_demo_func ( struct ast_channel chan,
void *  data 
)
static

Definition at line 62 of file app_ivrdemo.c.

63{
64 ast_verbose("IVR Demo, data is %s!\n", (char *) data);
65 return 0;
66}
void ast_verbose(const char *fmt,...)
Definition: extconf.c:2206

References ast_verbose().

◆ load_module()

static int load_module ( void  )
static

Definition at line 125 of file app_ivrdemo.c.

126{
128}
static int skel_exec(struct ast_channel *chan, const char *data)
Definition: app_ivrdemo.c:98
static char * app
Definition: app_ivrdemo.c:60
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Definition: module.h:640

References app, ast_register_application_xml, and skel_exec().

◆ skel_exec()

static int skel_exec ( struct ast_channel chan,
const char *  data 
)
static

Definition at line 98 of file app_ivrdemo.c.

99{
100 int res=0;
101 char *tmp;
102
103 if (ast_strlen_zero(data)) {
104 ast_log(LOG_WARNING, "skel requires an argument (filename)\n");
105 return -1;
106 }
107
108 tmp = ast_strdupa(data);
109
110 /* Do our thing here */
111
112 if (ast_channel_state(chan) != AST_STATE_UP)
113 res = ast_answer(chan);
114 if (!res)
115 res = ast_ivr_menu_run(chan, &ivr_demo, tmp);
116
117 return res;
118}
static struct ast_ivr_menu ivr_demo
Definition: app_ivrdemo.c:96
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:298
#define ast_log
Definition: astobj2.c:42
int ast_answer(struct ast_channel *chan)
Answer a channel.
Definition: channel.c:2774
ast_channel_state
ast_channel states
Definition: channelstate.h:35
@ AST_STATE_UP
Definition: channelstate.h:42
int ast_ivr_menu_run(struct ast_channel *c, struct ast_ivr_menu *menu, void *cbdata)
Runs an IVR menu.
Definition: main/app.c:2942
#define LOG_WARNING
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:65

References ast_answer(), ast_ivr_menu_run(), ast_log, AST_STATE_UP, ast_strdupa, ast_strlen_zero(), ivr_demo, and LOG_WARNING.

Referenced by load_module().

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 120 of file app_ivrdemo.c.

121{
123}
int ast_unregister_application(const char *app)
Unregister an application.
Definition: pbx_app.c:392

References app, and ast_unregister_application().

Variable Documentation

◆ __options_ivr_demo

struct ast_ivr_option __options_ivr_demo[] = { { "s", AST_ACTION_BACKGROUND, "demo-congrats" }, { "g", AST_ACTION_BACKGROUND, "demo-instruct" }, { "g", AST_ACTION_WAITOPTION }, { "1", AST_ACTION_PLAYBACK, "digits/1" }, { "1", AST_ACTION_RESTART }, { "2", AST_ACTION_MENU, &ivr_submenu }, { "2", AST_ACTION_RESTART }, { "i", AST_ACTION_PLAYBACK, "invalid" }, { "i", AST_ACTION_REPEAT, (void *)(unsigned long)2 }, { "#", AST_ACTION_EXIT }, { NULL }, }
static

Definition at line 96 of file app_ivrdemo.c.

◆ __options_ivr_submenu

struct ast_ivr_option __options_ivr_submenu[] = { { "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 } }
static

Definition at line 81 of file app_ivrdemo.c.

◆ app

char* app = "IVRDemo"
static

Definition at line 60 of file app_ivrdemo.c.

Referenced by load_module(), and unload_module().

◆ ivr_demo

struct ast_ivr_menu ivr_demo = { "IVR Demo Main Menu" , 0 , __options_ivr_demo }
static

Definition at line 96 of file app_ivrdemo.c.

Referenced by skel_exec().

◆ ivr_submenu

struct ast_ivr_menu ivr_submenu = { "IVR Demo Sub Menu" , 0 , __options_ivr_submenu }
static

Definition at line 81 of file app_ivrdemo.c.