56 if (!strcasecmp(engine->
name, engine_name)) {
101 while (current_result !=
NULL) {
102 prev_result = current_result;
220 if (!(new_speech =
ast_calloc(1,
sizeof(*new_speech)))) {
231 new_speech->
engine = engine;
322 ast_log(
LOG_WARNING,
"Speech recognition engine '%s' did not meet minimum API requirements.\n", engine->
name);
332 ast_verb(5,
"Registered speech recognition engine '%s'\n", engine->
name);
339 ast_verb(5,
"Made '%s' the default speech recognition engine\n", engine->
name);
362 if (!strcasecmp(engine->
name, engine_name)) {
369 ast_verb(5,
"Unregistered speech recognition engine '%s'\n", engine_name);
382 void (*on_unregistered)(
void *obj))
399 ast_verb(5,
"Unregistered speech recognition engine '%s'\n", engine->
name);
401 if (on_unregistered) {
402 on_unregistered(engine);
Asterisk main include file. File version handling, generic pbx functions.
#define ast_calloc(num, len)
A wrapper for calloc()
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
General Asterisk PBX channel definitions.
Standard Command Line Interface.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
#define ast_verb(level,...)
A set of macros to manage forward-linked lists.
#define AST_RWLIST_REMOVE_CURRENT
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized.
#define AST_RWLIST_TRAVERSE_SAFE_END
#define AST_RWLIST_TRAVERSE
#define AST_RWLIST_INSERT_HEAD
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
Asterisk locking-related definitions:
#define ast_mutex_init(pmutex)
#define ast_mutex_destroy(a)
Asterisk module definitions.
@ AST_MODFLAG_GLOBAL_SYMBOLS
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
struct ast_speech_engine * ast_speech_find_engine(const char *engine_name)
Find a speech recognition engine of specified name, if NULL then use the default one.
int ast_speech_dtmf(struct ast_speech *speech, const char *dtmf)
Signal to the engine that DTMF was received.
int ast_speech_results_free(struct ast_speech_result *result)
Free a list of results.
int ast_speech_grammar_deactivate(struct ast_speech *speech, const char *grammar_name)
Deactivate a loaded grammar on a speech structure.
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_grammar_unload(struct ast_speech *speech, const char *grammar_name)
Unload a local grammar from a speech structure.
void ast_speech_start(struct ast_speech *speech)
Start speech recognition on a speech structure.
int ast_speech_unregister(const char *engine_name)
Unregister a speech recognition engine.
struct ast_speech_engine * ast_speech_unregister2(const char *engine_name)
Unregister a speech recognition engine.
int ast_speech_write(struct ast_speech *speech, void *data, int len)
Write in signed linear audio to be recognized.
int ast_speech_change(struct ast_speech *speech, const char *name, const char *value)
Change an engine specific attribute.
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.
int ast_speech_destroy(struct ast_speech *speech)
Destroy a speech structure.
static struct ast_speech_engine * default_engine
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 ast_speech_grammar_load(struct ast_speech *speech, const char *grammar_name, const char *grammar)
Load a local grammar on a speech structure.
int ast_speech_grammar_activate(struct ast_speech *speech, const char *grammar_name)
Activate a loaded (either local or global) grammar.
struct ast_speech * ast_speech_new(const char *engine_name, const struct ast_format_cap *cap)
Create a new speech structure using the engine specified.
int ast_speech_register(struct ast_speech_engine *engine)
Register a speech recognition engine.
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_state(struct ast_speech *speech, int state)
Change state of a speech structure.
static int load_module(void)
static int unload_module(void)
struct ast_speech_result * ast_speech_results_get(struct ast_speech *speech)
Return the results of a recognition from the speech structure.
static int should_unregister(const struct ast_speech_engine *engine, void *data)
Generic Speech Recognition API.
@ AST_SPEECH_STATE_NOT_READY
@ AST_SPEECH_RESULTS_TYPE_NBEST
@ AST_SPEECH_RESULTS_TYPE_NORMAL
@ AST_SPEECH_HAVE_RESULTS
static force_inline int attribute_pure ast_strlen_zero(const char *s)
struct ast_format_cap * formats
int(* deactivate)(struct ast_speech *speech, const char *grammar_name)
int(* start)(struct ast_speech *speech)
int(* change_results_type)(struct ast_speech *speech, enum ast_speech_results_type results_type)
struct ast_speech_result *(* get)(struct ast_speech *speech)
int(* get_setting)(struct ast_speech *speech, const char *name, char *buf, size_t len)
int(* destroy)(struct ast_speech *speech)
int(* dtmf)(struct ast_speech *speech, const char *dtmf)
int(* load)(struct ast_speech *speech, const char *grammar_name, const char *grammar)
int(* change)(struct ast_speech *speech, const char *name, const char *value)
int(* activate)(struct ast_speech *speech, const char *grammar_name)
int(* create)(struct ast_speech *speech, struct ast_format *format)
int(* write)(struct ast_speech *speech, void *data, int len)
int(* unload)(struct ast_speech *speech, const char *grammar_name)
struct ast_format * format
struct ast_speech_engine * engine
enum ast_speech_results_type results_type
struct ast_speech_result * results
Handy terminal functions for vt* terms.
Support for translation of data formats. translate.c.
int ast_translator_best_choice(struct ast_format_cap *dst_cap, struct ast_format_cap *src_cap, struct ast_format **dst_fmt_out, struct ast_format **src_fmt_out)
Chooses the best translation path.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_clear_flag(p, flag)
#define ast_set_flag(p, flag)