#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, void *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_DEFAULT , .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 = "068e67f60f50dd9ee86464c05884a49d" , .load = load_module, .unload = unload_module, } |
static char * | app = "Echo" |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static char * | descrip |
static char * | synopsis = "Echo audio, video, or DTMF back to the calling party" |
Definition in file app_echo.c.
static void __reg_module | ( | void | ) | [static] |
Definition at line 86 of file app_echo.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 86 of file app_echo.c.
static int echo_exec | ( | struct ast_channel * | chan, | |
void * | data | |||
) | [static] |
Definition at line 46 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(), chan, f, format, and ast_channel::nativeformats.
Referenced by load_module().
00047 { 00048 int res = -1; 00049 int format; 00050 00051 format = ast_best_codec(chan->nativeformats); 00052 ast_set_write_format(chan, format); 00053 ast_set_read_format(chan, format); 00054 00055 while (ast_waitfor(chan, -1) > -1) { 00056 struct ast_frame *f = ast_read(chan); 00057 if (!f) 00058 break; 00059 f->delivery.tv_sec = 0; 00060 f->delivery.tv_usec = 0; 00061 if (ast_write(chan, f)) { 00062 ast_frfree(f); 00063 goto end; 00064 } 00065 if ((f->frametype == AST_FRAME_DTMF) && (f->subclass == '#')) { 00066 res = 0; 00067 ast_frfree(f); 00068 goto end; 00069 } 00070 ast_frfree(f); 00071 } 00072 end: 00073 return res; 00074 }
static int load_module | ( | void | ) | [static] |
Definition at line 81 of file app_echo.c.
References ast_register_application, and echo_exec().
00082 { 00083 return ast_register_application(app, echo_exec, synopsis, descrip); 00084 }
static int unload_module | ( | void | ) | [static] |
Definition at line 76 of file app_echo.c.
References ast_unregister_application().
00077 { 00078 return ast_unregister_application(app); 00079 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .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 = "068e67f60f50dd9ee86464c05884a49d" , .load = load_module, .unload = unload_module, } [static] |
Definition at line 86 of file app_echo.c.
char* app = "Echo" [static] |
Definition at line 36 of file app_echo.c.
const struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 86 of file app_echo.c.
char* descrip [static] |
Initial value:
" Echo(): This application will echo any audio, video, or DTMF frames read from\n" "the calling channel back to itself. If the DTMF digit '#' is received, the\n" "application will exit.\n"
Definition at line 40 of file app_echo.c.
char* synopsis = "Echo audio, video, or DTMF back to the calling party" [static] |
Definition at line 38 of file app_echo.c.