Asterisk - The Open Source Telephony Project GIT-master-754dea3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
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 <ricudis@itc.auth.gr>
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 <ricudis@itc.auth.gr>
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"
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 <since>
73 <version>0.2.0</version>
74 </since>
75 <synopsis>
76 Say text to the user.
77 </synopsis>
78 <syntax>
79 <parameter name="text" required="true" />
80 <parameter name="intkeys" />
81 </syntax>
82 <description>
83 <para>Connect to Festival, send the argument, get back the waveform, play it to the user,
84 allowing any given interrupt keys to immediately terminate and return the value, or
85 <literal>any</literal> to allow any number back (useful in dialplan).</para>
86 </description>
87 </application>
88 ***/
89
90static char *app = "Festival";
91
92static char *socket_receive_file_to_buff(int fd, int *size)
93{
94 /* Receive file (probably a waveform file) from socket using
95 * Festival key stuff technique, but long winded I know, sorry
96 * but will receive any file without closing the stream or
97 * using OOB data
98 */
99 static char *file_stuff_key = "ft_StUfF_key"; /* must == Festival's key */
100 char *buff, *tmp;
101 int bufflen;
102 int n,k,i;
103 char c;
104
105 bufflen = 1024;
106 if (!(buff = ast_malloc(bufflen)))
107 return NULL;
108 *size = 0;
109
110 for (k = 0; file_stuff_key[k] != '\0';) {
111 n = read(fd, &c, 1);
112 if (n == 0)
113 break; /* hit stream eof before end of file */
114 if ((*size) + k + 1 >= bufflen) {
115 /* +1 so you can add a terminating NULL if you want */
116 bufflen += bufflen / 4;
117 if (!(tmp = ast_realloc(buff, bufflen))) {
118 ast_free(buff);
119 return NULL;
120 }
121 buff = tmp;
122 }
123 if (file_stuff_key[k] == c)
124 k++;
125 else if ((c == 'X') && (file_stuff_key[k+1] == '\0')) {
126 /* It looked like the key but wasn't */
127 for (i = 0; i < k; i++, (*size)++)
128 buff[*size] = file_stuff_key[i];
129 k = 0;
130 /* omit the stuffed 'X' */
131 } else {
132 for (i = 0; i < k; i++, (*size)++)
133 buff[*size] = file_stuff_key[i];
134 k = 0;
135 buff[*size] = c;
136 (*size)++;
137 }
138 }
139
140 return buff;
141}
142
143static int send_waveform_to_fd(char *waveform, int length, int fd)
144{
145 int res;
146#if __BYTE_ORDER == __BIG_ENDIAN
147 int x;
148 char c;
149#endif
150
151 res = ast_safe_fork(0);
152 if (res < 0)
153 ast_log(LOG_WARNING, "Fork failed\n");
154 if (res) {
155 return res;
156 }
157 dup2(fd, 0);
161#if __BYTE_ORDER == __BIG_ENDIAN
162 for (x = 0; x < length; x += 2) {
163 c = *(waveform + x + 1);
164 *(waveform + x + 1) = *(waveform + x);
165 *(waveform + x) = c;
166 }
167#endif
168
169 if (write(0, waveform, length) < 0) {
170 /* Cannot log -- all FDs are already closed */
171 }
172
173 close(fd);
174 _exit(0);
175}
176
177static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, int length, char *intkeys)
178{
179 int res = 0;
180 int fds[2];
181 int needed = 0;
182 struct ast_format *owriteformat;
183 struct ast_frame *f;
184 struct myframe {
185 struct ast_frame f;
187 char frdata[2048];
188 } myf = {
189 .f = { 0, },
190 };
191
192 if (pipe(fds)) {
193 ast_log(LOG_WARNING, "Unable to create pipe\n");
194 return -1;
195 }
196
197 /* Answer if it's not already going */
198 if (ast_channel_state(chan) != AST_STATE_UP)
199 ast_answer(chan);
200 ast_stopstream(chan);
201 ast_indicate(chan, -1);
202
203 owriteformat = ao2_bump(ast_channel_writeformat(chan));
205 if (res < 0) {
206 ast_log(LOG_WARNING, "Unable to set write format to signed linear\n");
207 ao2_cleanup(owriteformat);
208 return -1;
209 }
210
211 myf.f.frametype = AST_FRAME_VOICE;
212 myf.f.subclass.format = ast_format_slin;
213 myf.f.offset = AST_FRIENDLY_OFFSET;
214 myf.f.src = __PRETTY_FUNCTION__;
215 myf.f.data.ptr = myf.frdata;
216
217 res = send_waveform_to_fd(waveform, length, fds[1]);
218 if (res >= 0) {
219 /* Order is important -- there's almost always going to be mp3... we want to prioritize the
220 user */
221 for (;;) {
222 res = ast_waitfor(chan, 1000);
223 if (res < 1) {
224 res = -1;
225 break;
226 }
227 f = ast_read(chan);
228 if (!f) {
229 ast_log(LOG_WARNING, "Null frame == hangup() detected\n");
230 res = -1;
231 break;
232 }
233 if (f->frametype == AST_FRAME_DTMF) {
234 ast_debug(1, "User pressed a key\n");
235 if (intkeys && strchr(intkeys, f->subclass.integer)) {
236 res = f->subclass.integer;
237 ast_frfree(f);
238 break;
239 }
240 }
241 if (f->frametype == AST_FRAME_VOICE) {
242 /* Treat as a generator */
243 needed = f->samples * 2;
244 if (needed > sizeof(myf.frdata)) {
245 ast_log(LOG_WARNING, "Only able to deliver %d of %d requested samples\n",
246 (int)sizeof(myf.frdata) / 2, needed/2);
247 needed = sizeof(myf.frdata);
248 }
249 res = read(fds[0], myf.frdata, needed);
250 if (res > 0) {
251 myf.f.datalen = res;
252 myf.f.samples = res / 2;
253 if (ast_write(chan, &myf.f) < 0) {
254 res = -1;
255 ast_frfree(f);
256 break;
257 }
258 if (res < needed) { /* last frame */
259 ast_debug(1, "Last frame\n");
260 res = 0;
261 ast_frfree(f);
262 break;
263 }
264 } else {
265 ast_debug(1, "No more waveform\n");
266 res = 0;
267 }
268 }
269 ast_frfree(f);
270 }
271 }
272 close(fds[0]);
273 close(fds[1]);
274
275 if (!res && owriteformat)
276 ast_set_write_format(chan, owriteformat);
277 ao2_cleanup(owriteformat);
278
279 return res;
280}
281
282static int festival_exec(struct ast_channel *chan, const char *vdata)
283{
284 int usecache;
285 int res = 0;
286 struct sockaddr_in serv_addr;
287 int fd;
288 FILE *fs;
289 const char *host;
290 const char *cachedir;
291 const char *temp;
292 const char *festivalcommand;
293 int port = 1314;
294 int n;
295 char ack[4];
296 char *waveform;
297 int filesize;
298 char bigstring[MAXFESTLEN];
299 int i;
300 struct MD5Context md5ctx;
301 unsigned char MD5Res[16];
302 char MD5Hex[33] = "";
303 char koko[4] = "";
304 char cachefile[MAXFESTLEN]="";
305 int readcache = 0;
306 int writecache = 0;
307 int strln;
308 int fdesc = -1;
309 char buffer[16384];
310 int seekpos = 0;
311 char *data;
312 struct ast_config *cfg;
313 char *newfestivalcommand;
314 struct ast_flags config_flags = { 0 };
317 AST_APP_ARG(interrupt);
318 );
319
320 if (ast_strlen_zero(vdata)) {
321 ast_log(LOG_WARNING, "festival requires an argument (text)\n");
322 return -1;
323 }
324
325 cfg = ast_config_load(FESTIVAL_CONFIG, config_flags);
326 if (!cfg) {
327 ast_log(LOG_WARNING, "No such configuration file %s\n", FESTIVAL_CONFIG);
328 return -1;
329 } else if (cfg == CONFIG_STATUS_FILEINVALID) {
330 ast_log(LOG_ERROR, "Config file " FESTIVAL_CONFIG " is in an invalid format. Aborting.\n");
331 return -1;
332 }
333
334 if (!(host = ast_variable_retrieve(cfg, "general", "host"))) {
335 host = "localhost";
336 }
337 if (!(temp = ast_variable_retrieve(cfg, "general", "port"))) {
338 port = 1314;
339 } else {
340 port = atoi(temp);
341 }
342 if (!(temp = ast_variable_retrieve(cfg, "general", "usecache"))) {
343 usecache = 0;
344 } else {
345 usecache = ast_true(temp);
346 }
347 if (!(cachedir = ast_variable_retrieve(cfg, "general", "cachedir"))) {
348 cachedir = "/tmp/";
349 }
350
351 data = ast_strdupa(vdata);
353
354 if (!(festivalcommand = ast_variable_retrieve(cfg, "general", "festivalcommand"))) {
355 const char *startcmd = "(tts_textasterisk \"";
356 const char *endcmd = "\" 'file)(quit)\n";
357
358 strln = strlen(startcmd) + strlen(args.text) + strlen(endcmd) + 1;
359 newfestivalcommand = ast_alloca(strln);
360 snprintf(newfestivalcommand, strln, "%s%s%s", startcmd, args.text, endcmd);
361 festivalcommand = newfestivalcommand;
362 } else { /* This else parses the festivalcommand that we're sent from the config file for \n's, etc */
363 int x, j;
364 newfestivalcommand = ast_alloca(strlen(festivalcommand) + strlen(args.text) + 1);
365
366 for (x = 0, j = 0; x < strlen(festivalcommand); x++) {
367 if (festivalcommand[x] == '\\' && festivalcommand[x + 1] == 'n') {
368 newfestivalcommand[j++] = '\n';
369 x++;
370 } else if (festivalcommand[x] == '\\') {
371 newfestivalcommand[j++] = festivalcommand[x + 1];
372 x++;
373 } else if (festivalcommand[x] == '%' && festivalcommand[x + 1] == 's') {
374 sprintf(&newfestivalcommand[j], "%s", args.text); /* we know it is big enough */
375 j += strlen(args.text);
376 x++;
377 } else
378 newfestivalcommand[j++] = festivalcommand[x];
379 }
380 newfestivalcommand[j] = '\0';
381 festivalcommand = newfestivalcommand;
382 }
383
384 if (args.interrupt && !strcasecmp(args.interrupt, "any"))
385 args.interrupt = AST_DIGIT_ANY;
386
387 ast_debug(1, "Text passed to festival server : %s\n", args.text);
388 /* Connect to local festival server */
389
390 fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
391
392 if (fd < 0) {
393 ast_log(LOG_WARNING, "festival_client: can't get socket\n");
395 return -1;
396 }
397
398 memset(&serv_addr, 0, sizeof(serv_addr));
399
400 if ((serv_addr.sin_addr.s_addr = inet_addr(host)) == -1) {
401 /* its a name rather than an ipnum */
402 struct ast_sockaddr addr = { {0,} };
403
404 if (ast_sockaddr_resolve_first_af(&addr, host, PARSE_PORT_FORBID, AF_INET)) {
405 ast_log(LOG_WARNING, "festival_client: ast_sockaddr_resolve_first_af() failed\n");
407 close(fd);
408 return -1;
409 }
410
411 /* We'll overwrite port and family in a sec */
412 ast_sockaddr_to_sin(&addr, &serv_addr);
413 }
414
415 serv_addr.sin_family = AF_INET;
416 serv_addr.sin_port = htons(port);
417
418 if (connect(fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) != 0) {
419 ast_log(LOG_WARNING, "festival_client: connect to server failed\n");
421 close(fd);
422 return -1;
423 }
424
425 /* Compute MD5 sum of string */
426 MD5Init(&md5ctx);
427 MD5Update(&md5ctx, (unsigned char *)args.text, strlen(args.text));
428 MD5Final(MD5Res, &md5ctx);
429 MD5Hex[0] = '\0';
430
431 /* Convert to HEX and look if there is any matching file in the cache
432 directory */
433 for (i = 0; i < 16; i++) {
434 snprintf(koko, sizeof(koko), "%X", (unsigned)MD5Res[i]);
435 strncat(MD5Hex, koko, sizeof(MD5Hex) - strlen(MD5Hex) - 1);
436 }
437 readcache = 0;
438 writecache = 0;
439 if (strlen(cachedir) + sizeof(MD5Hex) + 1 <= MAXFESTLEN && (usecache == -1)) {
440 snprintf(cachefile, sizeof(cachefile), "%s/%s", cachedir, MD5Hex);
441 fdesc = open(cachefile, O_RDWR);
442 if (fdesc == -1) {
443 fdesc = open(cachefile, O_CREAT | O_RDWR, AST_FILE_MODE);
444 if (fdesc != -1) {
445 writecache = 1;
446 strln = strlen(args.text);
447 ast_debug(1, "line length : %d\n", strln);
448 if (write(fdesc,&strln,sizeof(int)) < 0) {
449 ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
450 }
451 if (write(fdesc,data,strln) < 0) {
452 ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
453 }
454 seekpos = lseek(fdesc, 0, SEEK_CUR);
455 ast_debug(1, "Seek position : %d\n", seekpos);
456 }
457 } else {
458 if (read(fdesc,&strln,sizeof(int)) != sizeof(int)) {
459 ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno));
460 }
461 ast_debug(1, "Cache file exists, strln=%d, strlen=%d\n", strln, (int)strlen(args.text));
462 if (strlen(args.text) == strln) {
463 ast_debug(1, "Size OK\n");
464 if (read(fdesc,&bigstring,strln) != strln) {
465 ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno));
466 }
467 bigstring[strln] = 0;
468 if (strcmp(bigstring, args.text) == 0) {
469 readcache = 1;
470 } else {
471 ast_log(LOG_WARNING, "Strings do not match\n");
472 }
473 } else {
474 ast_log(LOG_WARNING, "Size mismatch\n");
475 }
476 }
477 }
478
479 if (readcache == 1) {
480 close(fd);
481 fd = fdesc;
482 ast_debug(1, "Reading from cache...\n");
483 } else {
484 ast_debug(1, "Passing text to festival...\n");
485 fs = fdopen(dup(fd), "wb");
486
487 fprintf(fs, "%s", festivalcommand);
488 fflush(fs);
489 fclose(fs);
490 }
491
492 /* Write to cache and then pass it down */
493 if (writecache == 1) {
494 ast_debug(1, "Writing result to cache...\n");
495 while ((strln = read(fd, buffer, 16384)) != 0) {
496 if (write(fdesc,buffer,strln) < 0) {
497 ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
498 }
499 }
500 close(fd);
501 close(fdesc);
502 fd = open(cachefile, O_RDWR);
503 lseek(fd, seekpos, SEEK_SET);
504 }
505
506 ast_debug(1, "Passing data to channel...\n");
507
508 /* Read back info from server */
509 /* This assumes only one waveform will come back, also LP is unlikely */
510 do {
511 int read_data;
512 for (n = 0; n < 3; ) {
513 read_data = read(fd, ack + n, 3 - n);
514 /* this avoids falling in infinite loop
515 * in case that festival server goes down
516 */
517 if (read_data == -1) {
518 ast_log(LOG_WARNING, "Unable to read from cache/festival fd\n");
519 close(fd);
521 return -1;
522 }
523 n += read_data;
524 }
525 ack[3] = '\0';
526 if (strcmp(ack, "WV\n") == 0) { /* receive a waveform */
527 ast_debug(1, "Festival WV command\n");
528 if ((waveform = socket_receive_file_to_buff(fd, &filesize))) {
529 res = send_waveform_to_channel(chan, waveform, filesize, args.interrupt);
530 ast_free(waveform);
531 }
532 break;
533 } else if (strcmp(ack, "LP\n") == 0) { /* receive an s-expr */
534 ast_debug(1, "Festival LP command\n");
535 if ((waveform = socket_receive_file_to_buff(fd, &filesize))) {
536 waveform[filesize] = '\0';
537 ast_log(LOG_WARNING, "Festival returned LP : %s\n", waveform);
538 ast_free(waveform);
539 }
540 } else if (strcmp(ack, "ER\n") == 0) { /* server got an error */
541 ast_log(LOG_WARNING, "Festival returned ER\n");
542 res = -1;
543 break;
544 }
545 } while (strcmp(ack, "OK\n") != 0);
546 close(fd);
548 return res;
549}
550
551static int unload_module(void)
552{
554}
555
556/*!
557 * \brief Load the module
558 *
559 * Module loading including tests for configuration or dependencies.
560 * This function can return AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_DECLINE,
561 * or AST_MODULE_LOAD_SUCCESS. If a dependency or environment variable fails
562 * tests return AST_MODULE_LOAD_FAILURE. If the module can not load the
563 * configuration file or other non-critical problem return
564 * AST_MODULE_LOAD_DECLINE. On success return AST_MODULE_LOAD_SUCCESS.
565 */
566static int load_module(void)
567{
568 struct ast_flags config_flags = { 0 };
569 struct ast_config *cfg = ast_config_load(FESTIVAL_CONFIG, config_flags);
570 if (!cfg) {
571 ast_log(LOG_WARNING, "No such configuration file %s\n", FESTIVAL_CONFIG);
573 } else if (cfg == CONFIG_STATUS_FILEINVALID) {
574 ast_log(LOG_ERROR, "Config file " FESTIVAL_CONFIG " is in an invalid format. Aborting.\n");
576 }
579}
580
#define MAXFESTLEN
Definition: app_festival.c:68
#define FESTIVAL_CONFIG
Definition: app_festival.c:66
static int send_waveform_to_fd(char *waveform, int length, int fd)
Definition: app_festival.c:143
static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, int length, char *intkeys)
Definition: app_festival.c:177
static char * app
Definition: app_festival.c:90
static char * socket_receive_file_to_buff(int fd, int *size)
Definition: app_festival.c:92
static int festival_exec(struct ast_channel *chan, const char *vdata)
Definition: app_festival.c:282
static int load_module(void)
Load the module.
Definition: app_festival.c:566
static int unload_module(void)
Definition: app_festival.c:551
AST_MODULE_INFO_STANDARD_EXTENDED(ASTERISK_GPL_KEY, "Simple Festival Interface")
char * text
Definition: app_queue.c:1809
Asterisk main include file. File version handling, generic pbx functions.
#define AST_FILE_MODE
Definition: asterisk.h:32
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:1848
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
Definition: astmm.h:288
#define ast_free(a)
Definition: astmm.h:180
#define ast_realloc(p, len)
A wrapper for realloc()
Definition: astmm.h:226
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:298
#define ast_malloc(len)
A wrapper for malloc()
Definition: astmm.h:191
#define ast_log
Definition: astobj2.c:42
#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
static unsigned char * buff
Definition: chan_unistim.c:259
General Asterisk PBX channel definitions.
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
Definition: channel.c:3190
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:5161
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
Definition: channel.c:4274
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
int ast_set_write_format(struct ast_channel *chan, struct ast_format *format)
Sets write format on channel chan.
Definition: channel.c:5820
int ast_answer(struct ast_channel *chan)
Answer a channel.
Definition: channel.c:2834
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
Definition: channel.c:4294
ast_channel_state
ast_channel states
Definition: channelstate.h:35
@ AST_STATE_UP
Definition: channelstate.h:42
Asterisk architecture endianess compatibility definitions.
Generic File Format Support. Should be included by clients of the file handling routines....
int ast_stopstream(struct ast_channel *c)
Stops a stream.
Definition: file.c:222
#define AST_DIGIT_ANY
Definition: file.h:48
Media Format Cache API.
struct ast_format * ast_format_slin
Built-in cached signed linear 8kHz format.
Definition: format_cache.c:41
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
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:3207
#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.
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:3202
Configuration File Parser.
#define ast_config_load(filename, flags)
Load a config file.
#define CONFIG_STATUS_FILEINVALID
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
Definition: extconf.c:1289
const char * ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable)
Definition: main/config.c:869
#define AST_FRAME_DTMF
#define ast_frfree(fr)
#define AST_FRIENDLY_OFFSET
Offset into a frame's data buffer.
@ AST_FRAME_VOICE
#define ast_debug(level,...)
Log a DEBUG message.
#define LOG_ERROR
#define LOG_WARNING
Asterisk locking-related definitions:
int errno
MD5 digest functions.
void MD5Update(struct MD5Context *context, unsigned char const *buf, unsigned len)
Definition: md5.c:72
void MD5Init(struct MD5Context *context)
Definition: md5.c:57
void MD5Final(unsigned char digest[MD5_DIGEST_LENGTH], struct MD5Context *context)
Definition: md5.c:120
Asterisk module definitions.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Definition: module.h:46
int ast_unregister_application(const char *app)
Unregister an application.
Definition: pbx_app.c:392
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Definition: module.h:78
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Definition: module.h:640
int ast_sockaddr_resolve_first_af(struct ast_sockaddr *addr, const char *name, int flag, int family)
Return the first entry from ast_sockaddr_resolve filtered by address family.
Definition: netsock2.c:337
#define ast_sockaddr_to_sin(addr, sin)
Converts a struct ast_sockaddr to a struct sockaddr_in.
Definition: netsock2.h:765
#define ast_opt_high_priority
Definition: options.h:112
Core PBX routines and definitions.
#define NULL
Definition: resample.c:96
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
Definition: utils.c:2199
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:65
Definition: md5.h:30
Main Channel structure associated with a channel.
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.
struct ast_frame_subclass subclass
enum ast_frame_type frametype
Socket address structure.
Definition: netsock2.h:97
const char * args
static struct test_val c
Utility functions.