Asterisk - The Open Source Telephony Project
18.5.0
|
Generic Speech Recognition API. More...
Go to the source code of this file.
Data Structures | |
struct | ast_speech |
struct | ast_speech_engine |
struct | ast_speech_result |
Enumerations | |
enum | ast_speech_flags { AST_SPEECH_QUIET = (1 << 0), AST_SPEECH_SPOKE = (1 << 1), AST_SPEECH_HAVE_RESULTS = (1 << 2) } |
enum | ast_speech_results_type { AST_SPEECH_RESULTS_TYPE_NORMAL = 0, AST_SPEECH_RESULTS_TYPE_NBEST } |
enum | ast_speech_states { AST_SPEECH_STATE_NOT_READY = 0, AST_SPEECH_STATE_READY, AST_SPEECH_STATE_WAIT, AST_SPEECH_STATE_DONE } |
Functions | |
int | ast_speech_change (struct ast_speech *speech, const char *name, const char *value) |
Change an engine specific attribute. More... | |
int | ast_speech_change_results_type (struct ast_speech *speech, enum ast_speech_results_type results_type) |
Change the type of results we want. More... | |
int | ast_speech_change_state (struct ast_speech *speech, int state) |
Change state of a speech structure. More... | |
int | ast_speech_destroy (struct ast_speech *speech) |
Destroy a speech structure. More... | |
int | ast_speech_dtmf (struct ast_speech *speech, const char *dtmf) |
Signal to the engine that DTMF was received. More... | |
int | ast_speech_get_setting (struct ast_speech *speech, const char *name, char *buf, size_t len) |
Get an engine specific attribute. More... | |
int | ast_speech_grammar_activate (struct ast_speech *speech, const char *grammar_name) |
Activate a grammar on a speech structure. More... | |
int | ast_speech_grammar_deactivate (struct ast_speech *speech, const char *grammar_name) |
Deactivate a grammar on a speech structure. More... | |
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) More... | |
int | ast_speech_grammar_unload (struct ast_speech *speech, const char *grammar_name) |
Unload a grammar. More... | |
struct ast_speech * | ast_speech_new (const char *engine_name, const struct ast_format_cap *formats) |
Create a new speech structure. More... | |
int | ast_speech_register (struct ast_speech_engine *engine) |
Register a speech recognition engine. More... | |
int | ast_speech_results_free (struct ast_speech_result *result) |
Free a set of results. More... | |
struct ast_speech_result * | ast_speech_results_get (struct ast_speech *speech) |
Get speech recognition results. More... | |
void | ast_speech_start (struct ast_speech *speech) |
Indicate to the speech engine that audio is now going to start being written. More... | |
int | ast_speech_unregister (const char *engine_name) |
Unregister a speech recognition engine. More... | |
int | ast_speech_write (struct ast_speech *speech, void *data, int len) |
Write audio to the speech engine. More... | |
Generic Speech Recognition API.
Definition in file speech.h.
enum ast_speech_flags |
Enumerator | |
---|---|
AST_SPEECH_QUIET | |
AST_SPEECH_SPOKE | |
AST_SPEECH_HAVE_RESULTS |
Enumerator | |
---|---|
AST_SPEECH_RESULTS_TYPE_NORMAL | |
AST_SPEECH_RESULTS_TYPE_NBEST |
Definition at line 45 of file speech.h.
enum ast_speech_states |
Enumerator | |
---|---|
AST_SPEECH_STATE_NOT_READY | |
AST_SPEECH_STATE_READY | |
AST_SPEECH_STATE_WAIT | |
AST_SPEECH_STATE_DONE |
int ast_speech_change | ( | struct ast_speech * | speech, |
const char * | name, | ||
const char * | value | ||
) |
Change an engine specific attribute.
Definition at line 168 of file res_speech.c.
References ast_speech_engine::change, and ast_speech::engine.
Referenced by handle_speechset(), and speech_engine_write().
int ast_speech_change_results_type | ( | struct ast_speech * | speech, |
enum ast_speech_results_type | results_type | ||
) |
Change the type of results we want.
Definition at line 284 of file res_speech.c.
References ast_speech_engine::change_results_type, ast_speech::engine, and ast_speech::results_type.
Referenced by speech_results_type_write().
int ast_speech_change_state | ( | struct ast_speech * | speech, |
int | state | ||
) |
Change state of a speech structure.
Definition at line 267 of file res_speech.c.
References ast_set_flag, AST_SPEECH_SPOKE, AST_SPEECH_STATE_WAIT, ast_speech::state, and state.
Referenced by ast_speech_new(), handle_speechrecognize(), and speech_background().
int ast_speech_destroy | ( | struct ast_speech * | speech | ) |
Destroy a speech structure.
Definition at line 240 of file res_speech.c.
References ao2_ref, ast_free, ast_mutex_destroy, ast_speech_results_free(), ast_speech_engine::destroy, ast_speech::engine, ast_speech::format, ast_speech::lock, ast_speech::processing_sound, and ast_speech::results.
Referenced by destroy_callback(), handle_speechdestroy(), launch_asyncagi(), run_agi(), and speech_create().
int ast_speech_dtmf | ( | struct ast_speech * | speech, |
const char * | dtmf | ||
) |
Signal to the engine that DTMF was received.
Definition at line 153 of file res_speech.c.
References AST_SPEECH_STATE_READY, ast_speech_engine::dtmf, ast_speech::engine, NULL, and ast_speech::state.
Referenced by speech_background().
int ast_speech_get_setting | ( | struct ast_speech * | speech, |
const char * | name, | ||
char * | buf, | ||
size_t | len | ||
) |
Get an engine specific attribute.
Definition at line 174 of file res_speech.c.
References ast_speech::engine, and ast_speech_engine::get_setting.
Referenced by speech_engine_read().
int ast_speech_grammar_activate | ( | struct ast_speech * | speech, |
const char * | grammar_name | ||
) |
Activate a grammar on a speech structure.
Activate a grammar on a speech structure.
Definition at line 65 of file res_speech.c.
References ast_speech_engine::activate, and ast_speech::engine.
Referenced by handle_speechactivategrammar(), and speech_activate().
int ast_speech_grammar_deactivate | ( | struct ast_speech * | speech, |
const char * | grammar_name | ||
) |
Deactivate a grammar on a speech structure.
Deactivate a grammar on a speech structure.
Definition at line 71 of file res_speech.c.
References ast_speech_engine::deactivate, and ast_speech::engine.
Referenced by handle_speechdeactivategrammar(), and speech_deactivate().
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)
Load a grammar on a speech structure (not globally)
Definition at line 77 of file res_speech.c.
References ast_speech::engine, and ast_speech_engine::load.
Referenced by handle_speechloadgrammar(), and speech_load().
int ast_speech_grammar_unload | ( | struct ast_speech * | speech, |
const char * | grammar_name | ||
) |
Unload a grammar.
Unload a grammar.
Definition at line 83 of file res_speech.c.
References ast_speech::engine, and ast_speech_engine::unload.
Referenced by handle_speechunloadgrammar(), and speech_unload().
struct ast_speech* ast_speech_new | ( | const char * | engine_name, |
const struct ast_format_cap * | cap | ||
) |
Create a new speech structure.
Create a new speech structure.
Definition at line 180 of file res_speech.c.
References ao2_bump, ao2_cleanup, ao2_ref, ast_calloc, ast_format_cap_alloc, AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_cap_get_compatible(), ast_format_cap_get_format(), ast_format_cap_iscompatible_format(), AST_FORMAT_CMP_NOT_EQUAL, ast_format_slin, ast_free, ast_mutex_destroy, ast_mutex_init, ast_speech_change_state(), AST_SPEECH_STATE_NOT_READY, ast_speech_engine::create, ast_speech::engine, find_engine(), ast_speech::format, ast_speech_engine::formats, ast_speech::lock, NULL, RAII_VAR, and ast_speech::results.
Referenced by handle_speechcreate(), and speech_create().
int ast_speech_register | ( | struct ast_speech_engine * | engine | ) |
Register a speech recognition engine.
Definition at line 292 of file res_speech.c.
References ast_log, AST_RWLIST_INSERT_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, ast_speech_engine::create, ast_speech_engine::destroy, find_engine(), LOG_WARNING, ast_speech_engine::name, and ast_speech_engine::write.
int ast_speech_results_free | ( | struct ast_speech_result * | result | ) |
Free a set of results.
Free a set of results.
Definition at line 95 of file res_speech.c.
References ast_free, AST_LIST_NEXT, ast_speech_result::grammar, NULL, result, and ast_speech_result::text.
Referenced by ast_speech_destroy(), and ast_speech_start().
struct ast_speech_result* ast_speech_results_get | ( | struct ast_speech * | speech | ) |
Get speech recognition results.
Get speech recognition results.
Definition at line 89 of file res_speech.c.
References ast_speech::engine, ast_speech_engine::get, and NULL.
Referenced by handle_speechrecognize(), and speech_background().
void ast_speech_start | ( | struct ast_speech * | speech | ) |
Indicate to the speech engine that audio is now going to start being written.
Indicate to the speech engine that audio is now going to start being written.
Definition at line 121 of file res_speech.c.
References ast_clear_flag, AST_SPEECH_HAVE_RESULTS, AST_SPEECH_QUIET, ast_speech_results_free(), AST_SPEECH_SPOKE, ast_speech::engine, NULL, ast_speech::results, and ast_speech_engine::start.
Referenced by handle_speechrecognize(), speech_background(), and speech_start().
int ast_speech_unregister | ( | const char * | engine_name | ) |
Unregister a speech recognition engine.
Definition at line 323 of file res_speech.c.
References AST_RWLIST_FIRST, AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strlen_zero, ast_verb, ast_speech_engine::name, and NULL.
int ast_speech_write | ( | struct ast_speech * | speech, |
void * | data, | ||
int | len | ||
) |
Write audio to the speech engine.
Write audio to the speech engine.
Definition at line 143 of file res_speech.c.
References AST_SPEECH_STATE_READY, ast_speech::engine, ast_speech::state, and ast_speech_engine::write.
Referenced by handle_speechrecognize(), and speech_background().