| Asterisk - The Open Source Telephony Project GIT-master-27fb039
    | 
Asterisk External Application Speech Engine. More...
#include "asterisk.h"#include "asterisk/astobj2.h"#include "asterisk/config.h"#include "asterisk/format.h"#include "asterisk/format_cap.h"#include "asterisk/json.h"#include "asterisk/module.h"#include "asterisk/speech.h"#include "asterisk/sorcery.h"#include "asterisk/res_aeap.h"#include "asterisk/res_aeap_message.h"
Go to the source code of this file.
| Data Structures | |
| struct | speech_param | 
| struct | speech_setting | 
| Macros | |
| #define | CONNECTION_TIMEOUT 2000 | 
| #define | log_error(obj, fmt, ...) ast_log(LOG_ERROR, "AEAP speech (%p): " fmt "\n", obj, ##__VA_ARGS__) | 
| #define | SPEECH_AEAP_VERSION "0.1.0" | 
| #define | SPEECH_PROTOCOL "speech_to_text" | 
| Functions | |
| static void | __reg_module (void) | 
| static void | __unreg_module (void) | 
| static void | ast_aeap_speech_on_error (struct ast_aeap *aeap) | 
| struct ast_module * | AST_MODULE_SELF_SYM (void) | 
| static struct ast_json * | custom_fields_to_params (const struct ast_variable *variables) | 
| static int | handle_request_set (struct ast_aeap *aeap, struct ast_aeap_message *message, void *data) | 
| static int | handle_response_get (struct ast_aeap *aeap, struct ast_aeap_message *message, void *data) | 
| static int | handle_response_set (struct ast_aeap *aeap, struct ast_aeap_message *message, void *data) | 
| static int | handle_response_setup (struct ast_aeap *aeap, struct ast_aeap_message *message, void *data) | 
| static int | handle_results (struct ast_aeap *aeap, struct ast_json_iter *iter, struct ast_speech_result **speech_results) | 
| static int | handle_setting (struct ast_aeap *aeap, struct ast_json_iter *iter, struct speech_setting *setting) | 
| static int | load_engine (void *obj, void *arg, int flags) | 
| static int | load_module (void) | 
| static int | matches_engine (void *obj, void *arg, int flags) | 
| static int | should_unregister (const struct ast_speech_engine *engine, void *data) | 
| static int | speech_aeap_engine_change (struct ast_speech *speech, const char *name, const char *value) | 
| static int | speech_aeap_engine_change_results_type (struct ast_speech *speech, enum ast_speech_results_type results_type) | 
| static int | speech_aeap_engine_create (struct ast_speech *speech, struct ast_format *format) | 
| static int | speech_aeap_engine_destroy (struct ast_speech *speech) | 
| static int | speech_aeap_engine_dtmf (struct ast_speech *speech, const char *dtmf) | 
| static struct ast_speech_result * | speech_aeap_engine_get (struct ast_speech *speech) | 
| static int | speech_aeap_engine_get_setting (struct ast_speech *speech, const char *name, char *buf, size_t len) | 
| static int | speech_aeap_engine_start (struct ast_speech *speech) | 
| static int | speech_aeap_engine_write (struct ast_speech *speech, void *data, int len) | 
| static int | speech_aeap_get (struct ast_speech *speech, const char *param, void *data) | 
| static int | speech_aeap_send_request (struct ast_aeap *aeap, const char *name, struct ast_json *json, void *data) | 
| static int | speech_aeap_set (struct ast_speech *speech, const char *name, const char *value) | 
| static struct ast_speech_engine * | speech_engine_alloc (const char *name) | 
| static void | speech_engine_alloc_and_register (const char *name, const struct ast_format_cap *formats) | 
| static void | speech_engine_destroy (void *obj) | 
| static void | speech_observer_loaded (const char *object_type) | 
| static int | unload_engine (void *obj, void *arg, int flags) | 
| static int | unload_module (void) | 
| Variables | |
| static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Asterisk External Application Speech Engine" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_CHANNEL_DEPEND, .requires = "res_speech,res_aeap", } | 
| static const struct ast_module_info * | ast_module_info = &__mod_info | 
| static const struct ast_aeap_message_handler | request_handlers [] | 
| static const struct ast_aeap_message_handler | response_handlers [] | 
| static struct ast_aeap_params | speech_aeap_params | 
| static const struct ast_sorcery_observer | speech_observer | 
| Observer for AEAP reloads. | |
Asterisk External Application Speech Engine.
Definition in file res_speech_aeap.c.
| #define CONNECTION_TIMEOUT 2000 | 
Definition at line 46 of file res_speech_aeap.c.
| #define log_error | ( | obj, | |
| fmt, | |||
| ... | |||
| ) | ast_log(LOG_ERROR, "AEAP speech (%p): " fmt "\n", obj, ##__VA_ARGS__) | 
Definition at line 48 of file res_speech_aeap.c.
| #define SPEECH_AEAP_VERSION "0.1.0" | 
Definition at line 43 of file res_speech_aeap.c.
| #define SPEECH_PROTOCOL "speech_to_text" | 
Definition at line 44 of file res_speech_aeap.c.
| 
 | static | 
Definition at line 763 of file res_speech_aeap.c.
| 
 | static | 
Definition at line 763 of file res_speech_aeap.c.
| 
 | static | 
Definition at line 359 of file res_speech_aeap.c.
References ast_aeap_user_data_object_by_id(), ast_log, ast_speech_change_state(), AST_SPEECH_STATE_DONE, and LOG_ERROR.
| struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) | 
Definition at line 763 of file res_speech_aeap.c.
| 
 | static | 
Definition at line 51 of file res_speech_aeap.c.
References ast_json_object_create(), ast_json_object_set(), ast_json_string_create(), ast_variable::name, ast_variable::next, NULL, and ast_variable::value.
Referenced by speech_aeap_engine_create().
| 
 | static | 
Definition at line 313 of file res_speech_aeap.c.
References ast_aeap_message_create_error(), ast_aeap_message_create_response(), ast_aeap_message_data(), ast_aeap_message_id(), ast_aeap_message_name(), ast_aeap_message_type_json, ast_aeap_send_msg(), ast_aeap_user_data_object_by_id(), ast_json_object_get(), ast_json_object_iter(), ast_json_object_iter_key(), ast_speech_change_state(), AST_SPEECH_STATE_DONE, handle_results(), log_error, NULL, and ast_speech::results.
| 
 | static | 
Definition at line 259 of file res_speech_aeap.c.
References ast_aeap_message_data(), ast_json_object_get(), ast_json_object_iter(), ast_json_object_iter_key(), handle_results(), handle_setting(), and log_error.
| 
 | static | 
Definition at line 173 of file res_speech_aeap.c.
| 
 | static | 
Definition at line 276 of file res_speech_aeap.c.
References ast_aeap_message_data(), ast_format_get_codec_name(), ast_json_array_get(), ast_json_array_size(), ast_json_object_get(), ast_json_object_string_get, and log_error.
| 
 | static | 
Definition at line 204 of file res_speech_aeap.c.
References ast_calloc, ast_json_array_get(), ast_json_array_size(), ast_json_object_integer_get, ast_json_object_iter_value(), ast_json_object_string_get, AST_LIST_NEXT, ast_strdup, log_error, NULL, and result.
Referenced by handle_request_set(), and handle_response_get().
| 
 | static | 
Definition at line 184 of file res_speech_aeap.c.
References ast_copy_string(), ast_json_object_iter_key(), ast_json_object_iter_value(), ast_json_string_get(), speech_setting::buf, speech_setting::len, log_error, speech_setting::param, and value.
Referenced by handle_response_get().
| 
 | static | 
Definition at line 610 of file res_speech_aeap.c.
References ao2_ref, ast_aeap_client_config_codecs(), ast_aeap_client_config_has_protocol(), ast_format_cap_alloc, AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_cap_identical(), ast_log, ast_sorcery_object_get_id(), ast_speech_find_engine(), ast_speech_unregister2(), ast_speech_engine::formats, ast_format_cap::formats, id, LOG_ERROR, ast_speech_engine::name, speech_engine_alloc_and_register(), and SPEECH_PROTOCOL.
Referenced by load_module(), and speech_observer_loaded().
| 
 | static | 
Definition at line 729 of file res_speech_aeap.c.
References AEAP_CONFIG_CLIENT, ao2_callback, ao2_ref, ast_aeap_client_configs_get(), ast_aeap_message_type_json, ast_aeap_sorcery(), AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_sorcery_observer_add(), container, load_engine(), ast_aeap_params::msg_type, NULL, speech_aeap_params, speech_observer, and SPEECH_PROTOCOL.
| 
 | static | 
Definition at line 647 of file res_speech_aeap.c.
References ast_sorcery_object_get_id(), CMP_MATCH, ast_speech_engine::name, and ast_speech_engine::start.
Referenced by should_unregister().
| 
 | static | 
Definition at line 654 of file res_speech_aeap.c.
References ao2_callback, ao2_ref, ast_speech_engine::create, matches_engine(), ast_speech_engine::name, speech_aeap_engine_create(), and ast_speech_engine::start.
Referenced by ast_speech_unregister_engines(), and speech_observer_loaded().
| 
 | static | 
Definition at line 475 of file res_speech_aeap.c.
References name, speech_aeap_set(), and value.
Referenced by speech_engine_alloc().
| 
 | static | 
Definition at line 492 of file res_speech_aeap.c.
References ast_speech_results_type_to_string(), and speech_aeap_set().
Referenced by speech_engine_alloc().
| 
 | static | 
Definition at line 403 of file res_speech_aeap.c.
References ao2_ref, ast_aeap_create_and_connect_by_id(), ast_aeap_custom_fields_get(), ast_aeap_user_data_register(), ast_format_get_codec_name(), ast_json_pack(), ast_module_ref, ast_module_unref, ast_variables_destroy(), CONNECTION_TIMEOUT, custom_fields_to_params(), ast_speech::data, ast_speech::engine, ast_speech_engine::name, NULL, ast_module_info::self, speech_aeap_params, speech_aeap_send_request(), and SPEECH_AEAP_VERSION.
Referenced by should_unregister(), and speech_engine_alloc().
| 
 | static | 
Definition at line 448 of file res_speech_aeap.c.
References ao2_cleanup, ao2_ref, ast_module_unref, ast_speech::data, ast_speech::engine, and ast_module_info::self.
Referenced by speech_engine_alloc().
| 
 | static | 
Definition at line 463 of file res_speech_aeap.c.
References speech_aeap_set().
Referenced by speech_engine_alloc().
| 
 | static | 
Definition at line 499 of file res_speech_aeap.c.
References NULL, ast_speech::results, and speech_aeap_get().
Referenced by speech_engine_alloc().
| 
 | static | 
Definition at line 480 of file res_speech_aeap.c.
References buf, len(), name, speech_setting::param, and speech_aeap_get().
Referenced by speech_engine_alloc().
| 
 | static | 
Definition at line 468 of file res_speech_aeap.c.
References ast_speech_change_state(), and AST_SPEECH_STATE_READY.
Referenced by speech_engine_alloc().
| 
 | static | 
Definition at line 458 of file res_speech_aeap.c.
References ast_aeap_send_binary(), ast_speech::data, and len().
Referenced by speech_engine_alloc().
| 
 | static | 
Definition at line 130 of file res_speech_aeap.c.
References ast_json_pack(), ast_speech::data, and speech_aeap_send_request().
Referenced by speech_aeap_engine_get(), and speech_aeap_engine_get_setting().
| 
 | static | 
Definition at line 90 of file res_speech_aeap.c.
References ast_aeap_message_create_request(), ast_aeap_message_type_json, ast_aeap_send_msg_tsx(), ast_aeap_tsx_params::msg, name, NULL, and ast_aeap_tsx_params::timeout.
Referenced by speech_aeap_engine_create(), speech_aeap_get(), and speech_aeap_set().
| 
 | static | 
Definition at line 162 of file res_speech_aeap.c.
References ast_json_pack(), ast_speech::data, name, NULL, speech_aeap_send_request(), and value.
Referenced by speech_aeap_engine_change(), speech_aeap_engine_change_results_type(), and speech_aeap_engine_dtmf().
| 
 | static | 
Definition at line 522 of file res_speech_aeap.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_ref, ao2_t_alloc_options, ast_format_cap_alloc, AST_FORMAT_CAP_FLAG_DEFAULT, ast_log, ast_strdup, ast_speech_engine::change, ast_speech_engine::change_results_type, ast_speech_engine::create, ast_speech_engine::destroy, ast_speech_engine::dtmf, ast_speech_engine::formats, ast_speech_engine::get, ast_speech_engine::get_setting, LOG_ERROR, name, ast_speech_engine::name, NULL, speech_aeap_engine_change(), speech_aeap_engine_change_results_type(), speech_aeap_engine_create(), speech_aeap_engine_destroy(), speech_aeap_engine_dtmf(), speech_aeap_engine_get(), speech_aeap_engine_get_setting(), speech_aeap_engine_start(), speech_aeap_engine_write(), speech_engine_destroy(), ast_speech_engine::start, and ast_speech_engine::write.
Referenced by speech_engine_alloc_and_register().
| 
 | static | 
Definition at line 554 of file res_speech_aeap.c.
References ao2_ref, ast_format_cap_append_from_cap(), ast_log, AST_MEDIA_TYPE_AUDIO, ast_speech_register(), ast_speech_engine::formats, LOG_WARNING, name, and speech_engine_alloc().
Referenced by load_engine().
| 
 | static | 
Definition at line 514 of file res_speech_aeap.c.
References ao2_cleanup, ast_free, ast_speech_engine::formats, and ast_speech_engine::name.
Referenced by speech_engine_alloc().
| 
 | static | 
Definition at line 681 of file res_speech_aeap.c.
References __ao2_cleanup(), AEAP_CONFIG_CLIENT, ao2_callback, ao2_ref, ast_aeap_client_configs_get(), ast_speech_unregister_engines(), container, load_engine(), NULL, should_unregister(), and SPEECH_PROTOCOL.
| 
 | static | 
Definition at line 601 of file res_speech_aeap.c.
References ao2_cleanup, ast_aeap_client_config_has_protocol(), ast_sorcery_object_get_id(), ast_speech_unregister2(), and SPEECH_PROTOCOL.
Referenced by unload_module().
| 
 | static | 
Definition at line 710 of file res_speech_aeap.c.
References AEAP_CONFIG_CLIENT, ao2_callback, ao2_cleanup, ao2_ref, ast_aeap_client_configs_get(), ast_aeap_sorcery(), ast_sorcery_observer_remove(), ast_speech_unregister2(), container, NULL, speech_observer, SPEECH_PROTOCOL, and unload_engine().
| 
 | static | 
Definition at line 763 of file res_speech_aeap.c.
| 
 | static | 
Definition at line 763 of file res_speech_aeap.c.
| 
 | static | 
Definition at line 349 of file res_speech_aeap.c.
| 
 | static | 
Definition at line 307 of file res_speech_aeap.c.
| 
 | static | 
Definition at line 370 of file res_speech_aeap.c.
Referenced by load_module(), and speech_aeap_engine_create().
| 
 | static | 
Observer for AEAP reloads.
Definition at line 706 of file res_speech_aeap.c.
Referenced by load_module(), and unload_module().