Wed Jan 8 2020 09:49:55

Asterisk developer's documentation


app_speech_utils.c File Reference

Speech Recognition Utility Applications. More...

#include "asterisk.h"
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/lock.h"
#include "asterisk/app.h"
#include "asterisk/speech.h"

Go to the source code of this file.

Enumerations

enum  { SB_OPT_NOANSWER = (1 << 0) }
 

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
 ASTERISK_FILE_VERSION (__FILE__,"$Revision: 419684 $")
 
static void destroy_callback (void *data)
 Helper function used by datastores to destroy the speech structure upon hangup. More...
 
static struct ast_speech_resultfind_result (struct ast_speech_result *results, char *result_num)
 
static struct ast_speechfind_speech (struct ast_channel *chan)
 Helper function used to find the speech structure attached to a channel. More...
 
static int load_module (void)
 
static int speech_activate (struct ast_channel *chan, const char *data)
 SpeechActivateGrammar(Grammar Name) Dialplan Application. More...
 
static int speech_background (struct ast_channel *chan, const char *data)
 SpeechBackground(Sound File,Timeout) Dialplan Application. More...
 
static int speech_create (struct ast_channel *chan, const char *data)
 SpeechCreate() Dialplan Application. More...
 
static int speech_datastore_destroy (struct ast_channel *chan)
 
static int speech_deactivate (struct ast_channel *chan, const char *data)
 SpeechDeactivateGrammar(Grammar Name) Dialplan Application. More...
 
static int speech_destroy (struct ast_channel *chan, const char *data)
 SpeechDestroy() Dialplan Application. More...
 
static int speech_engine_write (struct ast_channel *chan, const char *cmd, char *data, const char *value)
 SPEECH_ENGINE() Dialplan Function. More...
 
static int speech_grammar (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 SPEECH_GRAMMAR() Dialplan Function. More...
 
static int speech_load (struct ast_channel *chan, const char *vdata)
 SpeechLoadGrammar(Grammar Name,Path) Dialplan Application. More...
 
static int speech_processing_sound (struct ast_channel *chan, const char *data)
 SpeechProcessingSound(Sound File) Dialplan Application. More...
 
static int speech_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 SPEECH() Dialplan Function. More...
 
static int speech_results_type_write (struct ast_channel *chan, const char *cmd, char *data, const char *value)
 SPEECH_RESULTS_TYPE() Dialplan Function. More...
 
static int speech_score (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 SPEECH_SCORE() Dialplan Function. More...
 
static int speech_start (struct ast_channel *chan, const char *data)
 SpeechStart() Dialplan Application. More...
 
static int speech_streamfile (struct ast_channel *chan, const char *filename, const char *preflang)
 Helper function used by speech_background to playback a soundfile. More...
 
static int speech_text (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 SPEECH_TEXT() Dialplan Function. More...
 
static int speech_unload (struct ast_channel *chan, const char *data)
 SpeechUnloadGrammar(Grammar Name) Dialplan Application. More...
 
static int unload_module (void)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Dialplan Speech Applications" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .nonoptreq = "res_speech", }
 
static struct ast_module_infoast_module_info = &__mod_info
 
static struct ast_app_option speech_background_options [128] = { [ 'n' ] = { .flag = SB_OPT_NOANSWER }, }
 
static struct ast_datastore_info speech_datastore
 Static structure for datastore information. More...
 
static struct ast_custom_function speech_engine_function
 
static struct ast_custom_function speech_function
 
static struct ast_custom_function speech_grammar_function
 
static struct ast_custom_function speech_results_type_function
 
static struct ast_custom_function speech_score_function
 
static struct ast_custom_function speech_text_function
 

Detailed Description

Speech Recognition Utility Applications.

Author
Joshua Colp jcolp.nosp@m.@dig.nosp@m.ium.c.nosp@m.om

Definition in file app_speech_utils.c.

Enumeration Type Documentation

anonymous enum
Enumerator
SB_OPT_NOANSWER 

Definition at line 680 of file app_speech_utils.c.

680  {
681  SB_OPT_NOANSWER = (1 << 0),
682 };

Function Documentation

static void __reg_module ( void  )
static

Definition at line 995 of file app_speech_utils.c.

static void __unreg_module ( void  )
static

Definition at line 995 of file app_speech_utils.c.

ASTERISK_FILE_VERSION ( __FILE__  ,
"$Revision: 419684 $"   
)
static void destroy_callback ( void *  data)
static

Helper function used by datastores to destroy the speech structure upon hangup.

Definition at line 262 of file app_speech_utils.c.

References ast_speech_destroy().

263 {
264  struct ast_speech *speech = (struct ast_speech*)data;
265 
266  if (speech == NULL) {
267  return;
268  }
269 
270  /* Deallocate now */
271  ast_speech_destroy(speech);
272 
273  return;
274 }
int ast_speech_destroy(struct ast_speech *speech)
Destroy a speech structure.
Definition: res_speech.c:224
void * data
Definition: speech.h:63
static struct ast_speech_result* find_result ( struct ast_speech_result results,
char *  result_num 
)
static

Definition at line 333 of file app_speech_utils.c.

References AST_LIST_NEXT, and ast_speech_result::nbest_num.

Referenced by speech_grammar(), speech_score(), and speech_text().

334 {
335  struct ast_speech_result *result = results;
336  char *tmp = NULL;
337  int nbest_num = 0, wanted_num = 0, i = 0;
338 
339  if (!result) {
340  return NULL;
341  }
342 
343  if ((tmp = strchr(result_num, '/'))) {
344  *tmp++ = '\0';
345  nbest_num = atoi(result_num);
346  wanted_num = atoi(tmp);
347  } else {
348  wanted_num = atoi(result_num);
349  }
350 
351  do {
352  if (result->nbest_num != nbest_num)
353  continue;
354  if (i == wanted_num)
355  break;
356  i++;
357  } while ((result = AST_LIST_NEXT(result, list)));
358 
359  return result;
360 }
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
Definition: linkedlists.h:438
static struct ast_speech* find_speech ( struct ast_channel chan)
static

Helper function used to find the speech structure attached to a channel.

Definition at line 283 of file app_speech_utils.c.

References ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, and ast_datastore::data.

Referenced by speech_activate(), speech_background(), speech_deactivate(), speech_engine_write(), speech_grammar(), speech_load(), speech_processing_sound(), speech_read(), speech_results_type_write(), speech_score(), speech_start(), speech_text(), and speech_unload().

284 {
285  struct ast_speech *speech = NULL;
286  struct ast_datastore *datastore = NULL;
287 
288  if (!chan) {
289  return NULL;
290  }
291 
292  ast_channel_lock(chan);
293  datastore = ast_channel_datastore_find(chan, &speech_datastore, NULL);
294  ast_channel_unlock(chan);
295  if (datastore == NULL) {
296  return NULL;
297  }
298  speech = datastore->data;
299 
300  return speech;
301 }
#define ast_channel_lock(chan)
Definition: channel.h:2466
Structure for a data store object.
Definition: datastore.h:54
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
Definition: channel.c:2604
static struct ast_datastore_info speech_datastore
Static structure for datastore information.
#define ast_channel_unlock(chan)
Definition: channel.h:2467
void * data
Definition: datastore.h:56
static int load_module ( void  )
static

Definition at line 968 of file app_speech_utils.c.

References ast_custom_function_register, ast_register_application_xml, speech_activate(), speech_background(), speech_create(), speech_deactivate(), speech_destroy(), speech_load(), speech_processing_sound(), speech_start(), and speech_unload().

969 {
970  int res = 0;
971 
972  res = ast_register_application_xml("SpeechCreate", speech_create);
973  res |= ast_register_application_xml("SpeechLoadGrammar", speech_load);
974  res |= ast_register_application_xml("SpeechUnloadGrammar", speech_unload);
975  res |= ast_register_application_xml("SpeechActivateGrammar", speech_activate);
976  res |= ast_register_application_xml("SpeechDeactivateGrammar", speech_deactivate);
977  res |= ast_register_application_xml("SpeechStart", speech_start);
978  res |= ast_register_application_xml("SpeechBackground", speech_background);
979  res |= ast_register_application_xml("SpeechDestroy", speech_destroy);
980  res |= ast_register_application_xml("SpeechProcessingSound", speech_processing_sound);
987 
988  return res;
989 }
static int speech_create(struct ast_channel *chan, const char *data)
SpeechCreate() Dialplan Application.
static int speech_unload(struct ast_channel *chan, const char *data)
SpeechUnloadGrammar(Grammar Name) Dialplan Application.
static struct ast_custom_function speech_engine_function
static int speech_background(struct ast_channel *chan, const char *data)
SpeechBackground(Sound File,Timeout) Dialplan Application.
static struct ast_custom_function speech_grammar_function
static int speech_load(struct ast_channel *chan, const char *vdata)
SpeechLoadGrammar(Grammar Name,Path) Dialplan Application.
static int speech_destroy(struct ast_channel *chan, const char *data)
SpeechDestroy() Dialplan Application.
static struct ast_custom_function speech_function
static int speech_deactivate(struct ast_channel *chan, const char *data)
SpeechDeactivateGrammar(Grammar Name) Dialplan Application.
static struct ast_custom_function speech_results_type_function
static int speech_activate(struct ast_channel *chan, const char *data)
SpeechActivateGrammar(Grammar Name) Dialplan Application.
static int speech_start(struct ast_channel *chan, const char *data)
SpeechStart() Dialplan Application.
static int speech_processing_sound(struct ast_channel *chan, const char *data)
SpeechProcessingSound(Sound File) Dialplan Application.
static struct ast_custom_function speech_score_function
static struct ast_custom_function speech_text_function
#define ast_custom_function_register(acf)
Register a custom function.
Definition: pbx.h:1164
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Definition: module.h:437
static int speech_activate ( struct ast_channel chan,
const char *  data 
)
static

SpeechActivateGrammar(Grammar Name) Dialplan Application.

Definition at line 617 of file app_speech_utils.c.

References ast_speech_grammar_activate(), and find_speech().

Referenced by load_module().

618 {
619  int res = 0;
620  struct ast_speech *speech = find_speech(chan);
621 
622  if (speech == NULL)
623  return -1;
624 
625  /* Activate the grammar on the speech object */
626  res = ast_speech_grammar_activate(speech, data);
627 
628  return res;
629 }
void * data
Definition: speech.h:63
static struct ast_speech * find_speech(struct ast_channel *chan)
Helper function used to find the speech structure attached to a channel.
int ast_speech_grammar_activate(struct ast_speech *speech, const char *grammar_name)
Activate a grammar on a speech structure.
Definition: res_speech.c:67
static int speech_background ( struct ast_channel chan,
const char *  data 
)
static

SpeechBackground(Sound File,Timeout) Dialplan Application.

Definition at line 689 of file app_speech_utils.c.

References ast_channel::_state, args, ast_answer(), AST_APP_ARG, ast_app_parse_options(), ast_calloc, ast_channel_lock, ast_channel_unlock, ast_clear_flag, AST_CONTROL_HANGUP, AST_DECLARE_APP_ARGS, AST_FORMAT_SLINEAR, AST_FRAME_CONTROL, AST_FRAME_DTMF, AST_FRAME_VOICE, ast_frfree, AST_MAX_EXTENSION, ast_mutex_lock, ast_mutex_unlock, ast_read(), ast_sched_runq(), ast_sched_wait(), ast_set_read_format(), ast_speech_change_state(), ast_speech_dtmf(), AST_SPEECH_QUIET, ast_speech_results_get(), ast_speech_start(), AST_SPEECH_STATE_DONE, AST_SPEECH_STATE_NOT_READY, AST_SPEECH_STATE_READY, AST_SPEECH_STATE_WAIT, ast_speech_write(), AST_STANDARD_APP_ARGS, AST_STATE_UP, ast_stopstream(), ast_strdup, ast_strdupa, ast_strlen_zero(), ast_test_flag, ast_tvdiff_ms(), ast_tvnow(), ast_waitfor(), ast_frame::data, ast_frame::datalen, ast_pbx::dtimeoutms, f, find_speech(), ast_speech::format, ast_frame::frametype, ast_speech_result::grammar, ast_frame_subclass::integer, ast_channel::language, ast_speech::lock, parse(), ast_channel::pbx, pbx_builtin_getvar_helper(), ast_speech::processing_sound, ast_frame::ptr, ast_channel::readformat, ast_speech::results, SB_OPT_NOANSWER, ast_channel::sched, ast_speech_result::score, speech_background_options, speech_datastore_destroy(), speech_streamfile(), ast_speech::state, ast_channel::stream, ast_channel::streamid, strsep(), ast_frame::subclass, ast_speech_result::text, and ast_channel::timingfunc.

Referenced by load_module().

690 {
691  unsigned int timeout = 0;
692  int res = 0, done = 0, started = 0, quieted = 0, max_dtmf_len = 0;
693  struct ast_speech *speech = find_speech(chan);
694  struct ast_frame *f = NULL;
695  int oldreadformat = AST_FORMAT_SLINEAR;
696  char dtmf[AST_MAX_EXTENSION] = "";
697  struct timeval start = { 0, 0 }, current;
698  char *parse, *filename_tmp = NULL, *filename = NULL, tmp[2] = "", dtmf_terminator = '#';
699  const char *tmp2 = NULL;
700  struct ast_flags options = { 0 };
702  AST_APP_ARG(soundfile);
703  AST_APP_ARG(timeout);
704  AST_APP_ARG(options);
705  );
706 
707  parse = ast_strdupa(data);
708  AST_STANDARD_APP_ARGS(args, parse);
709 
710  if (speech == NULL)
711  return -1;
712 
713  if (!ast_strlen_zero(args.options)) {
714  char *options_buf = ast_strdupa(args.options);
715  ast_app_parse_options(speech_background_options, &options, NULL, options_buf);
716  }
717 
718  /* If channel is not already answered, then answer it */
719  if (chan->_state != AST_STATE_UP && !ast_test_flag(&options, SB_OPT_NOANSWER)
720  && ast_answer(chan)) {
721  return -1;
722  }
723 
724  /* Record old read format */
725  oldreadformat = chan->readformat;
726 
727  /* Change read format to be signed linear */
728  if (ast_set_read_format(chan, speech->format))
729  return -1;
730 
731  if (!ast_strlen_zero(args.soundfile)) {
732  /* Yay sound file */
733  filename_tmp = ast_strdupa(args.soundfile);
734  if (!ast_strlen_zero(args.timeout)) {
735  if ((timeout = atof(args.timeout) * 1000.0) == 0)
736  timeout = -1;
737  } else
738  timeout = 0;
739  }
740 
741  /* See if the maximum DTMF length variable is set... we use a variable in case they want to carry it through their entire dialplan */
742  ast_channel_lock(chan);
743  if ((tmp2 = pbx_builtin_getvar_helper(chan, "SPEECH_DTMF_MAXLEN")) && !ast_strlen_zero(tmp2)) {
744  max_dtmf_len = atoi(tmp2);
745  }
746 
747  /* See if a terminator is specified */
748  if ((tmp2 = pbx_builtin_getvar_helper(chan, "SPEECH_DTMF_TERMINATOR"))) {
749  if (ast_strlen_zero(tmp2))
750  dtmf_terminator = '\0';
751  else
752  dtmf_terminator = tmp2[0];
753  }
754  ast_channel_unlock(chan);
755 
756  /* Before we go into waiting for stuff... make sure the structure is ready, if not - start it again */
757  if (speech->state == AST_SPEECH_STATE_NOT_READY || speech->state == AST_SPEECH_STATE_DONE) {
759  ast_speech_start(speech);
760  }
761 
762  /* Ensure no streams are currently running */
763  ast_stopstream(chan);
764 
765  /* Okay it's streaming so go into a loop grabbing frames! */
766  while (done == 0) {
767  /* If the filename is null and stream is not running, start up a new sound file */
768  if (!quieted && (chan->streamid == -1 && chan->timingfunc == NULL) && (filename = strsep(&filename_tmp, "&"))) {
769  /* Discard old stream information */
770  ast_stopstream(chan);
771  /* Start new stream */
772  speech_streamfile(chan, filename, chan->language);
773  }
774 
775  /* Run scheduled stuff */
776  ast_sched_runq(chan->sched);
777 
778  /* Yay scheduling */
779  res = ast_sched_wait(chan->sched);
780  if (res < 0)
781  res = 1000;
782 
783  /* If there is a frame waiting, get it - if not - oh well */
784  if (ast_waitfor(chan, res) > 0) {
785  f = ast_read(chan);
786  if (f == NULL) {
787  /* The channel has hung up most likely */
788  done = 3;
789  break;
790  }
791  }
792 
793  /* Do timeout check (shared between audio/dtmf) */
794  if ((!quieted || strlen(dtmf)) && started == 1) {
795  current = ast_tvnow();
796  if ((ast_tvdiff_ms(current, start)) >= timeout) {
797  done = 1;
798  if (f)
799  ast_frfree(f);
800  break;
801  }
802  }
803 
804  /* Do checks on speech structure to see if it's changed */
805  ast_mutex_lock(&speech->lock);
806  if (ast_test_flag(speech, AST_SPEECH_QUIET)) {
807  if (chan->stream)
808  ast_stopstream(chan);
810  quieted = 1;
811  }
812  /* Check state so we can see what to do */
813  switch (speech->state) {
815  /* If audio playback has stopped do a check for timeout purposes */
816  if (chan->streamid == -1 && chan->timingfunc == NULL)
817  ast_stopstream(chan);
818  if (!quieted && chan->stream == NULL && timeout && started == 0 && !filename_tmp) {
819  if (timeout == -1) {
820  done = 1;
821  if (f)
822  ast_frfree(f);
823  break;
824  }
825  start = ast_tvnow();
826  started = 1;
827  }
828  /* Write audio frame out to speech engine if no DTMF has been received */
829  if (!strlen(dtmf) && f != NULL && f->frametype == AST_FRAME_VOICE) {
830  ast_speech_write(speech, f->data.ptr, f->datalen);
831  }
832  break;
834  /* Cue up waiting sound if not already playing */
835  if (!strlen(dtmf)) {
836  if (chan->stream == NULL) {
837  if (speech->processing_sound != NULL) {
838  if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound, "none")) {
839  speech_streamfile(chan, speech->processing_sound, chan->language);
840  }
841  }
842  } else if (chan->streamid == -1 && chan->timingfunc == NULL) {
843  ast_stopstream(chan);
844  if (speech->processing_sound != NULL) {
845  if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound, "none")) {
846  speech_streamfile(chan, speech->processing_sound, chan->language);
847  }
848  }
849  }
850  }
851  break;
853  /* Now that we are done... let's switch back to not ready state */
855  if (!strlen(dtmf)) {
856  /* Copy to speech structure the results, if available */
857  speech->results = ast_speech_results_get(speech);
858  /* Break out of our background too */
859  done = 1;
860  /* Stop audio playback */
861  if (chan->stream != NULL) {
862  ast_stopstream(chan);
863  }
864  }
865  break;
866  default:
867  break;
868  }
869  ast_mutex_unlock(&speech->lock);
870 
871  /* Deal with other frame types */
872  if (f != NULL) {
873  /* Free the frame we received */
874  switch (f->frametype) {
875  case AST_FRAME_DTMF:
876  if (dtmf_terminator != '\0' && f->subclass.integer == dtmf_terminator) {
877  done = 1;
878  } else {
879  quieted = 1;
880  if (chan->stream != NULL) {
881  ast_stopstream(chan);
882  }
883  if (!started) {
884  /* Change timeout to be 5 seconds for DTMF input */
885  timeout = (chan->pbx && chan->pbx->dtimeoutms) ? chan->pbx->dtimeoutms : 5000;
886  started = 1;
887  }
888  start = ast_tvnow();
889  snprintf(tmp, sizeof(tmp), "%c", f->subclass.integer);
890  strncat(dtmf, tmp, sizeof(dtmf) - strlen(dtmf) - 1);
891  /* If the maximum length of the DTMF has been reached, stop now */
892  if (max_dtmf_len && strlen(dtmf) == max_dtmf_len)
893  done = 1;
894  }
895  break;
896  case AST_FRAME_CONTROL:
897  switch (f->subclass.integer) {
898  case AST_CONTROL_HANGUP:
899  /* Since they hung up we should destroy the speech structure */
900  done = 3;
901  default:
902  break;
903  }
904  default:
905  break;
906  }
907  ast_frfree(f);
908  f = NULL;
909  }
910  }
911 
912  if (!ast_strlen_zero(dtmf)) {
913  /* We sort of make a results entry */
914  speech->results = ast_calloc(1, sizeof(*speech->results));
915  if (speech->results != NULL) {
916  ast_speech_dtmf(speech, dtmf);
917  speech->results->score = 1000;
918  speech->results->text = ast_strdup(dtmf);
919  speech->results->grammar = ast_strdup("dtmf");
920  }
922  }
923 
924  /* See if it was because they hung up */
925  if (done == 3) {
927  } else {
928  /* Channel is okay so restore read format */
929  ast_set_read_format(chan, oldreadformat);
930  }
931 
932  return 0;
933 }
union ast_frame_subclass subclass
Definition: frame.h:146
int state
Definition: speech.h:59
#define ast_channel_lock(chan)
Definition: channel.h:2466
char * strsep(char **str, const char *delims)
#define ast_strdup(a)
Definition: astmm.h:109
void ast_speech_start(struct ast_speech *speech)
Indicate to the speech engine that audio is now going to start being written.
Definition: res_speech.c:123
#define ast_test_flag(p, flag)
Definition: utils.h:63
void * ptr
Definition: frame.h:160
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
Definition: app.c:2101
#define AST_FRAME_DTMF
Definition: frame.h:128
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application&#39;s arguments.
Definition: app.h:572
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
Definition: channel.c:4383
struct ast_speech_result * ast_speech_results_get(struct ast_speech *speech)
Get speech recognition results.
Definition: res_speech.c:91
static int speech_streamfile(struct ast_channel *chan, const char *filename, const char *preflang)
Helper function used by speech_background to playback a soundfile.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Definition: time.h:142
#define ast_mutex_lock(a)
Definition: lock.h:155
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
Definition: time.h:90
char * grammar
Definition: speech.h:114
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
Definition: pbx.c:10475
static struct ast_app_option speech_background_options[128]
int ast_set_read_format(struct ast_channel *chan, format_t format)
Sets read format on channel chan Set read format for channel to whichever component of &quot;format&quot; is be...
Definition: channel.c:5301
int ast_speech_change_state(struct ast_speech *speech, int state)
Change state of a speech structure.
Definition: res_speech.c:249
static struct ast_speech * find_speech(struct ast_channel *chan)
Helper function used to find the speech structure attached to a channel.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:63
#define AST_MAX_EXTENSION
Definition: channel.h:135
int datalen
Definition: frame.h:148
struct sched_context * sched
Definition: channel.h:756
int streamid
Definition: channel.h:835
int(* timingfunc)(const void *data)
Definition: channel.h:759
struct ast_speech_result * results
Definition: speech.h:65
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: utils.h:663
static struct @350 args
enum ast_channel_state _state
Definition: channel.h:839
#define ast_channel_unlock(chan)
Definition: channel.h:2467
static void parse(struct mgcp_request *req)
Definition: chan_mgcp.c:1858
int format
Definition: speech.h:61
static struct ast_format f[]
Definition: format_g726.c:181
Structure used to handle boolean flags.
Definition: utils.h:200
#define ast_clear_flag(p, flag)
Definition: utils.h:77
static int speech_datastore_destroy(struct ast_channel *chan)
int ast_sched_runq(struct sched_context *con)
Runs the queue.
Definition: sched.c:600
ast_mutex_t lock
Definition: speech.h:53
#define AST_FORMAT_SLINEAR
Definition: frame.h:254
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
Definition: channel.c:3539
int dtimeoutms
Definition: pbx.h:180
int ast_speech_dtmf(struct ast_speech *speech, const char *dtmf)
Signal to the engine that DTMF was received.
Definition: res_speech.c:155
format_t readformat
Definition: channel.h:853
#define ast_calloc(a, b)
Definition: astmm.h:82
int ast_sched_wait(struct sched_context *con) attribute_warn_unused_result
Determines number of seconds until the next outstanding event to take place Determine the number of s...
Definition: sched.c:334
int ast_answer(struct ast_channel *chan)
Answer a channel.
Definition: channel.c:3086
Data structure associated with a single frame of data.
Definition: frame.h:142
char * processing_sound
Definition: speech.h:57
#define AST_APP_ARG(name)
Define an application argument.
Definition: app.h:555
enum ast_frame_type frametype
Definition: frame.h:144
#define ast_frfree(fr)
Definition: frame.h:583
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the &#39;standard&#39; argument separation process for an application.
Definition: app.h:604
int ast_speech_write(struct ast_speech *speech, void *data, int len)
Write audio to the speech engine.
Definition: res_speech.c:145
struct ast_filestream * stream
Definition: channel.h:757
union ast_frame::@172 data
const ast_string_field language
Definition: channel.h:787
int ast_stopstream(struct ast_channel *c)
Stops a stream.
Definition: file.c:128
#define ast_mutex_unlock(a)
Definition: lock.h:156
struct ast_pbx * pbx
Definition: channel.h:761
static int speech_create ( struct ast_channel chan,
const char *  data 
)
static

SpeechCreate() Dialplan Application.

Definition at line 532 of file app_speech_utils.c.

References ast_channel_datastore_add(), ast_channel_lock, ast_channel_unlock, ast_datastore_alloc(), ast_speech_destroy(), ast_speech_new(), ast_datastore::data, ast_channel::nativeformats, and pbx_builtin_setvar_helper().

Referenced by load_module().

533 {
534  struct ast_speech *speech = NULL;
535  struct ast_datastore *datastore = NULL;
536 
537  /* Request a speech object */
538  speech = ast_speech_new(data, chan->nativeformats);
539  if (speech == NULL) {
540  /* Not available */
541  pbx_builtin_setvar_helper(chan, "ERROR", "1");
542  return 0;
543  }
544 
545  datastore = ast_datastore_alloc(&speech_datastore, NULL);
546  if (datastore == NULL) {
547  ast_speech_destroy(speech);
548  pbx_builtin_setvar_helper(chan, "ERROR", "1");
549  return 0;
550  }
551  pbx_builtin_setvar_helper(chan, "ERROR", NULL);
552  datastore->data = speech;
553  ast_channel_lock(chan);
554  ast_channel_datastore_add(chan, datastore);
555  ast_channel_unlock(chan);
556 
557  return 0;
558 }
#define ast_channel_lock(chan)
Definition: channel.h:2466
int ast_speech_destroy(struct ast_speech *speech)
Destroy a speech structure.
Definition: res_speech.c:224
format_t nativeformats
Definition: channel.h:852
Structure for a data store object.
Definition: datastore.h:54
static struct ast_datastore_info speech_datastore
Static structure for datastore information.
struct ast_datastore * ast_datastore_alloc(const struct ast_datastore_info *info, const char *uid)
Definition: datastore.c:98
#define ast_channel_unlock(chan)
Definition: channel.h:2467
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
Definition: pbx.c:10546
void * data
Definition: datastore.h:56
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
Definition: channel.c:2590
struct ast_speech * ast_speech_new(const char *engine_name, int formats)
Create a new speech structure.
Definition: res_speech.c:176
static int speech_datastore_destroy ( struct ast_channel chan)
static

Definition at line 312 of file app_speech_utils.c.

References ast_channel_datastore_find(), ast_channel_datastore_remove(), ast_channel_lock, ast_channel_unlock, and ast_datastore_free().

Referenced by speech_background(), and speech_destroy().

313 {
314  struct ast_datastore *datastore;
315  int res;
316 
317  ast_channel_lock(chan);
318  datastore = ast_channel_datastore_find(chan, &speech_datastore, NULL);
319  if (datastore) {
320  ast_channel_datastore_remove(chan, datastore);
321  }
322  ast_channel_unlock(chan);
323  if (datastore) {
324  ast_datastore_free(datastore);
325  res = 0;
326  } else {
327  res = -1;
328  }
329  return res;
330 }
#define ast_channel_lock(chan)
Definition: channel.h:2466
Structure for a data store object.
Definition: datastore.h:54
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
Definition: channel.c:2604
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
Definition: datastore.c:65
static struct ast_datastore_info speech_datastore
Static structure for datastore information.
#define ast_channel_unlock(chan)
Definition: channel.h:2467
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
Definition: channel.c:2599
static int speech_deactivate ( struct ast_channel chan,
const char *  data 
)
static

SpeechDeactivateGrammar(Grammar Name) Dialplan Application.

Definition at line 602 of file app_speech_utils.c.

References ast_speech_grammar_deactivate(), and find_speech().

Referenced by load_module().

603 {
604  int res = 0;
605  struct ast_speech *speech = find_speech(chan);
606 
607  if (speech == NULL)
608  return -1;
609 
610  /* Deactivate the grammar on the speech object */
611  res = ast_speech_grammar_deactivate(speech, data);
612 
613  return res;
614 }
void * data
Definition: speech.h:63
int ast_speech_grammar_deactivate(struct ast_speech *speech, const char *grammar_name)
Deactivate a grammar on a speech structure.
Definition: res_speech.c:73
static struct ast_speech * find_speech(struct ast_channel *chan)
Helper function used to find the speech structure attached to a channel.
static int speech_destroy ( struct ast_channel chan,
const char *  data 
)
static

SpeechDestroy() Dialplan Application.

Definition at line 937 of file app_speech_utils.c.

References speech_datastore_destroy().

Referenced by load_module().

938 {
939  if (!chan) {
940  return -1;
941  }
942  return speech_datastore_destroy(chan);
943 }
static int speech_datastore_destroy(struct ast_channel *chan)
static int speech_engine_write ( struct ast_channel chan,
const char *  cmd,
char *  data,
const char *  value 
)
static

SPEECH_ENGINE() Dialplan Function.

Definition at line 440 of file app_speech_utils.c.

References ast_speech_change(), and find_speech().

441 {
442  struct ast_speech *speech = find_speech(chan);
443 
444  if (data == NULL || speech == NULL) {
445  return -1;
446  }
447 
448  ast_speech_change(speech, data, value);
449 
450  return 0;
451 }
void * data
Definition: speech.h:63
int value
Definition: syslog.c:39
static struct ast_speech * find_speech(struct ast_channel *chan)
Helper function used to find the speech structure attached to a channel.
int ast_speech_change(struct ast_speech *speech, const char *name, const char *value)
Change an engine specific attribute.
Definition: res_speech.c:170
static int speech_grammar ( struct ast_channel chan,
const char *  cmd,
char *  data,
char *  buf,
size_t  len 
)
static

SPEECH_GRAMMAR() Dialplan Function.

Definition at line 414 of file app_speech_utils.c.

References ast_copy_string(), find_result(), find_speech(), ast_speech_result::grammar, and ast_speech::results.

416 {
417  struct ast_speech_result *result = NULL;
418  struct ast_speech *speech = find_speech(chan);
419 
420  if (data == NULL || speech == NULL || !(result = find_result(speech->results, data))) {
421  return -1;
422  }
423 
424  if (result->grammar != NULL) {
425  ast_copy_string(buf, result->grammar, len);
426  } else {
427  buf[0] = '\0';
428  }
429 
430  return 0;
431 }
void * data
Definition: speech.h:63
char * grammar
Definition: speech.h:114
static struct ast_speech * find_speech(struct ast_channel *chan)
Helper function used to find the speech structure attached to a channel.
struct ast_speech_result * results
Definition: speech.h:65
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static struct ast_speech_result * find_result(struct ast_speech_result *results, char *result_num)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:223
static int speech_load ( struct ast_channel chan,
const char *  vdata 
)
static

SpeechLoadGrammar(Grammar Name,Path) Dialplan Application.

Definition at line 561 of file app_speech_utils.c.

References args, AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_speech_grammar_load(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_speech::data, and find_speech().

Referenced by load_module().

562 {
563  int res = 0;
564  struct ast_speech *speech = find_speech(chan);
565  char *data;
567  AST_APP_ARG(grammar);
568  AST_APP_ARG(path);
569  );
570 
571  data = ast_strdupa(vdata);
573 
574  if (speech == NULL)
575  return -1;
576 
577  if (args.argc != 2)
578  return -1;
579 
580  /* Load the grammar locally on the object */
581  res = ast_speech_grammar_load(speech, args.grammar, args.path);
582 
583  return res;
584 }
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application&#39;s arguments.
Definition: app.h:572
void * data
Definition: speech.h:63
static struct ast_speech * find_speech(struct ast_channel *chan)
Helper function used to find the speech structure attached to a channel.
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: utils.h:663
static struct @350 args
#define AST_APP_ARG(name)
Define an application argument.
Definition: app.h:555
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the &#39;standard&#39; argument separation process for an application.
Definition: app.h:604
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)
Definition: res_speech.c:79
static int speech_processing_sound ( struct ast_channel chan,
const char *  data 
)
static

SpeechProcessingSound(Sound File) Dialplan Application.

Definition at line 646 of file app_speech_utils.c.

References ast_free, ast_strdup, find_speech(), and ast_speech::processing_sound.

Referenced by load_module().

647 {
648  int res = 0;
649  struct ast_speech *speech = find_speech(chan);
650 
651  if (speech == NULL)
652  return -1;
653 
654  if (speech->processing_sound != NULL) {
655  ast_free(speech->processing_sound);
656  speech->processing_sound = NULL;
657  }
658 
659  speech->processing_sound = ast_strdup(data);
660 
661  return res;
662 }
#define ast_strdup(a)
Definition: astmm.h:109
void * data
Definition: speech.h:63
static struct ast_speech * find_speech(struct ast_channel *chan)
Helper function used to find the speech structure attached to a channel.
#define ast_free(a)
Definition: astmm.h:97
char * processing_sound
Definition: speech.h:57
static int speech_read ( struct ast_channel chan,
const char *  cmd,
char *  data,
char *  buf,
size_t  len 
)
static

SPEECH() Dialplan Function.

Definition at line 482 of file app_speech_utils.c.

References ast_copy_string(), AST_LIST_NEXT, AST_SPEECH_SPOKE, ast_test_flag, find_speech(), and ast_speech::results.

484 {
485  int results = 0;
486  struct ast_speech_result *result = NULL;
487  struct ast_speech *speech = find_speech(chan);
488  char tmp[128] = "";
489 
490  /* Now go for the various options */
491  if (!strcasecmp(data, "status")) {
492  if (speech != NULL)
493  ast_copy_string(buf, "1", len);
494  else
495  ast_copy_string(buf, "0", len);
496  return 0;
497  }
498 
499  /* Make sure we have a speech structure for everything else */
500  if (speech == NULL) {
501  return -1;
502  }
503 
504  /* Check to see if they are checking for silence */
505  if (!strcasecmp(data, "spoke")) {
506  if (ast_test_flag(speech, AST_SPEECH_SPOKE))
507  ast_copy_string(buf, "1", len);
508  else
509  ast_copy_string(buf, "0", len);
510  } else if (!strcasecmp(data, "results")) {
511  /* Count number of results */
512  for (result = speech->results; result; result = AST_LIST_NEXT(result, list))
513  results++;
514  snprintf(tmp, sizeof(tmp), "%d", results);
515  ast_copy_string(buf, tmp, len);
516  } else {
517  buf[0] = '\0';
518  }
519 
520  return 0;
521 }
#define ast_test_flag(p, flag)
Definition: utils.h:63
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
Definition: linkedlists.h:438
void * data
Definition: speech.h:63
static struct ast_speech * find_speech(struct ast_channel *chan)
Helper function used to find the speech structure attached to a channel.
struct ast_speech_result * results
Definition: speech.h:65
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:223
static int speech_results_type_write ( struct ast_channel chan,
const char *  cmd,
char *  data,
const char *  value 
)
static

SPEECH_RESULTS_TYPE() Dialplan Function.

Definition at line 460 of file app_speech_utils.c.

References ast_speech_change_results_type(), AST_SPEECH_RESULTS_TYPE_NBEST, AST_SPEECH_RESULTS_TYPE_NORMAL, and find_speech().

461 {
462  struct ast_speech *speech = find_speech(chan);
463 
464  if (data == NULL || speech == NULL)
465  return -1;
466 
467  if (!strcasecmp(value, "normal"))
469  else if (!strcasecmp(value, "nbest"))
471 
472  return 0;
473 }
void * data
Definition: speech.h:63
int value
Definition: syslog.c:39
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: res_speech.c:264
static struct ast_speech * find_speech(struct ast_channel *chan)
Helper function used to find the speech structure attached to a channel.
static int speech_score ( struct ast_channel chan,
const char *  cmd,
char *  data,
char *  buf,
size_t  len 
)
static

SPEECH_SCORE() Dialplan Function.

Definition at line 363 of file app_speech_utils.c.

References ast_copy_string(), find_result(), find_speech(), ast_speech::results, and ast_speech_result::score.

365 {
366  struct ast_speech_result *result = NULL;
367  struct ast_speech *speech = find_speech(chan);
368  char tmp[128] = "";
369 
370  if (data == NULL || speech == NULL || !(result = find_result(speech->results, data))) {
371  return -1;
372  }
373 
374  snprintf(tmp, sizeof(tmp), "%d", result->score);
375 
376  ast_copy_string(buf, tmp, len);
377 
378  return 0;
379 }
void * data
Definition: speech.h:63
static struct ast_speech * find_speech(struct ast_channel *chan)
Helper function used to find the speech structure attached to a channel.
struct ast_speech_result * results
Definition: speech.h:65
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static struct ast_speech_result * find_result(struct ast_speech_result *results, char *result_num)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:223
static int speech_start ( struct ast_channel chan,
const char *  data 
)
static

SpeechStart() Dialplan Application.

Definition at line 632 of file app_speech_utils.c.

References ast_speech_start(), and find_speech().

Referenced by load_module().

633 {
634  int res = 0;
635  struct ast_speech *speech = find_speech(chan);
636 
637  if (speech == NULL)
638  return -1;
639 
640  ast_speech_start(speech);
641 
642  return res;
643 }
void ast_speech_start(struct ast_speech *speech)
Indicate to the speech engine that audio is now going to start being written.
Definition: res_speech.c:123
static struct ast_speech * find_speech(struct ast_channel *chan)
Helper function used to find the speech structure attached to a channel.
static int speech_streamfile ( struct ast_channel chan,
const char *  filename,
const char *  preflang 
)
static

Helper function used by speech_background to playback a soundfile.

Definition at line 665 of file app_speech_utils.c.

References ast_applystream(), ast_openstream(), and ast_playstream().

Referenced by speech_background().

666 {
667  struct ast_filestream *fs = NULL;
668 
669  if (!(fs = ast_openstream(chan, filename, preflang)))
670  return -1;
671 
672  if (ast_applystream(chan, fs))
673  return -1;
674 
675  ast_playstream(fs);
676 
677  return 0;
678 }
int ast_playstream(struct ast_filestream *s)
Play a open stream on a channel.
Definition: file.c:867
int ast_applystream(struct ast_channel *chan, struct ast_filestream *s)
Applys a open stream to a channel.
Definition: file.c:861
char * filename
Definition: mod_format.h:106
This structure is allocated by file.c in one chunk, together with buf_size and desc_size bytes of mem...
Definition: mod_format.h:100
struct ast_filestream * ast_openstream(struct ast_channel *chan, const char *filename, const char *preflang)
Opens stream for use in seeking, playing.
Definition: file.c:636
static int speech_text ( struct ast_channel chan,
const char *  cmd,
char *  data,
char *  buf,
size_t  len 
)
static

SPEECH_TEXT() Dialplan Function.

Definition at line 388 of file app_speech_utils.c.

References ast_copy_string(), find_result(), find_speech(), ast_speech::results, and ast_speech_result::text.

390 {
391  struct ast_speech_result *result = NULL;
392  struct ast_speech *speech = find_speech(chan);
393 
394  if (data == NULL || speech == NULL || !(result = find_result(speech->results, data))) {
395  return -1;
396  }
397 
398  if (result->text != NULL) {
399  ast_copy_string(buf, result->text, len);
400  } else {
401  buf[0] = '\0';
402  }
403 
404  return 0;
405 }
void * data
Definition: speech.h:63
static struct ast_speech * find_speech(struct ast_channel *chan)
Helper function used to find the speech structure attached to a channel.
struct ast_speech_result * results
Definition: speech.h:65
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static struct ast_speech_result * find_result(struct ast_speech_result *results, char *result_num)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:223
static int speech_unload ( struct ast_channel chan,
const char *  data 
)
static

SpeechUnloadGrammar(Grammar Name) Dialplan Application.

Definition at line 587 of file app_speech_utils.c.

References ast_speech_grammar_unload(), and find_speech().

Referenced by load_module().

588 {
589  int res = 0;
590  struct ast_speech *speech = find_speech(chan);
591 
592  if (speech == NULL)
593  return -1;
594 
595  /* Unload the grammar */
596  res = ast_speech_grammar_unload(speech, data);
597 
598  return res;
599 }
void * data
Definition: speech.h:63
static struct ast_speech * find_speech(struct ast_channel *chan)
Helper function used to find the speech structure attached to a channel.
int ast_speech_grammar_unload(struct ast_speech *speech, const char *grammar_name)
Unload a grammar.
Definition: res_speech.c:85
static int unload_module ( void  )
static

Definition at line 945 of file app_speech_utils.c.

References ast_custom_function_unregister(), and ast_unregister_application().

946 {
947  int res = 0;
948 
949  res = ast_unregister_application("SpeechCreate");
950  res |= ast_unregister_application("SpeechLoadGrammar");
951  res |= ast_unregister_application("SpeechUnloadGrammar");
952  res |= ast_unregister_application("SpeechActivateGrammar");
953  res |= ast_unregister_application("SpeechDeactivateGrammar");
954  res |= ast_unregister_application("SpeechStart");
955  res |= ast_unregister_application("SpeechBackground");
956  res |= ast_unregister_application("SpeechDestroy");
957  res |= ast_unregister_application("SpeechProcessingSound");
964 
965  return res;
966 }
static struct ast_custom_function speech_engine_function
static struct ast_custom_function speech_grammar_function
int ast_unregister_application(const char *app)
Unregister an application.
Definition: pbx.c:7705
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
Definition: pbx.c:3814
static struct ast_custom_function speech_function
static struct ast_custom_function speech_results_type_function
static struct ast_custom_function speech_score_function
static struct ast_custom_function speech_text_function

Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Dialplan Speech Applications" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .nonoptreq = "res_speech", }
static

Definition at line 995 of file app_speech_utils.c.

Definition at line 995 of file app_speech_utils.c.

struct ast_app_option speech_background_options[128] = { [ 'n' ] = { .flag = SB_OPT_NOANSWER }, }
static

Definition at line 686 of file app_speech_utils.c.

Referenced by speech_background().

struct ast_datastore_info speech_datastore
static
Initial value:
= {
.type = "speech",
.destroy = destroy_callback
}
static void destroy_callback(void *data)
Helper function used by datastores to destroy the speech structure upon hangup.

Static structure for datastore information.

Definition at line 277 of file app_speech_utils.c.

struct ast_custom_function speech_engine_function
static
Initial value:
= {
.name = "SPEECH_ENGINE",
.read = NULL,
}
static int speech_engine_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
SPEECH_ENGINE() Dialplan Function.

Definition at line 453 of file app_speech_utils.c.

struct ast_custom_function speech_function
static
Initial value:
= {
.name = "SPEECH",
.read = speech_read,
.write = NULL,
}
static int speech_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
SPEECH() Dialplan Function.

Definition at line 523 of file app_speech_utils.c.

struct ast_custom_function speech_grammar_function
static
Initial value:
= {
.name = "SPEECH_GRAMMAR",
.read = speech_grammar,
.write = NULL,
}
static int speech_grammar(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
SPEECH_GRAMMAR() Dialplan Function.

Definition at line 433 of file app_speech_utils.c.

struct ast_custom_function speech_results_type_function
static
Initial value:
= {
.name = "SPEECH_RESULTS_TYPE",
.read = NULL,
}
static int speech_results_type_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
SPEECH_RESULTS_TYPE() Dialplan Function.

Definition at line 475 of file app_speech_utils.c.

struct ast_custom_function speech_score_function
static
Initial value:
= {
.name = "SPEECH_SCORE",
.read = speech_score,
.write = NULL,
}
static int speech_score(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
SPEECH_SCORE() Dialplan Function.

Definition at line 381 of file app_speech_utils.c.

struct ast_custom_function speech_text_function
static
Initial value:
= {
.name = "SPEECH_TEXT",
.read = speech_text,
.write = NULL,
}
static int speech_text(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
SPEECH_TEXT() Dialplan Function.

Definition at line 407 of file app_speech_utils.c.