[asterisk-addons-commits] tilghman: branch tilghman/app_speak_1.4 r434 - in /team/tilghman/app_speak_1....

SVN commits to the Asterisk addons project asterisk-addons-commits at lists.digium.com
Sun Aug 26 00:10:51 CDT 2007


Author: tilghman
Date: Sun Aug 26 00:10:51 2007
New Revision: 434

URL: http://svn.digium.com/view/asterisk-addons?view=rev&rev=434
Log:
Initial add

Added:
    team/tilghman/app_speak_1.4/app_speak.c   (with props)
Modified:
    team/tilghman/app_speak_1.4/Makefile
    team/tilghman/app_speak_1.4/aclocal.m4
    team/tilghman/app_speak_1.4/build_tools/menuselect-deps.in
    team/tilghman/app_speak_1.4/configure
    team/tilghman/app_speak_1.4/configure.ac
    team/tilghman/app_speak_1.4/makeopts.in

Modified: team/tilghman/app_speak_1.4/Makefile
URL: http://svn.digium.com/view/asterisk-addons/team/tilghman/app_speak_1.4/Makefile?view=diff&rev=434&r1=433&r2=434
==============================================================================
--- team/tilghman/app_speak_1.4/Makefile (original)
+++ team/tilghman/app_speak_1.4/Makefile Sun Aug 26 00:10:51 2007
@@ -16,7 +16,7 @@
 # Overwite config files on "make samples"
 OVERWRITE:=y
 
-CFLAGS+=-fPIC
+CFLAGS+=-fPIC -Wall -Werror
 
 # If the file .asteriskaddons.makeopts is present in your home directory, you can
 # include all of your favorite menuselect options so that every time you download
@@ -49,7 +49,7 @@
 endif
 MODULES_DIR=$(ASTLIBDIR)/modules
 
-MODS:=app_addon_sql_mysql app_saycountpl cdr_addon_mysql chan_ooh323 format_mp3 res_config_mysql
+MODS:=app_addon_sql_mysql app_saycountpl cdr_addon_mysql chan_ooh323 format_mp3 res_config_mysql app_speak
 
 SELECTED_MODS:=$(patsubst %,%.so,$(filter-out $(MENUSELECT_ADDONS),$(MODS)))
 
@@ -133,6 +133,12 @@
 endif
 
 CFLAGS+=$(ASTERISK_INCLUDE)
+
+app_speak.so: app_speak.o
+	$(CC) $(SOLINK) -o $@ $< $(SWIFT_LIB)
+
+app_speak.o: app_speak.c
+	$(CC) -c $(CFLAGS) -O0 -g3 -m32 $(SWIFT_INCLUDE) -o $@ $<
 
 cdr_addon_mysql.so: cdr_addon_mysql.o
 	$(CC) $(SOLINK) -o $@ $< $(MYSQLCLIENT_LIB)

Modified: team/tilghman/app_speak_1.4/aclocal.m4
URL: http://svn.digium.com/view/asterisk-addons/team/tilghman/app_speak_1.4/aclocal.m4?view=diff&rev=434&r1=433&r2=434
==============================================================================
--- team/tilghman/app_speak_1.4/aclocal.m4 (original)
+++ team/tilghman/app_speak_1.4/aclocal.m4 Sun Aug 26 00:10:51 2007
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.10 -*- Autoconf -*-
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006  Free Software Foundation, Inc.
+# 2005  Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.

Added: team/tilghman/app_speak_1.4/app_speak.c
URL: http://svn.digium.com/view/asterisk-addons/team/tilghman/app_speak_1.4/app_speak.c?view=auto&rev=434
==============================================================================
--- team/tilghman/app_speak_1.4/app_speak.c (added)
+++ team/tilghman/app_speak_1.4/app_speak.c Sun Aug 26 00:10:51 2007
@@ -1,0 +1,517 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (c) 2007 Digium, Inc.
+ *
+ * Tilghman Lesher <tilghman at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ */
+
+/*! \file
+ *
+ * \brief Speak application
+ *
+ * \author Tilghman Lesher <tilghman at digium.com>
+ * 
+ * \ingroup applications
+ */
+
+/*** MODULEINFO
+	<depend>swift</depend>
+ ***/
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <swift.h>
+
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/options.h"
+#include "asterisk/channel.h"
+#include "asterisk/pbx.h"
+#include "asterisk/module.h"
+#include "asterisk/app.h"
+
+#define AST_MODULE "app_speak"
+
+static char *app_speak = "Speak";
+static char *app_speak2 = "SpeakUntilExten";
+
+static char *speak_synopsis = "Synthesizes spoken audio from a text string";
+static char *speak2_synopsis = "Synthesizes spoken audio, while waiting for a new extension";
+
+static char *speak_descrip =
+"Speak(<text-to-speak>)\n"
+"  Speak synthesizes a voice audio stream from the given text and plays that\n"
+"audio back to the channel.\n";
+
+static char *speak2_descrip =
+"SpeakUntilExten(<text-to-speak>)\n"
+"  SpeakUntilExten synthesizes a voice audio stream from the given text and\n"
+"plays that audio back to the channel.  When DTMF is detected on the channel,\n"
+"SpeakUntilExten pauses and waits for a complete new extension to be entered.\n";
+
+typedef struct cst_item_contents_struct cst_item_contents;
+typedef struct cst_relation_struct cst_relation;
+typedef struct cst_item_struct cst_item;
+typedef struct cst_features_struct cst_features;
+typedef struct cst_utterance_struct cst_utterance;
+struct cst_item_struct {
+    cst_item_contents *contents;  /* the shared part of an item */
+    cst_relation *relation;
+    cst_item *n;
+    cst_item *p;
+    cst_item *u;
+    cst_item *d;
+};
+struct cst_relation_struct {
+    char *name;
+    cst_features *features;
+    cst_utterance *utterance;
+    cst_item *head;
+    cst_item *tail;
+};
+cst_item *relation_head(cst_relation *r)
+{
+    return ( r == NULL ? NULL : r->head);
+}
+
+typedef struct cst_regex_struct {
+    char regstart;		/* Internal use only. */
+    char reganch;		/* Internal use only. */
+    char *regmust;		/* Internal use only. */
+    int regmlen;		/* Internal use only. */
+    int regsize;
+    char *program;
+} cst_regex;
+static const unsigned char cst_rx_int_rxprog[] = {
+	156, 
+	6, 0, 40, 1, 0, 3, 6, 0, 8, 8, 
+	0, 8, 45, 0, 6, 0, 3, 9, 0, 3, 
+	11, 0, 17, 4, 0, 0, 48, 49, 50, 51, 
+	52, 53, 54, 55, 56, 57, 0, 2, 0, 3, 
+	0, 0, 0
+};
+static const cst_regex cst_rx_int_rx = {
+	0,
+	1,
+	NULL,
+	0,
+	44,
+	(char *) cst_rx_int_rxprog
+};
+const cst_regex *cst_rx_int = &cst_rx_int_rx;
+
+struct callback_data {
+	/* Raw buffer */
+	int buflen;
+	char buf[8192];
+	/* Channel to write back audio frames */
+	struct ast_channel *chan;
+	short voice_rate;
+	/* Cepstral pointers */
+	swift_port *port;
+	void *tid;
+	/* Flag for which DTMF digit was pressed */
+	int dtmf;
+	/* Flag for cancelling on DTMF */
+	unsigned int wantdtmf:1;
+};
+
+static void queue_some_frames(struct callback_data *cbd, int final)
+{
+	short *starting_sample, *sample;
+	void *unconsumed = cbd->buf;
+	int multiplier = cbd->voice_rate / 8000;
+	struct ast_frame *f;
+	int ms;
+	/* Frame */
+	struct ast_frame fr = {
+		.frametype = AST_FRAME_VOICE,
+		.subclass = AST_FORMAT_SLINEAR,
+		.datalen = 200,
+		.samples = 100,
+		.offset = AST_FRIENDLY_OFFSET,
+		.src = __PRETTY_FUNCTION__
+	};
+	char __attribute__((unused)) unused[AST_FRIENDLY_OFFSET] = "";
+	short frdata[100];
+
+	fr.data = frdata;
+
+	for (starting_sample = (void *)cbd->buf;
+		 (void *)starting_sample < (void *)cbd->buf + cbd->buflen - sizeof(frdata) * multiplier;
+		 starting_sample += sizeof(frdata) * multiplier) {
+		if (multiplier == 1) {
+			memcpy(frdata, starting_sample, sizeof(frdata));
+			unconsumed = (void *)starting_sample + sizeof(frdata);
+		} else {
+			int offset = 0;
+			for (sample = starting_sample;
+				 (void *)sample < (void *)starting_sample + sizeof(frdata) * multiplier;
+				 sample += multiplier)
+				frdata[offset++] = *sample;
+			unconsumed = sample;
+		}
+
+		/* Write the frame */
+		if (ast_write(cbd->chan, &fr) < 0)
+			break;
+
+		/* Wait for this sample to complete */
+		ms = ast_waitfor(cbd->chan, 100);
+		if (ms < 0) {
+			if (option_debug)
+				ast_log(LOG_DEBUG, "Hangup detected\n");
+			cbd->dtmf = -1;
+			break;
+		} else if (ms) {
+			f = ast_read(cbd->chan);
+			if (!f) {
+				if (option_debug)
+					ast_log(LOG_DEBUG, "Caught a NULL?!!\n");
+				cbd->dtmf = -1;
+				break;
+			}
+			if (f->frametype == AST_FRAME_DTMF) {
+				if (cbd->wantdtmf) {
+					cbd->dtmf = f->subclass;
+					ast_frfree(f);
+					break;
+				}
+			}
+			ast_frfree(f);
+		}
+	}
+
+	if (final) {
+		/* Queue any remaining data in the buffer */
+		fr.datalen = ((void *)cbd->buf + cbd->buflen - unconsumed) / multiplier;
+		fr.samples = fr.datalen / 2;
+
+		if (multiplier == 1)
+			memcpy(frdata, unconsumed, fr.datalen);
+		else {
+			int offset = 0;
+			for (sample = unconsumed;
+				 (void *)sample < unconsumed + fr.datalen * multiplier;
+				 sample += multiplier)
+				frdata[offset++] = *sample;
+		}
+
+		unconsumed += fr.datalen * multiplier;
+
+		/* Write the last frame */
+		ast_write(cbd->chan, &fr);
+	}
+
+	/* Update buffer pointers */
+	if (cbd->buf != unconsumed) {
+		if (option_debug)
+			ast_log(LOG_DEBUG, "Updating buffer pointers: %p, %p, %d\n", cbd->buf, unconsumed, (void *)cbd->buf - unconsumed + cbd->buflen);
+		memcpy(cbd->buf, unconsumed, (void *)cbd->buf + cbd->buflen - unconsumed);
+		cbd->buflen -= unconsumed - (void *)cbd->buf;
+	}
+
+	if (cbd->dtmf) {
+		/* User pressed DTMF */
+		swift_result_t rv = swift_port_stop(cbd->port, cbd->tid, SWIFT_EVENT_NOW);
+		if (rv != SWIFT_SUCCESS)
+			ast_log(LOG_ERROR, "swift_port_stop() failed: %s\n", swift_strerror(rv));
+	}
+}
+
+static swift_result_t audio_callback(swift_event *event, swift_event_t type, void *udata)
+{
+	struct callback_data *cbd = udata;
+    swift_event_t rv = SWIFT_SUCCESS;
+	void *buf = NULL;
+	int nbytes = 0;
+
+	if (cbd->dtmf)
+		return SWIFT_INTERRUPTED;
+
+	rv = swift_event_get_audio(event, &buf, &nbytes);
+	if (rv == SWIFT_SUCCESS && buf && nbytes > 0) {
+		int bytes_to_copy = nbytes;
+		void *offset = buf;
+		if (cbd->buflen + nbytes < sizeof(cbd->buf)) {
+			memcpy(cbd->buf + cbd->buflen, buf, nbytes);
+			cbd->buflen += nbytes;
+		} else {
+			/* This will probably never need to be executed, but better safe than sorry. */
+			fprintf(stderr, "This should never happen\n");
+			while (nbytes > sizeof(cbd->buf) - cbd->buflen) {
+				bytes_to_copy = sizeof(cbd->buf) - cbd->buflen;
+			
+				memcpy(cbd->buf + cbd->buflen, buf, bytes_to_copy);
+				cbd->buflen += bytes_to_copy;
+				offset += bytes_to_copy;
+				nbytes -= bytes_to_copy;
+
+				queue_some_frames(cbd, 0);
+
+				if (cbd->dtmf)
+					break;
+			}
+		}
+		queue_some_frames(cbd, 0);
+	}
+
+    return rv;
+}
+
+static int _speak_exec(struct ast_channel *chan, void *data, int wantdtmf)
+{
+	char *textstring = data;
+	swift_engine *engine;
+	swift_voice *voice;
+	swift_result_t rv;
+	const char *tts_name;
+	const char *tts_rate;
+	int oldwriteformat;
+	struct callback_data cbd = {
+		.chan = chan,
+		.wantdtmf = wantdtmf ? 1 : 0,
+	};
+
+	if (!data)
+		return 0;
+
+	do {
+		if (!(engine = swift_engine_open(NULL))) {
+			ast_log(LOG_ERROR, "Unable to open Cepstral engine\n");
+			break;
+		}
+
+		if (!(cbd.port = swift_port_open(engine, NULL))) {
+			ast_log(LOG_ERROR, "Unable to open Cepstral port\n");
+			swift_engine_close(engine);
+			break;
+		}
+
+		if ((tts_name = pbx_builtin_getvar_helper(chan, "~SPEAKVOICE"))) {
+			if (!(voice = swift_port_set_voice_by_name(cbd.port, tts_name))) {
+				ast_log(LOG_ERROR, "Unable to find %s voice in Cepstral engine\n", tts_name);
+				/* Fallback to any voice */
+				goto findanyvoice;
+			}
+		} else {
+findanyvoice:
+			if ((voice = swift_port_find_first_voice(cbd.port, NULL, NULL)) == NULL) {
+				ast_log(LOG_ERROR, "Unable to find any voice in Cepstral engine\n");
+				break;
+			}
+			if ((rv = swift_port_set_voice(cbd.port, voice)) != SWIFT_SUCCESS) {
+				ast_log(LOG_ERROR, "Unable to set Cepstral voice %p: %s\n", voice, swift_strerror(rv));
+				while ((voice = swift_port_find_next_voice(cbd.port))) {
+					if ((rv = swift_port_set_voice(cbd.port, voice)) != SWIFT_SUCCESS)
+						ast_log(LOG_ERROR, "Unable to set Cepstral voice %p: %s\n", voice, swift_strerror(rv));
+					else
+						break;
+				}
+			}
+		}
+
+		/* We use the voice rate to determine whether or not we need to downsample */
+		tts_rate = swift_voice_get_attribute(voice, "sample-rate");
+		sscanf(tts_rate, "%hd", &cbd.voice_rate);
+
+		swift_port_set_callback(cbd.port, &audio_callback, SWIFT_EVENT_AUDIO, &cbd);
+
+		if (chan->_state != AST_STATE_UP) {
+			if (ast_answer(chan))
+				break;
+		}
+
+		/* We queue in slinear */
+		oldwriteformat = chan->writeformat;
+		ast_set_write_format(chan, AST_FORMAT_SLINEAR);
+
+		/* This needs to occur asynchronously, otherwise we can't cancel it early. */
+		rv = swift_port_speak_text(cbd.port, textstring, 0, NULL, &cbd.tid, NULL);
+
+		if (SWIFT_FAILED(rv)) {
+			ast_log(LOG_ERROR, "Unable to speak prompt: %s\n", swift_strerror(rv));
+			break;
+		}
+
+		swift_port_wait(cbd.port, cbd.tid);
+	} while (0);
+
+	if (oldwriteformat)
+		ast_set_write_format(chan, oldwriteformat);
+	if (cbd.port != NULL)
+		swift_port_close(cbd.port);
+	if (engine != NULL)
+		swift_engine_close(engine);
+
+	return cbd.dtmf;
+}
+
+static int speak_exec(struct ast_channel *chan, void *data)
+{
+	return _speak_exec(chan, data, 0);
+}
+
+static int speak2_exec(struct ast_channel *chan, void *data)
+{
+	return _speak_exec(chan, data, 1);
+}
+
+static int speakvoice_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+{
+	const char *value = pbx_builtin_getvar_helper(chan, "~SPEAKVOICE");
+	if (value)
+		ast_copy_string(buf, value, len);
+	else {
+		swift_engine *engine = swift_engine_open(NULL);
+		swift_port *port;
+		swift_voice *voice;
+
+		if (!engine)
+			return -1;
+
+		if (!(port = swift_port_open(engine, NULL))) {
+			swift_engine_close(engine);
+			return -1;
+		}
+
+		if (!(voice = swift_port_find_first_voice(port, NULL, NULL))) {
+			swift_port_close(port);
+			swift_engine_close(engine);
+			return -1;
+		}
+		if ((value = swift_voice_get_attribute(voice, "name")))
+			ast_copy_string(buf, value, len);
+		else
+			buf[0] = '\0';
+
+		swift_port_close(port);
+		swift_engine_close(engine);
+	}
+	return 0;
+}
+
+static int speakvoice_write(struct ast_channel *chan, char *cmd, char *data, const char *value)
+{
+	swift_engine *engine = swift_engine_open(NULL);
+	swift_port *port;
+	swift_voice *voice;
+	int res = 0;
+
+	if (!engine) {
+		ast_log(LOG_ERROR, "Could not start the Speak engine\n");
+		return -1;
+	}
+
+	if (!(port = swift_port_open(engine, NULL))) {
+		ast_log(LOG_ERROR, "Could not start the Speak engine\n");
+		swift_engine_close(engine);
+		return -1;
+	}
+
+	if ((voice = swift_port_set_voice_by_name(port, data))) {
+		pbx_builtin_setvar_helper(chan, "__~SPEAKVOICE", data);
+	} else {
+		ast_log(LOG_WARNING, "Could not find the '%s' voice\n", data);
+		res = -1;
+	}
+
+	swift_port_close(port);
+	swift_engine_close(engine);
+
+	return res;
+}
+
+static struct ast_custom_function speakvoice_function = {
+	.name = "SPEAK_VOICE",
+	.synopsis = "Gets or sets the current voice used with Speak or SpeakUntilExten",
+	.syntax = "SPEAK_VOICE()",
+	.desc =
+"Retrieves the current voice setting for invocations of Speak or\n"
+"SpeakUntilExten.  May also be set.\n",
+	.read = speakvoice_read,
+	.write = speakvoice_write,
+};
+
+static int speakvoices_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+{
+	swift_engine *engine = swift_engine_open(NULL);
+	swift_port *port;
+	swift_voice *voice;
+
+	buf[0] = '\0';
+
+	if (!engine)
+		return -1;
+
+	if (!(port = swift_port_open(engine, NULL))) {
+		swift_engine_close(engine);
+		return -1;
+	}
+
+	for (voice = swift_port_find_first_voice(port, NULL, NULL);
+		 voice;
+		 voice = swift_port_find_next_voice(port)) {
+		const char *name = swift_voice_get_attribute(voice, "name");
+		if (!ast_strlen_zero(buf))
+			ast_copy_string(buf + strlen(buf), ",", len);
+		ast_copy_string(buf + strlen(buf), S_OR(name, ""), len);
+	}
+
+	swift_port_close(port);
+	swift_engine_close(engine);
+	return 0;
+}
+
+static struct ast_custom_function speakvoices_function = {
+	.name = "SPEAK_VOICES",
+	.synopsis = "Retrieves a comma-separated list of available voices",
+	.syntax = "SPEAK_VOICES()",
+	.desc =
+"Retrieves a comma-separated list of available voicees for invocations of\n"
+" Speak or SpeakUntilExten.\n",
+	.read = speakvoices_read,
+};
+
+static int unload_module(void)
+{
+	int res;
+
+	res = ast_unregister_application(app_speak);
+	res |= ast_unregister_application(app_speak2);
+	res |= ast_custom_function_unregister(&speakvoice_function);
+	res |= ast_custom_function_unregister(&speakvoices_function);
+
+	return res;
+}
+
+static int load_module(void)
+{
+	int res;
+
+	res = ast_register_application(app_speak, speak_exec, speak_synopsis, speak_descrip);
+	res |= ast_register_application(app_speak2, speak2_exec, speak2_synopsis, speak2_descrip);
+	res |= ast_custom_function_register(&speakvoice_function);
+	res |= ast_custom_function_register(&speakvoices_function);
+
+	return res;
+}
+
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Speech synthesis",
+	.load = load_module,
+	.unload = unload_module,
+);

Propchange: team/tilghman/app_speak_1.4/app_speak.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/tilghman/app_speak_1.4/app_speak.c
------------------------------------------------------------------------------
    svn:keywords = Id Author Date Revision

Propchange: team/tilghman/app_speak_1.4/app_speak.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/tilghman/app_speak_1.4/build_tools/menuselect-deps.in
URL: http://svn.digium.com/view/asterisk-addons/team/tilghman/app_speak_1.4/build_tools/menuselect-deps.in?view=diff&rev=434&r1=433&r2=434
==============================================================================
--- team/tilghman/app_speak_1.4/build_tools/menuselect-deps.in (original)
+++ team/tilghman/app_speak_1.4/build_tools/menuselect-deps.in Sun Aug 26 00:10:51 2007
@@ -1,2 +1,3 @@
 MYSQLCLIENT=@PBX_MYSQLCLIENT@
 ASTERISK=@PBX_ASTERISK@
+SWIFT=@PBX_SWIFT@

Modified: team/tilghman/app_speak_1.4/configure
URL: http://svn.digium.com/view/asterisk-addons/team/tilghman/app_speak_1.4/configure?view=diff&rev=434&r1=433&r2=434
==============================================================================
--- team/tilghman/app_speak_1.4/configure (original)
+++ team/tilghman/app_speak_1.4/configure Sun Aug 26 00:10:51 2007
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 277 .
+# From configure.ac Revision: 382 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61.
 #
@@ -710,6 +710,9 @@
 ASTERISK_LIB
 ASTERISK_INCLUDE
 PBX_ASTERISK
+SWIFT_LIB
+SWIFT_INCLUDE
+PBX_SWIFT
 CPP
 EGREP
 MYSQL_CONFIG
@@ -1305,6 +1308,7 @@
   --with-ncurses=PATH     use ncurses files in PATH
   --with-mysqlclient=PATH use mysqlclient files in PATH
   --with-asterisk=PATH    use asterisk files in PATH
+  --with-swift=PATH       use Cepstral files in PATH
 
 Some influential environment variables:
   CC          C compiler command
@@ -4563,6 +4567,33 @@
 
 
 
+SWIFT_DESCRIP="Cepstral"
+SWIFT_OPTION="swift"
+
+# Check whether --with-swift was given.
+if test "${with_swift+set}" = set; then
+  withval=$with_swift;
+case ${withval} in
+     n|no)
+     USE_SWIFT=no
+     ;;
+     y|ye|yes)
+     SWIFT_MANDATORY="yes"
+     ;;
+     *)
+     SWIFT_DIR="${withval}"
+     SWIFT_MANDATORY="yes"
+     ;;
+esac
+
+fi
+
+PBX_SWIFT=0
+
+
+
+
+
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -6318,6 +6349,402 @@
 echo "$as_me: *** including --without-mysqlclient" >&6;}
    exit 1
 fi
+
+
+if test "${USE_SWIFT}" != "no"; then
+   pbxlibdir=""
+   if test "x${SWIFT_DIR}" != "x"; then
+      if test -d ${SWIFT_DIR}/lib; then
+      	 pbxlibdir="-L${SWIFT_DIR}/lib"
+      else
+      	 pbxlibdir="-L${SWIFT_DIR}"
+      fi
+   fi
+   { echo "$as_me:$LINENO: checking for swift_engine_open in -lswift" >&5
+echo $ECHO_N "checking for swift_engine_open in -lswift... $ECHO_C" >&6; }
+if test "${ac_cv_lib_swift_swift_engine_open+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lswift ${pbxlibdir} -lm $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char swift_engine_open ();
+int
+main ()
+{
+return swift_engine_open ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_swift_swift_engine_open=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_swift_swift_engine_open=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_swift_swift_engine_open" >&5
+echo "${ECHO_T}$ac_cv_lib_swift_swift_engine_open" >&6; }
+if test $ac_cv_lib_swift_swift_engine_open = yes; then
+  AST_SWIFT_FOUND=yes
+else
+  AST_SWIFT_FOUND=no
+fi
+
+
+   if test "${AST_SWIFT_FOUND}" = "yes"; then
+      SWIFT_LIB="-lswift -lm"
+      SWIFT_HEADER_FOUND="1"
+      if test "x${SWIFT_DIR}" != "x"; then
+         SWIFT_LIB="${pbxlibdir} ${SWIFT_LIB}"
+	 SWIFT_INCLUDE="-I${SWIFT_DIR}/include"
+	 if test "xswift.h" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${SWIFT_DIR}/include/swift.h" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for ${SWIFT_DIR}/include/swift.h" >&5
+echo $ECHO_N "checking for ${SWIFT_DIR}/include/swift.h... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking ${SWIFT_DIR}/include/swift.h usability" >&5
+echo $ECHO_N "checking ${SWIFT_DIR}/include/swift.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <${SWIFT_DIR}/include/swift.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking ${SWIFT_DIR}/include/swift.h presence" >&5
+echo $ECHO_N "checking ${SWIFT_DIR}/include/swift.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <${SWIFT_DIR}/include/swift.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: ${SWIFT_DIR}/include/swift.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${SWIFT_DIR}/include/swift.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SWIFT_DIR}/include/swift.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${SWIFT_DIR}/include/swift.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: ${SWIFT_DIR}/include/swift.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${SWIFT_DIR}/include/swift.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SWIFT_DIR}/include/swift.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${SWIFT_DIR}/include/swift.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SWIFT_DIR}/include/swift.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${SWIFT_DIR}/include/swift.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SWIFT_DIR}/include/swift.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${SWIFT_DIR}/include/swift.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SWIFT_DIR}/include/swift.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${SWIFT_DIR}/include/swift.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SWIFT_DIR}/include/swift.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${SWIFT_DIR}/include/swift.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for ${SWIFT_DIR}/include/swift.h" >&5
+echo $ECHO_N "checking for ${SWIFT_DIR}/include/swift.h... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  SWIFT_HEADER_FOUND=1
+else
+  SWIFT_HEADER_FOUND=0
+fi
+
+
+	 fi
+      else
+	 if test "xswift.h" != "x" ; then
+            if test "${ac_cv_header_swift_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for swift.h" >&5
+echo $ECHO_N "checking for swift.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_swift_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_swift_h" >&5
+echo "${ECHO_T}$ac_cv_header_swift_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking swift.h usability" >&5
+echo $ECHO_N "checking swift.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <swift.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking swift.h presence" >&5
+echo $ECHO_N "checking swift.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <swift.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: swift.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: swift.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: swift.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: swift.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: swift.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: swift.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: swift.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: swift.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: swift.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: swift.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: swift.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: swift.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: swift.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: swift.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: swift.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: swift.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for swift.h" >&5
+echo $ECHO_N "checking for swift.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_swift_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_swift_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_swift_h" >&5
+echo "${ECHO_T}$ac_cv_header_swift_h" >&6; }
+
+fi
+if test $ac_cv_header_swift_h = yes; then
+  SWIFT_HEADER_FOUND=1
+else
+  SWIFT_HEADER_FOUND=0
+fi
+
+
+	 fi
+      fi
+      if test "x${SWIFT_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${SWIFT_MANDATORY}" ;
+         then
+            { echo "$as_me:$LINENO: ***" >&5
+echo "$as_me: ***" >&6;}
+            { echo "$as_me:$LINENO: *** It appears that you do not have the swift development package installed." >&5
+echo "$as_me: *** It appears that you do not have the swift development package installed." >&6;}
+            { echo "$as_me:$LINENO: *** Please install it to include ${SWIFT_DESCRIP} support" >&5
+echo "$as_me: *** Please install it to include ${SWIFT_DESCRIP} support" >&or re-run configure;}
+            { echo "$as_me:$LINENO: *** without explicitly specifying --with-${SWIFT_OPTION}" >&5
+echo "$as_me: *** without explicitly specifying --with-${SWIFT_OPTION}" >&6;}
+            exit 1
+         fi
+         SWIFT_LIB=""
+         SWIFT_INCLUDE=""
+         PBX_SWIFT=0
+      else
+         PBX_SWIFT=1
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_SWIFT 1
+_ACEOF
+
+      fi
+   elif test ! -z "${SWIFT_MANDATORY}";
+   then
+      { echo "$as_me:$LINENO: ***" >&5
+echo "$as_me: ***" >&6;}
+      { echo "$as_me:$LINENO: *** The ${SWIFT_DESCRIP} installation on this system appears to be broken." >&5
+echo "$as_me: *** The ${SWIFT_DESCRIP} installation on this system appears to be broken." >&6;}
+      { echo "$as_me:$LINENO: *** Either correct the installation" >&5
+echo "$as_me: *** Either correct the installation" >&or run configure;}
+      { echo "$as_me:$LINENO: *** without explicitly specifying --with-${SWIFT_OPTION}" >&5
+echo "$as_me: *** without explicitly specifying --with-${SWIFT_OPTION}" >&6;}
+      exit 1
+   fi
+fi
+
 
 if test "${USE_ASTERISK}" != "no"; then
    { echo "$as_me:$LINENO: checking for asterisk.h" >&5
@@ -7126,10 +7553,10 @@
 ASTERISK_LIB!$ASTERISK_LIB$ac_delim
 ASTERISK_INCLUDE!$ASTERISK_INCLUDE$ac_delim
 PBX_ASTERISK!$PBX_ASTERISK$ac_delim
+SWIFT_LIB!$SWIFT_LIB$ac_delim
+SWIFT_INCLUDE!$SWIFT_INCLUDE$ac_delim
+PBX_SWIFT!$PBX_SWIFT$ac_delim
 CPP!$CPP$ac_delim
-EGREP!$EGREP$ac_delim
-MYSQL_CONFIG!$MYSQL_CONFIG$ac_delim
-LIBOBJS!$LIBOBJS$ac_delim
 _ACEOF
 
   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -7171,10 +7598,13 @@
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
+EGREP!$EGREP$ac_delim
+MYSQL_CONFIG!$MYSQL_CONFIG$ac_delim
+LIBOBJS!$LIBOBJS$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 1; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 4; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

Modified: team/tilghman/app_speak_1.4/configure.ac
URL: http://svn.digium.com/view/asterisk-addons/team/tilghman/app_speak_1.4/configure.ac?view=diff&rev=434&r1=433&r2=434
==============================================================================
--- team/tilghman/app_speak_1.4/configure.ac (original)
+++ team/tilghman/app_speak_1.4/configure.ac Sun Aug 26 00:10:51 2007
@@ -163,6 +163,7 @@
 AST_EXT_LIB_SETUP([NCURSES], [ncurses], [ncurses])
 AST_EXT_LIB_SETUP([MYSQLCLIENT], [mysqlclient], [mysqlclient])
 AST_EXT_LIB_SETUP([ASTERISK], [asterisk], [asterisk])
+AST_EXT_LIB_SETUP([SWIFT], [Cepstral], [swift])
 
 AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h])
 
@@ -209,6 +210,8 @@
    AC_MSG_NOTICE(*** including --without-mysqlclient)
    exit 1
 fi
+
+AST_EXT_LIB_CHECK([SWIFT], [swift], [swift_engine_open], [swift.h], [-lm])
 
 if test "${USE_ASTERISK}" != "no"; then
    AC_MSG_CHECKING(for asterisk.h)

Modified: team/tilghman/app_speak_1.4/makeopts.in
URL: http://svn.digium.com/view/asterisk-addons/team/tilghman/app_speak_1.4/makeopts.in?view=diff&rev=434&r1=433&r2=434
==============================================================================
--- team/tilghman/app_speak_1.4/makeopts.in (original)
+++ team/tilghman/app_speak_1.4/makeopts.in Sun Aug 26 00:10:51 2007
@@ -39,6 +39,9 @@
 MYSQLCLIENT_LIB=@MYSQLCLIENT_LIB@
 MYSQLCLIENT_INCLUDE=@MYSQLCLIENT_INCLUDE@
 
+SWIFT_LIB=@SWIFT_LIB@
+SWIFT_INCLUDE=@SWIFT_INCLUDE@
+
 ASTERISK_INCLUDE=@ASTERISK_INCLUDE@
 
 NCURSES_LIB=@NCURSES_LIB@




More information about the asterisk-addons-commits mailing list