Skip to content

non-zeroed frame bug (complete crash in 11.20+) #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 81 additions & 28 deletions Makefile.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# app_swift -- A Cepstral Swift TTS engine interface
#
# Copyright (C) 2006 - 2011, Darren Sessions
# Portions Copyright (C) 2013 - 2014 Jeremy Kister
# Portions Copyright (C) 2013 - 2016 Jeremy Kister
#
# Darren Sessions <[email protected]>
#
Expand All @@ -13,49 +13,78 @@
# the LICENSE file at the top of the source tree for more
# information.

NAME=app_swift
CONF=swift.conf
### BELOW MADE BY CONFIGURE ###

CC=%%CC%%

SWIFT_DIR=%%SWIFT_DIR%%
SWIFT_VER=%%SWIFT_VER%%

SYS_LIB_DIR=%%LIB_DIR%%
SYS_INC_DIR=%%INC_DIR%%
VAR_LIB_DIR=%%VAR_DIR%%
SYS_CNF_DIR=%%CNF_DIR%%

AST_FULL_VER=%%AST_FULL_VER%%
AST_MAJOR_VER=%%AST_MAJOR_VER%%
SOLINK=%%SOLINK%%

SYS_LIB_DIR=%%SYS_LIB%%
SYS_INC_DIR=%%SYS_INC%%
### END CONFIGURE ###

NAME=app_swift
CONF=swift.conf
AST_CFG_DIR=$(SYS_CNF_DIR)/asterisk
AST_VAR_DIR=$(VAR_LIB_DIR)/asterisk
AST_MOD_DIR=$(SYS_LIB_DIR)/asterisk/modules
AST_INC_DIR=$(SYS_INC_DIR)/asterisk
AST_CFG_DIR=%%AST_CFG%%

CFLAGS=-I${SWIFT_DIR}/include -I${SYS_INC_DIR} -g -Wall -fPIC
LDFLAGS=-L${SWIFT_DIR}/lib -L${SYS_LIB_DIR} -lswift $(patsubst ${SWIFT_DIR}/lib/lib%.so,-l%,$(wildcard ${SWIFT_DIR}/lib/libcep*.so))
SOLINK=%%SOLINK%%
CFLAGS=-I$(SWIFT_DIR)/include -I$(SYS_INC_DIR) -g -Wall -fPIC
LDFLAGS=-L$(SWIFT_DIR)/lib -L$(SYS_LIB_DIR) -lswift \
$(patsubst $(SWIFT_DIR)/lib/lib%.so,-l%,$(wildcard $(SWIFT_DIR)/lib/libcep*.so))

CFLAGS+=-D_SWIFT_VER_%%SWIFT_VER%%
CFLAGS+=-D_SWIFT_VER_$(SWIFT_VER)

AST_INC_CHECK=$(shell if [ -f $(AST_INC_DIR)/channel.h ]; then echo "$(NAME).so"; else echo "ast_inc_fail"; fi)
AST_INC_CHECK=$(shell if ! [ -f $(AST_INC_DIR)/channel.h ]; then echo "ast_inc_fail"; fi)

AST_FULL_VER=%%AST_FULL_VER%%
AST_MAJOR_VER=%%AST_MAJOR_VER%%
PRE = built

BUILD = built/$(NAME).o built/$(NAME).so built/$(NAME)-en_US.xml built/$(CONF)

CLEAN = $(BUILD) Makefile

ifeq ($(AST_MAJOR_VER),)
AST_VER_CHECK=ast_ver_fail
else
AST_VER_CHECK=
CFLAGS+=-D_AST_VER_$(AST_MAJOR_VER)
CFLAGS+=-D_AST_MAJ_VER=$(AST_MAJOR_VER)
endif

all: banner $(AST_INC_CHECK) $(AST_VER_CHECK) built $(BUILD) made-msg

all: banner $(AST_INC_CHECK) $(AST_VER_CHECK)
@echo ""
@echo " ********************************************************"
@echo " * Run 'make install' to install the app_swift module. *"
@echo " ********************************************************"
@echo ""
built:
-mkdir built

built/$(CONF) : $(PRE) $(CONF).in
cp $(CONF).in built/$(CONF)

$(NAME).so : $(NAME).o
built/$(NAME)-en_US.xml : $(PRE) $(NAME).c
-echo '<?xml version="1.0" encoding="UTF-8"?>' > $@
-echo '<!DOCTYPE docs SYSTEM "appdocsxml.dtd">' >> $@
-echo '<docs xmlns:xi="http://www.w3.org/2001/XInclude">' >> $@
cat $(NAME).c | awk '/\/\*\*\* DOCUMENTATION/ {p=1; next} \
/\*\*\*\// {if (p) exit} \
{if (p) print}' \
>> $@
-echo '</docs>' >> $@

built/$(NAME).so : built/$(NAME).o
$(CC) $(SOLINK) -o $@ $< $(LDFLAGS)

built/$(NAME).o : $(NAME).c
$(CC) $(CFLAGS) -c -o $@ $<


banner:
@echo ""
@echo ""
Expand All @@ -68,6 +97,13 @@ banner:
@echo " |_| |_| "
@echo ""

made-msg:
@echo ""
@echo " ********************************************************"
@echo " * Run 'make install' to install the app_swift module. *"
@echo " ********************************************************"
@echo ""

ast_ver_fail:
@echo " An unsupported version of Asterisk has been detected. $(AST_FULL_VER)"
@echo ""
Expand All @@ -76,27 +112,44 @@ ast_ver_fail:
ast_inc_fail:
@echo " Could not locate Asterisk include files."
@echo ""
@echo " Retry with './configure --inc-dir=/include/directory'"
@echo " Retry with './configure --includedir=/include/directory'"
@echo ""
@exit 1

clean:
rm -f Makefile $(NAME).o $(NAME).so
-rm -f $(BUILD) Makefile

install: all
if ! [ -f $(AST_CFG_DIR)/$(CONF) ]; then \
install -m 644 $(CONF).sample /etc/asterisk/$(CONF) ; \
install -m 755 built/$(NAME).so $(AST_MOD_DIR)
@if [ ! -f $(AST_CFG_DIR)/$(CONF) ] ; then \
echo "installing config file." ; \
install -m 644 built/$(CONF) $(AST_CFG_DIR) ; \
fi
@if [ -d $(AST_VAR_DIR)/documentation/thirdparty ] ; then \
echo "installing documentation." ; \
install -m 644 built/app_swift-en_US.xml $(AST_VAR_DIR)/documentation/thirdparty ; \
echo "" ; \
echo " ********************************************************" ; \
echo " * Documentation has been installed but Asterisk must *" ; \
echo " * be restarted to use 'core show application Swift'. *" ; \
echo " * A restart is not otherwise necessary. *" ; \
echo " ********************************************************" ; \
else \
echo "XML docs not found - no problem, won't install ours." ; \
fi
if [ -f $(NAME).so ]; then \
install -m 755 $(NAME).so $(AST_MOD_DIR) ; \
@if ! grep 'swift' /etc/ld.so.conf 2>&1 >/dev/null ; then \
echo -e "\n$(SWIFT_DIR)/lib\n" >> /etc/ld.so.conf ; \
ldconfig ; \
fi
@ln -sf $(SWIFT_DIR)/include/* $(SYS_INC_DIR)


@echo ""
@echo " ********************************************************"
@echo " * Run 'make reload' load app_swift into asterisk. *"
@echo " * Or, run 'make reload' load app_swift into Asterisk. *"
@echo " ********************************************************"
@echo ""

reload: install
reload:
asterisk -rx "module unload $(NAME)"
asterisk -rx "module load $(NAME)"
37 changes: 32 additions & 5 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

Copyright (C) 2006-2012 - Darren Sessions
Portions Copyright (C) 2012, Cepstral LLC.
Portions Copyright (C) 2013-2014 - Jeremy Kister
Portions Copyright (C) 2013-2016 - Jeremy Kister


All rights reserved.
Expand Down Expand Up @@ -41,18 +41,45 @@
a max digits and a wait-for-digit timer very
simular to the AGI 'get data' command.


Requirements:

- Asterisk development header files
- Cepstral Swift Text-to-Speech engine (version 5 or 6)

Installation:
Configuration:

- Check that the swift libraries are in your ld path
* on debian, run: echo -e "\n/opt/swift/lib\n" >> /etc/ld.so.conf && ldconfig
- Check that the swift libraries are in your ld path

```
grep 'swift' /etc/ld.so.conf
```

- The following alsa and oss libraries are needed for best compatibility:

```
# rhel-based os
yum install -y alsa-lib alsa-lib-devel alsa-utils alsa-plugins-oss
# debian-based os
apt install -y libasound2 libasound2-dev alsa-base alsa-utils alsa-oss
```

- Check that the appropriate channel driver is configured / loaded:

In <your asterisk path>/modules.conf uncomment EITHER:

`;noload => chan_alsa.so` or `;noload => chan_oss.so`

Load the module if not loaded:

```
asterisk -x 'module show like <your channel driver>'
asterisk -x 'module load <your channel driver>'
```

- On some distributions you made need to copy asterisk.h to /usr/include

Installation:

./configure [options]
make
make install (as root)
Expand Down
Loading