Sat Aug 6 00:39:34 2011

Asterisk developer's documentation


app_ivrdemo.c File Reference

IVR Demo application. More...

#include "asterisk.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/lock.h"
#include "asterisk/app.h"

Go to the source code of this file.

Functions

static void __reg_module (void)
static void __unreg_module (void)
static int ivr_demo_func (struct ast_channel *chan, void *data)
static int load_module (void)
static int skel_exec (struct ast_channel *chan, void *data)
static int unload_module (void)

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "IVR Demo Application" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "361d7bb937402d51e4658efb5b4d76e4" , .load = load_module, .unload = unload_module, }
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 const struct ast_module_infoast_module_info = &__mod_info
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 }
static char * synopsis
static char * tdesc = "IVR Demo Application"


Detailed Description

IVR Demo application.

Author:
Mark Spencer <markster@digium.com>

Definition in file app_ivrdemo.c.


Function Documentation

static void __reg_module ( void   )  [static]

Definition at line 132 of file app_ivrdemo.c.

static void __unreg_module ( void   )  [static]

Definition at line 132 of file app_ivrdemo.c.

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

Definition at line 55 of file app_ivrdemo.c.

References ast_verbose().

00056 {
00057    ast_verbose("IVR Demo, data is %s!\n", (char *)data);
00058    return 0;
00059 }

static int load_module ( void   )  [static]

Definition at line 127 of file app_ivrdemo.c.

References ast_register_application(), and skel_exec().

00128 {
00129    return ast_register_application(app, skel_exec, tdesc, synopsis);
00130 }

static int skel_exec ( struct ast_channel chan,
void *  data 
) [static]

Definition at line 92 of file app_ivrdemo.c.

References ast_channel::_state, ast_answer(), ast_ivr_menu_run(), ast_log(), ast_module_user_add, ast_module_user_remove, AST_STATE_UP, ast_strlen_zero(), ast_module_user::chan, ivr_demo, and LOG_WARNING.

Referenced by load_module().

00093 {
00094    int res=0;
00095    struct ast_module_user *u;
00096    
00097    if (ast_strlen_zero(data)) {
00098       ast_log(LOG_WARNING, "skel requires an argument (filename)\n");
00099       return -1;
00100    }
00101    
00102    u = ast_module_user_add(chan);
00103 
00104    /* Do our thing here */
00105 
00106    if (chan->_state != AST_STATE_UP)
00107       res = ast_answer(chan);
00108    if (!res)
00109       res = ast_ivr_menu_run(chan, &ivr_demo, data);
00110    
00111    ast_module_user_remove(u);
00112 
00113    return res;
00114 }

static int unload_module ( void   )  [static]

Definition at line 116 of file app_ivrdemo.c.

References ast_module_user_hangup_all, and ast_unregister_application().

00117 {
00118    int res;
00119    
00120    res = ast_unregister_application(app);
00121 
00122    ast_module_user_hangup_all();
00123    
00124    return res;
00125 }


Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "IVR Demo Application" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "361d7bb937402d51e4658efb5b4d76e4" , .load = load_module, .unload = unload_module, } [static]

Definition at line 132 of file app_ivrdemo.c.

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 89 of file app_ivrdemo.c.

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 74 of file app_ivrdemo.c.

char* app = "IVRDemo" [static]

Definition at line 50 of file app_ivrdemo.c.

const struct ast_module_info* ast_module_info = &__mod_info [static]

Definition at line 132 of file app_ivrdemo.c.

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

Definition at line 89 of file app_ivrdemo.c.

Referenced by skel_exec().

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

Definition at line 74 of file app_ivrdemo.c.

char* synopsis [static]

Initial value:

 
"  This is a skeleton application that shows you the basic structure to create your\n"
"own asterisk applications and demonstrates the IVR demo.\n"

Definition at line 51 of file app_ivrdemo.c.

char* tdesc = "IVR Demo Application" [static]

Definition at line 49 of file app_ivrdemo.c.


Generated on Sat Aug 6 00:39:34 2011 for Asterisk - the Open Source PBX by  doxygen 1.4.7