23 #ifndef _ASTERISK_SPEECH_H
24 #define _ASTERISK_SPEECH_H
26 #if defined(__cplusplus) || defined(c_plusplus)
31 enum ast_speech_flags {
32 AST_SPEECH_QUIET = (1 << 0),
33 AST_SPEECH_SPOKE = (1 << 1),
34 AST_SPEECH_HAVE_RESULTS = (1 << 2),
38 enum ast_speech_states {
39 AST_SPEECH_STATE_NOT_READY = 0,
40 AST_SPEECH_STATE_READY,
41 AST_SPEECH_STATE_WAIT,
42 AST_SPEECH_STATE_DONE,
45 enum ast_speech_results_type {
46 AST_SPEECH_RESULTS_TYPE_NORMAL = 0,
47 AST_SPEECH_RESULTS_TYPE_NBEST,
84 int (*
load)(
struct ast_speech *speech,
const char *grammar_name,
const char *grammar);
165 int (*should_unregister)(const struct
ast_speech_engine *engine,
void *data),
void *data,
166 void (*on_unregistered)(
void *obj));
168 #if defined(__cplusplus) || defined(c_plusplus)
int(* destroy)(struct ast_speech *speech)
int ast_speech_destroy(struct ast_speech *speech)
Destroy a speech structure.
int(* create)(struct ast_speech *speech, struct ast_format *format)
void ast_speech_start(struct ast_speech *speech)
Indicate to the speech engine that audio is now going to start being written.
int(* change)(struct ast_speech *speech, const char *name, const char *value)
void ast_speech_unregister_engines(int(*should_unregister)(const struct ast_speech_engine *engine, void *data), void *data, void(*on_unregistered)(void *obj))
Unregister all speech recognition engines told to by callback.
struct ast_speech_engine * ast_speech_unregister2(const char *engine_name)
Unregister a speech recognition engine.
enum ast_speech_results_type results_type
int ast_speech_register(struct ast_speech_engine *engine)
Register a speech recognition engine.
struct ast_speech_result * ast_speech_results_get(struct ast_speech *speech)
Get speech recognition results.
int(* start)(struct ast_speech *speech)
int ast_speech_change_results_type(struct ast_speech *speech, enum ast_speech_results_type results_type)
Change the type of results we want.
int(* unload)(struct ast_speech *speech, const char *grammar_name)
int ast_speech_grammar_deactivate(struct ast_speech *speech, const char *grammar_name)
Deactivate a grammar on a speech structure.
int ast_speech_change_state(struct ast_speech *speech, int state)
Change state of a speech structure.
struct ast_format_cap * formats
int(* change_results_type)(struct ast_speech *speech, enum ast_speech_results_type results_type)
struct ast_speech_engine * engine
int ast_speech_grammar_unload(struct ast_speech *speech, const char *grammar_name)
Unload a grammar.
struct ast_speech_result * results
struct ast_speech_engine * ast_speech_find_engine(const char *engine_name)
Retrieve a speech recognition engine.
int(* activate)(struct ast_speech *speech, const char *grammar_name)
int(* write)(struct ast_speech *speech, void *data, int len)
int ast_speech_grammar_activate(struct ast_speech *speech, const char *grammar_name)
Activate a grammar on a speech structure.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
struct ast_format * format
const char * ast_speech_results_type_to_string(enum ast_speech_results_type type)
Convert a speech results type to a string.
int ast_speech_results_free(struct ast_speech_result *result)
Free a set of results.
int ast_speech_dtmf(struct ast_speech *speech, const char *dtmf)
Signal to the engine that DTMF was received.
int ast_speech_unregister(const char *engine_name)
Unregister a speech recognition engine.
int(* deactivate)(struct ast_speech *speech, const char *grammar_name)
struct ast_speech * ast_speech_new(const char *engine_name, const struct ast_format_cap *formats)
Create a new speech structure.
int(* load)(struct ast_speech *speech, const char *grammar_name, const char *grammar)
int(* dtmf)(struct ast_speech *speech, const char *dtmf)
int ast_speech_write(struct ast_speech *speech, void *data, int len)
Write audio to the speech engine.
int ast_speech_grammar_load(struct ast_speech *speech, const char *grammar_name, const char *grammar)
Load a grammar on a speech structure (not globally)
int ast_speech_get_setting(struct ast_speech *speech, const char *name, char *buf, size_t len)
Get an engine specific attribute.
int ast_speech_change(struct ast_speech *speech, const char *name, const char *value)
Change an engine specific attribute.
Structure for mutex and tracking information.
int(* get_setting)(struct ast_speech *speech, const char *name, char *buf, size_t len)