forked from darrensessions/app_swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_swift.c
673 lines (576 loc) · 18 KB
/
app_swift.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
/*
* app_swift -- A Cepstral Swift TTS engine interface
*
* Copyright (C) 2006 - 2012, Darren Sessions
* Portions Copyright (C) 2012, Cepstral LLC.
*
* All rights reserved.
*
*
* This program is free software, distributed under the
* terms of the GNU General Public License Version 2. See
* the LICENSE file at the top of the source tree for more
* information.
*
*/
/*!
* \file
* \author Darren Sessions <[email protected]>
* \brief Cepstral Swift text-to-speech engine interface
*
* \ingroup applications
* \note This module requires the Cepstral engine to be installed in
* it's default location (/opt/swift)
*/
/*** MODULEINFO
<defaultenabled>no</defaultenabled>
<depend>swift</depend>
***/
#include "asterisk.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 301000 $")
#include <swift.h>
#if defined _SWIFT_VER_6
#include <swift_asterisk_interface.h>
#endif
#include <math.h>
#include "asterisk/astobj.h"
#include "asterisk/channel.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
#include "asterisk/app.h"
#include "asterisk/file.h"
/*** DOCUMENTATION
<application name="Swift" language="en_US">
<synopsis>
Speak text through Swift text-to-speech engine (without writing files)
and optionally listen for DTMF.
</synopsis>
<syntax>
<parameter name="'text'" required="true"/>
<parameter name="options">
<optionlist>
<option name="timeout">
<para>Timeout in milliseconds.</para>
</option>
<option name="digits">
<para>Maxiumum digits.</para>
</option>
</optionlist>
</parameter>
</syntax>
<description>
<para>This application streams tts audio from the Cepstral swift engine and
will alternatively read DTMF into the ${SWIFT_DTMF} variable if the timeout
and digits options are used.</para>
</description>
</application>
***/
static char *app = "Swift";
#if (defined _AST_VER_1_4 || defined _AST_VER_1_6)
static char *synopsis = "Speak text through the Cepstral Swift text-to-speech engine.";
#endif
#if (defined _AST_VER_1_4 || defined _AST_VER_1_6)
static char *descrip =
"This application streams tts audio from the Cepstral swift engine and\n"
"will alternatively read DTMF into the ${SWIFT_DTMF} variable if the timeout\n"
"and digits options are used.\n\n"
" Syntax: Swift(text[|timeout in ms][|maximum digits])\n";
#endif
const int framesize = 20;
#define AST_MODULE "app_swift"
#define SWIFT_CONFIG_FILE "swift.conf"
#define dtmf_codes 12
static unsigned int cfg_buffer_size;
static int cfg_goto_exten;
static int samplerate;
static char cfg_voice[20];
struct stuff {
ASTOBJ_COMPONENTS(struct stuff);
int generating_done;
char *q;
char *pq_r; /* queue read position */
char *pq_w; /* queue write position */
int qc;
int immediate_exit;
};
struct dtmf_lookup {
long ast_res;
char* dtmf_res;
};
static struct dtmf_lookup ast_dtmf_table[dtmf_codes] = {
{35, "#"},
{42, "*"},
{48, "0"},
{49, "1"},
{50, "2"},
{51, "3"},
{52, "4"},
{53, "5"},
{54, "6"},
{55, "7"},
{56, "8"},
{57, "9"}
};
static void swift_init_stuff(struct stuff *ps)
{
ASTOBJ_INIT(ps);
ps->generating_done = 0;
ps->q = malloc(cfg_buffer_size);
ps->pq_r = ps->q;
ps->pq_w = ps->q;
ps->qc = 0;
ps->immediate_exit = 0;
}
static int swift_generator_running(struct stuff *ps)
{
int r;
ASTOBJ_RDLOCK(ps);
r = !ps->immediate_exit && (!ps->generating_done || ps->qc);
ASTOBJ_UNLOCK(ps);
return r;
}
static int swift_bytes_available(struct stuff *ps)
{
int r;
ASTOBJ_RDLOCK(ps);
r = ps->qc;
ASTOBJ_UNLOCK(ps);
return r;
}
static swift_result_t swift_cb(swift_event *event, swift_event_t type, void *udata)
{
void *buf;
int len, spacefree;
unsigned long sleepfor;
swift_event_t rv = SWIFT_SUCCESS;
struct stuff *ps = udata;
if (type == SWIFT_EVENT_AUDIO) {
rv = swift_event_get_audio(event, &buf, &len);
if (!SWIFT_FAILED(rv) && len > 0) {
ast_log(LOG_DEBUG, "audio callback\n");
ASTOBJ_WRLOCK(ps);
/* Sleep while waiting for some queue space to become available */
while (len + ps->qc > cfg_buffer_size && !ps->immediate_exit) {
/* Each byte is 125us of time, so assume queue space will become available
at that rate and guess when we'll have enough space available.
+ another (125 usec/sample * framesize samples) (1 frame) for fudge */
sleepfor = ((unsigned long)(len - (cfg_buffer_size - ps->qc)) * 125UL) + (125UL * (unsigned long)framesize);
/* ast_log(LOG_DEBUG, "generator: %d bytes to write but only %d space avail, sleeping %ldus\n", len, cfg_buffer_size - ps->qc, sleepfor); */
ASTOBJ_UNLOCK(ps);
usleep(sleepfor);
ASTOBJ_WRLOCK(ps);
}
if (ps->immediate_exit) {
ASTOBJ_UNLOCK(ps);
return SWIFT_SUCCESS;
}
spacefree = cfg_buffer_size - ((uintptr_t) ps->pq_w - (uintptr_t)ps->q);
if (len > spacefree) {
ast_log(LOG_DEBUG, "audio fancy write; %d bytes but only %d avail to end %d totalavail\n", len, spacefree, cfg_buffer_size - ps->qc);
/* write #1 to end of mem */
memcpy(ps->pq_w, buf, spacefree);
ps->pq_w = ps->q;
ps->qc += spacefree;
/* write #2 and beg of mem */
memcpy(ps->pq_w, buf + spacefree, len - spacefree);
ps->pq_w += len - spacefree;
ps->qc += len - spacefree;
} else {
ast_log(LOG_DEBUG, "audio easy write, %d avail to end %d totalavail\n", spacefree, cfg_buffer_size - ps->qc);
memcpy(ps->pq_w, buf, len);
ps->pq_w += len;
ps->qc += len;
}
ASTOBJ_UNLOCK(ps);
} else {
ast_log(LOG_DEBUG, "got audio callback but get_audio call failed\n");
}
} else if (type == SWIFT_EVENT_END) {
ast_log(LOG_DEBUG, "got END callback; done generating audio\n");
ASTOBJ_WRLOCK(ps);
ps->generating_done = 1;
ASTOBJ_UNLOCK(ps);
#if defined _SWIFT_VER_6
} else if (type == SWIFT_EVENT_ERROR) {
/*
* Error events are used to communicate to app_swift that there are no more swift_ports available.
* So check to make sure that is the cause of the error signal, then terminate.
* Termination may not be the best behavior, but any queuing should be managed on the Asterisk side.
*/
swift_result_t error_code;
if ((swift_event_get_error(event, &error_code, NULL)==SWIFT_SUCCESS) && (error_code == SWIFT_PORT_UNAVAILABLE)) {
ast_log(LOG_WARNING, "Received SWIFT_EVENT_ERROR with code: SWIFT_PORT_UNAVAILABLE. There are no ports available for simultaneous synthesis. All licensed ports are already in use.\n");
ASTOBJ_WRLOCK(ps);
ps->generating_done = 1;
ASTOBJ_UNLOCK(ps);
}
#endif
} else {
ast_log(LOG_DEBUG, "UNKNOWN callback\n");
}
return rv;
}
static int dtmf_conv(int dtmf)
{
char *res = (char *) malloc(100);
int dtmf_search_counter = 0, dtmf_search_match = 0;
memset(res, 0, 100);
while ((dtmf_search_counter < dtmf_codes) && (dtmf_search_match == 0)) {
if (dtmf == ast_dtmf_table[dtmf_search_counter].ast_res) {
dtmf_search_match += 1;
sprintf(res, "%s", ast_dtmf_table[dtmf_search_counter].dtmf_res);
}
dtmf_search_counter = dtmf_search_counter + 1;
}
return *res;
}
static char *listen_for_dtmf(struct ast_channel *chan, int timeout, int max_digits)
{
char *dtmf_conversion = (char *) malloc(100);
char cnv[2];
int dtmf = 0, i = 0;
memset(dtmf_conversion, 0, 100);
memset(cnv, 0, 2);
while (i < max_digits) {
dtmf = ast_waitfordigit(chan, timeout);
if (!dtmf) {
break;
}
sprintf(cnv, "%c", dtmf_conv(dtmf));
strcat(dtmf_conversion, cnv);
i += 1;
}
return strdup(dtmf_conversion);
}
#if (defined _AST_VER_1_4 || defined _AST_VER_1_6)
static int app_exec(struct ast_channel *chan, void *data)
#elif (defined _AST_VER_1_8 || defined _AST_VER_10)
static int app_exec(struct ast_channel *chan, const char *data)
#endif
{
int res = 0, max_digits = 0, timeout = 0, alreadyran = 0;
int ms, len, availatend;
char *argv[3], *text = NULL, *rc = NULL;
char tmp_exten[2], results[20];
struct ast_module_user *u;
struct ast_frame *f;
struct timeval next;
struct stuff *ps;
#if defined _AST_VER_10
struct ast_format old_writeformat;
#else
int old_writeformat = 0;
#endif
struct myframe {
struct ast_frame f;
unsigned char offset[AST_FRIENDLY_OFFSET];
unsigned char frdata[framesize];
} myf;
swift_engine *engine;
swift_port *port = NULL;
swift_voice *voice;
swift_params *params;
swift_result_t sresult;
swift_background_t tts_stream;
unsigned int event_mask;
memset(results, 0 ,20);
memset(tmp_exten, 0, 2);
memset(argv, 0, 3);
u = ast_module_user_add(chan);
text = argv[0];
if (!ast_strlen_zero(argv[1])) {
timeout = strtol(argv[1], NULL, 0);
}
if (!ast_strlen_zero(argv[2])) {
max_digits = strtol(argv[2], NULL, 0);
}
if (ast_strlen_zero(text)) {
ast_log(LOG_WARNING, "%s requires text to speak!\n", app);
return -1;
}
if (!ast_strlen_zero(text)) {
ast_log(LOG_DEBUG, "Text to Speak : %s\n", text);
}
if (timeout > 0) {
ast_log(LOG_DEBUG, "Timeout : %d\n", timeout);
}
if (max_digits > 0) {
ast_log(LOG_DEBUG, "Max Digits : %d\n", max_digits);
}
ps = malloc(sizeof(struct stuff));
swift_init_stuff(ps);
/* Setup synthesis */
if ((engine = swift_engine_open(NULL)) == NULL) {
ast_log(LOG_ERROR, "Failed to open Swift Engine.\n");
goto exception;
}
params = swift_params_new(NULL);
swift_params_set_string(params, "audio/encoding", "ulaw");
swift_params_set_string(params, "audio/sampling-rate", "8000");
swift_params_set_string(params, "audio/output-format", "raw");
swift_params_set_string(params, "tts/text-encoding", "utf-8");
/* Additional swift parameters
*
* swift_params_set_float(params, "speech/pitch/shift", 1.0);
* swift_params_set_int(params, "speech/rate", 150);
* swift_params_set_int(params, "audio/volume", 110);
* swift_params_set_int(params, "audio/deadair", 0);
*/
if ((port = swift_port_open(engine, params)) == NULL) {
ast_log(LOG_ERROR, "Failed to open Swift Port.\n");
goto exception;
}
#if defined _SWIFT_VER_6
if (port!=NULL) {
/*
* This registers a chan with swift, otherwise through repeated DTMF+synth requests
* a single call could consume all available concurrent synthesis ports.
*/
swift_register_ast_chan(port, chan);
}
#endif
if ((voice = swift_port_set_voice_by_name(port, cfg_voice)) == NULL) {
ast_log(LOG_ERROR, "Failed to set voice.\n");
goto exception;
}
#if defined _SWIFT_VER_6
event_mask = SWIFT_EVENT_AUDIO | SWIFT_EVENT_END | SWIFT_EVENT_ERROR;
#elif defined _SWIFT_VER_5
event_mask = SWIFT_EVENT_AUDIO | SWIFT_EVENT_END;
#endif
swift_port_set_callback(port, &swift_cb, event_mask, ps);
if (SWIFT_FAILED(swift_port_speak_text(port, text, 0, NULL, &tts_stream, NULL))) {
ast_log(LOG_ERROR, "Failed to speak.\n");
goto exception;
}
if (chan->_state != AST_STATE_UP) {
ast_answer(chan);
}
ast_stopstream(chan);
#if (defined _AST_VER_1_4 || defined _AST_VER_1_6 || defined _AST_VER_1_8)
old_writeformat = chan->writeformat;
if (ast_set_write_format(chan, AST_FORMAT_ULAW) < 0) {
#elif defined _AST_VER_10
ast_format_copy(&old_writeformat, &chan->writeformat);
if (ast_set_write_format_by_id(chan, AST_FORMAT_ULAW) < 0) {
#endif
ast_log(LOG_WARNING, "Unable to set write format.\n");
goto exception;
}
res = 0;
/* Wait 100ms first for synthesis to start crankin'; if that's not
* enough the
*/
next = ast_tvadd(ast_tvnow(), ast_tv(0, 100000));
while (swift_generator_running(ps)) {
ms = ast_tvdiff_ms(next, ast_tvnow());
if (ms <= 0) {
if (swift_bytes_available(ps) > 0) {
ASTOBJ_WRLOCK(ps);
len = fmin(framesize, ps->qc);
availatend = cfg_buffer_size - (ps->pq_r - ps->q);
if (len > availatend) {
/* read #1: to end of q buf */
memcpy(myf.frdata, ps->pq_r, availatend);
ps->qc -= availatend;
/* read #2: reset to start of q buf and get rest */
ps->pq_r = ps->q;
memcpy(myf.frdata + availatend, ps->pq_r, len - availatend);
ps->qc -= len - availatend;
ps->pq_r += len - availatend;
} else {
ast_log(LOG_DEBUG, "Easy read; %d bytes and %d at end, %d free\n", len, availatend, cfg_buffer_size - ps->qc);
memcpy(myf.frdata, ps->pq_r, len);
ps->qc -= len;
ps->pq_r += len;
}
myf.f.frametype = AST_FRAME_VOICE;
#if (defined _AST_VER_1_6 || defined _AST_VER_1_4)
myf.f.subclass = AST_FORMAT_ULAW;
#elif defined _AST_VER_1_8
myf.f.subclass.codec = AST_FORMAT_ULAW;
#endif
myf.f.datalen = len;
myf.f.samples = len;
#if defined _AST_VER_1_4
myf.f.data = myf.frdata;
#elif defined _AST_VER_1_6
myf.f.data.ptr = myf.frdata;
#endif
myf.f.mallocd = 0;
myf.f.offset = AST_FRIENDLY_OFFSET;
myf.f.src = __PRETTY_FUNCTION__;
myf.f.delivery.tv_sec = 0;
myf.f.delivery.tv_usec = 0;
if (ast_write(chan, &myf.f) < 0) {
ast_log(LOG_DEBUG, "ast_write failed\n");
}
ast_log(LOG_DEBUG, "wrote a frame of %d\n", len);
if (ps->qc < 0) {
ast_log(LOG_DEBUG, "queue claims to contain negative bytes. Huh? qc < 0\n");
}
ASTOBJ_UNLOCK(ps);
next = ast_tvadd(next, ast_samp2tv(myf.f.samples, samplerate));
} else {
next = ast_tvadd(next, ast_samp2tv(framesize / 2, samplerate));
ast_log(LOG_DEBUG, "Whoops, writer starved for audio\n");
}
} else {
ms = ast_waitfor(chan, ms);
if (ms < 0) {
ast_log(LOG_DEBUG, "Hangup detected\n");
res = -1;
ASTOBJ_WRLOCK(ps);
ps->immediate_exit = 1;
ASTOBJ_UNLOCK(ps);
} else if (ms) {
f = ast_read(chan);
if (!f) {
ast_log(LOG_DEBUG, "Null frame == hangup() detected\n");
res = -1;
ASTOBJ_WRLOCK(ps);
ps->immediate_exit = 1;
ASTOBJ_UNLOCK(ps);
} else {
if (f->frametype == AST_FRAME_DTMF && timeout > 0 && max_digits > 0) {
#if (defined _AST_VER_1_6 || defined _AST_VER_1_4)
char originalDTMF = f->subclass;
#elif (defined _AST_VER_1_8 || defined _AST_VER_10)
char originalDTMF = f->subclass.integer;
#endif
alreadyran = 1;
res = 0;
ASTOBJ_WRLOCK(ps);
ps->immediate_exit = 1;
ASTOBJ_UNLOCK(ps);
if (max_digits > 1) {
rc = listen_for_dtmf(chan, timeout, max_digits - 1);
}
if (rc) {
sprintf(results, "%c%s", originalDTMF, rc);
} else {
sprintf(results, "%c", originalDTMF);
}
ast_log(LOG_NOTICE, "DTMF = %s\n", results);
pbx_builtin_setvar_helper(chan, "SWIFT_DTMF", results);
}
if (f!=NULL) {
ast_frfree(f);
}
}
}
}
ASTOBJ_RDLOCK(ps);
if (ps->immediate_exit && !ps->generating_done) {
if (SWIFT_FAILED(sresult = swift_port_stop(port, tts_stream, SWIFT_EVENT_NOW))) {
ast_log(LOG_NOTICE, "Early top of swift port failed\n");
}
}
ASTOBJ_UNLOCK(ps);
}
if (alreadyran == 0 && timeout > 0 && max_digits > 0) {
rc = listen_for_dtmf(chan, timeout, max_digits);
if (rc != NULL) {
sprintf(results, "%s", rc);
ast_log(LOG_NOTICE, "DTMF = %s\n", results);
pbx_builtin_setvar_helper(chan, "SWIFT_DTMF", results);
}
}
if (max_digits >= 1 && results != NULL) {
if (cfg_goto_exten) {
ast_log(LOG_NOTICE, "GoTo(%s|%s|%d) : ", chan->context, results, 1);
#if (defined _AST_VER_1_6 || defined _AST_VER_1_4)
if (ast_exists_extension (chan, chan->context, results, 1, chan->cid.cid_num)) {
#elif (defined _AST_VER_1_8 || defined _AST_VER_10)
if (ast_exists_extension (chan, chan->context, results, 1, chan->caller.id.number.str)) {
#endif
ast_log(LOG_NOTICE, "OK\n");
ast_copy_string(chan->exten, results, sizeof(chan->exten) - 1);
chan->priority = 0;
} else {
ast_log(LOG_NOTICE, "FAILED\n");
}
}
}
exception:
if (port != NULL) {
swift_port_close(port);
}
if (engine != NULL) {
swift_engine_close(engine);
}
if (ps && ps->q) {
ast_free(ps->q);
ps->q = NULL;
}
if (ps) {
ast_free(ps);
ps = NULL;
}
#if (defined _AST_VER_1_6 || defined _AST_VER_1_4 || defined _AST_VER_1_8)
if (!res && old_writeformat) {
ast_set_write_format(chan, old_writeformat);
}
#elif defined _AST_VER_10
if (!res) {
ast_set_write_format(chan, &old_writeformat);
}
#endif
ast_module_user_remove(u);
return res;
}
static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
ast_module_user_hangup_all();
return res;
}
static int load_module(void)
{
int res = 0;
const char *val = NULL;
struct ast_config *cfg;
#if (defined _AST_VER_1_6 || defined _AST_VER_1_8 || defined _AST_VER_10)
struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE };
#endif
/* Set some defaults */
cfg_buffer_size = 65535;
cfg_goto_exten = 0;
samplerate = 8000; /* G711a/G711u */
ast_copy_string(cfg_voice, "Allison-8kHz", sizeof(cfg_voice));
#if (defined _AST_VER_1_6 || defined _AST_VER_1_4)
res = ast_register_application(app, app_exec, synopsis, descrip) ?
#elif (defined _AST_VER_1_8 || defined _AST_VER_10)
res = ast_register_application_xml(app, app_exec) ?
#endif
AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS;
#if defined _AST_VER_1_4
cfg = ast_config_load(SWIFT_CONFIG_FILE);
#elif (defined _AST_VER_1_6 || defined _AST_VER_1_8 || defined _AST_VER_10)
cfg = ast_config_load(SWIFT_CONFIG_FILE, config_flags);
#endif
if (cfg) {
if ((val = ast_variable_retrieve(cfg, "general", "buffer_size"))) {
cfg_buffer_size = atoi(val);
ast_log(LOG_DEBUG, "Config buffer_size is %d\n", cfg_buffer_size);
}
if ((val = ast_variable_retrieve(cfg, "general", "goto_exten"))) {
if (!strcmp(val, "yes")) {
cfg_goto_exten = 1;
} else {
cfg_goto_exten = 0;
ast_log(LOG_DEBUG, "Config goto_exten is %d\n", cfg_goto_exten);
}
}
if ((val = ast_variable_retrieve(cfg, "general", "voice"))) {
ast_copy_string(cfg_voice, val, sizeof(cfg_voice));
ast_log(LOG_DEBUG, "Config voice is %s\n", cfg_voice);
}
ast_config_destroy(cfg);
} else {
ast_log(LOG_NOTICE, "Failed to load config\n");
}
return res;
}
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Cepstral Swift TTS Application");