#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 = "6989f2ec67f8497e38c12890500c525b" , .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 104 of file app_echo.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 104 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 f->delivery.tv_sec = 0; 00071 f->delivery.tv_usec = 0; 00072 if (ast_write(chan, f)) { 00073 ast_frfree(f); 00074 goto end; 00075 } 00076 if ((f->frametype == AST_FRAME_DTMF) && (f->subclass == '#')) { 00077 res = 0; 00078 ast_frfree(f); 00079 goto end; 00080 } 00081 ast_frfree(f); 00082 } 00083 end: 00084 ast_module_user_remove(u); 00085 return res; 00086 }
static int load_module | ( | void | ) | [static] |
Definition at line 99 of file app_echo.c.
References ast_register_application(), and echo_exec().
00100 { 00101 return ast_register_application(app, echo_exec, synopsis, descrip); 00102 }
static int unload_module | ( | void | ) | [static] |
Definition at line 88 of file app_echo.c.
References ast_module_user_hangup_all, and ast_unregister_application().
00089 { 00090 int res; 00091 00092 res = ast_unregister_application(app); 00093 00094 ast_module_user_hangup_all(); 00095 00096 return res; 00097 }
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 = "6989f2ec67f8497e38c12890500c525b" , .load = load_module, .unload = unload_module, } [static] |
Definition at line 104 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 104 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.