Thu Apr 28 2011 16:56:50

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"
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, void *data)
static int load_module (void)
static int unload_module (void)

Variables

static struct ast_module_info
__MODULE_INFO_SECTION 
__mod_info = { __MODULE_INFO_GLOBALS .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Simple Echo Application" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, }
static 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 92 of file app_echo.c.

static void __unreg_module ( void  ) [static]

Definition at line 92 of file app_echo.c.

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

Definition at line 51 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(), ast_frame::delivery, f, format, ast_frame::frametype, ast_channel::nativeformats, and ast_frame::subclass.

Referenced by load_module().

{
   int res = -1;
   int format;

   format = ast_best_codec(chan->nativeformats);
   ast_set_write_format(chan, format);
   ast_set_read_format(chan, format);

   while (ast_waitfor(chan, -1) > -1) {
      struct ast_frame *f = ast_read(chan);
      if (!f) {
         break;
      }
      f->delivery.tv_sec = 0;
      f->delivery.tv_usec = 0;
      if (ast_write(chan, f)) {
         ast_frfree(f);
         goto end;
      }
      if ((f->frametype == AST_FRAME_DTMF) && (f->subclass == '#')) {
         res = 0;
         ast_frfree(f);
         goto end;
      }
      ast_frfree(f);
   }
end:
   return res;
}
static int load_module ( void  ) [static]

Definition at line 87 of file app_echo.c.

References ast_register_application_xml, and echo_exec().

static int unload_module ( void  ) [static]

Definition at line 82 of file app_echo.c.

References ast_unregister_application().


Variable Documentation

struct ast_module_info __MODULE_INFO_SECTION __mod_info = { __MODULE_INFO_GLOBALS .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Simple Echo Application" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, } [static]

Definition at line 92 of file app_echo.c.

char* app = "Echo" [static]

Definition at line 49 of file app_echo.c.

Definition at line 92 of file app_echo.c.