Asterisk - The Open Source Telephony Project  18.5.0
app_festival.c
Go to the documentation of this file.
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2002, Christos Ricudis
5  *
6  * Christos Ricudis <[email protected]>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18 
19 /*! \file
20  *
21  * \brief Connect to festival
22  *
23  * \author Christos Ricudis <[email protected]>
24  *
25  * \extref The Festival Speech Synthesis System - http://www.cstr.ed.ac.uk/projects/festival/
26  *
27  * \ingroup applications
28  */
29 
30 /*! \li \ref app_festival.c uses the configuration file \ref festival.conf
31  * \addtogroup configuration_file Configuration Files
32  */
33 
34 /*!
35  * \page festival.conf festival.conf
36  * \verbinclude festival.conf.sample
37  */
38 
39 /*** MODULEINFO
40  <support_level>extended</support_level>
41  ***/
42 
43 #include "asterisk.h"
44 
45 #include <sys/socket.h>
46 #include <netdb.h>
47 #include <netinet/in.h>
48 #include <arpa/inet.h>
49 #include <signal.h>
50 #include <fcntl.h>
51 #include <ctype.h>
52 #include <errno.h>
53 
54 #include "asterisk/file.h"
55 #include "asterisk/channel.h"
56 #include "asterisk/pbx.h"
57 #include "asterisk/module.h"
58 #include "asterisk/md5.h"
59 #include "asterisk/config.h"
60 #include "asterisk/utils.h"
61 #include "asterisk/lock.h"
62 #include "asterisk/app.h"
63 #include "asterisk/endian.h"
64 #include "asterisk/format_cache.h"
65 
66 #define FESTIVAL_CONFIG "festival.conf"
67 #define MAXLEN 180
68 #define MAXFESTLEN 2048
69 
70 /*** DOCUMENTATION
71  <application name="Festival" language="en_US">
72  <synopsis>
73  Say text to the user.
74  </synopsis>
75  <syntax>
76  <parameter name="text" required="true" />
77  <parameter name="intkeys" />
78  </syntax>
79  <description>
80  <para>Connect to Festival, send the argument, get back the waveform, play it to the user,
81  allowing any given interrupt keys to immediately terminate and return the value, or
82  <literal>any</literal> to allow any number back (useful in dialplan).</para>
83  </description>
84  </application>
85  ***/
86 
87 static char *app = "Festival";
88 
89 static char *socket_receive_file_to_buff(int fd, int *size)
90 {
91  /* Receive file (probably a waveform file) from socket using
92  * Festival key stuff technique, but long winded I know, sorry
93  * but will receive any file without closing the stream or
94  * using OOB data
95  */
96  static char *file_stuff_key = "ft_StUfF_key"; /* must == Festival's key */
97  char *buff, *tmp;
98  int bufflen;
99  int n,k,i;
100  char c;
101 
102  bufflen = 1024;
103  if (!(buff = ast_malloc(bufflen)))
104  return NULL;
105  *size = 0;
106 
107  for (k = 0; file_stuff_key[k] != '\0';) {
108  n = read(fd, &c, 1);
109  if (n == 0)
110  break; /* hit stream eof before end of file */
111  if ((*size) + k + 1 >= bufflen) {
112  /* +1 so you can add a terminating NULL if you want */
113  bufflen += bufflen / 4;
114  if (!(tmp = ast_realloc(buff, bufflen))) {
115  ast_free(buff);
116  return NULL;
117  }
118  buff = tmp;
119  }
120  if (file_stuff_key[k] == c)
121  k++;
122  else if ((c == 'X') && (file_stuff_key[k+1] == '\0')) {
123  /* It looked like the key but wasn't */
124  for (i = 0; i < k; i++, (*size)++)
125  buff[*size] = file_stuff_key[i];
126  k = 0;
127  /* omit the stuffed 'X' */
128  } else {
129  for (i = 0; i < k; i++, (*size)++)
130  buff[*size] = file_stuff_key[i];
131  k = 0;
132  buff[*size] = c;
133  (*size)++;
134  }
135  }
136 
137  return buff;
138 }
139 
140 static int send_waveform_to_fd(char *waveform, int length, int fd)
141 {
142  int res;
143 #if __BYTE_ORDER == __BIG_ENDIAN
144  int x;
145  char c;
146 #endif
147 
148  res = ast_safe_fork(0);
149  if (res < 0)
150  ast_log(LOG_WARNING, "Fork failed\n");
151  if (res) {
152  return res;
153  }
154  dup2(fd, 0);
157  ast_set_priority(0);
158 #if __BYTE_ORDER == __BIG_ENDIAN
159  for (x = 0; x < length; x += 2) {
160  c = *(waveform + x + 1);
161  *(waveform + x + 1) = *(waveform + x);
162  *(waveform + x) = c;
163  }
164 #endif
165 
166  if (write(0, waveform, length) < 0) {
167  /* Cannot log -- all FDs are already closed */
168  }
169 
170  close(fd);
171  _exit(0);
172 }
173 
174 static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, int length, char *intkeys)
175 {
176  int res = 0;
177  int fds[2];
178  int needed = 0;
179  struct ast_format *owriteformat;
180  struct ast_frame *f;
181  struct myframe {
182  struct ast_frame f;
184  char frdata[2048];
185  } myf = {
186  .f = { 0, },
187  };
188 
189  if (pipe(fds)) {
190  ast_log(LOG_WARNING, "Unable to create pipe\n");
191  return -1;
192  }
193 
194  /* Answer if it's not already going */
195  if (ast_channel_state(chan) != AST_STATE_UP)
196  ast_answer(chan);
197  ast_stopstream(chan);
198  ast_indicate(chan, -1);
199 
200  owriteformat = ao2_bump(ast_channel_writeformat(chan));
202  if (res < 0) {
203  ast_log(LOG_WARNING, "Unable to set write format to signed linear\n");
204  ao2_cleanup(owriteformat);
205  return -1;
206  }
207 
208  myf.f.frametype = AST_FRAME_VOICE;
209  myf.f.subclass.format = ast_format_slin;
210  myf.f.offset = AST_FRIENDLY_OFFSET;
211  myf.f.src = __PRETTY_FUNCTION__;
212  myf.f.data.ptr = myf.frdata;
213 
214  res = send_waveform_to_fd(waveform, length, fds[1]);
215  if (res >= 0) {
216  /* Order is important -- there's almost always going to be mp3... we want to prioritize the
217  user */
218  for (;;) {
219  res = ast_waitfor(chan, 1000);
220  if (res < 1) {
221  res = -1;
222  break;
223  }
224  f = ast_read(chan);
225  if (!f) {
226  ast_log(LOG_WARNING, "Null frame == hangup() detected\n");
227  res = -1;
228  break;
229  }
230  if (f->frametype == AST_FRAME_DTMF) {
231  ast_debug(1, "User pressed a key\n");
232  if (intkeys && strchr(intkeys, f->subclass.integer)) {
233  res = f->subclass.integer;
234  ast_frfree(f);
235  break;
236  }
237  }
238  if (f->frametype == AST_FRAME_VOICE) {
239  /* Treat as a generator */
240  needed = f->samples * 2;
241  if (needed > sizeof(myf.frdata)) {
242  ast_log(LOG_WARNING, "Only able to deliver %d of %d requested samples\n",
243  (int)sizeof(myf.frdata) / 2, needed/2);
244  needed = sizeof(myf.frdata);
245  }
246  res = read(fds[0], myf.frdata, needed);
247  if (res > 0) {
248  myf.f.datalen = res;
249  myf.f.samples = res / 2;
250  if (ast_write(chan, &myf.f) < 0) {
251  res = -1;
252  ast_frfree(f);
253  break;
254  }
255  if (res < needed) { /* last frame */
256  ast_debug(1, "Last frame\n");
257  res = 0;
258  ast_frfree(f);
259  break;
260  }
261  } else {
262  ast_debug(1, "No more waveform\n");
263  res = 0;
264  }
265  }
266  ast_frfree(f);
267  }
268  }
269  close(fds[0]);
270  close(fds[1]);
271 
272  if (!res && owriteformat)
273  ast_set_write_format(chan, owriteformat);
274  ao2_cleanup(owriteformat);
275 
276  return res;
277 }
278 
279 static int festival_exec(struct ast_channel *chan, const char *vdata)
280 {
281  int usecache;
282  int res = 0;
283  struct sockaddr_in serv_addr;
284  struct hostent *serverhost;
285  struct ast_hostent ahp;
286  int fd;
287  FILE *fs;
288  const char *host;
289  const char *cachedir;
290  const char *temp;
291  const char *festivalcommand;
292  int port = 1314;
293  int n;
294  char ack[4];
295  char *waveform;
296  int filesize;
297  char bigstring[MAXFESTLEN];
298  int i;
299  struct MD5Context md5ctx;
300  unsigned char MD5Res[16];
301  char MD5Hex[33] = "";
302  char koko[4] = "";
303  char cachefile[MAXFESTLEN]="";
304  int readcache = 0;
305  int writecache = 0;
306  int strln;
307  int fdesc = -1;
308  char buffer[16384];
309  int seekpos = 0;
310  char *data;
311  struct ast_config *cfg;
312  char *newfestivalcommand;
313  struct ast_flags config_flags = { 0 };
315  AST_APP_ARG(text);
316  AST_APP_ARG(interrupt);
317  );
318 
319  if (ast_strlen_zero(vdata)) {
320  ast_log(LOG_WARNING, "festival requires an argument (text)\n");
321  return -1;
322  }
323 
324  cfg = ast_config_load(FESTIVAL_CONFIG, config_flags);
325  if (!cfg) {
326  ast_log(LOG_WARNING, "No such configuration file %s\n", FESTIVAL_CONFIG);
327  return -1;
328  } else if (cfg == CONFIG_STATUS_FILEINVALID) {
329  ast_log(LOG_ERROR, "Config file " FESTIVAL_CONFIG " is in an invalid format. Aborting.\n");
330  return -1;
331  }
332 
333  if (!(host = ast_variable_retrieve(cfg, "general", "host"))) {
334  host = "localhost";
335  }
336  if (!(temp = ast_variable_retrieve(cfg, "general", "port"))) {
337  port = 1314;
338  } else {
339  port = atoi(temp);
340  }
341  if (!(temp = ast_variable_retrieve(cfg, "general", "usecache"))) {
342  usecache = 0;
343  } else {
344  usecache = ast_true(temp);
345  }
346  if (!(cachedir = ast_variable_retrieve(cfg, "general", "cachedir"))) {
347  cachedir = "/tmp/";
348  }
349 
350  data = ast_strdupa(vdata);
352 
353  if (!(festivalcommand = ast_variable_retrieve(cfg, "general", "festivalcommand"))) {
354  const char *startcmd = "(tts_textasterisk \"";
355  const char *endcmd = "\" 'file)(quit)\n";
356 
357  strln = strlen(startcmd) + strlen(args.text) + strlen(endcmd) + 1;
358  newfestivalcommand = ast_alloca(strln);
359  snprintf(newfestivalcommand, strln, "%s%s%s", startcmd, args.text, endcmd);
360  festivalcommand = newfestivalcommand;
361  } else { /* This else parses the festivalcommand that we're sent from the config file for \n's, etc */
362  int x, j;
363  newfestivalcommand = ast_alloca(strlen(festivalcommand) + strlen(args.text) + 1);
364 
365  for (x = 0, j = 0; x < strlen(festivalcommand); x++) {
366  if (festivalcommand[x] == '\\' && festivalcommand[x + 1] == 'n') {
367  newfestivalcommand[j++] = '\n';
368  x++;
369  } else if (festivalcommand[x] == '\\') {
370  newfestivalcommand[j++] = festivalcommand[x + 1];
371  x++;
372  } else if (festivalcommand[x] == '%' && festivalcommand[x + 1] == 's') {
373  sprintf(&newfestivalcommand[j], "%s", args.text); /* we know it is big enough */
374  j += strlen(args.text);
375  x++;
376  } else
377  newfestivalcommand[j++] = festivalcommand[x];
378  }
379  newfestivalcommand[j] = '\0';
380  festivalcommand = newfestivalcommand;
381  }
382 
383  if (args.interrupt && !strcasecmp(args.interrupt, "any"))
384  args.interrupt = AST_DIGIT_ANY;
385 
386  ast_debug(1, "Text passed to festival server : %s\n", args.text);
387  /* Connect to local festival server */
388 
389  fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
390 
391  if (fd < 0) {
392  ast_log(LOG_WARNING, "festival_client: can't get socket\n");
393  ast_config_destroy(cfg);
394  return -1;
395  }
396 
397  memset(&serv_addr, 0, sizeof(serv_addr));
398 
399  if ((serv_addr.sin_addr.s_addr = inet_addr(host)) == -1) {
400  /* its a name rather than an ipnum */
401  serverhost = ast_gethostbyname(host, &ahp);
402 
403  if (serverhost == NULL) {
404  ast_log(LOG_WARNING, "festival_client: gethostbyname failed\n");
405  ast_config_destroy(cfg);
406  close(fd);
407  return -1;
408  }
409  memmove(&serv_addr.sin_addr, serverhost->h_addr, serverhost->h_length);
410  }
411 
412  serv_addr.sin_family = AF_INET;
413  serv_addr.sin_port = htons(port);
414 
415  if (connect(fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) != 0) {
416  ast_log(LOG_WARNING, "festival_client: connect to server failed\n");
417  ast_config_destroy(cfg);
418  close(fd);
419  return -1;
420  }
421 
422  /* Compute MD5 sum of string */
423  MD5Init(&md5ctx);
424  MD5Update(&md5ctx, (unsigned char *)args.text, strlen(args.text));
425  MD5Final(MD5Res, &md5ctx);
426  MD5Hex[0] = '\0';
427 
428  /* Convert to HEX and look if there is any matching file in the cache
429  directory */
430  for (i = 0; i < 16; i++) {
431  snprintf(koko, sizeof(koko), "%X", (unsigned)MD5Res[i]);
432  strncat(MD5Hex, koko, sizeof(MD5Hex) - strlen(MD5Hex) - 1);
433  }
434  readcache = 0;
435  writecache = 0;
436  if (strlen(cachedir) + strlen(MD5Hex) + 1 <= MAXFESTLEN && (usecache == -1)) {
437  snprintf(cachefile, sizeof(cachefile), "%s/%s", cachedir, MD5Hex);
438  fdesc = open(cachefile, O_RDWR);
439  if (fdesc == -1) {
440  fdesc = open(cachefile, O_CREAT | O_RDWR, AST_FILE_MODE);
441  if (fdesc != -1) {
442  writecache = 1;
443  strln = strlen(args.text);
444  ast_debug(1, "line length : %d\n", strln);
445  if (write(fdesc,&strln,sizeof(int)) < 0) {
446  ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
447  }
448  if (write(fdesc,data,strln) < 0) {
449  ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
450  }
451  seekpos = lseek(fdesc, 0, SEEK_CUR);
452  ast_debug(1, "Seek position : %d\n", seekpos);
453  }
454  } else {
455  if (read(fdesc,&strln,sizeof(int)) != sizeof(int)) {
456  ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno));
457  }
458  ast_debug(1, "Cache file exists, strln=%d, strlen=%d\n", strln, (int)strlen(args.text));
459  if (strlen(args.text) == strln) {
460  ast_debug(1, "Size OK\n");
461  if (read(fdesc,&bigstring,strln) != strln) {
462  ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno));
463  }
464  bigstring[strln] = 0;
465  if (strcmp(bigstring, args.text) == 0) {
466  readcache = 1;
467  } else {
468  ast_log(LOG_WARNING, "Strings do not match\n");
469  }
470  } else {
471  ast_log(LOG_WARNING, "Size mismatch\n");
472  }
473  }
474  }
475 
476  if (readcache == 1) {
477  close(fd);
478  fd = fdesc;
479  ast_debug(1, "Reading from cache...\n");
480  } else {
481  ast_debug(1, "Passing text to festival...\n");
482  fs = fdopen(dup(fd), "wb");
483 
484  fprintf(fs, "%s", festivalcommand);
485  fflush(fs);
486  fclose(fs);
487  }
488 
489  /* Write to cache and then pass it down */
490  if (writecache == 1) {
491  ast_debug(1, "Writing result to cache...\n");
492  while ((strln = read(fd, buffer, 16384)) != 0) {
493  if (write(fdesc,buffer,strln) < 0) {
494  ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
495  }
496  }
497  close(fd);
498  close(fdesc);
499  fd = open(cachefile, O_RDWR);
500  lseek(fd, seekpos, SEEK_SET);
501  }
502 
503  ast_debug(1, "Passing data to channel...\n");
504 
505  /* Read back info from server */
506  /* This assumes only one waveform will come back, also LP is unlikely */
507  do {
508  int read_data;
509  for (n = 0; n < 3; ) {
510  read_data = read(fd, ack + n, 3 - n);
511  /* this avoids falling in infinite loop
512  * in case that festival server goes down
513  */
514  if (read_data == -1) {
515  ast_log(LOG_WARNING, "Unable to read from cache/festival fd\n");
516  close(fd);
517  ast_config_destroy(cfg);
518  return -1;
519  }
520  n += read_data;
521  }
522  ack[3] = '\0';
523  if (strcmp(ack, "WV\n") == 0) { /* receive a waveform */
524  ast_debug(1, "Festival WV command\n");
525  if ((waveform = socket_receive_file_to_buff(fd, &filesize))) {
526  res = send_waveform_to_channel(chan, waveform, filesize, args.interrupt);
527  ast_free(waveform);
528  }
529  break;
530  } else if (strcmp(ack, "LP\n") == 0) { /* receive an s-expr */
531  ast_debug(1, "Festival LP command\n");
532  if ((waveform = socket_receive_file_to_buff(fd, &filesize))) {
533  waveform[filesize] = '\0';
534  ast_log(LOG_WARNING, "Festival returned LP : %s\n", waveform);
535  ast_free(waveform);
536  }
537  } else if (strcmp(ack, "ER\n") == 0) { /* server got an error */
538  ast_log(LOG_WARNING, "Festival returned ER\n");
539  res = -1;
540  break;
541  }
542  } while (strcmp(ack, "OK\n") != 0);
543  close(fd);
544  ast_config_destroy(cfg);
545  return res;
546 }
547 
548 static int unload_module(void)
549 {
551 }
552 
553 /*!
554  * \brief Load the module
555  *
556  * Module loading including tests for configuration or dependencies.
557  * This function can return AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_DECLINE,
558  * or AST_MODULE_LOAD_SUCCESS. If a dependency or environment variable fails
559  * tests return AST_MODULE_LOAD_FAILURE. If the module can not load the
560  * configuration file or other non-critical problem return
561  * AST_MODULE_LOAD_DECLINE. On success return AST_MODULE_LOAD_SUCCESS.
562  */
563 static int load_module(void)
564 {
565  struct ast_flags config_flags = { 0 };
566  struct ast_config *cfg = ast_config_load(FESTIVAL_CONFIG, config_flags);
567  if (!cfg) {
568  ast_log(LOG_WARNING, "No such configuration file %s\n", FESTIVAL_CONFIG);
570  } else if (cfg == CONFIG_STATUS_FILEINVALID) {
571  ast_log(LOG_ERROR, "Config file " FESTIVAL_CONFIG " is in an invalid format. Aborting.\n");
573  }
574  ast_config_destroy(cfg);
576 }
577 
578 AST_MODULE_INFO_STANDARD_EXTENDED(ASTERISK_GPL_KEY, "Simple Festival Interface");
static int unload_module(void)
Definition: app_festival.c:548
Main Channel structure associated with a channel.
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
#define ast_realloc(p, len)
A wrapper for realloc()
Definition: astmm.h:228
#define AST_DIGIT_ANY
Definition: file.h:48
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
Definition: channel.c:4322
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the &#39;standard&#39; argument separation process for an application.
static int festival_exec(struct ast_channel *chan, const char *vdata)
Definition: app_festival.c:279
#define LOG_WARNING
Definition: logger.h:274
#define CONFIG_STATUS_FILEINVALID
static int tmp()
Definition: bt_open.c:389
void ast_close_fds_above_n(int n)
Common routine for child processes, to close all fds prior to exec(2)
Definition: main/app.c:3042
void MD5Final(unsigned char digest[16], struct MD5Context *context)
Definition: md5.c:120
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
Definition: channel.c:4302
ast_channel_state
ast_channel states
Definition: channelstate.h:35
Definition of a media format.
Definition: format.c:43
static struct test_val c
char * text
Definition: app_queue.c:1508
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
const char * args
#define NULL
Definition: resample.c:96
#define AST_FRAME_DTMF
int ast_unregister_application(const char *app)
Unregister an application.
Definition: pbx_app.c:392
#define AST_FILE_MODE
Definition: asterisk.h:32
static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, int length, char *intkeys)
Definition: app_festival.c:174
void MD5Init(struct MD5Context *context)
Definition: md5.c:57
struct ast_frame_subclass subclass
Utility functions.
#define ast_strlen_zero(foo)
Definition: strings.h:52
#define ao2_bump(obj)
Definition: astobj2.h:491
Configuration File Parser.
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
#define ast_log
Definition: astobj2.c:42
#define ast_config_load(filename, flags)
Load a config file.
static char host[256]
Definition: muted.c:77
General Asterisk PBX channel definitions.
#define AST_FRIENDLY_OFFSET
Offset into a frame&#39;s data buffer.
Asterisk architecture endianess compatibility definitions.
void ast_config_destroy(struct ast_config *config)
Destroys a config.
Definition: extconf.c:1290
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:300
#define MAXFESTLEN
Definition: app_festival.c:68
#define ast_malloc(len)
A wrapper for malloc()
Definition: astmm.h:193
int ast_set_write_format(struct ast_channel *chan, struct ast_format *format)
Sets write format on channel chan.
Definition: channel.c:5890
Core PBX routines and definitions.
int ast_set_priority(int)
We set ourselves to a high priority, that we might pre-empt everything else. If your PBX has heavy ac...
Definition: asterisk.c:1799
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
Definition: astmm.h:290
void MD5Update(struct MD5Context *context, unsigned char const *buf, unsigned len)
Definition: md5.c:72
#define LOG_ERROR
Definition: logger.h:285
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
Definition: main/utils.c:1951
int errno
int ast_safe_fork(int stop_reaper)
Common routine to safely fork without a chance of a signal handler firing badly in the child...
Definition: main/app.c:3047
#define ast_free(a)
Definition: astmm.h:182
#define FESTIVAL_CONFIG
Definition: app_festival.c:66
int ast_write(struct ast_channel *chan, struct ast_frame *frame)
Write a frame to a channel This function writes the given frame to the indicated channel.
Definition: channel.c:5189
static char * app
Definition: app_festival.c:87
Module has failed to load, may be in an inconsistent state.
Definition: module.h:78
Structure used to handle boolean flags.
Definition: utils.h:199
Definition: md5.h:26
AST_MODULE_INFO_STANDARD_EXTENDED(ASTERISK_GPL_KEY, "Simple Festival Interface")
const char * ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable)
Definition: main/config.c:694
struct hostent * ast_gethostbyname(const char *host, struct ast_hostent *hp)
Thread-safe gethostbyname function to use in Asterisk.
Definition: main/utils.c:197
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
Definition: channel.c:3171
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
static unsigned char * buff
Definition: chan_unistim.c:259
#define ast_frfree(fr)
int ast_answer(struct ast_channel *chan)
Answer a channel.
Definition: channel.c:2814
Data structure associated with a single frame of data.
enum ast_frame_type frametype
static int load_module(void)
Load the module.
Definition: app_festival.c:563
#define ASTERISK_GPL_KEY
The text the key() function should return.
Definition: module.h:46
struct ast_format * ast_format_slin
Built-in cached signed linear 8kHz format.
Definition: format_cache.c:41
Asterisk module definitions.
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
MD5 digest functions.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application&#39;s arguments.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
int ast_stopstream(struct ast_channel *c)
Stops a stream.
Definition: file.c:187
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Definition: module.h:626
#define ast_opt_high_priority
Definition: options.h:110
static char * socket_receive_file_to_buff(int fd, int *size)
Definition: app_festival.c:89
static int send_waveform_to_fd(char *waveform, int length, int fd)
Definition: app_festival.c:140
Media Format Cache API.
#define AST_APP_ARG(name)
Define an application argument.