#include "asterisk.h"
#include "asterisk/file.h"
#include "asterisk/module.h"
#include "asterisk/channel.h"
Go to the source code of this file.
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | echo_exec (struct ast_channel *chan, const char *data) |
static int | load_module (void) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Simple Echo 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 = "8586c2a7d357cb591cc3a6607a8f62d1" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } |
static const char | app [] = "Echo" |
static struct ast_module_info * | ast_module_info = &__mod_info |
Definition in file app_echo.c.
static void __reg_module | ( | void | ) | [static] |
Definition at line 92 of file app_echo.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 92 of file app_echo.c.
static int echo_exec | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 51 of file app_echo.c.
References ast_best_codec(), AST_FRAME_DTMF, ast_frfree, ast_read(), ast_set_read_format(), ast_set_write_format(), ast_waitfor(), ast_write(), f, format, and ast_channel::nativeformats.
Referenced by load_module().
00052 { 00053 int res = -1; 00054 format_t format; 00055 00056 format = ast_best_codec(chan->nativeformats); 00057 ast_set_write_format(chan, format); 00058 ast_set_read_format(chan, format); 00059 00060 while (ast_waitfor(chan, -1) > -1) { 00061 struct ast_frame *f = ast_read(chan); 00062 if (!f) { 00063 break; 00064 } 00065 f->delivery.tv_sec = 0; 00066 f->delivery.tv_usec = 0; 00067 if (ast_write(chan, f)) { 00068 ast_frfree(f); 00069 goto end; 00070 } 00071 if ((f->frametype == AST_FRAME_DTMF) && (f->subclass.integer == '#')) { 00072 res = 0; 00073 ast_frfree(f); 00074 goto end; 00075 } 00076 ast_frfree(f); 00077 } 00078 end: 00079 return res; 00080 }
static int load_module | ( | void | ) | [static] |
Definition at line 87 of file app_echo.c.
References ast_register_application_xml, and echo_exec().
00088 { 00089 return ast_register_application_xml(app, echo_exec); 00090 }
static int unload_module | ( | void | ) | [static] |
Definition at line 82 of file app_echo.c.
References ast_unregister_application().
00083 { 00084 return ast_unregister_application(app); 00085 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Simple Echo 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 = "8586c2a7d357cb591cc3a6607a8f62d1" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } [static] |
Definition at line 92 of file app_echo.c.
const char app[] = "Echo" [static] |
Definition at line 49 of file app_echo.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 92 of file app_echo.c.