61 static const char app[] =
"Dictate";
76 #define ast_toggle_flag(it,flag) if(ast_test_flag(it, flag)) ast_clear_flag(it, flag); else ast_set_flag(it, flag) 89 char *path =
NULL, filein[256], *filename =
"";
100 int ffactor = 320 * 80,
124 if (
args.argc > 1 &&
args.filename) {
125 filename =
args.filename;
138 for (res = 0; !res;) {
140 if (
ast_app_getdata(chan,
"dictate/enter_filename", filein,
sizeof(filein), 0) ||
150 len = strlen(base) + strlen(filein) + 2;
151 if (!path ||
len > maxlen) {
154 memset(path, 0,
len);
157 memset(path, 0, maxlen);
160 snprintf(path,
len,
"%s/%s", base, filein);
163 memset(&flags, 0,
sizeof(flags));
253 }
else if (
digit < 0) {
271 }
else if (
digit < 0) {
287 for (x = 0; x < speed; x++) {
302 int oflags = O_CREAT | O_WRONLY;
307 }
else if (
digit < 0) {
int ast_safe_sleep(struct ast_channel *chan, int ms)
Wait for a specified amount of time, looking for hangups.
AST_MODULE_INFO_STANDARD_EXTENDED(ASTERISK_GPL_KEY, "Virtual Dictation Machine")
Main Channel structure associated with a channel.
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
Asterisk main include file. File version handling, generic pbx functions.
#define ast_test_flag(p, flag)
#define ast_toggle_flag(it, flag)
#define ast_set_flag(p, flag)
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
ast_channel_state
ast_channel states
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
int ast_unregister_application(const char *app)
Unregister an application.
struct ast_frame_subclass subclass
#define ast_strlen_zero(foo)
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
void ast_channel_stream_set(struct ast_channel *chan, struct ast_filestream *value)
Asterisk file paths, configured in asterisk.conf.
int ast_set_read_format(struct ast_channel *chan, struct ast_format *format)
Sets read format on channel chan.
#define ao2_ref(o, delta)
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ast_malloc(len)
A wrapper for malloc()
Core PBX routines and definitions.
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel's frame queue.
static int play_and_wait(struct ast_channel *chan, char *file, char *digits)
struct ast_frame * ast_readframe(struct ast_filestream *s)
Read a frame from a filestream.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
struct ast_filestream * ast_writefile(const char *filename, const char *type, const char *comment, int flags, int check, mode_t mode)
Starts writing a file.
static int load_module(void)
int ast_seekstream(struct ast_filestream *fs, off_t sample_offset, int whence)
Seeks into stream.
static void parse(struct mgcp_request *req)
int ast_closestream(struct ast_filestream *f)
Closes a stream.
int ast_write(struct ast_channel *chan, struct ast_frame *frame)
Write a frame to a channel This function writes the given frame to the indicated channel.
const char * ast_config_AST_SPOOL_DIR
int ast_app_getdata(struct ast_channel *c, const char *prompt, char *s, int maxlen, int timeout)
Plays a stream and gets DTMF data from a channel.
Structure used to handle boolean flags.
#define ast_clear_flag(p, flag)
This structure is allocated by file.c in one chunk, together with buf_size and desc_size bytes of mem...
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
int ast_say_number(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options)
says a number
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
int ast_writestream(struct ast_filestream *fs, struct ast_frame *f)
Writes a frame to a stream.
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
int ast_answer(struct ast_channel *chan)
Answer a channel.
Data structure associated with a single frame of data.
const char * ast_channel_language(const struct ast_channel *chan)
static int dictate_exec(struct ast_channel *chan, const char *data)
static int unload_module(void)
enum ast_frame_type frametype
Say numbers and dates (maybe words one day too)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
struct ast_filestream * ast_openstream(struct ast_channel *chan, const char *filename, const char *preflang)
Opens stream for use in seeking, playing.
#define AST_APP_ARG(name)
Define an application argument.
int ast_mkdir(const char *path, int mode)
Recursively create directory path.