#include "asterisk.h"
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.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 | AST_MODFLAG_BUILDSUM, .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 = "361d7bb937402d51e4658efb5b4d76e4" , .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 105 of file app_echo.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 105 of file app_echo.c.
static int echo_exec | ( | struct ast_channel * | chan, | |
void * | data | |||
) | [static] |
Definition at line 54 of file app_echo.c.
References ast_best_codec(), AST_FRAME_DTMF, ast_frfree, ast_module_user_add, ast_module_user_remove, ast_read(), ast_set_read_format(), ast_set_write_format(), ast_waitfor(), ast_write(), ast_module_user::chan, f, format, and ast_channel::nativeformats.
Referenced by load_module().
00055 { 00056 int res = -1; 00057 int format; 00058 struct ast_module_user *u; 00059 00060 u = ast_module_user_add(chan); 00061 00062 format = ast_best_codec(chan->nativeformats); 00063 ast_set_write_format(chan, format); 00064 ast_set_read_format(chan, format); 00065 00066 while (ast_waitfor(chan, -1) > -1) { 00067 struct ast_frame *f = ast_read(chan); 00068 if (!f) { 00069 break; 00070 } 00071 f->delivery.tv_sec = 0; 00072 f->delivery.tv_usec = 0; 00073 if (ast_write(chan, f)) { 00074 ast_frfree(f); 00075 goto end; 00076 } 00077 if ((f->frametype == AST_FRAME_DTMF) && (f->subclass == '#')) { 00078 res = 0; 00079 ast_frfree(f); 00080 goto end; 00081 } 00082 ast_frfree(f); 00083 } 00084 end: 00085 ast_module_user_remove(u); 00086 return res; 00087 }
static int load_module | ( | void | ) | [static] |
Definition at line 100 of file app_echo.c.
References ast_register_application(), and echo_exec().
00101 { 00102 return ast_register_application(app, echo_exec, synopsis, descrip); 00103 }
static int unload_module | ( | void | ) | [static] |
Definition at line 89 of file app_echo.c.
References ast_module_user_hangup_all, and ast_unregister_application().
00090 { 00091 int res; 00092 00093 res = ast_unregister_application(app); 00094 00095 ast_module_user_hangup_all(); 00096 00097 return res; 00098 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .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 = "361d7bb937402d51e4658efb5b4d76e4" , .load = load_module, .unload = unload_module, } [static] |
Definition at line 105 of file app_echo.c.
char* app = "Echo" [static] |
Definition at line 44 of file app_echo.c.
const struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 105 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 48 of file app_echo.c.
char* synopsis = "Echo audio, video, or DTMF back to the calling party" [static] |
Definition at line 46 of file app_echo.c.