55 if (!strcasecmp(engine->
name, engine_name)) {
100 while (current_result !=
NULL) {
101 prev_result = current_result;
209 if (!(new_speech =
ast_calloc(1,
sizeof(*new_speech)))) {
220 new_speech->
engine = engine;
298 ast_log(
LOG_WARNING,
"Speech recognition engine '%s' did not meet minimum API requirements.\n", engine->
name);
308 ast_verb(2,
"Registered speech recognition engine '%s'\n", engine->
name);
313 if (!default_engine) {
314 default_engine = engine;
315 ast_verb(2,
"Made '%s' the default speech recognition engine\n", engine->
name);
333 if (!strcasecmp(engine->
name, engine_name)) {
337 if (engine == default_engine) {
340 ast_verb(2,
"Unregistered speech recognition engine '%s'\n", engine_name);
int ast_speech_change_state(struct ast_speech *speech, int state)
Change state of a speech structure.
enum sip_cc_notify_state state
struct ast_speech_result * ast_speech_results_get(struct ast_speech *speech)
Return the results of a recognition from the speech structure.
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
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_write(struct ast_speech *speech, void *data, int len)
Write in signed linear audio to be recognized.
int(* destroy)(struct ast_speech *speech)
Generic Speech Recognition API.
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized...
int(* create)(struct ast_speech *speech, struct ast_format *format)
int(* change)(struct ast_speech *speech, const char *name, const char *value)
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
#define ast_set_flag(p, flag)
int ast_speech_grammar_activate(struct ast_speech *speech, const char *grammar_name)
Activate a loaded (either local or global) grammar.
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
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_register(struct ast_speech_engine *engine)
Register a speech recognition engine.
enum ast_speech_results_type results_type
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
static int unload_module(void)
void ast_speech_start(struct ast_speech *speech)
Start speech recognition on a speech structure.
static struct ast_speech_engine * default_engine
int ast_speech_unregister(const char *engine_name)
Unregister a speech recognition engine.
#define ast_verb(level,...)
int(* start)(struct ast_speech *speech)
int ast_speech_grammar_unload(struct ast_speech *speech, const char *grammar_name)
Unload a local grammar from a speech structure.
#define ast_strlen_zero(foo)
int(* unload)(struct ast_speech *speech, const char *grammar_name)
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
#define AST_RWLIST_INSERT_HEAD
General Asterisk PBX channel definitions.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
int ast_speech_grammar_load(struct ast_speech *speech, const char *grammar_name, const char *grammar)
Load a local grammar on a speech structure.
#define AST_RWLIST_TRAVERSE
int ast_speech_change(struct ast_speech *speech, const char *name, const char *value)
Change an engine specific attribute.
#define ao2_ref(o, delta)
struct ast_format_cap * formats
#define AST_RWLIST_REMOVE_CURRENT
A set of macros to manage forward-linked lists.
int(* change_results_type)(struct ast_speech *speech, enum ast_speech_results_type results_type)
struct ast_speech_engine * engine
static int load_module(void)
struct ast_speech_result * results
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
struct ast_speech_result *(* get)(struct ast_speech *speech)
int(* activate)(struct ast_speech *speech, const char *grammar_name)
int(* write)(struct ast_speech *speech, void *data, int len)
int ast_speech_results_free(struct ast_speech_result *result)
Free a list of results.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
#define ast_calloc(num, len)
A wrapper for calloc()
struct ast_format * format
static struct ast_speech_engine * find_engine(const char *engine_name)
Find a speech recognition engine of specified name, if NULL then use the default one.
#define ast_clear_flag(p, flag)
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
Standard Command Line Interface.
int(* deactivate)(struct ast_speech *speech, const char *grammar_name)
int ast_speech_dtmf(struct ast_speech *speech, const char *dtmf)
Signal to the engine that DTMF was received.
int(* load)(struct ast_speech *speech, const char *grammar_name, const char *grammar)
int(* dtmf)(struct ast_speech *speech, const char *dtmf)
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.
Handy terminal functions for vt* terms.
#define ast_mutex_init(pmutex)
#define ast_mutex_destroy(a)
int ast_speech_destroy(struct ast_speech *speech)
Destroy a speech structure.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
#define AST_RWLIST_TRAVERSE_SAFE_END
int ast_speech_grammar_deactivate(struct ast_speech *speech, const char *grammar_name)
Deactivate a loaded grammar on a speech structure.
int(* get_setting)(struct ast_speech *speech, const char *name, char *buf, size_t len)