[asterisk-commits] russell: trunk r101082 - in /trunk: CHANGES apps/app_speech_utils.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jan 29 18:04:18 CST 2008
Author: russell
Date: Tue Jan 29 18:04:17 2008
New Revision: 101082
URL: http://svn.digium.com/view/asterisk?view=rev&rev=101082
Log:
Add the 'n' option to SpeechBackground, which has the application not answer the
channel if it has not already been answered.
(closes SPD-51)
Modified:
trunk/CHANGES
trunk/apps/app_speech_utils.c
Modified: trunk/CHANGES
URL: http://svn.digium.com/view/asterisk/trunk/CHANGES?view=diff&rev=101082&r1=101081&r2=101082
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Tue Jan 29 18:04:17 2008
@@ -467,6 +467,8 @@
backend functionality.
* Added a new module, res_config_ldap, which permits the use of an LDAP
server for realtime data access.
+ * Added support for writing and running your dialplan in lua using the pgx_lua
+ module. See configs/extensions.lua.sample for examples of how to do this.
Miscellaneous
-------------
@@ -486,8 +488,6 @@
will now be available in the failed extension using the REASON dialplan variable.
* Added support for reading the TOUCH_MONITOR_PREFIX channel variable.
It allows you to configure a prefix for auto-monitor recordings.
- * Added support for writing and running your dialplan in lua. See
- configs/extensions.lua.sample for examples of how to do this.
* A new extension pattern matching algorithm, based on a trie, is introduced
here, that could noticeably speed up mid-sized to large dialplans.
It is NOT used by default, as duplicating the behaviour of the old pattern
@@ -502,3 +502,5 @@
* Added logging to 'make update' command. See update.log
* Added strictrtp option to rtp.conf. If enabled this will drop RTP packets that
do not come from the remote party.
+ * Added the 'n' option to the SpeechBackground application to tell it to not
+ answer the channel if it has not already been answered.
Modified: trunk/apps/app_speech_utils.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_speech_utils.c?view=diff&rev=101082&r1=101081&r2=101082
==============================================================================
--- trunk/apps/app_speech_utils.c (original)
+++ trunk/apps/app_speech_utils.c Tue Jan 29 18:04:17 2008
@@ -56,15 +56,17 @@
"fed to it. This has no arguments.\n";
static char *speechbackground_descrip =
-" SpeechBackground(Sound File,Timeout):\n"
+" SpeechBackground(<Sound File>[,Timeout[,options]]):\n"
"This application plays a sound file and waits for the person to speak. Once they start speaking playback\n"
"of the file stops, and silence is heard. Once they stop talking the processing sound is played to indicate\n"
"the speech recognition engine is working. Once results are available the application returns and results \n"
"(score and text) are available using dialplan functions.\n"
-"The first text and score are ${SPEECH_TEXT(0)} AND ${SPEECH_SCORE(0)} while the second are ${SPEECH_TEXT(1)}\n"
+" The first text and score are ${SPEECH_TEXT(0)} AND ${SPEECH_SCORE(0)} while the second are ${SPEECH_TEXT(1)}\n"
"and ${SPEECH_SCORE(1)}.\n"
-"The first argument is the sound file and the second is the timeout integer in seconds. Note the timeout will\n"
-"only start once the sound file has stopped playing.\n";
+" The first argument is the sound file and the second is the timeout integer in seconds. Note the timeout will\n"
+"only start once the sound file has stopped playing. The third argument specifies options:\n"
+" Valid Options:\n"
+" n - Don't answer the channel if it has not already been answered.\n";
static char *speechdeactivategrammar_descrip =
" SpeechDeactivateGrammar(Grammar Name):\n"
@@ -487,6 +489,14 @@
return 0;
}
+enum {
+ SB_OPT_NOANSWER = (1 << 0),
+};
+
+AST_APP_OPTIONS(speech_background_options, BEGIN_OPTIONS
+ AST_APP_OPTION('n', SB_OPT_NOANSWER),
+END_OPTIONS );
+
/*! \brief SpeechBackground(Sound File,Timeout) Dialplan Application */
static int speech_background(struct ast_channel *chan, void *data)
{
@@ -500,9 +510,11 @@
struct ast_datastore *datastore = NULL;
char *parse, *filename_tmp = NULL, *filename = NULL, tmp[2] = "", dtmf_terminator = '#';
const char *tmp2 = NULL;
+ struct ast_flags options = { 0 };
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(soundfile);
AST_APP_ARG(timeout);
+ AST_APP_ARG(options);
);
parse = ast_strdupa(data);
@@ -511,9 +523,16 @@
if (speech == NULL)
return -1;
+ if (!ast_strlen_zero(args.options)) {
+ char *options_buf = ast_strdupa(args.options);
+ ast_app_parse_options(speech_background_options, &options, NULL, options_buf);
+ }
+
/* If channel is not already answered, then answer it */
- if (chan->_state != AST_STATE_UP && ast_answer(chan))
- return -1;
+ if (chan->_state != AST_STATE_UP && !ast_test_flag(&options, SB_OPT_NOANSWER)
+ && ast_answer(chan)) {
+ return -1;
+ }
/* Record old read format */
oldreadformat = chan->readformat;
More information about the asterisk-commits
mailing list