[asterisk-commits] file: trunk r374096 - in /trunk: apps/ include/asterisk/ res/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Oct 1 07:29:10 CDT 2012
Author: file
Date: Mon Oct 1 07:29:04 2012
New Revision: 374096
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=374096
Log:
Add support for retrieving engine specific settings using the speech API and from dialplan.
(closes issue ASTERISK-17136)
Reported by: kenner
Modified:
trunk/apps/app_speech_utils.c
trunk/include/asterisk/speech.h
trunk/res/res_speech.c
Modified: trunk/apps/app_speech_utils.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_speech_utils.c?view=diff&rev=374096&r1=374095&r2=374096
==============================================================================
--- trunk/apps/app_speech_utils.c (original)
+++ trunk/apps/app_speech_utils.c Mon Oct 1 07:29:04 2012
@@ -213,7 +213,7 @@
</function>
<function name="SPEECH_ENGINE" language="en_US">
<synopsis>
- Change a speech engine specific attribute.
+ Get or change a speech engine specific attribute.
</synopsis>
<syntax>
<parameter name="name" required="true" />
@@ -401,7 +401,7 @@
.write = NULL,
};
-/*! \brief SPEECH_ENGINE() Dialplan Function */
+/*! \brief SPEECH_ENGINE() Dialplan Set Function */
static int speech_engine_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
{
struct ast_speech *speech = find_speech(chan);
@@ -413,11 +413,23 @@
ast_speech_change(speech, data, value);
return 0;
+}
+
+/*! \brief SPEECH_ENGINE() Dialplan Get Function */
+static int speech_engine_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
+{
+ struct ast_speech *speech = find_speech(chan);
+
+ if (!data || !speech) {
+ return -1;
+ }
+
+ return ast_speech_get_setting(speech, data, buf, len);
}
static struct ast_custom_function speech_engine_function = {
.name = "SPEECH_ENGINE",
- .read = NULL,
+ .read = speech_engine_read,
.write = speech_engine_write,
};
Modified: trunk/include/asterisk/speech.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/speech.h?view=diff&rev=374096&r1=374095&r2=374096
==============================================================================
--- trunk/include/asterisk/speech.h (original)
+++ trunk/include/asterisk/speech.h Mon Oct 1 07:29:04 2012
@@ -93,6 +93,8 @@
int (*start)(struct ast_speech *speech);
/*! Change an engine specific setting */
int (*change)(struct ast_speech *speech, const char *name, const char *value);
+ /*! Get an engine specific setting */
+ int (*get_setting)(struct ast_speech *speech, const char *name, char *buf, size_t len);
/*! Change the type of results we want back */
int (*change_results_type)(struct ast_speech *speech, enum ast_speech_results_type results_type);
/*! Try to get results */
@@ -140,6 +142,8 @@
int ast_speech_dtmf(struct ast_speech *speech, const char *dtmf);
/*! \brief Change an engine specific attribute */
int ast_speech_change(struct ast_speech *speech, const char *name, const char *value);
+/*! \brief Get an engine specific attribute */
+int ast_speech_get_setting(struct ast_speech *speech, const char *name, char *buf, size_t len);
/*! \brief Change the type of results we want */
int ast_speech_change_results_type(struct ast_speech *speech, enum ast_speech_results_type results_type);
/*! \brief Change state of a speech structure */
Modified: trunk/res/res_speech.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_speech.c?view=diff&rev=374096&r1=374095&r2=374096
==============================================================================
--- trunk/res/res_speech.c (original)
+++ trunk/res/res_speech.c Mon Oct 1 07:29:04 2012
@@ -172,6 +172,12 @@
return (speech->engine->change ? speech->engine->change(speech, name, value) : -1);
}
+/*! \brief Get an engine specific attribute */
+int ast_speech_get_setting(struct ast_speech *speech, const char *name, char *buf, size_t len)
+{
+ return (speech->engine->get_setting ? speech->engine->get_setting(speech, name, buf, len) : -1);
+}
+
/*! \brief Create a new speech structure using the engine specified */
struct ast_speech *ast_speech_new(const char *engine_name, const struct ast_format_cap *cap)
{
More information about the asterisk-commits
mailing list