Sat Mar 10 01:54:31 2012

Asterisk developer's documentation


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"

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 = "88eaa8f5c1bd988bedd71113385e0886" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, }
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 98 of file app_echo.c.

static void __unreg_module ( void   )  [static]

Definition at line 98 of file app_echo.c.

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

Definition at line 57 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().

00058 {
00059    int res = -1;
00060    format_t format;
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.integer == '#')) {
00078          res = 0;
00079          ast_frfree(f);
00080          goto end;
00081       }
00082       ast_frfree(f);
00083    }
00084 end:
00085    return res;
00086 }

static int load_module ( void   )  [static]

Definition at line 93 of file app_echo.c.

References ast_register_application_xml, and echo_exec().

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

static int unload_module ( void   )  [static]

Definition at line 88 of file app_echo.c.

References ast_unregister_application().

00089 {
00090    return ast_unregister_application(app);
00091 }


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 = "88eaa8f5c1bd988bedd71113385e0886" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } [static]

Definition at line 98 of file app_echo.c.

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

Definition at line 55 of file app_echo.c.

struct ast_module_info* ast_module_info = &__mod_info [static]

Definition at line 98 of file app_echo.c.


Generated on Sat Mar 10 01:54:31 2012 for Asterisk - The Open Source Telephony Project by  doxygen 1.4.7