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 | |
AST_MODULE_INFO_STANDARD (ASTERISK_GPL_KEY,"Simple Echo Application") | |
static int | echo_exec (struct ast_channel *chan, const char *data) |
static int | load_module (void) |
static int | unload_module (void) |
Variables | |
static const char | app [] = "Echo" |
Echo application -- play back what you hear to evaluate latency.
Definition in file app_echo.c.
AST_MODULE_INFO_STANDARD | ( | ASTERISK_GPL_KEY | , | |
"Simple Echo Application" | ||||
) |
static int echo_exec | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 58 of file app_echo.c.
References ast_best_codec(), AST_FRAME_CONTROL, AST_FRAME_DTMF, AST_FRAME_MODEM, AST_FRAME_NULL, 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_frame_subclass::integer, ast_channel::nativeformats, and ast_frame::subclass.
Referenced by load_module().
00059 { 00060 int res = -1; 00061 format_t format; 00062 00063 format = ast_best_codec(chan->nativeformats); 00064 ast_set_write_format(chan, format); 00065 ast_set_read_format(chan, format); 00066 00067 while (ast_waitfor(chan, -1) > -1) { 00068 struct ast_frame *f = ast_read(chan); 00069 if (!f) { 00070 break; 00071 } 00072 f->delivery.tv_sec = 0; 00073 f->delivery.tv_usec = 0; 00074 if (f->frametype != AST_FRAME_CONTROL 00075 && f->frametype != AST_FRAME_MODEM 00076 && f->frametype != AST_FRAME_NULL 00077 && ast_write(chan, f)) { 00078 ast_frfree(f); 00079 goto end; 00080 } 00081 if ((f->frametype == AST_FRAME_DTMF) && (f->subclass.integer == '#')) { 00082 res = 0; 00083 ast_frfree(f); 00084 goto end; 00085 } 00086 ast_frfree(f); 00087 } 00088 end: 00089 return res; 00090 }
static int load_module | ( | void | ) | [static] |
Definition at line 97 of file app_echo.c.
References ast_register_application_xml, and echo_exec().
00098 { 00099 return ast_register_application_xml(app, echo_exec); 00100 }
static int unload_module | ( | void | ) | [static] |
Definition at line 92 of file app_echo.c.
References ast_unregister_application().
00093 { 00094 return ast_unregister_application(app); 00095 }
const char app[] = "Echo" [static] |
Definition at line 56 of file app_echo.c.