Asterisk - The Open Source Telephony Project GIT-master-0bf3178
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 <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
87static char *app = "Festival";
88
89static 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
140static 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);
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
174static 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
279static 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 int fd;
285 FILE *fs;
286 const char *host;
287 const char *cachedir;
288 const char *temp;
289 const char *festivalcommand;
290 int port = 1314;
291 int n;
292 char ack[4];
293 char *waveform;
294 int filesize;
295 char bigstring[MAXFESTLEN];
296 int i;
297 struct MD5Context md5ctx;
298 unsigned char MD5Res[16];
299 char MD5Hex[33] = "";
300 char koko[4] = "";
301 char cachefile[MAXFESTLEN]="";
302 int readcache = 0;
303 int writecache = 0;
304 int strln;
305 int fdesc = -1;
306 char buffer[16384];
307 int seekpos = 0;
308 char *data;
309 struct ast_config *cfg;
310 char *newfestivalcommand;
311 struct ast_flags config_flags = { 0 };
314 AST_APP_ARG(interrupt);
315 );
316
317 if (ast_strlen_zero(vdata)) {
318 ast_log(LOG_WARNING, "festival requires an argument (text)\n");
319 return -1;
320 }
321
322 cfg = ast_config_load(FESTIVAL_CONFIG, config_flags);
323 if (!cfg) {
324 ast_log(LOG_WARNING, "No such configuration file %s\n", FESTIVAL_CONFIG);
325 return -1;
326 } else if (cfg == CONFIG_STATUS_FILEINVALID) {
327 ast_log(LOG_ERROR, "Config file " FESTIVAL_CONFIG " is in an invalid format. Aborting.\n");
328 return -1;
329 }
330
331 if (!(host = ast_variable_retrieve(cfg, "general", "host"))) {
332 host = "localhost";
333 }
334 if (!(temp = ast_variable_retrieve(cfg, "general", "port"))) {
335 port = 1314;
336 } else {
337 port = atoi(temp);
338 }
339 if (!(temp = ast_variable_retrieve(cfg, "general", "usecache"))) {
340 usecache = 0;
341 } else {
342 usecache = ast_true(temp);
343 }
344 if (!(cachedir = ast_variable_retrieve(cfg, "general", "cachedir"))) {
345 cachedir = "/tmp/";
346 }
347
348 data = ast_strdupa(vdata);
350
351 if (!(festivalcommand = ast_variable_retrieve(cfg, "general", "festivalcommand"))) {
352 const char *startcmd = "(tts_textasterisk \"";
353 const char *endcmd = "\" 'file)(quit)\n";
354
355 strln = strlen(startcmd) + strlen(args.text) + strlen(endcmd) + 1;
356 newfestivalcommand = ast_alloca(strln);
357 snprintf(newfestivalcommand, strln, "%s%s%s", startcmd, args.text, endcmd);
358 festivalcommand = newfestivalcommand;
359 } else { /* This else parses the festivalcommand that we're sent from the config file for \n's, etc */
360 int x, j;
361 newfestivalcommand = ast_alloca(strlen(festivalcommand) + strlen(args.text) + 1);
362
363 for (x = 0, j = 0; x < strlen(festivalcommand); x++) {
364 if (festivalcommand[x] == '\\' && festivalcommand[x + 1] == 'n') {
365 newfestivalcommand[j++] = '\n';
366 x++;
367 } else if (festivalcommand[x] == '\\') {
368 newfestivalcommand[j++] = festivalcommand[x + 1];
369 x++;
370 } else if (festivalcommand[x] == '%' && festivalcommand[x + 1] == 's') {
371 sprintf(&newfestivalcommand[j], "%s", args.text); /* we know it is big enough */
372 j += strlen(args.text);
373 x++;
374 } else
375 newfestivalcommand[j++] = festivalcommand[x];
376 }
377 newfestivalcommand[j] = '\0';
378 festivalcommand = newfestivalcommand;
379 }
380
381 if (args.interrupt && !strcasecmp(args.interrupt, "any"))
382 args.interrupt = AST_DIGIT_ANY;
383
384 ast_debug(1, "Text passed to festival server : %s\n", args.text);
385 /* Connect to local festival server */
386
387 fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
388
389 if (fd < 0) {
390 ast_log(LOG_WARNING, "festival_client: can't get socket\n");
392 return -1;
393 }
394
395 memset(&serv_addr, 0, sizeof(serv_addr));
396
397 if ((serv_addr.sin_addr.s_addr = inet_addr(host)) == -1) {
398 /* its a name rather than an ipnum */
399 struct ast_sockaddr addr = { {0,} };
400
401 if (ast_sockaddr_resolve_first_af(&addr, host, PARSE_PORT_FORBID, AF_INET)) {
402 ast_log(LOG_WARNING, "festival_client: ast_sockaddr_resolve_first_af() failed\n");
404 close(fd);
405 return -1;
406 }
407
408 /* We'll overwrite port and family in a sec */
409 ast_sockaddr_to_sin(&addr, &serv_addr);
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");
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) + sizeof(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);
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);
545 return res;
546}
547
548static 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 */
563static 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 }
576}
577
#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:140
static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, int length, char *intkeys)
Definition: app_festival.c:174
static char * app
Definition: app_festival.c:87
static char * socket_receive_file_to_buff(int fd, int *size)
Definition: app_festival.c:89
static int festival_exec(struct ast_channel *chan, const char *vdata)
Definition: app_festival.c:279
static int load_module(void)
Load the module.
Definition: app_festival.c:563
static int unload_module(void)
Definition: app_festival.c:548
AST_MODULE_INFO_STANDARD_EXTENDED(ASTERISK_GPL_KEY, "Simple Festival Interface")
char * text
Definition: app_queue.c:1668
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:1842
#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 int tmp()
Definition: bt_open.c:389
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:3181
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:5163
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
Definition: channel.c:4276
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:5822
int ast_answer(struct ast_channel *chan)
Answer a channel.
Definition: channel.c:2824
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
Definition: channel.c:4296
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:784
#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[16], 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:26
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.