57 if (!strcasecmp(engine->
name, engine_name)) {
102 while (current_result != NULL) {
103 prev_result = current_result;
105 if (current_result->
text != NULL) {
107 current_result->
text = NULL;
109 if (current_result->
grammar != NULL) {
111 current_result->
grammar = NULL;
187 if ((format = (engine->
formats & formats)))
195 if (!(new_speech =
ast_calloc(1,
sizeof(*new_speech))))
214 if (engine->
create(new_speech, format)) {
278 ast_log(
LOG_WARNING,
"Speech recognition engine '%s' did not meet minimum API requirements.\n", engine->
name);
288 ast_verb(2,
"Registered speech recognition engine '%s'\n", engine->
name);
293 if (!default_engine) {
295 ast_verb(2,
"Made '%s' the default speech recognition engine\n", engine->
name);
313 if (!strcasecmp(engine->
name, engine_name)) {
317 if (engine == default_engine) {
320 ast_verb(2,
"Unregistered speech recognition engine '%s'\n", engine_name);
enum sip_cc_notify_state state
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
int(* change_results_type)(struct ast_speech *speech, enum ast_speech_results_type results_type)
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 ast_speech_destroy(struct ast_speech *speech)
Destroy a speech structure.
void ast_speech_start(struct ast_speech *speech)
Indicate to the speech engine that audio is now going to start being written.
int(* activate)(struct ast_speech *speech, const char *grammar_name)
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
#define ast_set_flag(p, flag)
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
enum ast_speech_results_type results_type
int(* change)(struct ast_speech *speech, const char *name, const char *value)
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
static int unload_module(void)
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.
static struct ast_speech_engine * default_engine
format_t ast_best_codec(format_t fmts)
Pick the best audio codec.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
#define ast_verb(level,...)
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.
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
#define AST_RWLIST_INSERT_HEAD
int ast_speech_grammar_deactivate(struct ast_speech *speech, const char *grammar_name)
Deactivate a grammar on a speech structure.
General Asterisk PBX channel definitions.
int(* dtmf)(struct ast_speech *speech, const char *dtmf)
int ast_speech_change_state(struct ast_speech *speech, int state)
Change state of a speech structure.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define AST_RWLIST_TRAVERSE
#define AST_RWLIST_REMOVE_CURRENT
int(* create)(struct ast_speech *speech, int format)
A set of macros to manage forward-linked lists.
struct ast_speech_engine * engine
int(* unload)(struct ast_speech *speech, const char *grammar_name)
int ast_speech_grammar_unload(struct ast_speech *speech, const char *grammar_name)
Unload a grammar.
static int load_module(void)
struct ast_speech_result * results
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
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.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
int(* load)(struct ast_speech *speech, const char *grammar_name, const char *grammar)
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
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)
int ast_speech_results_free(struct ast_speech_result *result)
Free a set of results.
#define AST_FORMAT_SLINEAR
int ast_speech_dtmf(struct ast_speech *speech, const char *dtmf)
Signal to the engine that DTMF was received.
Standard Command Line Interface.
int ast_speech_unregister(const char *engine_name)
Unregister a speech recognition engine.
Handy terminal functions for vt* terms.
#define ast_mutex_init(pmutex)
#define ast_mutex_destroy(a)
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(* deactivate)(struct ast_speech *speech, const char *grammar_name)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
static snd_pcm_format_t format
int ast_speech_change(struct ast_speech *speech, const char *name, const char *value)
Change an engine specific attribute.
#define AST_RWLIST_TRAVERSE_SAFE_END
int(* destroy)(struct ast_speech *speech)
struct ast_speech_result *(* get)(struct ast_speech *speech)
struct ast_speech * ast_speech_new(const char *engine_name, int formats)
Create a new speech structure.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.