Asterisk - The Open Source Telephony Project GIT-master-8f1982c
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
Enumerations | Functions | Variables
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"
Include dependency graph for app_speech_utils.c:

Go to the source code of this file.

Enumerations

enum  { SB_OPT_NOANSWER = (1 << 0) , SB_OPT_PARTIALRESULTS = (1 << 1) }
 

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
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_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 SPEECH_ENGINE() Dialplan Get Function. More...
 
static int speech_engine_write (struct ast_channel *chan, const char *cmd, char *data, const char *value)
 SPEECH_ENGINE() Dialplan Set 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 = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .requires = "res_speech", }
 
static const struct ast_module_infoast_module_info = &__mod_info
 
static const struct ast_app_option speech_background_options [128] = { [ 'n' ] = { .flag = SB_OPT_NOANSWER }, [ 'p' ] = { .flag = SB_OPT_PARTIALRESULTS }, }
 
static const 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

anonymous enum
Enumerator
SB_OPT_NOANSWER 
SB_OPT_PARTIALRESULTS 

Definition at line 749 of file app_speech_utils.c.

749 {
750 SB_OPT_NOANSWER = (1 << 0),
751 SB_OPT_PARTIALRESULTS = (1 << 1),
752};
@ SB_OPT_NOANSWER
@ SB_OPT_PARTIALRESULTS

Function Documentation

◆ __reg_module()

static void __reg_module ( void  )
static

Definition at line 1073 of file app_speech_utils.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 1073 of file app_speech_utils.c.

◆ AST_MODULE_SELF_SYM()

struct ast_module * AST_MODULE_SELF_SYM ( void  )

Definition at line 1073 of file app_speech_utils.c.

◆ destroy_callback()

static void destroy_callback ( void *  data)
static

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

Definition at line 319 of file app_speech_utils.c.

320{
321 struct ast_speech *speech = (struct ast_speech*)data;
322
323 if (speech == NULL) {
324 return;
325 }
326
327 /* Deallocate now */
328 ast_speech_destroy(speech);
329
330 return;
331}
#define NULL
Definition: resample.c:96
int ast_speech_destroy(struct ast_speech *speech)
Destroy a speech structure.
Definition: res_speech.c:251
void * data
Definition: speech.h:66

References ast_speech_destroy(), ast_speech::data, and NULL.

◆ find_result()

static struct ast_speech_result * find_result ( struct ast_speech_result results,
char *  result_num 
)
static

Definition at line 390 of file app_speech_utils.c.

391{
392 struct ast_speech_result *result = results;
393 char *tmp = NULL;
394 int nbest_num = 0, wanted_num = 0, i = 0;
395
396 if (!result) {
397 return NULL;
398 }
399
400 if ((tmp = strchr(result_num, '/'))) {
401 *tmp++ = '\0';
402 nbest_num = atoi(result_num);
403 wanted_num = atoi(tmp);
404 } else {
405 wanted_num = atoi(result_num);
406 }
407
408 do {
409 if (result->nbest_num != nbest_num)
410 continue;
411 if (i == wanted_num)
412 break;
413 i++;
414 } while ((result = AST_LIST_NEXT(result, list)));
415
416 return result;
417}
static PGresult * result
Definition: cel_pgsql.c:84
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
Definition: linkedlists.h:439

References AST_LIST_NEXT, ast_speech_result::nbest_num, NULL, and result.

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

◆ find_speech()

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 340 of file app_speech_utils.c.

341{
342 struct ast_speech *speech = NULL;
343 struct ast_datastore *datastore = NULL;
344
345 if (!chan) {
346 return NULL;
347 }
348
349 ast_channel_lock(chan);
351 ast_channel_unlock(chan);
352 if (datastore == NULL) {
353 return NULL;
354 }
355 speech = datastore->data;
356
357 return speech;
358}
static const struct ast_datastore_info speech_datastore
Static structure for datastore information.
#define ast_channel_lock(chan)
Definition: channel.h:2972
#define ast_channel_unlock(chan)
Definition: channel.h:2973
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:2368
Structure for a data store object.
Definition: datastore.h:64
void * data
Definition: datastore.h:66

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

Referenced by speech_activate(), speech_background(), speech_deactivate(), speech_engine_read(), 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().

◆ load_module()

static int load_module ( void  )
static

Definition at line 1045 of file app_speech_utils.c.

1046{
1047 int res = 0;
1048
1049 res = ast_register_application_xml("SpeechCreate", speech_create);
1050 res |= ast_register_application_xml("SpeechLoadGrammar", speech_load);
1051 res |= ast_register_application_xml("SpeechUnloadGrammar", speech_unload);
1052 res |= ast_register_application_xml("SpeechActivateGrammar", speech_activate);
1053 res |= ast_register_application_xml("SpeechDeactivateGrammar", speech_deactivate);
1054 res |= ast_register_application_xml("SpeechStart", speech_start);
1055 res |= ast_register_application_xml("SpeechBackground", speech_background);
1056 res |= ast_register_application_xml("SpeechDestroy", speech_destroy);
1057 res |= ast_register_application_xml("SpeechProcessingSound", speech_processing_sound);
1064
1065 return res;
1066}
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 struct ast_custom_function speech_score_function
static int speech_create(struct ast_channel *chan, const char *data)
SpeechCreate() 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_load(struct ast_channel *chan, const char *vdata)
SpeechLoadGrammar(Grammar Name,Path) Dialplan Application.
static struct ast_custom_function speech_function
static int speech_destroy(struct ast_channel *chan, const char *data)
SpeechDestroy() Dialplan Application.
static int speech_processing_sound(struct ast_channel *chan, const char *data)
SpeechProcessingSound(Sound File) Dialplan Application.
static int speech_background(struct ast_channel *chan, const char *data)
SpeechBackground(Sound File,Timeout) Dialplan Application.
static int speech_deactivate(struct ast_channel *chan, const char *data)
SpeechDeactivateGrammar(Grammar Name) Dialplan Application.
static struct ast_custom_function speech_text_function
static struct ast_custom_function speech_grammar_function
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Definition: module.h:640
#define ast_custom_function_register(acf)
Register a custom function.
Definition: pbx.h:1559

References ast_custom_function_register, ast_register_application_xml, speech_activate(), speech_background(), speech_create(), speech_deactivate(), speech_destroy(), speech_engine_function, speech_function, speech_grammar_function, speech_load(), speech_processing_sound(), speech_results_type_function, speech_score_function, speech_start(), speech_text_function, and speech_unload().

◆ speech_activate()

static int speech_activate ( struct ast_channel chan,
const char *  data 
)
static

SpeechActivateGrammar(Grammar Name) Dialplan Application.

Definition at line 686 of file app_speech_utils.c.

687{
688 int res = 0;
689 struct ast_speech *speech = find_speech(chan);
690
691 if (speech == NULL)
692 return -1;
693
694 /* Activate the grammar on the speech object */
695 res = ast_speech_grammar_activate(speech, data);
696
697 return res;
698}
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:66

References ast_speech_grammar_activate(), ast_speech::data, find_speech(), and NULL.

Referenced by load_module().

◆ speech_background()

static int speech_background ( struct ast_channel chan,
const char *  data 
)
static

SpeechBackground(Sound File,Timeout) Dialplan Application.

Definition at line 760 of file app_speech_utils.c.

761{
762 unsigned int timeout = 0;
763 int res = 0, done = 0, started = 0, quieted = 0, max_dtmf_len = 0;
764 struct ast_speech *speech = find_speech(chan);
765 struct ast_frame *f = NULL;
766 RAII_VAR(struct ast_format *, oldreadformat, NULL, ao2_cleanup);
767 char dtmf[AST_MAX_EXTENSION] = "";
768 struct timeval start = { 0, 0 }, current;
769 char *parse, *filename_tmp = NULL, *filename = NULL, tmp[2] = "", dtmf_terminator = '#';
770 const char *tmp2 = NULL;
771 struct ast_flags options = { 0 };
773 AST_APP_ARG(soundfile);
774 AST_APP_ARG(timeout);
776 );
777
778 parse = ast_strdupa(data);
780
781 if (speech == NULL)
782 return -1;
783
784 if (!ast_strlen_zero(args.options)) {
785 char *options_buf = ast_strdupa(args.options);
787 }
788
789 /* If channel is not already answered, then answer it */
791 && ast_answer(chan)) {
792 return -1;
793 }
794
795 /* Record old read format */
796 oldreadformat = ao2_bump(ast_channel_readformat(chan));
797
798 /* Change read format to be signed linear */
799 if (ast_set_read_format(chan, speech->format))
800 return -1;
801
802 if (!ast_strlen_zero(args.soundfile)) {
803 /* Yay sound file */
804 filename_tmp = ast_strdupa(args.soundfile);
805 if (!ast_strlen_zero(args.timeout)) {
806 if ((timeout = atof(args.timeout) * 1000.0) == 0)
807 timeout = -1;
808 } else
809 timeout = 0;
810 }
811
812 /* See if the maximum DTMF length variable is set... we use a variable in case they want to carry it through their entire dialplan */
813 ast_channel_lock(chan);
814 if ((tmp2 = pbx_builtin_getvar_helper(chan, "SPEECH_DTMF_MAXLEN")) && !ast_strlen_zero(tmp2)) {
815 max_dtmf_len = atoi(tmp2);
816 }
817
818 /* See if a terminator is specified */
819 if ((tmp2 = pbx_builtin_getvar_helper(chan, "SPEECH_DTMF_TERMINATOR"))) {
820 if (ast_strlen_zero(tmp2))
821 dtmf_terminator = '\0';
822 else
823 dtmf_terminator = tmp2[0];
824 }
825 ast_channel_unlock(chan);
826
827 /* Before we go into waiting for stuff... make sure the structure is ready, if not - start it again */
828 if (speech->state == AST_SPEECH_STATE_NOT_READY || speech->state == AST_SPEECH_STATE_DONE) {
830 ast_speech_start(speech);
831 }
832
833 /* Ensure no streams are currently running */
834 ast_stopstream(chan);
835
836 /* Okay it's streaming so go into a loop grabbing frames! */
837 while (done == 0) {
838 /* If the filename is null and stream is not running, start up a new sound file */
839 if (!quieted
840 && ast_channel_streamid(chan) == -1
841 && ast_channel_timingfunc(chan) == NULL
842 && (filename = ast_strsep(&filename_tmp, '&', AST_STRSEP_STRIP | AST_STRSEP_TRIM))) {
843 /* Discard old stream information */
844 ast_stopstream(chan);
845 /* Start new stream */
846 speech_streamfile(chan, filename, ast_channel_language(chan));
847 }
848
849 /* Run scheduled stuff */
851
852 /* Yay scheduling */
854 if (res < 0)
855 res = 1000;
856
857 /* If there is a frame waiting, get it - if not - oh well */
858 if (ast_waitfor(chan, res) > 0) {
859 f = ast_read(chan);
860 if (f == NULL) {
861 /* The channel has hung up most likely */
862 done = 3;
863 break;
864 }
865 }
866
867 /* Do timeout check (shared between audio/dtmf) */
868 if ((!quieted || strlen(dtmf)) && started == 1) {
869 current = ast_tvnow();
870 if ((ast_tvdiff_ms(current, start)) >= timeout) {
871 done = 1;
872 if (f)
873 ast_frfree(f);
874 break;
875 }
876 }
877
878 /* Do checks on speech structure to see if it's changed */
879 ast_mutex_lock(&speech->lock);
880 if (ast_test_flag(speech, AST_SPEECH_QUIET)) {
881 if (ast_channel_stream(chan))
882 ast_stopstream(chan);
884 quieted = 1;
885 }
886 /* Check state so we can see what to do */
887 switch (speech->state) {
889 /* If audio playback has stopped do a check for timeout purposes */
890 if (ast_channel_streamid(chan) == -1 && ast_channel_timingfunc(chan) == NULL)
891 ast_stopstream(chan);
892 if (!quieted && ast_channel_stream(chan) == NULL && timeout && started == 0 && !filename_tmp) {
893 if (timeout == -1) {
894 done = 1;
895 if (f)
896 ast_frfree(f);
897 break;
898 }
899 start = ast_tvnow();
900 started = 1;
901 }
902 /* Write audio frame out to speech engine if no DTMF has been received */
903 if (!strlen(dtmf) && f != NULL && f->frametype == AST_FRAME_VOICE) {
904 ast_speech_write(speech, f->data.ptr, f->datalen);
905 }
906 break;
908 /* Cue up waiting sound if not already playing */
909 if (!strlen(dtmf)) {
910 if (ast_channel_stream(chan) == NULL) {
911 if (speech->processing_sound != NULL) {
912 if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound, "none")) {
914 }
915 }
916 } else if (ast_channel_streamid(chan) == -1 && ast_channel_timingfunc(chan) == NULL) {
917 ast_stopstream(chan);
918 if (speech->processing_sound != NULL) {
919 if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound, "none")) {
921 }
922 }
923 }
924 }
925 break;
927 /* Now that we are done... let's switch back to not ready state */
929 if (!strlen(dtmf)) {
930 /* Copy to speech structure the results, if available */
931 speech->results = ast_speech_results_get(speech);
932 /* Break out of our background too */
933 done = 1;
934 /* Stop audio playback */
935 if (ast_channel_stream(chan) != NULL) {
936 ast_stopstream(chan);
937 }
938 }
939 break;
940 default:
941 break;
942 }
943 ast_mutex_unlock(&speech->lock);
944
945 /* Deal with other frame types */
946 if (f != NULL) {
947 /* Free the frame we received */
948 switch (f->frametype) {
949 case AST_FRAME_DTMF:
950 if (dtmf_terminator != '\0' && f->subclass.integer == dtmf_terminator) {
951 done = 1;
952 } else {
953 quieted = 1;
954 if (ast_channel_stream(chan) != NULL) {
955 ast_stopstream(chan);
956 }
957 if (!started) {
958 /* Change timeout to be 5 seconds for DTMF input */
959 timeout = (ast_channel_pbx(chan) && ast_channel_pbx(chan)->dtimeoutms) ? ast_channel_pbx(chan)->dtimeoutms : 5000;
960 started = 1;
961 }
962 start = ast_tvnow();
963 snprintf(tmp, sizeof(tmp), "%c", f->subclass.integer);
964 strncat(dtmf, tmp, sizeof(dtmf) - strlen(dtmf) - 1);
965 /* If the maximum length of the DTMF has been reached, stop now */
966 if (max_dtmf_len && strlen(dtmf) == max_dtmf_len)
967 done = 1;
968 }
969 break;
971 switch (f->subclass.integer) {
973 /* Since they hung up we should destroy the speech structure */
974 done = 3;
975 default:
976 break;
977 }
978 default:
979 break;
980 }
981 ast_frfree(f);
982 f = NULL;
983 }
984 }
985
987 /* Copy to speech structure the results, even partial ones, if desired and available */
988 speech->results = ast_speech_results_get(speech);
989 } else if (!ast_strlen_zero(dtmf)) {
990 /* We sort of make a results entry */
991 speech->results = ast_calloc(1, sizeof(*speech->results));
992 if (speech->results != NULL) {
993 ast_speech_dtmf(speech, dtmf);
994 speech->results->score = 1000;
995 speech->results->text = ast_strdup(dtmf);
996 speech->results->grammar = ast_strdup("dtmf");
997 }
999 }
1000
1001 /* See if it was because they hung up */
1002 if (done == 3) {
1004 } else {
1005 /* Channel is okay so restore read format */
1006 ast_set_read_format(chan, oldreadformat);
1007 }
1008
1009 return 0;
1010}
static int speech_streamfile(struct ast_channel *chan, const char *filename, const char *preflang)
Helper function used by speech_background to playback a soundfile.
static const struct ast_app_option speech_background_options[128]
static int speech_datastore_destroy(struct ast_channel *chan)
#define ast_strdup(str)
A wrapper for strdup()
Definition: astmm.h:241
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:298
#define ast_calloc(num, len)
A wrapper for calloc()
Definition: astmm.h:202
#define ao2_cleanup(obj)
Definition: astobj2.h:1934
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
Definition: astobj2.h:480
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
Definition: channel.c:3130
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
Definition: channel.c:4214
int ast_set_read_format(struct ast_channel *chan, struct ast_format *format)
Sets read format on channel chan.
Definition: channel.c:5721
ast_timing_func_t ast_channel_timingfunc(const struct ast_channel *chan)
const char * ast_channel_language(const struct ast_channel *chan)
int ast_channel_streamid(const struct ast_channel *chan)
struct ast_sched_context * ast_channel_sched(const struct ast_channel *chan)
struct ast_filestream * ast_channel_stream(const struct ast_channel *chan)
struct ast_pbx * ast_channel_pbx(const struct ast_channel *chan)
int ast_answer(struct ast_channel *chan)
Answer a channel.
Definition: channel.c:2774
#define AST_MAX_EXTENSION
Definition: channel.h:134
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
ast_channel_state
ast_channel states
Definition: channelstate.h:35
@ AST_STATE_UP
Definition: channelstate.h:42
size_t current
int ast_stopstream(struct ast_channel *c)
Stops a stream.
Definition: file.c:222
#define AST_APP_ARG(name)
Define an application argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
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: main/app.c:3066
#define AST_FRAME_DTMF
#define ast_frfree(fr)
@ AST_FRAME_VOICE
@ AST_FRAME_CONTROL
@ AST_CONTROL_HANGUP
#define ast_mutex_unlock(a)
Definition: lock.h:197
#define ast_mutex_lock(a)
Definition: lock.h:196
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
int ast_sched_runq(struct ast_sched_context *con)
Runs the queue.
Definition: sched.c:786
int ast_sched_wait(struct ast_sched_context *con) attribute_warn_unused_result
Determines number of seconds until the next outstanding event to take place.
Definition: sched.c:433
int ast_speech_dtmf(struct ast_speech *speech, const char *dtmf)
Signal to the engine that DTMF was received.
Definition: res_speech.c:154
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:122
int ast_speech_write(struct ast_speech *speech, void *data, int len)
Write audio to the speech engine.
Definition: res_speech.c:144
int ast_speech_change_state(struct ast_speech *speech, int state)
Change state of a speech structure.
Definition: res_speech.c:278
@ AST_SPEECH_STATE_DONE
Definition: speech.h:42
@ AST_SPEECH_STATE_READY
Definition: speech.h:40
@ AST_SPEECH_STATE_NOT_READY
Definition: speech.h:39
@ AST_SPEECH_STATE_WAIT
Definition: speech.h:41
struct ast_speech_result * ast_speech_results_get(struct ast_speech *speech)
Get speech recognition results.
Definition: res_speech.c:90
@ AST_SPEECH_QUIET
Definition: speech.h:32
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:65
@ AST_STRSEP_TRIM
Definition: strings.h:256
@ AST_STRSEP_STRIP
Definition: strings.h:255
char * ast_strsep(char **s, const char sep, uint32_t flags)
Act like strsep but ignore separators inside quotes.
Definition: utils.c:1835
Structure used to handle boolean flags.
Definition: utils.h:199
Definition of a media format.
Definition: format.c:43
Data structure associated with a single frame of data.
union ast_frame::@228 data
struct ast_frame_subclass subclass
enum ast_frame_type frametype
int dtimeoutms
Definition: pbx.h:216
char * grammar
Definition: speech.h:119
char * processing_sound
Definition: speech.h:60
int state
Definition: speech.h:62
struct ast_format * format
Definition: speech.h:64
ast_mutex_t lock
Definition: speech.h:56
struct ast_speech_result * results
Definition: speech.h:68
int done
Definition: test_amihooks.c:48
const char * args
static struct test_options options
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
Definition: time.h:107
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Definition: time.h:159
#define ast_test_flag(p, flag)
Definition: utils.h:63
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:941
#define ast_clear_flag(p, flag)
Definition: utils.h:77

References ao2_bump, ao2_cleanup, args, ast_answer(), AST_APP_ARG, ast_app_parse_options(), ast_calloc, ast_channel_language(), ast_channel_lock, ast_channel_pbx(), ast_channel_readformat(), ast_channel_sched(), ast_channel_stream(), ast_channel_streamid(), ast_channel_timingfunc(), ast_channel_unlock, ast_clear_flag, AST_CONTROL_HANGUP, AST_DECLARE_APP_ARGS, 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_strsep(), AST_STRSEP_STRIP, AST_STRSEP_TRIM, ast_test_flag, ast_tvdiff_ms(), ast_tvnow(), ast_waitfor(), current, ast_frame::data, ast_frame::datalen, done, ast_pbx::dtimeoutms, find_speech(), ast_speech::format, ast_frame::frametype, ast_speech_result::grammar, ast_frame_subclass::integer, ast_speech::lock, NULL, options, pbx_builtin_getvar_helper(), ast_speech::processing_sound, ast_frame::ptr, RAII_VAR, ast_speech::results, SB_OPT_NOANSWER, SB_OPT_PARTIALRESULTS, ast_speech_result::score, speech_background_options, speech_datastore_destroy(), speech_streamfile(), ast_speech::state, ast_frame::subclass, and ast_speech_result::text.

Referenced by load_module().

◆ speech_create()

static int speech_create ( struct ast_channel chan,
const char *  data 
)
static

SpeechCreate() Dialplan Application.

Definition at line 601 of file app_speech_utils.c.

602{
603 struct ast_speech *speech = NULL;
604 struct ast_datastore *datastore = NULL;
605
606 /* Request a speech object */
608 if (speech == NULL) {
609 /* Not available */
610 pbx_builtin_setvar_helper(chan, "ERROR", "1");
611 return 0;
612 }
613
615 if (datastore == NULL) {
616 ast_speech_destroy(speech);
617 pbx_builtin_setvar_helper(chan, "ERROR", "1");
618 return 0;
619 }
620 pbx_builtin_setvar_helper(chan, "ERROR", NULL);
621 datastore->data = speech;
622 ast_channel_lock(chan);
623 ast_channel_datastore_add(chan, datastore);
624 ast_channel_unlock(chan);
625
626 return 0;
627}
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
Definition: channel.c:2354
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
#define ast_datastore_alloc(info, uid)
Definition: datastore.h:85
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.
struct ast_speech * ast_speech_new(const char *engine_name, const struct ast_format_cap *formats)
Create a new speech structure.
Definition: res_speech.c:181

References ast_channel_datastore_add(), ast_channel_lock, ast_channel_nativeformats(), ast_channel_unlock, ast_datastore_alloc, ast_speech_destroy(), ast_speech_new(), ast_datastore::data, NULL, pbx_builtin_setvar_helper(), and speech_datastore.

Referenced by load_module().

◆ speech_datastore_destroy()

static int speech_datastore_destroy ( struct ast_channel chan)
static

Definition at line 369 of file app_speech_utils.c.

370{
371 struct ast_datastore *datastore;
372 int res;
373
374 ast_channel_lock(chan);
376 if (datastore) {
377 ast_channel_datastore_remove(chan, datastore);
378 }
379 ast_channel_unlock(chan);
380 if (datastore) {
381 ast_datastore_free(datastore);
382 res = 0;
383 } else {
384 res = -1;
385 }
386 return res;
387}
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
Definition: channel.c:2363
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
Definition: datastore.c:68

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

Referenced by speech_background(), and speech_destroy().

◆ speech_deactivate()

static int speech_deactivate ( struct ast_channel chan,
const char *  data 
)
static

SpeechDeactivateGrammar(Grammar Name) Dialplan Application.

Definition at line 671 of file app_speech_utils.c.

672{
673 int res = 0;
674 struct ast_speech *speech = find_speech(chan);
675
676 if (speech == NULL)
677 return -1;
678
679 /* Deactivate the grammar on the speech object */
680 res = ast_speech_grammar_deactivate(speech, data);
681
682 return res;
683}
int ast_speech_grammar_deactivate(struct ast_speech *speech, const char *grammar_name)
Deactivate a grammar on a speech structure.
Definition: res_speech.c:72

References ast_speech_grammar_deactivate(), ast_speech::data, find_speech(), and NULL.

Referenced by load_module().

◆ speech_destroy()

static int speech_destroy ( struct ast_channel chan,
const char *  data 
)
static

SpeechDestroy() Dialplan Application.

Definition at line 1014 of file app_speech_utils.c.

1015{
1016 if (!chan) {
1017 return -1;
1018 }
1019 return speech_datastore_destroy(chan);
1020}

References speech_datastore_destroy().

Referenced by load_module().

◆ speech_engine_read()

static int speech_engine_read ( struct ast_channel chan,
const char *  cmd,
char *  data,
char *  buf,
size_t  len 
)
static

SPEECH_ENGINE() Dialplan Get Function.

Definition at line 511 of file app_speech_utils.c.

512{
513 struct ast_speech *speech = find_speech(chan);
514
515 if (!data || !speech) {
516 return -1;
517 }
518
519 return ast_speech_get_setting(speech, data, buf, len);
520}
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
int ast_speech_get_setting(struct ast_speech *speech, const char *name, char *buf, size_t len)
Get an engine specific attribute.
Definition: res_speech.c:175

References ast_speech_get_setting(), buf, ast_speech::data, find_speech(), and len().

◆ speech_engine_write()

static int speech_engine_write ( struct ast_channel chan,
const char *  cmd,
char *  data,
const char *  value 
)
static

SPEECH_ENGINE() Dialplan Set Function.

Definition at line 497 of file app_speech_utils.c.

498{
499 struct ast_speech *speech = find_speech(chan);
500
501 if (data == NULL || speech == NULL) {
502 return -1;
503 }
504
505 ast_speech_change(speech, data, value);
506
507 return 0;
508}
int ast_speech_change(struct ast_speech *speech, const char *name, const char *value)
Change an engine specific attribute.
Definition: res_speech.c:169
int value
Definition: syslog.c:37

References ast_speech_change(), ast_speech::data, find_speech(), NULL, and value.

◆ speech_grammar()

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 471 of file app_speech_utils.c.

473{
474 struct ast_speech_result *result = NULL;
475 struct ast_speech *speech = find_speech(chan);
476
477 if (data == NULL || speech == NULL || !(result = find_result(speech->results, data))) {
478 return -1;
479 }
480
481 if (result->grammar != NULL) {
482 ast_copy_string(buf, result->grammar, len);
483 } else {
484 buf[0] = '\0';
485 }
486
487 return 0;
488}
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:425

References ast_copy_string(), buf, ast_speech::data, find_result(), find_speech(), len(), NULL, result, and ast_speech::results.

◆ speech_load()

static int speech_load ( struct ast_channel chan,
const char *  vdata 
)
static

SpeechLoadGrammar(Grammar Name,Path) Dialplan Application.

Definition at line 630 of file app_speech_utils.c.

631{
632 int res = 0;
633 struct ast_speech *speech = find_speech(chan);
634 char *data;
636 AST_APP_ARG(grammar);
637 AST_APP_ARG(path);
638 );
639
640 data = ast_strdupa(vdata);
642
643 if (speech == NULL)
644 return -1;
645
646 if (args.argc != 2)
647 return -1;
648
649 /* Load the grammar locally on the object */
650 res = ast_speech_grammar_load(speech, args.grammar, args.path);
651
652 return res;
653}
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:78

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

Referenced by load_module().

◆ speech_processing_sound()

static int speech_processing_sound ( struct ast_channel chan,
const char *  data 
)
static

SpeechProcessingSound(Sound File) Dialplan Application.

Definition at line 715 of file app_speech_utils.c.

716{
717 int res = 0;
718 struct ast_speech *speech = find_speech(chan);
719
720 if (speech == NULL)
721 return -1;
722
723 if (speech->processing_sound != NULL) {
724 ast_free(speech->processing_sound);
725 speech->processing_sound = NULL;
726 }
727
729
730 return res;
731}
#define ast_free(a)
Definition: astmm.h:180

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

Referenced by load_module().

◆ speech_read()

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 551 of file app_speech_utils.c.

553{
554 int results = 0;
555 struct ast_speech_result *result = NULL;
556 struct ast_speech *speech = find_speech(chan);
557 char tmp[128] = "";
558
559 /* Now go for the various options */
560 if (!strcasecmp(data, "status")) {
561 if (speech != NULL)
562 ast_copy_string(buf, "1", len);
563 else
564 ast_copy_string(buf, "0", len);
565 return 0;
566 }
567
568 /* Make sure we have a speech structure for everything else */
569 if (speech == NULL) {
570 return -1;
571 }
572
573 /* Check to see if they are checking for silence */
574 if (!strcasecmp(data, "spoke")) {
575 if (ast_test_flag(speech, AST_SPEECH_SPOKE))
576 ast_copy_string(buf, "1", len);
577 else
578 ast_copy_string(buf, "0", len);
579 } else if (!strcasecmp(data, "results")) {
580 /* Count number of results */
581 for (result = speech->results; result; result = AST_LIST_NEXT(result, list))
582 results++;
583 snprintf(tmp, sizeof(tmp), "%d", results);
584 ast_copy_string(buf, tmp, len);
585 } else {
586 buf[0] = '\0';
587 }
588
589 return 0;
590}
@ AST_SPEECH_SPOKE
Definition: speech.h:33

References ast_copy_string(), AST_LIST_NEXT, AST_SPEECH_SPOKE, ast_test_flag, buf, ast_speech::data, find_speech(), len(), NULL, result, and ast_speech::results.

◆ speech_results_type_write()

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 529 of file app_speech_utils.c.

530{
531 struct ast_speech *speech = find_speech(chan);
532
533 if (data == NULL || speech == NULL)
534 return -1;
535
536 if (!strcasecmp(value, "normal"))
538 else if (!strcasecmp(value, "nbest"))
540
541 return 0;
542}
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:308
@ AST_SPEECH_RESULTS_TYPE_NBEST
Definition: speech.h:47
@ AST_SPEECH_RESULTS_TYPE_NORMAL
Definition: speech.h:46

References ast_speech_change_results_type(), AST_SPEECH_RESULTS_TYPE_NBEST, AST_SPEECH_RESULTS_TYPE_NORMAL, ast_speech::data, find_speech(), NULL, and value.

◆ speech_score()

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 420 of file app_speech_utils.c.

422{
423 struct ast_speech_result *result = NULL;
424 struct ast_speech *speech = find_speech(chan);
425 char tmp[128] = "";
426
427 if (data == NULL || speech == NULL || !(result = find_result(speech->results, data))) {
428 return -1;
429 }
430
431 snprintf(tmp, sizeof(tmp), "%d", result->score);
432
433 ast_copy_string(buf, tmp, len);
434
435 return 0;
436}

References ast_copy_string(), buf, ast_speech::data, find_result(), find_speech(), len(), NULL, result, and ast_speech::results.

◆ speech_start()

static int speech_start ( struct ast_channel chan,
const char *  data 
)
static

SpeechStart() Dialplan Application.

Definition at line 701 of file app_speech_utils.c.

702{
703 int res = 0;
704 struct ast_speech *speech = find_speech(chan);
705
706 if (speech == NULL)
707 return -1;
708
709 ast_speech_start(speech);
710
711 return res;
712}

References ast_speech_start(), find_speech(), and NULL.

Referenced by load_module().

◆ speech_streamfile()

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 734 of file app_speech_utils.c.

735{
736 struct ast_filestream *fs = NULL;
737
738 if (!(fs = ast_openstream(chan, filename, preflang)))
739 return -1;
740
741 if (ast_applystream(chan, fs))
742 return -1;
743
744 ast_playstream(fs);
745
746 return 0;
747}
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:845
int ast_applystream(struct ast_channel *chan, struct ast_filestream *s)
Applies a open stream to a channel.
Definition: file.c:1065
int ast_playstream(struct ast_filestream *s)
Play a open stream on a channel.
Definition: file.c:1071
This structure is allocated by file.c in one chunk, together with buf_size and desc_size bytes of mem...
Definition: mod_format.h:101
char * filename
Definition: mod_format.h:107

References ast_applystream(), ast_openstream(), ast_playstream(), ast_filestream::filename, and NULL.

Referenced by speech_background().

◆ speech_text()

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 445 of file app_speech_utils.c.

447{
448 struct ast_speech_result *result = NULL;
449 struct ast_speech *speech = find_speech(chan);
450
451 if (data == NULL || speech == NULL || !(result = find_result(speech->results, data))) {
452 return -1;
453 }
454
455 if (result->text != NULL) {
456 ast_copy_string(buf, result->text, len);
457 } else {
458 buf[0] = '\0';
459 }
460
461 return 0;
462}

References ast_copy_string(), buf, ast_speech::data, find_result(), find_speech(), len(), NULL, result, and ast_speech::results.

◆ speech_unload()

static int speech_unload ( struct ast_channel chan,
const char *  data 
)
static

SpeechUnloadGrammar(Grammar Name) Dialplan Application.

Definition at line 656 of file app_speech_utils.c.

657{
658 int res = 0;
659 struct ast_speech *speech = find_speech(chan);
660
661 if (speech == NULL)
662 return -1;
663
664 /* Unload the grammar */
665 res = ast_speech_grammar_unload(speech, data);
666
667 return res;
668}
int ast_speech_grammar_unload(struct ast_speech *speech, const char *grammar_name)
Unload a grammar.
Definition: res_speech.c:84

References ast_speech_grammar_unload(), ast_speech::data, find_speech(), and NULL.

Referenced by load_module().

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 1022 of file app_speech_utils.c.

1023{
1024 int res = 0;
1025
1026 res = ast_unregister_application("SpeechCreate");
1027 res |= ast_unregister_application("SpeechLoadGrammar");
1028 res |= ast_unregister_application("SpeechUnloadGrammar");
1029 res |= ast_unregister_application("SpeechActivateGrammar");
1030 res |= ast_unregister_application("SpeechDeactivateGrammar");
1031 res |= ast_unregister_application("SpeechStart");
1032 res |= ast_unregister_application("SpeechBackground");
1033 res |= ast_unregister_application("SpeechDestroy");
1034 res |= ast_unregister_application("SpeechProcessingSound");
1041
1042 return res;
1043}
int ast_unregister_application(const char *app)
Unregister an application.
Definition: pbx_app.c:392
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.

References ast_custom_function_unregister(), ast_unregister_application(), speech_engine_function, speech_function, speech_grammar_function, speech_results_type_function, speech_score_function, and speech_text_function.

Variable Documentation

◆ __mod_info

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 = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .requires = "res_speech", }
static

Definition at line 1073 of file app_speech_utils.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 1073 of file app_speech_utils.c.

◆ speech_background_options

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

Definition at line 757 of file app_speech_utils.c.

Referenced by speech_background().

◆ speech_datastore

const 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 334 of file app_speech_utils.c.

Referenced by find_speech(), speech_create(), and speech_datastore_destroy().

◆ speech_engine_function

struct ast_custom_function speech_engine_function
static
Initial value:
= {
.name = "SPEECH_ENGINE",
}
static int speech_engine_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
SPEECH_ENGINE() Dialplan Set Function.
static int speech_engine_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
SPEECH_ENGINE() Dialplan Get Function.

Definition at line 522 of file app_speech_utils.c.

Referenced by load_module(), and unload_module().

◆ speech_function

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 592 of file app_speech_utils.c.

Referenced by load_module(), and unload_module().

◆ speech_grammar_function

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 490 of file app_speech_utils.c.

Referenced by load_module(), and unload_module().

◆ speech_results_type_function

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 544 of file app_speech_utils.c.

Referenced by load_module(), and unload_module().

◆ speech_score_function

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 438 of file app_speech_utils.c.

Referenced by load_module(), and unload_module().

◆ speech_text_function

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 464 of file app_speech_utils.c.

Referenced by load_module(), and unload_module().