Package: asterisk / 1:1.6.2.9-2+squeeze12

hack-multiple-app-voicemail Patch series | download
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
Subject: build multiple versions of app_voicemail.so
Author: Faidon Liambotis <paravoid@debian.org>
Bug: http://issues.asterisk.org/view.php?id=13822
Last-Update: 2009-12-19

This is a very ugly hack on upstream's Makefiles to allow building multiple
variants of app_voicemail. Three variants are created:
  * app_voicemail.so: plain old filesystem storage that doesn't break existing
    setups
  * app_voicemail_imap.so: IMAP storage
  * app_voicemail_odbc.so: ODBC storage (and app_directory_odbc.so)
All these conflict with each other and Asterisk will refuse to load them
concurrently.
They are marked noload on our default autoload configuration.

Patch suggested to upstream but rejected for being "hackish":

--- a/apps/Makefile
+++ b/apps/Makefile
@@ -15,6 +15,8 @@ MODULE_PREFIX=app
 MENUSELECT_CATEGORY=APPS
 MENUSELECT_DESCRIPTION=Applications
 
+MODS_C_ADDITIONAL=app_voicemail_imap app_voicemail_odbc
+
 MENUSELECT_OPTS_app_directory:=$(MENUSELECT_OPTS_app_voicemail)
 ifneq ($(findstring ODBC_STORAGE,$(MENUSELECT_OPTS_app_voicemail)),)
   MENUSELECT_DEPENDS_app_voicemail+=$(MENUSELECT_DEPENDS_ODBC_STORAGE)
@@ -25,6 +27,22 @@ endif
 
 all: _all
 
+add_depends_cmd = sed -i -e '/^\/\*\*\* MODULEINFO/a\\t<depend>$(1)<\/depend>'
+app_voicemail_imap.c: app_voicemail.c
+	cp $< $@
+	$(call add_depends_cmd,imap_tk) $@
+	$(call add_depends_cmd,openssl) $@
+app_voicemail_odbc.c: app_voicemail.c
+	cp $< $@
+	$(call add_depends_cmd,unixodbc) $@
+	$(call add_depends_cmd,ltdl) $@
+
+clean::
+	rm -f app_voicemail_*.c
+
+app_voicemail_imap.o: _ASTCFLAGS+=-DIMAP_STORAGE
+app_voicemail_odbc.o: _ASTCFLAGS+=-DODBC_STORAGE
+
 include $(ASTTOPDIR)/Makefile.moddir_rules
 
 ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
--- a/Makefile.moddir_rules
+++ b/Makefile.moddir_rules
@@ -37,7 +37,7 @@ include $(ASTTOPDIR)/Makefile.rules
 # Use MODULE_EXCLUDE to specify additional modules to exclude.
 
 ifneq ($(MODULE_PREFIX),)
-    ALL_C_MODS:=
+    ALL_C_MODS:=$(MODS_C_ADDITIONAL)
     ALL_C_MODS+=$(foreach p,$(MODULE_PREFIX),$(patsubst %.c,%,$(wildcard $(p)_*.c)))
     ALL_CC_MODS:=
     ALL_CC_MODS+=$(foreach p,$(MODULE_PREFIX),$(patsubst %.cc,%,$(wildcard $(p)_*.cc)))
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -40,6 +40,9 @@ c-client (http://www.washington.edu/imap
  *        with a plan to clean this up.
  */
 
+/*** MODULEINFO
+ ***/
+
 /*** MAKEOPTS
 <category name="MENUSELECT_OPTS_app_voicemail" displayname="Voicemail Build Options" positive_output="yes" remove_on_change="apps/app_voicemail.o apps/app_voicemail.so apps/app_directory.o apps/app_directory.so">
 	<member name="FILE_STORAGE" displayname="Storage of Voicemail using filesystem">