app_echo.c File Reference

Echo application -- play back what you hear to evaluate latency. More...

#include "asterisk.h"
#include "asterisk/file.h"
#include "asterisk/module.h"
#include "asterisk/channel.h"

Include dependency graph for app_echo.c:

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 = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
static const char app [] = "Echo"
static struct ast_module_infoast_module_info = &__mod_info


Detailed Description

Echo application -- play back what you hear to evaluate latency.

Author:
Mark Spencer <markster@digium.com>

Definition in file app_echo.c.


Function Documentation

static void __reg_module ( void   )  [static]

Definition at line 97 of file app_echo.c.

static void __unreg_module ( void   )  [static]

Definition at line 97 of file app_echo.c.

static int echo_exec ( struct ast_channel chan,
const char *  data 
) [static]

Definition at line 58 of file app_echo.c.

References AST_FRAME_CONTROL, AST_FRAME_DTMF, AST_FRAME_MODEM, AST_FRAME_NULL, ast_frfree, ast_read(), ast_waitfor(), ast_write(), ast_frame::delivery, end, f, ast_frame::frametype, ast_frame_subclass::integer, and ast_frame::subclass.

Referenced by load_module().

00059 {
00060    int res = -1;
00061 
00062    while (ast_waitfor(chan, -1) > -1) {
00063       struct ast_frame *f = ast_read(chan);
00064       if (!f) {
00065          break;
00066       }
00067       f->delivery.tv_sec = 0;
00068       f->delivery.tv_usec = 0;
00069       if (f->frametype != AST_FRAME_CONTROL
00070          && f->frametype != AST_FRAME_MODEM
00071          && f->frametype != AST_FRAME_NULL
00072          && ast_write(chan, f)) {
00073          ast_frfree(f);
00074          goto end;
00075       }
00076       if ((f->frametype == AST_FRAME_DTMF) && (f->subclass.integer == '#')) {
00077          res = 0;
00078          ast_frfree(f);
00079          goto end;
00080       }
00081       ast_frfree(f);
00082    }
00083 end:
00084    return res;
00085 }

static int load_module ( void   )  [static]

Definition at line 92 of file app_echo.c.

References ast_register_application_xml, and echo_exec().

00093 {
00094    return ast_register_application_xml(app, echo_exec);
00095 }

static int unload_module ( void   )  [static]

Definition at line 87 of file app_echo.c.

References ast_unregister_application().

00088 {
00089    return ast_unregister_application(app);
00090 }


Variable Documentation

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 = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } [static]

Definition at line 97 of file app_echo.c.

const char app[] = "Echo" [static]

Definition at line 56 of file app_echo.c.

Definition at line 97 of file app_echo.c.


Generated on Thu Apr 16 06:28:26 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6