[Freeswitch-trunk] [GIT]FreeSWITCH branch master updated. v1.0.6-1122-g6d7e019

git at svn.freeswitch.org git at svn.freeswitch.org
Mon Jan 31 23:16:17 MSK 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FreeSWITCH".

The branch, master has been updated
       via  6d7e019b5c0244f53c16361d2667049b430adb55 (commit)
      from  128d53c2e6a73a6136efcfffa4e880e6635e43f1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6d7e019b5c0244f53c16361d2667049b430adb55
Author: Luke Dashjr <luke at openmethods.com>
Date:   Sun Aug 22 00:26:21 2010 -0500

    switch_ivr interfaces to enable/disable grammar: switch_ivr_detect_speech_enable_grammar, switch_ivr_detect_speech_disable_grammar, and switch_ivr_detect_speech_disable_all_grammars

diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h
index 40ba1dc..8641766 100644
--- a/src/include/switch_ivr.h
+++ b/src/include/switch_ivr.h
@@ -26,6 +26,7 @@
  * Anthony Minessale II <anthm at freeswitch.org>
  * Neal Horman <neal at wanlink dot com>
  * Bret McDanel <trixter AT 0xdecafbad dot com>
+ * Luke Dashjr <luke at openmethods.com> (OpenMethods, LLC)
  *
  * switch_ivr.h -- IVR Library
  *
@@ -198,6 +199,29 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_load_grammar(switch_cor
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *name);
 
+/*!
+  \brief Enable a grammar on a background speech detection handle
+  \param session The session to change the grammar on
+  \param name the grammar name
+  \return SWITCH_STATUS_SUCCESS if all is well
+*/
+SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_enable_grammar(switch_core_session_t *session, const char *name);
+
+/*!
+  \brief Disable a grammar on a background speech detection handle
+  \param session The session to change the grammar on
+  \param name the grammar name
+  \return SWITCH_STATUS_SUCCESS if all is well
+*/
+SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_disable_grammar(switch_core_session_t *session, const char *name);
+
+/*!
+  \brief Disable all grammars on a background speech detection handle
+  \param session The session to change the grammar on
+  \return SWITCH_STATUS_SUCCESS if all is well
+*/
+SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_disable_all_grammars(switch_core_session_t *session);
+
 SWITCH_DECLARE(switch_status_t) switch_ivr_set_param_detect_speech(switch_core_session_t *session, const char *name, const char *val);
 
 /*!
diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c
index 4fe5732..672750a 100644
--- a/src/switch_ivr_async.c
+++ b/src/switch_ivr_async.c
@@ -26,6 +26,7 @@
  * Anthony Minessale II <anthm at freeswitch.org>
  * Michael Jerris <mike at jerris.com>
  * Bret McDanel <bret AT 0xdecafbad dot com>
+ * Luke Dashjr <luke at openmethods.com> (OpenMethods, LLC)
  *
  * switch_ivr_async.c -- IVR Library (async operations)
  *
@@ -2745,6 +2746,57 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_c
 	return SWITCH_STATUS_FALSE;
 }
 
+SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_enable_grammar(switch_core_session_t *session, const char *name)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;
+	struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY);
+	switch_status_t status;
+
+	if (sth) {
+		if ((status = switch_core_asr_enable_grammar(sth->ah, name)) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Error enabling Grammar\n");
+			switch_core_asr_close(sth->ah, &flags);
+		}
+		return status;
+	}
+	return SWITCH_STATUS_FALSE;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_disable_grammar(switch_core_session_t *session, const char *name)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;
+	struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY);
+	switch_status_t status;
+
+	if (sth) {
+		if ((status = switch_core_asr_disable_grammar(sth->ah, name)) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Error disabling Grammar\n");
+			switch_core_asr_close(sth->ah, &flags);
+		}
+		return status;
+	}
+	return SWITCH_STATUS_FALSE;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_disable_all_grammars(switch_core_session_t *session)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;
+	struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY);
+	switch_status_t status;
+
+	if (sth) {
+		if ((status = switch_core_asr_disable_all_grammars(sth->ah)) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Error disabling all Grammars\n");
+			switch_core_asr_close(sth->ah, &flags);
+		}
+		return status;
+	}
+	return SWITCH_STATUS_FALSE;
+}
+
 SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *session,
 														 const char *mod_name,
 														 const char *grammar, const char *name, const char *dest, switch_asr_handle_t *ah)

-----------------------------------------------------------------------

Summary of changes:
 src/include/switch_ivr.h |   24 +++++++++++++++++++++
 src/switch_ivr_async.c   |   52 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 76 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
FreeSWITCH



More information about the Freeswitch-trunk mailing list