Sun, 20 Mar 2011 20:03:11 +0100
Update and completely overhaul packaging and build configuration.
1.1 --- a/asterisk/asterisk.patch Sun Mar 20 20:00:02 2011 +0100 1.2 +++ b/asterisk/asterisk.patch Sun Mar 20 20:03:11 2011 +0100 1.3 @@ -1,83 +1,74 @@ 1.4 -Index: Makefile 1.5 ---- Makefile.orig 2010-06-10 22:35:06.000000000 +0200 1.6 -+++ Makefile 2010-07-24 11:16:19.000000000 +0200 1.7 -@@ -126,40 +126,18 @@ 1.8 +Index: addons/chan_ooh323.c 1.9 +diff -Nau addons/chan_ooh323.c.orig addons/chan_ooh323.c 1.10 +--- addons/chan_ooh323.c.orig 2010-10-09 16:02:26.000000000 +0200 1.11 ++++ addons/chan_ooh323.c 2011-03-13 14:03:42.000000000 +0100 1.12 +@@ -23,6 +23,12 @@ 1.13 1.14 - # Define standard directories for various platforms 1.15 - # These apply if they are not redefined in asterisk.conf 1.16 --ifeq ($(OSARCH),SunOS) 1.17 -- ASTETCDIR=/var/etc/asterisk 1.18 -- ASTLIBDIR=/opt/asterisk/lib 1.19 -- ASTVARLIBDIR=/var/opt/asterisk 1.20 -- ASTDBDIR=$(ASTVARLIBDIR) 1.21 -- ASTKEYDIR=$(ASTVARLIBDIR) 1.22 -- ASTSPOOLDIR=/var/spool/asterisk 1.23 -- ASTLOGDIR=/var/log/asterisk 1.24 -- ASTHEADERDIR=/opt/asterisk/include 1.25 -- ASTSBINDIR=/opt/asterisk/sbin 1.26 -- ASTVARRUNDIR=/var/run/asterisk 1.27 -- ASTMANDIR=/opt/asterisk/man 1.28 --else 1.29 - ASTETCDIR=$(sysconfdir)/asterisk 1.30 - ASTLIBDIR=$(libdir)/asterisk 1.31 - ASTHEADERDIR=$(includedir)/asterisk 1.32 - ASTSBINDIR=$(sbindir) 1.33 -- ASTSPOOLDIR=$(localstatedir)/spool/asterisk 1.34 -- ASTLOGDIR=$(localstatedir)/log/asterisk 1.35 -- ASTVARRUNDIR=$(localstatedir)/run/asterisk 1.36 -+ ASTSPOOLDIR=$(localstatedir)/spool 1.37 -+ ASTLOGDIR=$(localstatedir)/log 1.38 -+ ASTVARRUNDIR=$(localstatedir)/run 1.39 - ASTMANDIR=$(mandir) 1.40 --ifneq ($(findstring BSD,$(OSARCH)),) 1.41 -- ASTVARLIBDIR=$(prefix)/share/asterisk 1.42 -- ASTVARRUNDIR=$(localstatedir)/run/asterisk 1.43 -- ASTDBDIR=$(localstatedir)/db/asterisk 1.44 --else 1.45 -- ASTVARLIBDIR=$(localstatedir)/lib/asterisk 1.46 -- ASTDBDIR=$(ASTVARLIBDIR) 1.47 --endif 1.48 -+ ASTVARLIBDIR=$(localstatedir)/lib 1.49 -+ ASTDBDIR=$(localstatedir)/db 1.50 - ASTKEYDIR=$(ASTVARLIBDIR) 1.51 --endif 1.52 --ifeq ($(ASTDATADIR),) 1.53 - ASTDATADIR:=$(ASTVARLIBDIR) 1.54 --endif 1.55 + #include "chan_ooh323.h" 1.56 + #include <math.h> 1.57 ++#if defined __SVR4 && defined __sun 1.58 ++#include <sys/sockio.h> 1.59 ++#ifndef IPTOS_MINCOST 1.60 ++#define IPTOS_MINCOST 0x02 1.61 ++#endif 1.62 ++#endif 1.63 1.64 - # Asterisk.conf is located in ASTETCDIR or by using the -C flag 1.65 - # when starting Asterisk 1.66 -@@ -259,12 +237,6 @@ 1.67 - _ASTCFLAGS+=-fsigned-char 1.68 - endif 1.69 + #define FORMAT_STRING_SIZE 512 1.70 1.71 --ifeq ($(OSARCH),FreeBSD) 1.72 -- # -V is understood by BSD Make, not by GNU make. 1.73 -- BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk) 1.74 -- _ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi) 1.75 --endif 1.76 -- 1.77 - ifeq ($(OSARCH),NetBSD) 1.78 - _ASTCFLAGS+=-pthread -I/usr/pkg/include 1.79 - endif 1.80 -@@ -567,8 +539,7 @@ 1.81 - fi 1.82 - mkdir -p $(DESTDIR)$(ASTDATADIR)/documentation 1.83 - mkdir -p $(DESTDIR)$(ASTDATADIR)/documentation/thirdparty 1.84 -- mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv 1.85 -- mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom 1.86 -+ mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr 1.87 - mkdir -p $(DESTDIR)$(ASTDATADIR)/keys 1.88 - mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware 1.89 - mkdir -p $(DESTDIR)$(ASTDATADIR)/firmware/iax 1.90 +Index: addons/ooh323c/src/ooCmdChannel.c 1.91 +diff -Nau addons/ooh323c/src/ooCmdChannel.c.orig addons/ooh323c/src/ooCmdChannel.c 1.92 +--- addons/ooh323c/src/ooCmdChannel.c.orig 2010-03-26 00:38:58.000000000 +0100 1.93 ++++ addons/ooh323c/src/ooCmdChannel.c 2011-03-13 14:03:42.000000000 +0100 1.94 +@@ -25,6 +25,10 @@ 1.95 + #include "ooCalls.h" 1.96 + #include "ooCmdChannel.h" 1.97 + 1.98 ++#ifndef AF_LOCAL 1.99 ++#define AF_LOCAL AF_UNIX 1.100 ++#define PF_LOCAL PF_UNIX 1.101 ++#endif 1.102 + 1.103 + /** Global endpoint structure */ 1.104 + extern OOH323EndPoint gH323ep; 1.105 +Index: addons/ooh323c/src/ooSocket.c 1.106 +diff -Nau addons/ooh323c/src/ooSocket.c.orig addons/ooh323c/src/ooSocket.c 1.107 +--- addons/ooh323c/src/ooSocket.c.orig 2010-03-25 22:39:04.000000000 +0100 1.108 ++++ addons/ooh323c/src/ooSocket.c 2011-03-13 14:03:42.000000000 +0100 1.109 +@@ -24,6 +24,9 @@ 1.110 + 1.111 + #include "ooSocket.h" 1.112 + #include "ootrace.h" 1.113 ++#if defined __SVR4 && defined __sun 1.114 ++#include <sys/sockio.h> 1.115 ++#endif 1.116 + #if defined(_WIN32_WCE) 1.117 + static int inited = 0; 1.118 + #define SEND_FLAGS 0 1.119 +Index: addons/ooh323cDriver.c 1.120 +diff -Nau addons/ooh323cDriver.c.orig addons/ooh323cDriver.c 1.121 +--- addons/ooh323cDriver.c.orig 2010-03-26 00:38:58.000000000 +0100 1.122 ++++ addons/ooh323cDriver.c 2011-03-13 14:03:42.000000000 +0100 1.123 +@@ -27,6 +27,11 @@ 1.124 + 1.125 + #define SEC_TO_HOLD_THREAD 24 1.126 + 1.127 ++#ifndef AF_LOCAL 1.128 ++#define AF_LOCAL AF_UNIX 1.129 ++#define PF_LOCAL PF_UNIX 1.130 ++#endif 1.131 ++ 1.132 + extern struct ast_module *myself; 1.133 + extern OOBOOL gH323Debug; 1.134 + extern OOH323EndPoint gH323ep; 1.135 Index: apps/app_backticks.c 1.136 ---- apps/app_backticks.c.orig 2010-07-24 11:12:31.000000000 +0200 1.137 -+++ apps/app_backticks.c 2010-07-24 11:12:31.000000000 +0200 1.138 +diff -Nau apps/app_backticks.c.orig apps/app_backticks.c 1.139 +--- apps/app_backticks.c.orig 1970-01-01 01:00:00.000000000 +0100 1.140 ++++ apps/app_backticks.c 2011-03-13 14:03:42.000000000 +0100 1.141 @@ -0,0 +1,129 @@ 1.142 + 1.143 +#include "asterisk.h" 1.144 + 1.145 -+ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.53 $") 1.146 ++ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.52 $") 1.147 + 1.148 +#include <stdio.h> 1.149 +#include <asterisk/file.h> 1.150 @@ -204,37 +195,38 @@ 1.151 +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "BACKTICKS() dialplan function"); 1.152 + 1.153 Index: apps/app_meetme.c 1.154 ---- apps/app_meetme.c.orig 2010-06-23 23:15:53.000000000 +0200 1.155 -+++ apps/app_meetme.c 2010-07-24 11:12:31.000000000 +0200 1.156 -@@ -522,6 +522,7 @@ 1.157 +diff -Nau apps/app_meetme.c.orig apps/app_meetme.c 1.158 +--- apps/app_meetme.c.orig 2011-01-07 21:53:02.000000000 +0100 1.159 ++++ apps/app_meetme.c 2011-03-13 14:03:42.000000000 +0100 1.160 +@@ -604,6 +604,7 @@ 1.161 CONFFLAG_DURATION_LIMIT = (1 << 30), 1.162 /*! Do not write any audio to this channel until the state is up. */ 1.163 CONFFLAG_NO_AUDIO_UNTIL_UP = (1 << 31), 1.164 -+ CONFFLAG_USERNAME = (1 << 31), 1.165 ++ CONFFLAG_USERNAME = (1 << 32), 1.166 }; 1.167 1.168 - enum { 1.169 -@@ -531,6 +532,7 @@ 1.170 - OPT_ARG_DURATION_LIMIT = 3, 1.171 + /* !If set play an intro announcement at start of conference */ 1.172 +@@ -617,6 +618,7 @@ 1.173 OPT_ARG_MOH_CLASS = 4, 1.174 - OPT_ARG_ARRAY_SIZE = 5, 1.175 -+ OPT_ARG_USERNAME = 6, 1.176 + OPT_ARG_INTROMSG = 5, 1.177 + OPT_ARG_ARRAY_SIZE = 6, 1.178 ++ OPT_ARG_USERNAME = 7, 1.179 }; 1.180 1.181 AST_APP_OPTIONS(meetme_opts, BEGIN_OPTIONS 1.182 -@@ -563,6 +565,7 @@ 1.183 +@@ -650,6 +652,7 @@ 1.184 AST_APP_OPTION('1', CONFFLAG_NOONLYPERSON ), 1.185 AST_APP_OPTION_ARG('S', CONFFLAG_DURATION_STOP, OPT_ARG_DURATION_STOP), 1.186 AST_APP_OPTION_ARG('L', CONFFLAG_DURATION_LIMIT, OPT_ARG_DURATION_LIMIT), 1.187 + AST_APP_OPTION_ARG('n', CONFFLAG_USERNAME, OPT_ARG_USERNAME), 1.188 END_OPTIONS ); 1.189 1.190 - static const char *app = "MeetMe"; 1.191 -@@ -2243,6 +2246,12 @@ 1.192 - if (!(confflags & CONFFLAG_QUIET) && ((confflags & CONFFLAG_INTROUSER) || (confflags & CONFFLAG_INTROUSERNOREVIEW))) { 1.193 + static const char * const app = "MeetMe"; 1.194 +@@ -2429,6 +2432,12 @@ 1.195 + ast_test_flag64(confflags, CONFFLAG_INTROUSERNOREVIEW))) { 1.196 char destdir[PATH_MAX]; 1.197 1.198 -+ if ( (confflags & CONFFLAG_USERNAME) 1.199 ++ if (!ast_test_flag64(confflags, CONFFLAG_USERNAME) 1.200 + && !ast_strlen_zero(optargs[OPT_ARG_USERNAME]) 1.201 + && ast_fileexists(optargs[OPT_ARG_USERNAME], NULL, NULL)) 1.202 + snprintf(destdir, sizeof(destdir), "%s", optargs[OPT_ARG_USERNAME]); 1.203 @@ -243,7 +235,7 @@ 1.204 snprintf(destdir, sizeof(destdir), "%s/meetme", ast_config_AST_SPOOL_DIR); 1.205 1.206 if (ast_mkdir(destdir, 0777) != 0) { 1.207 -@@ -2259,6 +2268,7 @@ 1.208 +@@ -2445,6 +2454,7 @@ 1.209 res = ast_record_review(chan, "vm-rec-name", user->namerecloc, 10, "sln", &duration, NULL); 1.210 if (res == -1) 1.211 goto outrun; 1.212 @@ -251,59 +243,142 @@ 1.213 } 1.214 1.215 ast_mutex_lock(&conf->playlock); 1.216 -Index: build_tools/make_defaults_h 1.217 ---- build_tools/make_defaults_h.orig 2008-01-24 23:58:10.000000000 +0100 1.218 -+++ build_tools/make_defaults_h 2010-07-24 11:12:31.000000000 +0200 1.219 -@@ -17,7 +17,7 @@ 1.220 - #define DEFAULT_PID "${INSTALL_PATH}${ASTVARRUNDIR}/asterisk.pid" 1.221 - 1.222 - #define DEFAULT_VAR_DIR "${INSTALL_PATH}${ASTVARLIBDIR}" 1.223 --#define DEFAULT_DB "${INSTALL_PATH}${ASTDBDIR}/astdb" 1.224 -+#define DEFAULT_DB "${INSTALL_PATH}${ASTDBDIR}/asterisk.db" 1.225 - 1.226 - #define DEFAULT_DATA_DIR "${INSTALL_PATH}${ASTDATADIR}" 1.227 - #define DEFAULT_KEY_DIR "${INSTALL_PATH}${ASTDATADIR}/keys" 1.228 -Index: cdr/cdr_custom.c 1.229 ---- cdr/cdr_custom.c.orig 2008-11-20 18:48:58.000000000 +0100 1.230 -+++ cdr/cdr_custom.c 2010-07-24 11:12:31.000000000 +0200 1.231 -@@ -83,7 +83,7 @@ 1.232 - ast_log(LOG_WARNING, "Format string too long, will be truncated, at line %d\n", var->lineno); 1.233 - ast_copy_string(format, var->value, sizeof(format) - 1); 1.234 - strcat(format,"\n"); 1.235 -- snprintf(master, sizeof(master),"%s/%s/%s", ast_config_AST_LOG_DIR, name, var->name); 1.236 -+ snprintf(master, sizeof(master),"%s/cdr/%s", ast_config_AST_LOG_DIR, var->name); 1.237 - if (var->next) { 1.238 - ast_log(LOG_NOTICE, "Sorry, only one mapping is supported at this time, mapping '%s' will be ignored at line %d.\n", var->next->name, var->next->lineno); 1.239 - break; 1.240 -Index: cdr/cdr_sqlite3_custom.c 1.241 ---- cdr/cdr_sqlite3_custom.c.orig 2010-04-13 18:38:41.000000000 +0200 1.242 -+++ cdr/cdr_sqlite3_custom.c 2010-07-24 11:12:31.000000000 +0200 1.243 -@@ -300,7 +300,7 @@ 1.244 +Index: apps/app_voicemail.c 1.245 +diff -Nau apps/app_voicemail.c.orig apps/app_voicemail.c 1.246 +--- apps/app_voicemail.c.orig 2011-01-07 20:58:30.000000000 +0100 1.247 ++++ apps/app_voicemail.c 2011-03-13 14:03:42.000000000 +0100 1.248 +@@ -366,6 +366,7 @@ 1.249 + static char imapport[8]; 1.250 + static char imapflags[128]; 1.251 + static char imapfolder[64]; 1.252 ++static int imapsubfold = 0; 1.253 + static char imapparentfolder[64] = "\0"; 1.254 + static char greetingfolder[64]; 1.255 + static char authuser[32]; 1.256 +@@ -2464,7 +2465,7 @@ 1.257 } 1.258 1.259 - /* is the database there? */ 1.260 -- snprintf(filename, sizeof(filename), "%s/master.db", ast_config_AST_LOG_DIR); 1.261 -+ snprintf(filename, sizeof(filename), "%s/cdr/master.db", ast_config_AST_LOG_DIR); 1.262 - res = sqlite3_open(filename, &db); 1.263 - if (res != SQLITE_OK) { 1.264 - ast_log(LOG_ERROR, "Could not open database %s.\n", filename); 1.265 -Index: chan_capi-1.1.5/Makefile 1.266 ---- chan_capi-1.1.5/Makefile.orig 2010-04-06 19:33:25.000000000 +0200 1.267 -+++ chan_capi-1.1.5/Makefile 2010-07-24 11:12:31.000000000 +0200 1.268 -@@ -100,6 +100,9 @@ 1.269 - CFLAGS+=-O2 1.270 - CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi) 1.271 - CFLAGS+=$(shell if uname -m | grep -q "ppc\|arm\|s390"; then echo "-fsigned-char"; fi) 1.272 -+ifeq (${USE_OWN_LIBCAPI},yes) 1.273 -+CFLAGS+=-DUSE_OWN_LIBCAPI 1.274 -+endif 1.275 + /* Build up server information */ 1.276 +- ast_build_string(&t, &left, "{%s:%s/imap", imapserver, imapport); 1.277 ++ ast_build_string(&t, &left, "{%s:%s", imapserver, imapport); 1.278 1.279 - LIBS=-ldl -lpthread -lm 1.280 - CC=gcc 1.281 -Index: chan_capi-1.1.5/chan_capi20.h 1.282 ---- chan_capi-1.1.5/chan_capi20.h.orig 2005-09-20 20:33:40.000000000 +0200 1.283 -+++ chan_capi-1.1.5/chan_capi20.h 2010-07-24 11:12:31.000000000 +0200 1.284 -@@ -8,6 +8,8 @@ 1.285 + /* Add authentication user if present */ 1.286 + if (!ast_strlen_zero(authuser)) 1.287 +@@ -6035,6 +6036,7 @@ 1.288 + /* simple. huh? */ 1.289 + char sequence[10]; 1.290 + char mailbox[256]; 1.291 ++ char folder[256]; 1.292 + int res; 1.293 + 1.294 + /* get the real IMAP message number for this message */ 1.295 +@@ -6050,10 +6052,24 @@ 1.296 + mail_setflag(vms->mailstream, sequence, "\\Unseen"); 1.297 + mail_clearflag(vms->mailstream, sequence, "\\Seen"); 1.298 + } 1.299 +- if (!strcasecmp(mbox(vmu, NEW_FOLDER), vms->curbox) && (box == NEW_FOLDER || box == OLD_FOLDER)) { 1.300 +- ast_mutex_unlock(&vms->lock); 1.301 ++ 1.302 ++ if ((!strcasecmp(mbox(vmu, NEW_FOLDER), vms->curbox) || \ 1.303 ++ !strcasecmp(mbox(vmu, OLD_FOLDER), vms->curbox)) && \ 1.304 ++ (box == NEW_FOLDER || box == OLD_FOLDER)) { /* Don't copy data, */ 1.305 ++ ast_mutex_unlock(&vms->lock); /* just change Seen flag */ 1.306 + return 0; 1.307 ++ } else if (box != NEW_FOLDER && box != OLD_FOLDER) { /* Do copy data */ 1.308 ++ if (imapsubfold == 1) /* using INBOX or subfolder */ 1.309 ++ snprintf(folder, sizeof(folder), "%s%c%s", imapfolder, delimiter, mbox(vmu, box)); 1.310 ++ else 1.311 ++ strncpy(folder, mbox(vmu, box), sizeof(folder)); 1.312 ++ int res = !mail_copy(vms->mailstream,sequence,folder); 1.313 ++ ast_mutex_unlock(&vms->lock); 1.314 ++ return res; 1.315 ++ } else { /* Copy data to INBOX delegating new/old status to Seen flag */ 1.316 ++ int res = !mail_copy(vms->mailstream,sequence,imapfolder); 1.317 + } 1.318 ++ 1.319 + /* Create the folder if it don't exist */ 1.320 + imap_mailbox_name(mailbox, sizeof(mailbox), vms, box, 1); /* Get the full mailbox name */ 1.321 + ast_debug(5, "Checking if folder exists: %s\n", mailbox); 1.322 +@@ -10221,6 +10237,10 @@ 1.323 + #ifndef IMAP_STORAGE 1.324 + } else if (!cmd) { 1.325 + vms.deleted[vms.curmsg] = 1; 1.326 ++#else 1.327 ++ } else if (!cmd && (folder_int(vms.curbox) > 1 || box > 1)) { 1.328 ++ vms.deleted[vms.curmsg] = 1; /* Enforce deletion after */ 1.329 ++ deleted = 1; /* successful copy op */ 1.330 + #endif 1.331 + } else { 1.332 + vms.deleted[vms.curmsg] = 0; 1.333 +@@ -11688,6 +11708,15 @@ 1.334 + } else { 1.335 + ast_copy_string(imapfolder, "INBOX", sizeof(imapfolder)); 1.336 + } 1.337 ++ /* IMAP saved (sub)folder location policy */ 1.338 ++ if ((val = ast_variable_retrieve(cfg, "general", "imapsubfold"))) { 1.339 ++ if (ast_false(val)) 1.340 ++ imapsubfold = 0; 1.341 ++ else 1.342 ++ imapsubfold = 1; 1.343 ++ } else { 1.344 ++ imapsubfold = 0; 1.345 ++ } 1.346 + if ((val = ast_variable_retrieve(cfg, "general", "imapparentfolder"))) { 1.347 + ast_copy_string(imapparentfolder, val, sizeof(imapparentfolder)); 1.348 + } 1.349 +Index: apps/.moduleinfo 1.350 +diff -Nau apps/.moduleinfo.orig apps/.moduleinfo 1.351 +--- apps/.moduleinfo.orig 2011-02-22 23:50:32.000000000 +0100 1.352 ++++ apps/.moduleinfo 2011-03-13 14:03:42.000000000 +0100 1.353 +@@ -72,7 +72,7 @@ 1.354 + <member name="app_image" displayname="Image Transmission Application" remove_on_change="apps/app_image.o apps/app_image.so"> 1.355 + </member> 1.356 + <member name="app_ivrdemo" displayname="IVR Demo Application" remove_on_change="apps/app_ivrdemo.o apps/app_ivrdemo.so"> 1.357 +- <defaultenabled>no</defaultenabled> 1.358 ++ <defaultenabled>yes</defaultenabled> 1.359 + </member> 1.360 + <member name="app_jack" displayname="JACK Interface" remove_on_change="apps/app_jack.o apps/app_jack.so"> 1.361 + <depend>jack</depend> 1.362 +@@ -127,10 +127,10 @@ 1.363 + <member name="app_rpt" displayname="Radio Repeater/Remote Base Application" remove_on_change="apps/app_rpt.o apps/app_rpt.so"> 1.364 + <depend>dahdi</depend> 1.365 + <depend>tonezone</depend> 1.366 +- <defaultenabled>no</defaultenabled> 1.367 ++ <defaultenabled>yes</defaultenabled> 1.368 + </member> 1.369 + <member name="app_saycounted" displayname="Decline words according to channel language" remove_on_change="apps/app_saycounted.o apps/app_saycounted.so"> 1.370 +- <defaultenabled>no</defaultenabled> 1.371 ++ <defaultenabled>yes</defaultenabled> 1.372 + </member> 1.373 + <member name="app_sayunixtime" displayname="Say time" remove_on_change="apps/app_sayunixtime.o apps/app_sayunixtime.so"> 1.374 + </member> 1.375 +Index: build_tools/cflags.xml 1.376 +diff -Nau build_tools/cflags.xml.orig build_tools/cflags.xml 1.377 +--- build_tools/cflags.xml.orig 2010-02-16 16:36:53.000000000 +0100 1.378 ++++ build_tools/cflags.xml 2011-03-13 14:03:42.000000000 +0100 1.379 +@@ -26,10 +26,11 @@ 1.380 + <member name="RADIO_RELAX" displayname="Relax DTMF for Radio Applications"> 1.381 + </member> 1.382 + <member name="G711_NEW_ALGORITHM" displayname="Use the NEW ulaw/alaw codecs (slower, but cleaner)"> 1.383 +- <defaultenabled>no</defaultenabled> 1.384 ++ <defaultenabled>yes</defaultenabled> 1.385 + </member> 1.386 + <member name="G711_REDUCED_BRANCHING" displayname="New ulaw/alaw codec, reduced branching (might help it run faster in some architectures)"> 1.387 + <depend>G711_NEW_ALGORITHM</depend> 1.388 ++ <defaultenabled>yes</defaultenabled> 1.389 + </member> 1.390 + <member name="TEST_CODING_TABLES" displayname="New ulaw/alaw codec, turn on table tests on init"> 1.391 + <depend>G711_NEW_ALGORITHM</depend> 1.392 +Index: chan_capi-1.1.5.919/chan_capi20.h 1.393 +diff -Nau chan_capi-1.1.5.919/chan_capi20.h.orig chan_capi-1.1.5.919/chan_capi20.h 1.394 +--- chan_capi-1.1.5.919/chan_capi20.h.orig 2011-01-07 02:29:32.000000000 +0100 1.395 ++++ chan_capi-1.1.5.919/chan_capi20.h 2011-03-13 14:03:42.000000000 +0100 1.396 +@@ -4,10 +4,13 @@ 1.397 + * first. Else the checks below will fail. 1.398 + */ 1.399 + 1.400 ++#include <stddef.h> 1.401 + #include <capi20.h> 1.402 1.403 #undef CAPI_OS_HINT 1.404 1.405 @@ -312,7 +387,7 @@ 1.406 #if (defined(__FreeBSD__) || defined(__OpenBSD__) || \ 1.407 defined(__NetBSD__) || defined(__APPLE__)) 1.408 1.409 -@@ -29,6 +31,8 @@ 1.410 +@@ -29,6 +32,8 @@ 1.411 #include <capiutils.h> 1.412 #endif /* BSD */ 1.413 1.414 @@ -321,10 +396,11 @@ 1.415 #ifndef HEADER_CID 1.416 #define HEADER_CID(x) ((x)->adr.adrNCCI) 1.417 #endif 1.418 -Index: chan_capi-1.1.5/chan_capi_utils.c 1.419 ---- chan_capi-1.1.5/chan_capi_utils.c.orig 2010-04-06 19:33:25.000000000 +0200 1.420 -+++ chan_capi-1.1.5/chan_capi_utils.c 2010-07-24 11:12:31.000000000 +0200 1.421 -@@ -1087,6 +1087,9 @@ 1.422 +Index: chan_capi-1.1.5.919/chan_capi_utils.c 1.423 +diff -Nau chan_capi-1.1.5.919/chan_capi_utils.c.orig chan_capi-1.1.5.919/chan_capi_utils.c 1.424 +--- chan_capi-1.1.5.919/chan_capi_utils.c.orig 2011-01-07 02:29:32.000000000 +0100 1.425 ++++ chan_capi-1.1.5.919/chan_capi_utils.c 2011-03-13 14:03:42.000000000 +0100 1.426 +@@ -1155,6 +1155,9 @@ 1.427 { 1.428 MESSAGE_EXCHANGE_ERROR error; 1.429 int waitcount = 50; 1.430 @@ -334,9 +410,10 @@ 1.431 unsigned char manbuf[CAPI_MANUFACTURER_LEN]; 1.432 _cmsg CMSG; 1.433 1.434 -Index: chan_capi-1.1.5/libcapi20/capi20.c 1.435 ---- chan_capi-1.1.5/libcapi20/capi20.c.orig 2010-04-06 19:33:25.000000000 +0200 1.436 -+++ chan_capi-1.1.5/libcapi20/capi20.c 2010-07-24 11:12:31.000000000 +0200 1.437 +Index: chan_capi-1.1.5.919/libcapi20/capi20.c 1.438 +diff -Nau chan_capi-1.1.5.919/libcapi20/capi20.c.orig chan_capi-1.1.5.919/libcapi20/capi20.c 1.439 +--- chan_capi-1.1.5.919/libcapi20/capi20.c.orig 2011-01-07 02:29:31.000000000 +0100 1.440 ++++ chan_capi-1.1.5.919/libcapi20/capi20.c 2011-03-13 14:03:42.000000000 +0100 1.441 @@ -19,8 +19,10 @@ 1.442 #include <stdio.h> 1.443 #include <ctype.h> 1.444 @@ -622,26 +699,7 @@ 1.445 } 1.446 1.447 unsigned 1.448 -@@ -993,7 +1047,7 @@ 1.449 - unsigned short* tmp = (unsigned short*)buf; 1.450 - 1.451 - if(*tmp == CapiNoError) { 1.452 -- memcpy(Buf, buf + 2, (Ctrl) ? sizeof(struct capi_profile) : 2); 1.453 -+ memcpy(Buf, buf + 2, (Ctrl) ? 224 /* sizeof(struct capi_profile) */ : 2); 1.454 - } 1.455 - 1.456 - fret = *tmp; 1.457 -@@ -1002,6 +1056,9 @@ 1.458 - return (fret); 1.459 - } 1.460 - 1.461 -+#if 1 1.462 -+ return CapiMsgOSResourceErr; 1.463 -+#else 1.464 - ioctl_data.contr = Ctrl; 1.465 - 1.466 - if (ioctl(capi_fd, CAPI_GET_PROFILE, &ioctl_data) < 0) { 1.467 -@@ -1018,6 +1075,7 @@ 1.468 +@@ -1018,6 +1072,7 @@ 1.469 sizeof(ioctl_data.profile.ncontroller)); 1.470 } 1.471 return CapiNoError; 1.472 @@ -649,9 +707,10 @@ 1.473 } 1.474 /* 1.475 * functions added to the CAPI2.0 spec 1.476 -Index: chan_capi-1.1.5/libcapi20/convert.c 1.477 ---- chan_capi-1.1.5/libcapi20/convert.c.orig 2009-07-23 16:11:08.000000000 +0200 1.478 -+++ chan_capi-1.1.5/libcapi20/convert.c 2010-07-24 11:12:31.000000000 +0200 1.479 +Index: chan_capi-1.1.5.919/libcapi20/convert.c 1.480 +diff -Nau chan_capi-1.1.5.919/libcapi20/convert.c.orig chan_capi-1.1.5.919/libcapi20/convert.c 1.481 +--- chan_capi-1.1.5.919/libcapi20/convert.c.orig 2011-01-07 02:29:31.000000000 +0100 1.482 ++++ chan_capi-1.1.5.919/libcapi20/convert.c 2011-03-13 14:03:42.000000000 +0100 1.483 @@ -11,7 +11,14 @@ 1.484 #include <stddef.h> 1.485 #include <time.h> 1.486 @@ -667,9 +726,46 @@ 1.487 1.488 #include "capi20.h" 1.489 1.490 +Index: chan_capi-1.1.5.919/Makefile 1.491 +diff -Nau chan_capi-1.1.5.919/Makefile.orig chan_capi-1.1.5.919/Makefile 1.492 +--- chan_capi-1.1.5.919/Makefile.orig 2011-01-07 02:29:32.000000000 +0100 1.493 ++++ chan_capi-1.1.5.919/Makefile 2011-03-13 14:03:42.000000000 +0100 1.494 +@@ -111,6 +111,9 @@ 1.495 + CFLAGS+=-O2 1.496 + CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi) 1.497 + CFLAGS+=$(shell if uname -m | grep -q "ppc\|arm\|s390"; then echo "-fsigned-char"; fi) 1.498 ++ifeq (${USE_OWN_LIBCAPI},yes) 1.499 ++CFLAGS+=-DUSE_OWN_LIBCAPI 1.500 ++endif 1.501 + ifeq (${DIVA_STREAMING},1) 1.502 + CFLAGS += -DDIVA_STREAMING=1 1.503 + endif 1.504 +Index: channels/chan_sip.c 1.505 +diff -Nau channels/chan_sip.c.orig channels/chan_sip.c 1.506 +--- channels/chan_sip.c.orig 2011-01-14 18:32:52.000000000 +0100 1.507 ++++ channels/chan_sip.c 2011-03-13 14:03:42.000000000 +0100 1.508 +@@ -11210,7 +11210,16 @@ 1.509 + } else { 1.510 + if (sipmethod == SIP_NOTIFY && !ast_strlen_zero(p->theirtag)) { 1.511 + /* If this is a NOTIFY, use the From: tag in the subscribe (RFC 3265) */ 1.512 +- snprintf(to, sizeof(to), "<%s%s>;tag=%s", (strncasecmp(p->uri, "sip:", 4) ? "sip:" : ""), p->uri, p->theirtag); 1.513 ++ if (strncasecmp(p->uri, "sip:", strlen("sip:"))) 1.514 ++ if (strncasecmp(p->uri, "sips:", strlen("sips:"))) 1.515 ++ if (p->socket.type == SIP_TRANSPORT_TLS) 1.516 ++ snprintf(to, sizeof(to), "<%s%s>;tag=%s", "sips:", p->uri, p->theirtag); 1.517 ++ else 1.518 ++ snprintf(to, sizeof(to), "<%s%s>;tag=%s", "sips:", p->uri, p->theirtag); 1.519 ++ else /* if (strncasecmp(p->uri, "sips:"... */ 1.520 ++ snprintf(to, sizeof(to), "<%s%s>;tag=%s", "", p->uri, p->theirtag); 1.521 ++ else /* if (strncasecmp(p->uri, "sip:"... */ 1.522 ++ snprintf(to, sizeof(to), "<%s%s>;tag=%s", "", p->uri, p->theirtag); 1.523 + } else if (p->options && p->options->vxml_url) { 1.524 + /* If there is a VXML URL append it to the SIP URL */ 1.525 + snprintf(to, sizeof(to), "<%s>;%s", p->uri, p->options->vxml_url); 1.526 Index: channels/console_video.h 1.527 +diff -Nau channels/console_video.h.orig channels/console_video.h 1.528 --- channels/console_video.h.orig 2008-06-30 17:45:15.000000000 +0200 1.529 -+++ channels/console_video.h 2010-07-24 11:12:31.000000000 +0200 1.530 ++++ channels/console_video.h 2011-03-13 14:03:42.000000000 +0100 1.531 @@ -28,10 +28,7 @@ 1.532 "console {device}" 1.533 #else 1.534 @@ -683,10 +779,11 @@ 1.535 #define CONSOLE_VIDEO_CMDS \ 1.536 "console {videodevice|videocodec" \ 1.537 Index: configure 1.538 ---- configure.orig 2010-06-24 01:40:16.000000000 +0200 1.539 -+++ configure 2010-07-24 11:14:22.000000000 +0200 1.540 -@@ -4530,11 +4530,6 @@ 1.541 - # note- does not work on FreeBSD 1.542 +diff -Nau configure.orig configure 1.543 +--- configure.orig 2011-01-09 22:40:34.000000000 +0100 1.544 ++++ configure 2011-03-13 14:14:50.000000000 +0100 1.545 +@@ -4700,11 +4700,6 @@ 1.546 + esac 1.547 1.548 case "${host_os}" in 1.549 - freebsd*) 1.550 @@ -697,10 +794,316 @@ 1.551 openbsd*) 1.552 1.553 if test ${prefix} = '/usr/local' || test ${prefix} = 'NONE'; then 1.554 +@@ -18227,8 +18222,8 @@ 1.555 + if test -f "${IMAP_TK_DIR}/c-client/LDFLAGS"; then 1.556 + imap_ldflags=`cat ${IMAP_TK_DIR}/c-client/LDFLAGS` 1.557 + fi 1.558 +- imap_libs="${IMAP_TK_DIR}/c-client/c-client.a" 1.559 +- imap_include="-I${IMAP_TK_DIR}/c-client" 1.560 ++ imap_libs="-limap -lssl -lcrypto -lcrypt" 1.561 ++ imap_include="-DUSE_SYSTEM_IMAP -I${IMAP_TK_DIR}/include/imap" 1.562 + CPPFLAGS="${CPPFLAGS} ${imap_include}" 1.563 + LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}` 1.564 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext 1.565 +@@ -25461,14 +25456,14 @@ 1.566 + else 1.567 + ast_ext_lib_check_save_CFLAGS="${CFLAGS}" 1.568 + CFLAGS="${CFLAGS} " 1.569 +- as_ac_Lib=`$as_echo "ac_cv_lib_lua5.1_${pbxfuncname}" | $as_tr_sh` 1.570 +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -llua5.1" >&5 1.571 +-$as_echo_n "checking for ${pbxfuncname} in -llua5.1... " >&6; } 1.572 ++ as_ac_Lib=`$as_echo "ac_cv_lib_lua_${pbxfuncname}" | $as_tr_sh` 1.573 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -llua" >&5 1.574 ++$as_echo_n "checking for ${pbxfuncname} in -llua... " >&6; } 1.575 + if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then : 1.576 + $as_echo_n "(cached) " >&6 1.577 + else 1.578 + ac_check_lib_save_LIBS=$LIBS 1.579 +-LIBS="-llua5.1 ${pbxlibdir} -lm $LIBS" 1.580 ++LIBS="-llua ${pbxlibdir} -lm $LIBS" 1.581 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext 1.582 + /* end confdefs.h. */ 1.583 + 1.584 +@@ -25511,19 +25506,19 @@ 1.585 + 1.586 + # now check for the header. 1.587 + if test "${AST_LUA_FOUND}" = "yes"; then 1.588 +- LUA_LIB="${pbxlibdir} -llua5.1 -lm" 1.589 ++ LUA_LIB="${pbxlibdir} -llua -lm" 1.590 + # if --with-LUA=DIR has been specified, use it. 1.591 + if test "x${LUA_DIR}" != "x"; then 1.592 + LUA_INCLUDE="-I${LUA_DIR}/include" 1.593 + fi 1.594 + LUA_INCLUDE="${LUA_INCLUDE} " 1.595 +- if test "xlua5.1/lua.h" = "x" ; then # no header, assume found 1.596 ++ if test "xlua/lua.h" = "x" ; then # no header, assume found 1.597 + LUA_HEADER_FOUND="1" 1.598 + else # check for the header 1.599 + ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}" 1.600 + CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}" 1.601 +- ac_fn_c_check_header_mongrel "$LINENO" "lua5.1/lua.h" "ac_cv_header_lua5_1_lua_h" "$ac_includes_default" 1.602 +-if test "x$ac_cv_header_lua5_1_lua_h" = x""yes; then : 1.603 ++ ac_fn_c_check_header_mongrel "$LINENO" "lua/lua.h" "ac_cv_header_lua_lua_h" "$ac_includes_default" 1.604 ++if test "x$ac_cv_header_lua_lua_h" = x""yes; then : 1.605 + LUA_HEADER_FOUND=1 1.606 + else 1.607 + LUA_HEADER_FOUND=0 1.608 +@@ -25551,9 +25546,9 @@ 1.609 + 1.610 + if test "x${PBX_LUA}" = "x1" ; then 1.611 + if test x"${LUA_DIR}" = x; then 1.612 +- LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua5.1" 1.613 ++ LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua" 1.614 + else 1.615 +- LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua5.1" 1.616 ++ LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua" 1.617 + fi 1.618 + fi 1.619 + 1.620 +@@ -26238,7 +26233,7 @@ 1.621 + pbxlibdir="-L${SQLITE_DIR}" 1.622 + fi 1.623 + fi 1.624 +- pbxfuncname="sqlite_exec" 1.625 ++ pbxfuncname="sqlite3_exec" 1.626 + if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers 1.627 + AST_SQLITE_FOUND=yes 1.628 + else 1.629 +@@ -26953,16 +26948,16 @@ 1.630 + if test "x${PBX_GMIME}" != "x1" -a "${USE_GMIME}" != "no"; then 1.631 + PBX_GMIME=0 1.632 + if test -n "$ac_tool_prefix"; then 1.633 +- # Extract the first word of "${ac_tool_prefix}gmime-config", so it can be a program name with args. 1.634 +-set dummy ${ac_tool_prefix}gmime-config; ac_word=$2 1.635 ++ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. 1.636 ++ set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 1.637 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 1.638 + $as_echo_n "checking for $ac_word... " >&6; } 1.639 +-if test "${ac_cv_path_CONFIG_GMIME+set}" = set; then : 1.640 ++if test "${ac_cv_prog_PKGCONFIG+set}" = set; then 1.641 + $as_echo_n "(cached) " >&6 1.642 + else 1.643 +- case $CONFIG_GMIME in 1.644 ++ case $PKGCONFIG in 1.645 + [\\/]* | ?:[\\/]*) 1.646 +- ac_cv_path_CONFIG_GMIME="$CONFIG_GMIME" # Let the user override the test with a path. 1.647 ++ ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. 1.648 + ;; 1.649 + *) 1.650 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 1.651 +@@ -26973,7 +26968,7 @@ 1.652 + test -z "$as_dir" && as_dir=. 1.653 + for ac_exec_ext in '' $ac_executable_extensions; do 1.654 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 1.655 +- ac_cv_path_CONFIG_GMIME="$as_dir/$ac_word$ac_exec_ext" 1.656 ++ ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" 1.657 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 1.658 + break 2 1.659 + fi 1.660 +@@ -26984,10 +26979,10 @@ 1.661 + ;; 1.662 + esac 1.663 + fi 1.664 +-CONFIG_GMIME=$ac_cv_path_CONFIG_GMIME 1.665 +-if test -n "$CONFIG_GMIME"; then 1.666 +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CONFIG_GMIME" >&5 1.667 +-$as_echo "$CONFIG_GMIME" >&6; } 1.668 ++PKGCONFIG=$ac_cv_path_PKGCONFIG 1.669 ++if test -n "$PKGCONFIG"; then 1.670 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 1.671 ++$as_echo "$PKGCONFIG" >&6; } 1.672 + else 1.673 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 1.674 + $as_echo "no" >&6; } 1.675 +@@ -26995,18 +26990,18 @@ 1.676 + 1.677 + 1.678 + fi 1.679 +-if test -z "$ac_cv_path_CONFIG_GMIME"; then 1.680 +- ac_pt_CONFIG_GMIME=$CONFIG_GMIME 1.681 +- # Extract the first word of "gmime-config", so it can be a program name with args. 1.682 +-set dummy gmime-config; ac_word=$2 1.683 ++if test -z "$ac_cv_path_PKGCONFIG"; then 1.684 ++ ac_pt_PKGCONFIG=$PKGCONFIG 1.685 ++ # Extract the first word of "pkg-config", so it can be a program name with args. 1.686 ++set dummy pkg-config; ac_word=$2 1.687 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 1.688 + $as_echo_n "checking for $ac_word... " >&6; } 1.689 +-if test "${ac_cv_path_ac_pt_CONFIG_GMIME+set}" = set; then : 1.690 ++if test "${ac_cv_path_ac_pt_PKGCONFIG+set}" = set; then : 1.691 + $as_echo_n "(cached) " >&6 1.692 + else 1.693 +- case $ac_pt_CONFIG_GMIME in 1.694 ++ case $ac_pt_PKGCONFIG in 1.695 + [\\/]* | ?:[\\/]*) 1.696 +- ac_cv_path_ac_pt_CONFIG_GMIME="$ac_pt_CONFIG_GMIME" # Let the user override the test with a path. 1.697 ++ ac_cv_path_ac_pt_PKGCONFIG="$ac_pt_PKGCONFIG" # Let the user override the test with a path. 1.698 + ;; 1.699 + *) 1.700 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 1.701 +@@ -27017,7 +27012,7 @@ 1.702 + test -z "$as_dir" && as_dir=. 1.703 + for ac_exec_ext in '' $ac_executable_extensions; do 1.704 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 1.705 +- ac_cv_path_ac_pt_CONFIG_GMIME="$as_dir/$ac_word$ac_exec_ext" 1.706 ++ ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" 1.707 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 1.708 + break 2 1.709 + fi 1.710 +@@ -27028,17 +27023,17 @@ 1.711 + ;; 1.712 + esac 1.713 + fi 1.714 +-ac_pt_CONFIG_GMIME=$ac_cv_path_ac_pt_CONFIG_GMIME 1.715 +-if test -n "$ac_pt_CONFIG_GMIME"; then 1.716 +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_CONFIG_GMIME" >&5 1.717 +-$as_echo "$ac_pt_CONFIG_GMIME" >&6; } 1.718 ++ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG 1.719 ++if test -n "$ac_pt_PKGCONFIG"; then 1.720 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKGCONFIG" >&5 1.721 ++$as_echo "${ECHO_T}$ac_pt_PKGCONFIG" >&6; } 1.722 + else 1.723 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 1.724 + $as_echo "no" >&6; } 1.725 + fi 1.726 + 1.727 +- if test "x$ac_pt_CONFIG_GMIME" = x; then 1.728 +- CONFIG_GMIME="No" 1.729 ++ if test "x$ac_pt_PKGCONFIG" = x; then 1.730 ++ PKGCONFIG="No" 1.731 + else 1.732 + case $cross_compiling:$ac_tool_warned in 1.733 + yes:) 1.734 +@@ -27046,17 +27041,15 @@ 1.735 + $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} 1.736 + ac_tool_warned=yes ;; 1.737 + esac 1.738 +- CONFIG_GMIME=$ac_pt_CONFIG_GMIME 1.739 ++ PKGCONFIG=$ac_pt_PKGCONFIG 1.740 + fi 1.741 + else 1.742 +- CONFIG_GMIME="$ac_cv_path_CONFIG_GMIME" 1.743 ++ PKGCONFIG="$ac_cv_path_PKGCONFIG" 1.744 + fi 1.745 + 1.746 +- if test ! "x${CONFIG_GMIME}" = xNo; then 1.747 +- if test x"" = x ; then A=--cflags ; else A="" ; fi 1.748 +- GMIME_INCLUDE=$(${CONFIG_GMIME} $A) 1.749 +- if test x"" = x ; then A=--libs ; else A="" ; fi 1.750 +- GMIME_LIB=$(${CONFIG_GMIME} $A) 1.751 ++ if test ! "x${PKGCONFIG}" = xNo; then 1.752 ++ GMIME_INCLUDE=$(${PKGCONFIG} gmime-2.4 --cflags 2>/dev/null) 1.753 ++ GMIME_LIB=$(${PKGCONFIG} gmime-2.4 --libs) 1.754 + if test x"#include <gmime/gmime.h>" != x ; then 1.755 + saved_cppflags="${CPPFLAGS}" 1.756 + if test "x${GMIME_DIR}" != "x"; then 1.757 +Index: formats/format_pcm.c 1.758 +diff -Nau formats/format_pcm.c.orig formats/format_pcm.c 1.759 +--- formats/format_pcm.c.orig 2010-07-26 05:27:06.000000000 +0200 1.760 ++++ formats/format_pcm.c 2011-03-13 14:03:42.000000000 +0100 1.761 +@@ -350,6 +350,7 @@ 1.762 + ast_log(LOG_WARNING, "Unable to write header\n"); 1.763 + return -1; 1.764 + } 1.765 ++ fflush(f); /* issues.asterisk.org bug 0016610 */ 1.766 + return 0; 1.767 + } 1.768 + 1.769 +Index: formats/format_wav.c 1.770 +diff -Nau formats/format_wav.c.orig formats/format_wav.c 1.771 +--- formats/format_wav.c.orig 2010-09-02 18:43:09.000000000 +0200 1.772 ++++ formats/format_wav.c 2011-03-13 14:03:42.000000000 +0100 1.773 +@@ -310,6 +310,7 @@ 1.774 + ast_log(LOG_WARNING, "Unable to write header\n"); 1.775 + return -1; 1.776 + } 1.777 ++ fflush(f); /* issues.asterisk.org bug 0016610 */ 1.778 + return 0; 1.779 + } 1.780 + 1.781 +Index: formats/format_wav_gsm.c 1.782 +diff -Nau formats/format_wav_gsm.c.orig formats/format_wav_gsm.c 1.783 +--- formats/format_wav_gsm.c.orig 2010-07-26 05:27:06.000000000 +0200 1.784 ++++ formats/format_wav_gsm.c 2011-03-13 14:03:42.000000000 +0100 1.785 +@@ -362,6 +362,7 @@ 1.786 + ast_log(LOG_WARNING, "Unable to write header\n"); 1.787 + return -1; 1.788 + } 1.789 ++ fflush(f); /* issues.asterisk.org bug 0016610 */ 1.790 + return 0; 1.791 + } 1.792 + 1.793 +Index: main/db1-ast/hash/hash.h 1.794 +diff -Nau main/db1-ast/hash/hash.h.orig main/db1-ast/hash/hash.h 1.795 +--- main/db1-ast/hash/hash.h.orig 2006-08-21 04:11:39.000000000 +0200 1.796 ++++ main/db1-ast/hash/hash.h 2011-03-13 14:03:42.000000000 +0100 1.797 +@@ -36,6 +36,8 @@ 1.798 + * @(#)hash.h 8.3 (Berkeley) 5/31/94 1.799 + */ 1.800 + 1.801 ++#include <stdint.h> 1.802 ++ 1.803 + /* Operations */ 1.804 + typedef enum { 1.805 + HASH_GET, HASH_PUT, HASH_PUTNEW, HASH_DELETE, HASH_FIRST, HASH_NEXT 1.806 +Index: main/db1-ast/hash/ndbm.c 1.807 +diff -Nau main/db1-ast/hash/ndbm.c.orig main/db1-ast/hash/ndbm.c 1.808 +--- main/db1-ast/hash/ndbm.c.orig 2006-08-21 04:11:39.000000000 +0200 1.809 ++++ main/db1-ast/hash/ndbm.c 2011-03-13 14:03:42.000000000 +0100 1.810 +@@ -49,7 +49,8 @@ 1.811 + #include <string.h> 1.812 + #include <stdlib.h> 1.813 + 1.814 +-#include <ndbm.h> 1.815 ++#include "../include/ndbm.h" 1.816 ++#include "../include/db.h" 1.817 + #include "hash.h" 1.818 + 1.819 + /* 1.820 +Index: main/features.c 1.821 +diff -Nau main/features.c.orig main/features.c 1.822 +--- main/features.c.orig 2011-01-20 21:24:36.000000000 +0100 1.823 ++++ main/features.c 2011-03-13 14:03:42.000000000 +0100 1.824 +@@ -1658,6 +1658,10 @@ 1.825 + snprintf(args, len, "%s,%s,m", S_OR(touch_format, "wav"), touch_filename); 1.826 + } 1.827 + 1.828 ++ for(x = 0; x < strlen(touch_filename); x++) { 1.829 ++ if (args[x] == '/') 1.830 ++ args[x] = '-'; 1.831 ++ } 1.832 + for(x = 0; x < strlen(args); x++) { 1.833 + if (args[x] == '/') 1.834 + args[x] = '-'; 1.835 +@@ -1774,6 +1778,10 @@ 1.836 + snprintf(args, len, "%s.%s,b", touch_filename, S_OR(touch_format, "wav")); 1.837 + } 1.838 + 1.839 ++ for( x = 0; x < strlen(touch_filename); x++) { 1.840 ++ if (args[x] == '/') 1.841 ++ args[x] = '-'; 1.842 ++ } 1.843 + for( x = 0; x < strlen(args); x++) { 1.844 + if (args[x] == '/') 1.845 + args[x] = '-'; 1.846 +Index: main/file.c 1.847 +diff -Nau main/file.c.orig main/file.c 1.848 +--- main/file.c.orig 2011-01-12 17:05:12.000000000 +0100 1.849 ++++ main/file.c 2011-03-13 14:03:42.000000000 +0100 1.850 +@@ -255,7 +255,7 @@ 1.851 + char *fn = NULL; 1.852 + 1.853 + if (!strcmp(ext, "wav49")) 1.854 +- ext = "WAV"; 1.855 ++ ext = "wav"; 1.856 + 1.857 + if (filename[0] == '/') { 1.858 + if (asprintf(&fn, "%s.%s", filename, ext) < 0) { 1.859 Index: main/Makefile 1.860 ---- main/Makefile.orig 2010-06-25 20:58:37.000000000 +0200 1.861 -+++ main/Makefile 2010-07-24 11:12:31.000000000 +0200 1.862 -@@ -78,10 +78,7 @@ 1.863 +diff -Nau main/Makefile.orig main/Makefile 1.864 +--- main/Makefile.orig 2010-12-18 00:52:04.000000000 +0100 1.865 ++++ main/Makefile 2011-03-13 14:03:42.000000000 +0100 1.866 +@@ -69,10 +69,7 @@ 1.867 endif 1.868 1.869 ifeq ($(OSARCH),FreeBSD) 1.870 @@ -712,22 +1115,11 @@ 1.871 endif 1.872 1.873 ifneq ($(findstring $(OSARCH), mingw32 cygwin ),) 1.874 -Index: main/file.c 1.875 ---- main/file.c.orig 2010-03-25 17:26:13.000000000 +0100 1.876 -+++ main/file.c 2010-07-24 11:12:31.000000000 +0200 1.877 -@@ -254,7 +254,7 @@ 1.878 - char *fn = NULL; 1.879 - 1.880 - if (!strcmp(ext, "wav49")) 1.881 -- ext = "WAV"; 1.882 -+ ext = "wav"; 1.883 - 1.884 - if (filename[0] == '/') { 1.885 - if (asprintf(&fn, "%s.%s", filename, ext) < 0) { 1.886 Index: main/tcptls.c 1.887 ---- main/tcptls.c.orig 2010-03-20 18:33:03.000000000 +0100 1.888 -+++ main/tcptls.c 2010-07-24 11:12:31.000000000 +0200 1.889 -@@ -325,6 +325,7 @@ 1.890 +diff -Nau main/tcptls.c.orig main/tcptls.c 1.891 +--- main/tcptls.c.orig 2010-07-09 00:08:07.000000000 +0200 1.892 ++++ main/tcptls.c 2011-03-13 14:03:42.000000000 +0100 1.893 +@@ -354,6 +354,7 @@ 1.894 if (!ast_strlen_zero(cfg->cafile) || !ast_strlen_zero(cfg->capath)) { 1.895 if (SSL_CTX_load_verify_locations(cfg->ssl_ctx, S_OR(cfg->cafile, NULL), S_OR(cfg->capath,NULL)) == 0) 1.896 ast_verb(0, "SSL CA file(%s)/path(%s) error\n", cfg->cafile, cfg->capath); 1.897 @@ -735,40 +1127,103 @@ 1.898 } 1.899 1.900 ast_verb(0, "SSL certificate ok\n"); 1.901 +Index: main/udptl.c 1.902 +diff -Nau main/udptl.c.orig main/udptl.c 1.903 +--- main/udptl.c.orig 2011-02-22 23:52:11.000000000 +0100 1.904 ++++ main/udptl.c 2011-03-13 14:03:42.000000000 +0100 1.905 +@@ -98,6 +98,18 @@ 1.906 + 1.907 + #define UDPTL_BUF_MASK 15 1.908 + 1.909 ++/*! Copied from chan_oss.c, corrects link errors: 1.910 ++udptl.o: In function `calculate_local_max_datagram': 1.911 ++main/udptl.c:740: undefined reference to `MIN' 1.912 ++udptl.o: In function `calculate_far_max_ifp': 1.913 ++main/udptl.c:770: undefined reference to `MAX' */ 1.914 ++#ifndef MIN 1.915 ++#define MIN(a,b) ((a) < (b) ? (a) : (b)) 1.916 ++#endif 1.917 ++#ifndef MAX 1.918 ++#define MAX(a,b) ((a) > (b) ? (a) : (b)) 1.919 ++#endif 1.920 ++ 1.921 + typedef struct { 1.922 + int buf_len; 1.923 + uint8_t buf[LOCAL_FAX_MAX_DATAGRAM]; 1.924 +Index: Makefile 1.925 +diff -Nau Makefile.orig Makefile 1.926 +--- Makefile.orig 2011-01-12 16:57:43.000000000 +0100 1.927 ++++ Makefile 2011-03-13 14:03:42.000000000 +0100 1.928 +@@ -230,15 +230,6 @@ 1.929 + _ASTCFLAGS+=-fsigned-char 1.930 + endif 1.931 + 1.932 +-ifeq ($(OSARCH),FreeBSD) 1.933 +- ifeq ($(PROC),i386) 1.934 +- _ASTCFLAGS+=-march=i686 1.935 +- endif 1.936 +- # -V is understood by BSD Make, not by GNU make. 1.937 +- BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk) 1.938 +- _ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi) 1.939 +-endif 1.940 +- 1.941 + ifeq ($(OSARCH),NetBSD) 1.942 + _ASTCFLAGS+=-pthread -I/usr/pkg/include 1.943 + endif 1.944 Index: menuselect-tree 1.945 ---- menuselect-tree.orig 2010-07-22 21:20:17.000000000 +0200 1.946 -+++ menuselect-tree 2010-07-24 11:12:31.000000000 +0200 1.947 -@@ -153,6 +153,8 @@ 1.948 +diff -Nau menuselect-tree.orig menuselect-tree 1.949 +--- menuselect-tree.orig 2011-02-22 23:50:45.000000000 +0100 1.950 ++++ menuselect-tree 2011-03-13 14:03:42.000000000 +0100 1.951 +@@ -38,6 +38,8 @@ 1.952 </member> 1.953 - <member name="app_system" displayname="Generic System() application" remove_on_change="apps/app_system.o apps/app_system.so"> 1.954 + <member name="app_authenticate" displayname="Authentication Application" remove_on_change="apps/app_authenticate.o apps/app_authenticate.so"> 1.955 </member> 1.956 -+<member name="app_backticks" displayname="Generic Backticks() application" remove_on_change="apps/app_backticks.o apps/app_backticks.so"> 1.957 ++<member name="app_backticks" displayname="BACKTICKS() dialplan function" remove_on_change="apps/app_backticks.o apps/app_backticks.so"> 1.958 +</member> 1.959 - <member name="app_talkdetect" displayname="Playback with Talk Detection" remove_on_change="apps/app_talkdetect.o apps/app_talkdetect.so"> 1.960 + <member name="app_cdr" displayname="Tell Asterisk to not maintain a CDR for the current call" remove_on_change="apps/app_cdr.o apps/app_cdr.so"> 1.961 </member> 1.962 - <member name="app_test" displayname="Interface Test Application" remove_on_change="apps/app_test.o apps/app_test.so"> 1.963 -@@ -693,9 +695,9 @@ 1.964 - <member name="CORE-SOUNDS-EN-ULAW" displayname="English, mu-Law format"> 1.965 - </member> 1.966 + <member name="app_celgenuserevent" displayname="Generate an User-Defined CEL event" remove_on_change="apps/app_celgenuserevent.o apps/app_celgenuserevent.so"> 1.967 +@@ -937,11 +939,11 @@ 1.968 <member name="CORE-SOUNDS-EN-ALAW" displayname="English, a-Law format"> 1.969 -+ <defaultenabled>yes</defaultenabled> 1.970 </member> 1.971 <member name="CORE-SOUNDS-EN-GSM" displayname="English, GSM format" > 1.972 - <defaultenabled>yes</defaultenabled> 1.973 </member> 1.974 <member name="CORE-SOUNDS-EN-G729" displayname="English, G.729 format"> 1.975 </member> 1.976 -@@ -771,6 +773,7 @@ 1.977 - <member name="EXTRA-SOUNDS-EN-ULAW" displayname="English, mu-Law format"> 1.978 - </member> 1.979 - <member name="EXTRA-SOUNDS-EN-ALAW" displayname="English, a-Law format"> 1.980 + <member name="CORE-SOUNDS-EN-G722" displayname="English, G.722 format"> 1.981 + <defaultenabled>yes</defaultenabled> 1.982 </member> 1.983 - <member name="EXTRA-SOUNDS-EN-GSM" displayname="English, GSM format" > 1.984 + <member name="CORE-SOUNDS-EN-SLN16" displayname="English, Signed-linear 16kHz format"> 1.985 + </member> 1.986 +@@ -1006,7 +1008,6 @@ 1.987 + </category> 1.988 + <category name="MENUSELECT_MOH" displayname="Music On Hold File Packages" positive_output="yes"> 1.989 + <member name="MOH-OPSOUND-WAV" displayname="opsound.org Music On Hold Files, WAV format" > 1.990 +- <defaultenabled>yes</defaultenabled> 1.991 + </member> 1.992 + <member name="MOH-OPSOUND-ULAW" displayname="opsound.org Music On Hold Files, mu-Law format" > 1.993 + </member> 1.994 +@@ -1017,6 +1018,7 @@ 1.995 + <member name="MOH-OPSOUND-G729" displayname="opsound.org Music On Hold Files, G.729 format" > 1.996 + </member> 1.997 + <member name="MOH-OPSOUND-G722" displayname="opsound.org Music On Hold Files, G.722 format" > 1.998 ++ <defaultenabled>yes</defaultenabled> 1.999 + </member> 1.1000 + <member name="MOH-OPSOUND-SLN16" displayname="opsound.org Music On Hold Files, Signed-linear 16kHz format" > 1.1001 + </member> 1.1002 +@@ -1037,6 +1039,7 @@ 1.1003 + <member name="EXTRA-SOUNDS-EN-G729" displayname="English, G.729 format"> 1.1004 + </member> 1.1005 + <member name="EXTRA-SOUNDS-EN-G722" displayname="English, G.722 format"> 1.1006 ++ <defaultenabled>yes</defaultenabled> 1.1007 + </member> 1.1008 + <member name="EXTRA-SOUNDS-EN-SLN16" displayname="English, Signed-linear 16kHz format"> 1.1009 </member> 1.1010 Index: res/res_http_post.c 1.1011 ---- res/res_http_post.c.orig 2009-10-27 18:12:09.000000000 +0100 1.1012 -+++ res/res_http_post.c 2010-07-24 11:12:31.000000000 +0200 1.1013 +diff -Nau res/res_http_post.c.orig res/res_http_post.c 1.1014 +--- res/res_http_post.c.orig 2009-10-27 17:48:54.000000000 +0100 1.1015 ++++ res/res_http_post.c 2011-03-13 14:03:42.000000000 +0100 1.1016 @@ -122,14 +122,8 @@ 1.1017 ast_log(LOG_WARNING, "Got unexpected GMIME_IS_MESSAGE_PARTIAL\n"); 1.1018 return; 1.1019 @@ -787,24 +1242,43 @@ 1.1020 const char *filename; 1.1021 1.1022 Index: sounds/sounds.xml 1.1023 ---- sounds/sounds.xml.orig 2009-08-18 22:31:40.000000000 +0200 1.1024 -+++ sounds/sounds.xml 2010-07-24 11:12:31.000000000 +0200 1.1025 -@@ -4,9 +4,9 @@ 1.1026 - <member name="CORE-SOUNDS-EN-ULAW" displayname="English, mu-Law format"> 1.1027 - </member> 1.1028 +diff -Nau sounds/sounds.xml.orig sounds/sounds.xml 1.1029 +--- sounds/sounds.xml.orig 2010-10-18 23:51:23.000000000 +0200 1.1030 ++++ sounds/sounds.xml 2011-03-13 14:03:42.000000000 +0100 1.1031 +@@ -6,11 +6,11 @@ 1.1032 <member name="CORE-SOUNDS-EN-ALAW" displayname="English, a-Law format"> 1.1033 -+ <defaultenabled>yes</defaultenabled> 1.1034 </member> 1.1035 <member name="CORE-SOUNDS-EN-GSM" displayname="English, GSM format" > 1.1036 - <defaultenabled>yes</defaultenabled> 1.1037 </member> 1.1038 <member name="CORE-SOUNDS-EN-G729" displayname="English, G.729 format"> 1.1039 </member> 1.1040 -@@ -82,6 +82,7 @@ 1.1041 - <member name="EXTRA-SOUNDS-EN-ULAW" displayname="English, mu-Law format"> 1.1042 - </member> 1.1043 - <member name="EXTRA-SOUNDS-EN-ALAW" displayname="English, a-Law format"> 1.1044 + <member name="CORE-SOUNDS-EN-G722" displayname="English, G.722 format"> 1.1045 + <defaultenabled>yes</defaultenabled> 1.1046 </member> 1.1047 - <member name="EXTRA-SOUNDS-EN-GSM" displayname="English, GSM format" > 1.1048 + <member name="CORE-SOUNDS-EN-SLN16" displayname="English, Signed-linear 16kHz format"> 1.1049 </member> 1.1050 +@@ -75,7 +75,6 @@ 1.1051 + </category> 1.1052 + <category name="MENUSELECT_MOH" displayname="Music On Hold File Packages" positive_output="yes"> 1.1053 + <member name="MOH-OPSOUND-WAV" displayname="opsound.org Music On Hold Files, WAV format" > 1.1054 +- <defaultenabled>yes</defaultenabled> 1.1055 + </member> 1.1056 + <member name="MOH-OPSOUND-ULAW" displayname="opsound.org Music On Hold Files, mu-Law format" > 1.1057 + </member> 1.1058 +@@ -86,6 +85,7 @@ 1.1059 + <member name="MOH-OPSOUND-G729" displayname="opsound.org Music On Hold Files, G.729 format" > 1.1060 + </member> 1.1061 + <member name="MOH-OPSOUND-G722" displayname="opsound.org Music On Hold Files, G.722 format" > 1.1062 ++ <defaultenabled>yes</defaultenabled> 1.1063 + </member> 1.1064 + <member name="MOH-OPSOUND-SLN16" displayname="opsound.org Music On Hold Files, Signed-linear 16kHz format" > 1.1065 + </member> 1.1066 +@@ -106,6 +106,7 @@ 1.1067 + <member name="EXTRA-SOUNDS-EN-G729" displayname="English, G.729 format"> 1.1068 + </member> 1.1069 + <member name="EXTRA-SOUNDS-EN-G722" displayname="English, G.722 format"> 1.1070 ++ <defaultenabled>yes</defaultenabled> 1.1071 + </member> 1.1072 + <member name="EXTRA-SOUNDS-EN-SLN16" displayname="English, Signed-linear 16kHz format"> 1.1073 + </member>
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/asterisk/asterisk.patch.proxymwi Sun Mar 20 20:03:11 2011 +0100 2.3 @@ -0,0 +1,24 @@ 2.4 +Index: channels/chan_sip.c 2.5 +diff -Nau channels/chan_sip.c.orig channels/chan_sip.c 2.6 +--- channels/chan_sip.c.orig 2011-01-14 18:32:52.000000000 +0100 2.7 ++++ channels/chan_sip.c 2011-03-13 14:34:29.000000000 +0100 2.8 +@@ -24267,6 +24267,7 @@ 2.9 + /* Called with peerl lock, but releases it */ 2.10 + struct sip_pvt *p; 2.11 + int newmsgs = 0, oldmsgs = 0; 2.12 ++ char *s = NULL; 2.13 + 2.14 + if (ast_test_flag((&peer->flags[1]), SIP_PAGE2_SUBSCRIBEMWIONLY) && !peer->mwipvt) 2.15 + return 0; 2.16 +@@ -24307,6 +24308,11 @@ 2.17 + } 2.18 + /* Recalculate our side, and recalculate Call ID */ 2.19 + ast_sip_ouraddrfor(&p->sa, &p->ourip, p); 2.20 ++ /* Set the username = mailbox and remove the context */ 2.21 ++ ast_string_field_build(p, username, "%s", peer->name); 2.22 ++ s = strchr(p->username, '@'); 2.23 ++ if (s != NULL) 2.24 ++ *s = 0; 2.25 + build_via(p); 2.26 + ao2_t_unlink(dialogs, p, "About to change the callid -- remove the old name"); 2.27 + build_callid_pvt(p);
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/asterisk/asterisk.patch.xfersips Sun Mar 20 20:03:11 2011 +0100 3.3 @@ -0,0 +1,37 @@ 3.4 +Index: channels/chan_sip.c 3.5 +diff -Nau channels/chan_sip.c.orig channels/chan_sip.c 3.6 +--- channels/chan_sip.c.orig 2011-01-14 18:32:52.000000000 +0100 3.7 ++++ channels/chan_sip.c 2011-03-13 14:32:58.000000000 +0100 3.8 +@@ -27854,6 +27854,7 @@ 3.9 + \todo Fix this function so that we wait for reply to the REFER and 3.10 + react to errors, denials or other issues the other end might have. 3.11 + */ 3.12 ++/* MSvB: Paramater dest may be SIPS encoded, having '@' before domain */ 3.13 + static int sip_sipredirect(struct sip_pvt *p, const char *dest) 3.14 + { 3.15 + char *cdest; 3.16 +@@ -27862,7 +27863,7 @@ 3.17 + cdest = ast_strdupa(dest); 3.18 + 3.19 + extension = strsep(&cdest, "@"); 3.20 +- domain = strsep(&cdest, ":"); 3.21 ++ domain = strsep(&cdest, ":"); /* MSvB: Could begin with '@' if SIPS */ 3.22 + if (ast_strlen_zero(extension)) { 3.23 + ast_log(LOG_ERROR, "Missing mandatory argument: extension\n"); 3.24 + return 0; 3.25 +@@ -27894,7 +27895,14 @@ 3.26 + } 3.27 + } 3.28 + 3.29 +- ast_string_field_build(p, our_contact, "Transfer <sip:%s@%s>", extension, domain); 3.30 ++ if (domain && *domain == '@') { 3.31 ++ ast_log(LOG_DEBUG, "Decoding TLS incapable Asterisk SIP URI to a standard SIPS URI before redirecting via 302 Moved Temporarily\n"); 3.32 ++ ast_string_field_build(p, our_contact, "Transfer <sips:%s@%s>", extension, domain); 3.33 ++ 3.34 ++ } 3.35 ++ else 3.36 ++ ast_string_field_build(p, our_contact, "Transfer <sip:%s@%s>", extension, domain); 3.37 ++ 3.38 + transmit_response_reliable(p, "302 Moved Temporarily", &p->initreq); 3.39 + 3.40 + sip_scheddestroy(p, SIP_TRANS_TIMEOUT); /* Make sure we stop send this reply. */
4.1 --- a/asterisk/asterisk.spec Sun Mar 20 20:00:02 2011 +0100 4.2 +++ b/asterisk/asterisk.spec Sun Mar 20 20:03:11 2011 +0100 4.3 @@ -1,6 +1,6 @@ 4.4 ## 4.5 ## asterisk.spec -- OpenPKG RPM Package Specification 4.6 -## Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/> 4.7 +## Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/> 4.8 ## 4.9 ## Permission to use, copy, modify, and distribute this software for 4.10 ## any purpose with or without fee is hereby granted, provided that 4.11 @@ -22,13 +22,21 @@ 4.12 ## 4.13 4.14 # package version 4.15 -%define V_opkg 1.6.2.13 4.16 -%define V_asterisk 1.6.2.13 4.17 -%define V_asterisk_addons 1.6.2.2 4.18 -%define V_asterisk_sounds_core_en 1.4.20 4.19 -%define V_asterisk_sounds_core_de current 4.20 -%define V_asterisk_sounds_extra_en 1.4.11 4.21 -%define V_chan_capi 1.1.5 4.22 +%define V_opkg 1.8.3.2 4.23 +%define V_asterisk 1.8.3.2 4.24 +%define V_asterisk_fax_digium 1.8.0_1.3.0 4.25 +%define V_asterisk_sounds_core 1.4.20 4.26 +%define V_asterisk_sounds_extra 1.4.11 4.27 +%define V_asterisk_sounds_amoogab 1.4 4.28 +%define V_asterisk_sounds_amootts current 4.29 +%define V_asterisk_sounds_custom 1.0 4.30 +%define V_asterisk_sounds_mohop 2.03 4.31 +%define V_asterisk_addons_mp3dec 1 4.32 +%define V_fswitch_sounds_en 1.0.14 4.33 +%define V_fswitch_sounds_ru 1.0.12 4.34 +%define V_fswitch_music 1.0.8 4.35 +%define V_asterisk_codecs_ilbc 20110104 4.36 +%define V_chan_capi 1.1.5.919 4.37 4.38 # package information 4.39 Name: asterisk 4.40 @@ -41,7 +49,7 @@ 4.41 Group: VoIP 4.42 License: GPL 4.43 Version: %{V_opkg} 4.44 -Release: 20101019 4.45 +Release: 20110314 4.46 4.47 # package options 4.48 %option with_dahdi no 4.49 @@ -53,27 +61,56 @@ 4.50 %option with_ldap no 4.51 %option with_radius no 4.52 %option with_sqlite no 4.53 +%option with_srtp no 4.54 +%option with_pgsql no 4.55 %option with_lua no 4.56 %option with_jabber no 4.57 %option with_imap no 4.58 %option with_odbc no 4.59 +%option with_libpri no 4.60 +%option with_esounds no 4.61 +%option with_xfersips yes 4.62 +%option with_proxymwi yes 4.63 +%option with_smdipoll 10 4.64 4.65 # list of sources 4.66 Source0: http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-%{V_asterisk}.tar.gz 4.67 -Source1: http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-addons-%{V_asterisk_addons}.tar.gz 4.68 -Source2: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-en-alaw-%{V_asterisk_sounds_core_en}.tar.gz 4.69 -Source3: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-en-alaw-%{V_asterisk_sounds_extra_en}.tar.gz 4.70 -Source4: http://www.amooma.de/asterisk/sprachbausteine/asterisk-core-sounds-de-gsm-%{V_asterisk_sounds_core_de}.tar.gz 4.71 -Source5: ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz 4.72 -Source6: asterisk.txt 4.73 -Source7: rc.asterisk 4.74 +Source1: ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz 4.75 +Source2: ftp://ftp.europalab.com/pub/sfw/machsnds/asterisk-moh-freeplay-sln16.tar.gz 4.76 +Source3: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-moh-opsound-sln16-%{V_asterisk_sounds_mohop}.tar.gz 4.77 +Source4: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-en-sln16-%{V_asterisk_sounds_core}.tar.gz 4.78 +Source5: http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en_AU-sln16-current.tar.gz 4.79 +Source6: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-es-sln16-%{V_asterisk_sounds_core}.tar.gz 4.80 +Source7: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-fr-sln16-%{V_asterisk_sounds_core}.tar.gz 4.81 +Source8: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-en-sln16-%{V_asterisk_sounds_extra}.tar.gz 4.82 +Source9: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-fr-sln16-%{V_asterisk_sounds_extra}.tar.gz 4.83 +Source10: http://www.amooma.de/asterisk/sprachbausteine/asterisk-%{V_asterisk_sounds_amoogab}-de-prompts.tar.gz 4.84 +Source11: http://www.amooma.de/asterisk/sprachbausteine/asterisk-core-sounds-de-gsm-current.tar.gz 4.85 +Source12: ftp://ftp.europalab.com/pub/sfw/machsnds/de-digits/de-digits-%{V_asterisk_sounds_custom}.tar.bz2 4.86 +Source13: ftp://ftp.europalab.com/pub/sfw/machsnds/de-sounds/astmultisnds-de-sln16-%{V_asterisk_sounds_custom}.tar.bz2 4.87 +Source14: ftp://ftp.europalab.com/pub/sfw/machsnds/msvbsnds-sln16-%{V_asterisk_sounds_custom}.tar.bz2 4.88 +Source15: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-48000-%{V_fswitch_sounds_en}.tar.gz 4.89 +Source16: http://files.freeswitch.org/freeswitch-sounds-es-mx-maria-44100.tar.gz 4.90 +Source17: http://files.freeswitch.org/freeswitch-sounds-ru-RU-elena-48000-%{V_fswitch_sounds_ru}.tar.gz 4.91 +Source18: http://files.freeswitch.org/freeswitch-sounds-music-48000-%{V_fswitch_music}.tar.gz 4.92 +Source19: http://svn.digium.com/svn/thirdparty/mp3/trunk/addons/mp3-%{V_asterisk_addons_mp3dec}.tar.gz 4.93 +Source20: http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-1.8.0/x86-64/res_fax_digium-%{V_asterisk_fax_digium}-generic_64.tar.gz 4.94 +Source21: http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-1.8.0/x86-32/res_fax_digium-%{V_asterisk_fax_digium}-generic_32.tar.gz 4.95 +Source22: ilbc-20110104.tar.gz 4.96 +Source23: asterisk.txt 4.97 +Source24: rc.asterisk 4.98 +Source25: wakeup.agi 4.99 Patch0: asterisk.patch 4.100 +Patch1: asterisk.patch.xfersips 4.101 +Patch2: asterisk.patch.proxymwi 4.102 4.103 # build information 4.104 -BuildPreReq: OpenPKG, openpkg >= 20100101, bison, gcc, make, grep 4.105 -PreReq: OpenPKG, openpkg >= 20100101, MTA 4.106 -BuildPreReq: zlib, curl, openssl, ncurses, speex, popt, gmime22 4.107 -PreReq: zlib, curl, openssl, ncurses, speex, popt, gmime22 4.108 +Prefix: %{l_prefix} 4.109 +BuildRoot: %{l_buildroot} 4.110 +BuildPreReq: OpenPKG, openpkg >= 20040130, bison, gcc, make, grep 4.111 +PreReq: OpenPKG, openpkg >= 20040130, MTA 4.112 +BuildPreReq: zlib, curl, openssl, ncurses, speex, sox, popt, gmime, libxml 4.113 +PreReq: zlib, curl, openssl, ncurses, speex, sox, popt, gmime, libxml 4.114 %if "%{with_ogg}" == "yes" 4.115 BuildPreReq: vorbis-libs 4.116 PreReq: vorbis-libs 4.117 @@ -89,14 +126,18 @@ 4.118 BuildPreReq: sqlite 4.119 PreReq: sqlite 4.120 %endif 4.121 +%if "%{with_srtp}" == "yes" 4.122 +BuildPreReq: srtp 4.123 +PreReq: srtp 4.124 +%endif 4.125 +%if "%{with_pgsql}" == "yes" 4.126 +BuildPreReq: postgresql 4.127 +PreReq: postgresql 4.128 +%endif 4.129 %if "%{with_lua}" == "yes" 4.130 BuildPreReq: lua 4.131 PreReq: lua 4.132 %endif 4.133 -%if "%{with_fax}" == "yes" 4.134 -BuildPreReq: spandsp, tiff, jpeg, zlib 4.135 -PreReq: spandsp, tiff, jpeg, zlib 4.136 -%endif 4.137 %if "%{with_avcodec}" == "yes" 4.138 BuildPreReq: ffmpeg 4.139 PreReq: ffmpeg 4.140 @@ -117,15 +158,37 @@ 4.141 BuildPreReq: unixodbc, sqlite, sqlite::with_odbc = yes 4.142 PreReq: unixodbc, sqlite, sqlite::with_odbc = yes 4.143 %endif 4.144 +%if "%{with_libpri}" == "yes" 4.145 +BuildPreReq: libpri > 1.4.11.5 4.146 +PreReq: libpri > 1.4.11.5 4.147 +%endif 4.148 +%if "%{with_esounds}" == "yes" 4.149 +BuildPreReq: sox 4.150 +%endif 4.151 +AutoReq: no 4.152 +AutoReqProv: no 4.153 4.154 %description 4.155 Asterisk is a complete Private Branch Exchange (PBX) in software. 4.156 - It provides all of the features you would expect from a PBX and 4.157 - more. Asterisk does Voice over IP (VoIP) in many protocols. Asterisk 4.158 - provides Voicemail services with Directory, Call Conferencing, 4.159 - Interactive Voice Response and Call Queuing. It has support for 4.160 - three-way calling, caller ID services, ADSI, SIP, etc. Asterisk 4.161 - needs no additional hardware for VoIP. 4.162 + It provides more than the features normally expected from a PBX, 4.163 + and can transceive Voice over IP (VoIP) in many protocols. Asterisk 4.164 + provides voicemail services with directory, call conferencing, 4.165 + interactive voice response and call queuing as well. It has support 4.166 + for three way calling, caller ID, ADSI, and SIP, and requires no 4.167 + additional hardware for VoIP applications. 4.168 + 4.169 + This copy of Asterisk is optionally patched to allow the asterisk 4.170 + server to respond to SIP/TLS transfer requests using the Transfer() 4.171 + application. Should this option be chosen, the asterisk server 4.172 + successfully dispatches all transfer destinations using 'SIPS' 4.173 + technology by means of the standard SIP/2.0 302 Moved Temporarily 4.174 + message, with a URI resembling <sips:extension@hostname.tld:port>. 4.175 + 4.176 + This copy of Asterisk is optionally patched as well to enclose the 4.177 + correct user name in NOTIFY messages when MWI logic detects changes 4.178 + in the state of Messages-Waiting. Asterisk will send NOTIFY messages 4.179 + with the URI 'user@hostname' instead of simply 'hostname'. This can 4.180 + be used by a external SIP proxy to route the MWI to the correct phone. 4.181 4.182 %track 4.183 prog asterisk = { 4.184 @@ -133,26 +196,51 @@ 4.185 url = http://downloads.asterisk.org/pub/telephony/asterisk/releases/ 4.186 regex = asterisk-(\d+\.\d+(\.\d+)+)\.tar\.gz 4.187 } 4.188 - prog asterisk:addons = { 4.189 - version = %{V_asterisk_addons} 4.190 - url = http://downloads.asterisk.org/pub/telephony/asterisk/releases/ 4.191 - regex = asterisk-addons-(\d+\.\d+(\.\d+)+)\.tar\.gz 4.192 + prog asterisk:fax_digium_32 = { 4.193 + version = %{V_asterisk_fax_digium} 4.194 + url = http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-1.8.0/x86-32/ 4.195 + regex = res_fax_digium-(__VER__)-generic_32.tar.gz\.tar\.gz 4.196 } 4.197 - prog asterisk:sounds_core_en = { 4.198 - version = %{V_asterisk_sounds_core_en} 4.199 + prog asterisk:fax_digium_64 = { 4.200 + version = %{V_asterisk_fax_digium} 4.201 + url = http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-1.8.0/x86-64/ 4.202 + regex = res_fax_digium-(__VER__)-generic_64.tar.gz\.tar\.gz 4.203 + } 4.204 + prog asterisk:sounds_core = { 4.205 + version = %{V_asterisk_sounds_core} 4.206 url = http://downloads.asterisk.org/pub/telephony/sounds/releases/ 4.207 - regex = asterisk-core-sounds-en-alaw-(\d+\.\d+(\.\d+)+)\.tar\.gz 4.208 + regex = asterisk-core-sounds-en-sln16-(\d+\.\d+(\.\d+)+)\.tar\.gz 4.209 } 4.210 - prog asterisk:sounds_extra_en = { 4.211 - version = %{V_asterisk_sounds_extra_en} 4.212 + prog asterisk:sounds_extra = { 4.213 + version = %{V_asterisk_sounds_extra} 4.214 url = http://downloads.asterisk.org/pub/telephony/sounds/releases/ 4.215 - regex = asterisk-extra-sounds-en-alaw-(\d+\.\d+(\.\d+)+)\.tar\.gz 4.216 + regex = asterisk-extra-sounds-en-sln16-(\d+\.\d+(\.\d+)+)\.tar\.gz 4.217 } 4.218 - prog asterisk:sounds_core_de = { 4.219 - version = %{V_asterisk_sounds_core_de} 4.220 + prog asterisk:sounds_amootts = { 4.221 + version = %{V_asterisk_sounds_amootts} 4.222 url = http://www.amooma.de/asterisk/sprachbausteine/ 4.223 regex = asterisk-core-sounds-de-gsm-(__VER__)\.tar\.gz 4.224 } 4.225 + prog asterisk:sounds_amoogab = { 4.226 + version = %{V_asterisk_sounds_amoogab} 4.227 + url = http://www.amooma.de/asterisk/sprachbausteine/ 4.228 + regex = asterisk-(__VER__)-de-prompts\.tar\.gz 4.229 + } 4.230 + prog asterisk:sounds_digits = { 4.231 + version = %{V_asterisk_sounds_custom} 4.232 + url = ftp://ftp.europalab.com/pub/sfw/machsnds/de-digits/ 4.233 + regex = de-digits-(__VER__)\.tar\.bz2 4.234 + } 4.235 + prog asterisk:sounds_custom = { 4.236 + version = %{V_asterisk_sounds_custom} 4.237 + url = ftp://ftp.europalab.com/pub/sfw/machsnds/de-sounds/ 4.238 + regex = astmultisnds-de-sln16-(__VER__)\.tar\.bz2 4.239 + } 4.240 + prog asterisk:sounds_mohop = { 4.241 + version = %{V_asterisk_sounds_mohop} 4.242 + url = http://downloads.asterisk.org/pub/telephony/sounds/releases/ 4.243 + regex = asterisk-moh-opsound-sln16-(__VER__)\.tar\.gz 4.244 + } 4.245 prog asterisk:chan_capi = { 4.246 version = %{V_chan_capi} 4.247 url = ftp://ftp.chan-capi.org/chan-capi/ 4.248 @@ -162,32 +250,126 @@ 4.249 %prep 4.250 %setup -q -n asterisk-%{V_asterisk} 4.251 %setup -q -n asterisk-%{V_asterisk} -D -T -a 1 4.252 - %setup -q -n asterisk-%{V_asterisk} -D -T -a 5 4.253 + %setup -q -n asterisk-%{V_asterisk} -D -T -a 2 4.254 +%if "%{with_fax}" == "yes" 4.255 + %setup -q -n asterisk-%{V_asterisk} -D -T -a 20 4.256 + %setup -q -n asterisk-%{V_asterisk} -D -T -a 21 4.257 +%endif 4.258 + ( cd addons 4.259 + %{l_tar} zxf %{_sourcedir}/mp3-%{V_asterisk_addons_mp3dec}.tar.gz 4.260 + ) || exit $? 4.261 + ( cd codecs 4.262 + %{l_tar} zxf %{_sourcedir}/ilbc-%{V_asterisk_codecs_ilbc}.tar.gz 4.263 + mv ilbc-%{V_asterisk_codecs_ilbc}/* ilbc/ 4.264 + rmdir ilbc-%{V_asterisk_codecs_ilbc} 4.265 + ) || exit $? 4.266 %patch -p0 4.267 - exit 0 4.268 - cp %{SOURCE2} %{SOURCE3} sounds/ 4.269 +%if "%{with_xfersips}" == "yes" 4.270 + %patch -p0 -P 1 4.271 +%endif 4.272 +%if "%{with_proxymwi}" == "yes" 4.273 + %patch -p0 -P 2 4.274 +%endif 4.275 %{l_shtool} subst \ 4.276 - -e 's;\(CORE_SOUNDS_VERSION\):=.*$;\1:=%{V_asterisk_sounds_core_en};' \ 4.277 - -e 's;\(EXTRA_SOUNDS_VERSION\):=.*$;\1:=%{V_asterisk_sounds_extra_en};' \ 4.278 + -e 's;\(astdatadir=.*\)\${astvarlibdir};\1${datadir};' \ 4.279 + -e 's;\(astvarlibdir=.*\)/lib/asterisk;\1/asterisk/lib;' \ 4.280 + -e 's;\(dir=.*{localstatedir}\)/\([^/][^/]*\)/asterisk;\1/asterisk/\2;g' \ 4.281 + configure 4.282 + %{l_shtool} subst \ 4.283 + -e 's;-llua5\.1;-llua;' \ 4.284 + -e 's;lua5\.1/lua\.h;lua/lua.h;' \ 4.285 + -e 's;ffmpeg/avcodec\.h;libavcodec/avcodec.h;' \ 4.286 + -e 's;\(sqlite\)\(_exec\);\13\2;g' \ 4.287 + -e 's;-lradiusclient-ng;-lradiusclient;g' \ 4.288 + -e 's;radiusclient-ng\.h;radiusclient.h;g' \ 4.289 + -e 's;-I${IMAP_TK_DIR}/c-client;-DUSE_SYSTEM_IMAP -I${IMAP_TK_DIR}/include/imap;g' \ 4.290 + -e 's;${IMAP_TK_DIR}/c-client/c-client\.a;-limap -lssl -lcrypto -lcrypt;g' \ 4.291 + configure 4.292 + %{l_shtool} subst \ 4.293 + -e 's;\(sh\) \(bash\) ksh sh5;\2 \1;' \ 4.294 + configure 4.295 + %{l_shtool} subst \ 4.296 + -e 's;^\(#define DEFAULT_DB .*\${ASTDBDIR}\)/astdb;\1/asterisk.db;' \ 4.297 + build_tools/make_defaults_h 4.298 + %{l_shtool} subst \ 4.299 + -e 's; *-I/usr/local/ssl/include;;g' \ 4.300 + -e 's;/opt/ssl/include;%{l_prefix}/include;g' \ 4.301 + -e 's;/usr/local;%{l_prefix};g' \ 4.302 + Makefile 4.303 + %{l_shtool} subst \ 4.304 + -e 's;\$(SUBMAKE);$(MAKE);g' \ 4.305 + -e 's;\$(SILENTMAKE);$(MAKE) --quiet --no-print-directory;g' \ 4.306 + -e 's;\$(MAKE_MENUSELECT); $(MAKE) -C menuselect;g' \ 4.307 + Makefile 4.308 + %{l_shtool} subst \ 4.309 + -e 's; *-L/usr/local/ssl/lib;;g' \ 4.310 + -e 's;/opt/ssl/lib;%{l_prefix}/lib;g' \ 4.311 + -e 's;/usr/local;%{l_prefix};g' \ 4.312 + -e 's;\(ASTLINK=\)$;\1-Wl,--export-dynamic;g' \ 4.313 + -e 's;\( CFLAGS=\)"[^"]+";"%{l_cflags -O}";g' \ 4.314 + main/Makefile 4.315 + %{l_shtool} subst \ 4.316 + -e 's;\(<defaultenabled>\)no\(</defaultenabled>\);\1yes\2;g' \ 4.317 + addons/.*.moduleinfo \ 4.318 + apps/.app_ivrdemo.moduleinfo \ 4.319 + apps/.app_saycounted.moduleinfo \ 4.320 + apps/.app_rpt.moduleinfo \ 4.321 + codecs/.moduleinfo \ 4.322 + utils/utils.xml \ 4.323 + agi/agi.xml 4.324 + %{l_shtool} subst \ 4.325 + -e 's;check_expr2;check_expr;g' \ 4.326 + utils/utils.xml 4.327 + %{l_shtool} subst \ 4.328 + -e 's;\(-DSOLARIS\);\1 -D__EXTENSIONS__=1;g' \ 4.329 + main/editline/Makefile.in \ 4.330 + main/db1-ast/Makefile 4.331 + %{l_shtool} subst \ 4.332 + -e 's;%s/astdb;%s/asterisk.db;g' \ 4.333 + main/asterisk.c 4.334 + %{l_shtool} subst \ 4.335 + -e 's;u_int\([0-9]*\)_t;uint\1_t;g' \ 4.336 + main/db1-ast/hash/hash.h 4.337 + %{l_shtool} subst \ 4.338 + -e 's;if \(((tmp = strchr(name\);while \1;g' \ 4.339 + main/abstract_jb.c 4.340 + %{l_shtool} subst \ 4.341 + -e 's;\(CORE_SOUNDS_VERSION\):=.*$;\1:=%{V_asterisk_sounds_core};' \ 4.342 + -e 's;\(EXTRA_SOUNDS_VERSION\):=.*$;\1:=%{V_asterisk_sounds_extra};' \ 4.343 sounds/Makefile 4.344 %{l_shtool} subst \ 4.345 - -e 's;-lradiusclient-ng;-lradiusclient;g' \ 4.346 - -e 's;radiusclient-ng\.h;radiusclient.h;g' \ 4.347 - configure cdr/cdr_radius.c 4.348 + -e 's;\(/etc/radiusclient-ng/radiusclient.conf\);%{l_prefix}\1;g' \ 4.349 + -e 's;\(radiusclient\)-ng;\1;g' \ 4.350 + cdr/cdr_radius.c \ 4.351 + cel/cel_radius.c 4.352 + %{l_shtool} subst \ 4.353 + -e 's;\(sqlite\)\(\.h\);\13\2;g' \ 4.354 + cdr/cdr_sqlite.c 4.355 + %{l_shtool} subst \ 4.356 + -e 's;\(#define DEFAULT_POLLING_INTERVAL\) .*;\1 %{with_smdipoll};' \ 4.357 + res/res_smdi.c 4.358 + %{l_shtool} subst \ 4.359 + -e 's;\(ASTERISK_HEADER_DIR=\).*;\1%{l_prefix}/include;g' \ 4.360 + -e 's;\(MODULES_DIR=\).*;\1%{l_prefix}/lib/asterisk/modules;g' \ 4.361 + -e 's;\(CONFIG_DIR=\).*;\1%{l_prefix}/etc/asterisk;g' \ 4.362 + -e 's;\(\$(MODULES_DIR)\);$(DESTDIR)\1;g' \ 4.363 + -e 's;\${CONFIG_DIR};$(DESTDIR)$(CONFIG_DIR);g' \ 4.364 + -e 's;^\(USE_OWN_LIBCAPI\)=yes;\1=no;' \ 4.365 + chan_capi-%{V_chan_capi}/Makefile 4.366 4.367 %build 4.368 - # sanity check 4.369 + # sanity check operating system 4.370 %if "%{with_dahdi}" == "yes" 4.371 dahdi_prefix="" 4.372 case "%{l_platform -t}" in 4.373 *-linux* ) 4.374 - if [ ! -f /usr/include/linux/dahdi.h ]; then 4.375 + if [ ! -f /usr/include/dahdi/user.h ]; then 4.376 echo "option \"with_dahdi\" requires DAHDI Linux drivers installed" 1>&2; exit 1 4.377 fi 4.378 dahdi_prefix=/usr 4.379 ;; 4.380 *-freebsd* ) 4.381 - if [ ! -f /usr/local/include/dahdi/dahdi.h ]; then 4.382 + if [ ! -f /usr/local/include/dahdi/user.h ]; then 4.383 echo "option \"with_dahdi\" requires DAHDI FreeBSD drivers installed" 1>&2; exit 1 4.384 fi 4.385 dahdi_prefix=/usr/local 4.386 @@ -195,8 +377,15 @@ 4.387 * ) echo "option \"with_dahdi\" supported under Linux and FreeBSD only" 1>&2; exit 1 ;; 4.388 esac 4.389 %endif 4.390 + # correct platform dependent build configuration 4.391 + extflg= 4.392 + case "%{l_platform -t}" in 4.393 + *-linux* ) 4.394 + pthlibflg='-lpthread' 4.395 + ;; 4.396 + esac 4.397 4.398 - # re-configure music-on-hold to find mpg123 4.399 + # adapt buildconf to find mpg123 (for music on hold) 4.400 %if "%{with_mp3}" == "yes" 4.401 mpg123="%{l_prefix}/bin/mpg123" 4.402 %else 4.403 @@ -207,21 +396,16 @@ 4.404 -e "s;/usr/bin/mpg123;$mpg123;" \ 4.405 res/res_musiconhold.c apps/app_mp3.c 4.406 4.407 - # build program 4.408 - %{l_shtool} subst \ 4.409 - -e 's;-llua5\.1;-llua;' \ 4.410 - -e 's;lua5\.1/lua\.h;lua/lua.h;' \ 4.411 - -e 's;ffmpeg/avcodec\.h;libavcodec/avcodec.h;' \ 4.412 - configure 4.413 + # configure program 4.414 ( echo "ac_cv_prog_CONFIG_GMIME=%{l_prefix}/bin/gmime-config" 4.415 ) >config.cache 4.416 cflags="%{l_cflags -O}" 4.417 - cppflags="%{l_cppflags ncurses lua .}" 4.418 + cppflags="%{l_cppflags ncurses lua}" 4.419 ldflags="%{l_ldflags}" 4.420 libs="" 4.421 - cppflags="$cppflags `pkg-config gmime-2.0 --cflags-only-I`" 4.422 - ldflags="$ldflags `pkg-config gmime-2.0 --libs-only-L`" 4.423 - libs="$libs `pkg-config gmime-2.0 --libs-only-l`" 4.424 + cppflags="$cppflags `pkg-config gmime-2.4 --cflags-only-I`" 4.425 + ldflags="$ldflags `pkg-config gmime-2.4 --libs-only-L`" 4.426 + libs="$libs `pkg-config gmime-2.4 --libs-only-l` -lssl -lcrypto" 4.427 %if "%{with_ogg}" == "yes" 4.428 libs="$libs -logg -lm" 4.429 %endif 4.430 @@ -229,7 +413,7 @@ 4.431 libs="$libs -lavcodec -lavutil" 4.432 %endif 4.433 %if "%{with_ldap}" == "yes" 4.434 - libs="$libs -lldap -llber -lssl -lcrypto" 4.435 + libs="$libs -lldap -llber" 4.436 %endif 4.437 %if "%{with_dahdi}" == "yes" 4.438 cppflags="$cppflags -I$dahdi_prefix/include" 4.439 @@ -240,14 +424,18 @@ 4.440 CPPFLAGS="$cppflags" \ 4.441 LDFLAGS="$ldflags" \ 4.442 LIBS="$libs" \ 4.443 + INSTALL="%{l_shtool} install -c" \ 4.444 + PTHREAD_LIBS="$pthlibflg" \ 4.445 ./configure \ 4.446 --cache-file=./config.cache \ 4.447 --prefix=%{l_prefix} \ 4.448 --mandir=%{l_prefix}/man \ 4.449 --sysconfdir=%{l_prefix}/etc \ 4.450 - --localstatedir=%{l_prefix}/var/asterisk \ 4.451 + --localstatedir=%{l_prefix}/var \ 4.452 + --datarootdir=%{l_prefix}/share/asterisk \ 4.453 + --with-crypto=%{l_prefix} \ 4.454 --with-curl=%{l_prefix} \ 4.455 - --with-ncurses \ 4.456 + --with-ncurses=%{l_prefix} \ 4.457 --with-gsm="internal" \ 4.458 --with-popt=%{l_prefix} \ 4.459 %if "%{with_sqlite}" == "yes" 4.460 @@ -255,6 +443,16 @@ 4.461 %else 4.462 --without-sqlite3 \ 4.463 %endif 4.464 +%if "%{with_srtp}" == "yes" 4.465 + --with-srtp=%{l_prefix} \ 4.466 +%else 4.467 + --without-srtp \ 4.468 +%endif 4.469 +%if "%{with_pgsql}" == "yes" 4.470 + --with-postgres=%{l_prefix} \ 4.471 +%else 4.472 + --with-postgres=no \ 4.473 +%endif 4.474 --with-speex=%{l_prefix} \ 4.475 --with-speexdsp=%{l_prefix} \ 4.476 --with-ssl=%{l_prefix} \ 4.477 @@ -301,6 +499,7 @@ 4.478 %endif 4.479 %if "%{with_imap}" == "yes" 4.480 --with-imap=%{l_prefix} \ 4.481 + --disable-largefile \ 4.482 %else 4.483 --without-imap \ 4.484 %endif 4.485 @@ -309,80 +508,83 @@ 4.486 %else 4.487 --without-odbc \ 4.488 %endif 4.489 +%if "%{with_libpri}" == "yes" 4.490 + --with-pri=%{l_prefix} \ 4.491 +%else 4.492 + --without-pri \ 4.493 +%endif 4.494 + --with-sounds-cache=no \ 4.495 --without-netsnmp \ 4.496 --without-isdnnet \ 4.497 --without-misdn \ 4.498 - --without-kde \ 4.499 --without-nbs \ 4.500 --without-newt \ 4.501 --without-asound \ 4.502 --without-oss \ 4.503 - --without-qt \ 4.504 --without-sqlite \ 4.505 - --without-postgres \ 4.506 --without-tds \ 4.507 --without-osptk \ 4.508 - --without-pri \ 4.509 --without-suppserv \ 4.510 --without-vpb \ 4.511 --without-sdl \ 4.512 --without-x11 \ 4.513 --without-gtk \ 4.514 --without-gtk2 4.515 - %{l_make} %{l_mflags} \ 4.516 - CC="%{l_cc} $cflags -I. -I./include -I../include -I../../include $cppflags" 4.517 + 4.518 + # build menuselect 4.519 + %{l_make} %{l_mflags -O} menuselect.makeopts 4.520 + %{l_shtool} subst \ 4.521 + -e 's;\(MENUSELECT_MOH=\).*;\1;' \ 4.522 + -e 's;\(MENUSELECT_CORE_SOUNDS=\).*;\1;' \ 4.523 + -e 's;\(MENUSELECT_EXTRA_SOUNDS=\).*;\1;' \ 4.524 + menuselect.makeopts 4.525 +%if "%{with_imap}" == "yes" 4.526 + %{l_shtool} subst \ 4.527 + -e 's;\(MENUSELECT_OPTS_app_voicemail=\).*;\1IMAP_STORAGE;' \ 4.528 + menuselect.makeopts 4.529 +%endif 4.530 + 4.531 + # build program 4.532 + %{l_make} %{l_mflags -O} \ 4.533 + CC="%{l_cc} $cflags -I../include -I../../include $cppflags" NOISY_BUILD=yes 4.534 4.535 # build addon modules 4.536 - ( cd asterisk-addons-* 4.537 - ASTERISK_DIR="`pwd`/.." \ 4.538 - CC="%{l_cc}" \ 4.539 - CFLAGS="%{l_cflags -O}" \ 4.540 - CPPFLAGS="%{l_cppflags ncurses tiff .}" \ 4.541 - LDFLAGS="%{l_ldflags}" \ 4.542 -%if "%{with_fax}" == "yes" 4.543 - LIBS="-ltiff -ljpeg -lz -lm" \ 4.544 -%else 4.545 - LIBS="-lm" \ 4.546 -%endif 4.547 - ./configure \ 4.548 - --prefix=%{l_prefix} \ 4.549 - --mandir=%{l_prefix}/man \ 4.550 - --sysconfdir=%{l_prefix}/etc \ 4.551 - --localstatedir=%{l_prefix}/var/asterisk \ 4.552 - --with-ncurses \ 4.553 - --with-asterisk \ 4.554 - --without-mysqlclient \ 4.555 -%if "%{with_fax}" == "yes" 4.556 - --with-spandsp=%{l_prefix} 4.557 -%else 4.558 - --without-spandsp 4.559 -%endif 4.560 - %{l_make} %{l_mflags} \ 4.561 - CC="%{l_cc} %{l_cflags -O} -I. %{l_cppflags ncurses tiff .}" 4.562 + ( cd addons 4.563 + %{l_make} %{l_mflags -O} \ 4.564 + CC="%{l_cc} %{l_cflags -O} -I../../include %{l_cppflags ncurses}" NOISY_BUILD=yes ASTTOPDIR=.. 4.565 ) || exit $? 4.566 + 4.567 + # build agi programs 4.568 + ( cd agi && %{l_make} %{l_mflags -O}) || exit $? 4.569 + 4.570 %if "%{with_capi}" == "yes" 4.571 + # build capi channel 4.572 ( cd chan_capi-* 4.573 ln -s ../include/asterisk . 4.574 ln -s ../include/asterisk.h . 4.575 - %{l_make} %{l_mflags} \ 4.576 + %{l_make} %{l_mflags -O} V=1 \ 4.577 INSTALL_PREFIX=%{l_prefix} \ 4.578 - ASTERISK_HEADER_DIR="`pwd`" 4.579 + ASTERISK_HEADER_DIR="`pwd`" \ 4.580 ) || exit $? 4.581 %endif 4.582 4.583 %install 4.584 # install program 4.585 + rm -rf $RPM_BUILD_ROOT 4.586 %{l_make} %{l_mflags} install \ 4.587 DESTDIR=$RPM_BUILD_ROOT \ 4.588 INSTALL_PREFIX=%{l_prefix} 4.589 4.590 # install addon modules 4.591 - ( cd asterisk-addons-* 4.592 + ( cd addons 4.593 %{l_make} %{l_mflags} install \ 4.594 + ASTTOPDIR=.. \ 4.595 DESTDIR=$RPM_BUILD_ROOT \ 4.596 INSTALL_PREFIX=%{l_prefix} 4.597 ) || exit $? 4.598 + 4.599 %if "%{with_capi}" == "yes" 4.600 + # install capi channel 4.601 ( cd chan_capi-* 4.602 %{l_make} %{l_mflags} install \ 4.603 INSTALL_PREFIX=$RPM_BUILD_ROOT%{l_prefix} \ 4.604 @@ -391,34 +593,163 @@ 4.605 ) || exit $? 4.606 %endif 4.607 4.608 - # install addon sounds 4.609 - %{l_shtool} mkdir -f -p -m 755 \ 4.610 - $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de 4.611 - ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de 4.612 - %{l_gzip} -d -c %{SOURCE4} | %{l_tar} xf - 4.613 - ) || exit $? 4.614 +%if "%{with_fax}" == "yes" 4.615 + # install fax support 4.616 + case "%{l_platform -t}" in 4.617 + amd64*-* ) 4.618 + %{l_shtool} install -c -m 755 \ 4.619 + res_fax_digium-%{V_asterisk_fax_digium}-generic_64/res_*.so \ 4.620 + $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/ 4.621 + %{l_shtool} install -c -m 640 \ 4.622 + res_fax_digium-%{V_asterisk_fax_digium}-generic_64/*.conf \ 4.623 + $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/ 4.624 + ;; 4.625 + i?86-* ) 4.626 + %{l_shtool} install -c -m 755 \ 4.627 + res_fax_digium-%{V_asterisk_fax_digium}-generic_32/res_*.so \ 4.628 + $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/ 4.629 + %{l_shtool} install -c -m 640 \ 4.630 + res_fax_digium-%{V_asterisk_fax_digium}-generic_32/*.conf \ 4.631 + $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/ 4.632 + ;; 4.633 + *-* ) 4.634 + echo "Error determining hardware architecture." \ 4.635 + | %{l_rpmtool} msg -b -t warn 4.636 + exit 1; 4.637 + ;; 4.638 + esac 4.639 +%endif 4.640 + 4.641 + ( echo 'Start of sound installation block (RPM)' 4.642 +%if "%{with_esounds}" == "yes" 4.643 + # install freeswitch sound prompt files, expecting 4.644 + # identical sound filenames to be overwritten later 4.645 + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en 4.646 + %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-en-us-callie-48000-%{V_fswitch_sounds_en}.tar.gz 4.647 + subs=`( cd en/us/callie && find * -type d -prune )` 4.648 + for subdir in $subs; do 4.649 + mkdir $subdir 4.650 + mv -f en/us/callie/$subdir/*/* ${subdir}/ 4.651 + done 4.652 + rm -rf en 4.653 + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/es 4.654 + %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-es-mx-maria-44100.tar.gz 4.655 + subs=`( cd es/mx/maria && find * -type d -prune )` 4.656 + for subdir in $subs; do 4.657 + mkdir $subdir 4.658 + mv -f es/mx/maria/$subdir/*/* ${subdir}/ 4.659 + done 4.660 + rm -rf es 4.661 + %{l_shtool} mkdir -f -p -m 755 \ 4.662 + $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ru 4.663 + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ru 4.664 + %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-ru-RU-elena-48000-%{V_fswitch_sounds_ru}.tar.gz 4.665 + subs=`( cd ru/RU/elena && find * -type d -prune )` 4.666 + for subdir in $subs; do 4.667 + mkdir $subdir 4.668 + mv -f ru/RU/elena/$subdir/*/* ${subdir}/ 4.669 + done 4.670 + rm -rf ru 4.671 + 4.672 + # install freeswitch music on hold files 4.673 + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh 4.674 + %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-music-48000-%{V_fswitch_music}.tar.gz 4.675 + mv -f music/48000/* . && rm -rf music 4.676 + 4.677 + # convert freeswitch 48000 and 441000 KHz to 8000 Khz 4.678 + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk 4.679 + for highfile in `find . -name '*.wav'`; do 4.680 + lowfile=`echo $highfile | sed -e 's;\(.*\)\.wav;\1.sln16;'` 4.681 + %{l_prefix}/bin/sox $highfile -t raw -r 16000 -s -2 -c 1 $lowfile 4.682 + rm $highfile 4.683 + done 4.684 +%endif 4.685 + 4.686 + # install australian nonversioned sound prompt files 4.687 + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en_AU 4.688 + %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-en_AU-current.tar.gz 4.689 + 4.690 + # install main sound prompt files 4.691 + #for codec in alaw ulaw g722 g729 gsm; do 4.692 + for lang in en es fr; do 4.693 + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang} 4.694 + %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-${lang}-sln16-%{V_asterisk_sounds_core}.tar.gz 4.695 + done 4.696 + for lang in en fr; do 4.697 + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang} 4.698 + %{l_tar} zxf %{_sourcedir}/asterisk-extra-sounds-${lang}-sln16-%{V_asterisk_sounds_extra}.tar.gz 4.699 + done 4.700 + 4.701 + # install special case sound files 4.702 + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds 4.703 + #%{l_tar} jxf %{SOURCE de-digits-%{V_asterisk_sounds_custom}.tar.bz2} 4.704 + #( cd de && %{l_tar} zxf %{SOURCE asterisk-core-sounds-de-gsm-%{V_asterisk_sounds_amootts}.tar.gz} ) || exit $? 4.705 + #%{l_tar} zxf %{SOURCE asterisk-%{V_asterisk_sounds_amoogab}-de-prompts.tar.gz} 4.706 + #mv -f dictate/de/* de/dictate/ && rm -rf dictate/de 4.707 + #mv -f digits/de/* de/digits/ && rm -rf digits/de 4.708 + #mv -f letters/de/* de/letters/ && rm -rf letters/de 4.709 + #mv -f phonetic/de/* de/phonetic/ && rm -rf phonetic/de 4.710 + %{l_tar} jxf %{SOURCE astmultisnds-de-sln16-%{V_asterisk_sounds_custom}.tar.bz2} 4.711 + %{l_tar} jxf %{SOURCE msvbsnds-sln16-%{V_asterisk_sounds_custom}.tar.bz2} 4.712 + 4.713 + # install additional asterisk music on hold 4.714 + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh 4.715 + %{l_tar} zxf %{_sourcedir}/asterisk-moh-freeplay-sln16.tar.gz 4.716 + %{l_tar} zxf %{_sourcedir}/asterisk-moh-opsound-sln16-%{V_asterisk_sounds_mohop}.tar.gz 4.717 + 4.718 + # correct sound permissions 4.719 + find $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ -type f \ 4.720 + | xargs chmod 644 4.721 + find $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ -type d \ 4.722 + | xargs chmod 755 4.723 + 4.724 + # apply provisional workaround for bug 0016104 4.725 + # https://issues.asterisk.org/view.php?id=16104 4.726 + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds 4.727 + cd en && ln -s vm-INBOX.sln16 vm-Voicemail.sln16 4.728 + cd ../es && ln -s vm-INBOX.sln16 vm-Voicemail.sln16 4.729 + cd ../de && ln -s vm-INBOX.sln16 vm-Voicemail.sln16 4.730 + cd ../fr && ln -s vm-INBOX.sln16 vm-Voicemail.sln16 4.731 + 4.732 +# # install nonstandard voicemail prompts 4.733 +# %{l_shtool} mkdir -f -p -m 755 \ 4.734 +# $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail 4.735 +# %{l_shtool} install -c -m 660 \ 4.736 +# %{_sourcedir}/ansage-%{V_ansage}.wav} \ 4.737 +# $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail.wav 4.738 + ) || exit $? # End of sound installation block (RPM) 4.739 4.740 # strip down installation 4.741 rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/autosupport >/dev/null 2>&1 || true 4.742 rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/safe_asterisk >/dev/null 2>&1 || true 4.743 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/autosupport.8 >/dev/null 2>&1 || true 4.744 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/safe_asterisk.8 >/dev/null 2>&1 || true 4.745 - rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/firmware >/dev/null 2>&1 || true 4.746 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images >/dev/null 2>&1 || true 4.747 - rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/.asterisk* >/dev/null 2>&1 || true 4.748 - rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en/CREDIT* >/dev/null 2>&1 || true 4.749 - rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en/CHANGES* >/dev/null 2>&1 || true 4.750 - rmdir $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/es >/dev/null 2>&1 || true 4.751 - rmdir $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/fr >/dev/null 2>&1 || true 4.752 + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/CREDIT* >/dev/null 2>&1 || true 4.753 + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/CHANGES* >/dev/null 2>&1 || true 4.754 + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/CREDIT* >/dev/null 2>&1 || true 4.755 + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/CHANGES* >/dev/null 2>&1 || true 4.756 4.757 # create additional directories 4.758 %{l_shtool} mkdir -f -p -m 755 \ 4.759 - $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/db 4.760 + $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/db \ 4.761 + $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/lib/licenses \ 4.762 + $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/outgoing 4.763 4.764 - # post-adjust installation 4.765 - strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true 4.766 + # postadjust installation 4.767 + strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* \ 4.768 + $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/* \ 4.769 + $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/* \ 4.770 + >/dev/null 2>&1 || true 4.771 mv $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin \ 4.772 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin 4.773 + 4.774 + # install AGI progs 4.775 + ( cd agi 4.776 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 4.777 + DialAnMp3.agi fastagi-test numeralize %{SOURCE wakeup.agi} \ 4.778 + $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/ 4.779 + ) || exit $? 4.780 for bin in $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/*.*; do 4.781 mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'` 4.782 done 4.783 @@ -444,7 +775,7 @@ 4.784 $name $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/ 4.785 done 4.786 4.787 - # install run-command script 4.788 + # install runcommand script 4.789 %{l_shtool} mkdir -f -p -m 755 \ 4.790 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d 4.791 %{l_shtool} install -c -m 755 %{l_value -s -a} \ 4.792 @@ -453,12 +784,18 @@ 4.793 # determine installation files 4.794 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 4.795 %{l_files_std} \ 4.796 + '%config %{l_prefix}/var/asterisk/lib/licenses' \ 4.797 '%config %attr(640,%{l_mgrp},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \ 4.798 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk' 4.799 4.800 +# '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/es/vm-Voicemail.sln16' \ 4.801 +# '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/de/vm-Voicemail.sln16' \ 4.802 +# '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/fr/vm-Voicemail.sln16' \ 4.803 + 4.804 %files -f files 4.805 4.806 %clean 4.807 + rm -rf $RPM_BUILD_ROOT 4.808 4.809 %post 4.810 %if "%{with_dahdi}" == "yes" 4.811 @@ -495,6 +832,16 @@ 4.812 ) || exit $? 4.813 fi 4.814 %endif 4.815 +%if "%{with_fax}" == "yes" 4.816 + ( echo "Asterisk has been installed with proprietary Digium fax support." 4.817 + echo "The responsible module is called res_fax_digium and requires a" 4.818 + echo "valid license. The license must be found in the directory" 4.819 + echo "'licenses' which in turn must be found in $prefix/var/asterisk/lib" 4.820 + echo "or wherever astvarlibdir has been configured in 'asterisk.conf'." 4.821 + echo "" 4.822 + echo "Please see http://downloads.digium.com/pub/telephony/fax/ for information." 4.823 + ) | %{l_rpmtool} msg -b -t notice 4.824 +%endif 4.825 # after upgrade, restart service 4.826 [ $1 -eq 2 ] || exit 0 4.827 eval `%{l_rc} asterisk status 2>/dev/null` 4.828 @@ -509,6 +856,7 @@ 4.829 rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/cdr-*/* >/dev/null 2>&1 || true 4.830 rm -f $RPM_INSTALL_PREFIX/var/asterisk/run/* >/dev/null 2>&1 || true 4.831 rm -f $RPM_INSTALL_PREFIX/var/asterisk/spool/*/* >/dev/null 2>&1 || true 4.832 + rm -f $RPM_INSTALL_PREFIX/var/asterisk/lib/* >/dev/null 2>&1 || true 4.833 rm -f $RPM_INSTALL_PREFIX/var/asterisk/db/* >/dev/null 2>&1 || true 4.834 %if "%{with_odbc}" == "yes" 4.835 # before erase, optionally unlink from ODBC and destroy database
5.1 --- a/asterisk/asterisk.txt Sun Mar 20 20:00:02 2011 +0100 5.2 +++ b/asterisk/asterisk.txt Sun Mar 20 20:03:11 2011 +0100 5.3 @@ -105,7 +105,7 @@ 5.4 bindaddr = 127.0.0.1 5.5 bindport = 8088 5.6 sslenable = no 5.7 -slbindport = 8089 5.8 +sslbindport = 8089 5.9 sslbindaddr = 127.0.0.1 5.10 sslcert = @l_prefix@/etc/asterisk/asterisk.pem 5.11 enablestatic = yes 5.12 @@ -232,6 +232,58 @@ 5.13 rtpend = 7089 5.14 5.15 </file> 5.16 +<file name="sip_notify.conf"> 5.17 +;; 5.18 +;; sip_notify.conf -- Asterisk NOTIFY automation from command line 5.19 +;; 5.20 + 5.21 +; rfc3842 5.22 +; put empty "Content=>" at the end to have CRLF after last body line 5.23 +[clear-mwi] 5.24 +Event=>message-summary 5.25 +Content-type=>application/simple-message-summary 5.26 +Content=>Messages-Waiting: no 5.27 +Content=>Message-Account: sip:asterisk@127.0.0.1 5.28 +Content=>Voice-Message: 0/0 (0/0) 5.29 +Content=> 5.30 + 5.31 +; Aastra 5.32 +[aastra-check-cfg] 5.33 +Event=>check-sync 5.34 + 5.35 +[aastra-xml] 5.36 +Event=>aastra-xml 5.37 + 5.38 +; Linksys 5.39 +[linksys-cold-restart] 5.40 +Event=>reboot_now 5.41 + 5.42 +[linksys-warm-restart] 5.43 +Event=>restart_now 5.44 + 5.45 +; Polycom 5.46 +[polycom-check-cfg] 5.47 +Event=>check-sync 5.48 + 5.49 +; Sipura 5.50 +[sipura-check-cfg] 5.51 +Event=>resync 5.52 + 5.53 +[sipura-get-report] 5.54 +Event=>report 5.55 + 5.56 +; Snom 5.57 +[snom-check-cfg] 5.58 +Event=>check-sync\;reboot=false 5.59 + 5.60 +[snom-reboot] 5.61 +Event=>reboot 5.62 + 5.63 +; Cisco 5.64 +[cisco-check-cfg] 5.65 +Event=>check-sync 5.66 + 5.67 +</file> 5.68 <file name="extensions.conf"> 5.69 ;; 5.70 ;; extensions.conf -- Asterisk inbound & outbound call configuration
6.1 --- a/asterisk/rc.asterisk Sun Mar 20 20:00:02 2011 +0100 6.2 +++ b/asterisk/rc.asterisk Sun Mar 20 20:03:11 2011 +0100 6.3 @@ -31,15 +31,15 @@ 6.4 %stop -u @l_susr@ 6.5 rcService asterisk enable yes || exit 0 6.6 rcService asterisk active no && exit 0 6.7 - ( @l_prefix@/sbin/asterisk -rx "stop gracefully" & 6.8 + ( @l_prefix@/sbin/asterisk -rx "core stop gracefully" & 6.9 sleep 2 6.10 - @l_prefix@/sbin/asterisk -rx "stop now" & 6.11 + @l_prefix@/sbin/asterisk -rx "core stop now" & 6.12 ) >/dev/null 2>&1 || true 6.13 6.14 %restart -u @l_susr@ 6.15 rcService asterisk enable yes || exit 0 6.16 rcService asterisk active no && exit 0 6.17 - rc asterisk stop start 6.18 + @l_prefix@/sbin/asterisk -rx "core restart now" 6.19 6.20 %reload -u @l_susr@ 6.21 rcService asterisk enable yes || exit 0
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/asterisk/wakeup.agi Sun Mar 20 20:03:11 2011 +0100 7.3 @@ -0,0 +1,733 @@ 7.4 +#! @l_prefix@/bin/perl 7.5 +# 7.6 +# wakeup.agi 1.1 7.7 +# 7.8 +# A wakeup agi script for Asterisk 7.9 +# 7.10 +# Copyright (C) 2007 7.11 +# 7.12 +# Jonas Arndt <jonas_arndt@comcast.net> 7.13 +# 7.14 +# This program is free software, distributed under the terms of the 7.15 +# GNU General Public License v2. 7.16 +# 7.17 +# 7.18 +# This program is free software: you can redistribute it and/or modify 7.19 +# it under the terms of the GNU General Public License as published by 7.20 +# the Free Software Foundation, either version 3 of the License, or 7.21 +# (at your option) any later version. 7.22 +# 7.23 +# This program is distributed in the hope that it will be useful, 7.24 +# but WITHOUT ANY WARRANTY; without even the implied warranty of 7.25 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 7.26 +# GNU General Public License for more details. 7.27 +# 7.28 +# You should have received a copy of the GNU General Public License 7.29 +# along with this program. If not, see <http://www.gnu.org/licenses/>. 7.30 +# 7.31 + 7.32 +use strict; 7.33 +use Time::Local; 7.34 +$|=1; 7.35 +# Setup some variables 7.36 +my %AGI; my $DEBUG=0; 7.37 +# Some constants 7.38 +my $OUTDIR="@l_prefix@/var/asterisk/spool/outgoing"; 7.39 +my $WAKEDIR="@l_prefix@/var/asterisk/spool/tmp"; 7.40 +my $debugfile="@l_prefix@/var/asterisk/spool/tmp/wakeup.log"; 7.41 +my $DEBUGOUT = "filehandle"; 7.42 +my $CALL = "filehandle"; 7.43 +my $TOUCH = "/usr/bin/touch"; 7.44 + 7.45 +############ check_result ########## 7.46 +# Use this to check the result of # 7.47 +# a sent command # 7.48 +# I pretty much stole this from # 7.49 +# the regular agi-test.agi # 7.50 +#################################### 7.51 +sub checkresult { 7.52 + my ($res) = @_; 7.53 + my $retval; 7.54 + chomp $res; 7.55 + if ($res =~ /^200/) { 7.56 + $res =~ /result=(-?\d+)/; 7.57 + if (!length($1)) { 7.58 + print DEBUGOUT "FAIL ($res)\n"; 7.59 + exit(1); 7.60 + } elsif ($DEBUG=1) { 7.61 + print DEBUGOUT "PASS ($1)\n"; 7.62 + } 7.63 + } else { 7.64 + print STDERR "FAIL (unexpected result '$res')\n"; 7.65 + exit(1); 7.66 + } 7.67 +} 7.68 + 7.69 + 7.70 +############ send_file ############# 7.71 +# Use this to send a wave file on # 7.72 +# the channel # 7.73 +# # 7.74 +#################################### 7.75 +sub send_file { 7.76 + my ($myfile) = @_; 7.77 + chomp($myfile); 7.78 + if ($DEBUG == 1 ) { 7.79 + print DEBUGOUT "Sending stream $myfile \n"; 7.80 + } 7.81 + print "STREAM FILE $myfile \"0123456789\"\n"; 7.82 + my $result = <STDIN>; 7.83 + &checkresult($result); 7.84 + $result =~ /result=(-?\d+)/; 7.85 + return $1; 7.86 +} 7.87 + 7.88 +############ hangup ############### 7.89 +# Use this to hand up a channel # 7.90 +# the channel # 7.91 +# # 7.92 +#################################### 7.93 +sub hangup { 7.94 + if ($DEBUG == 1 ) { 7.95 + print DEBUGOUT "Hanging up \n"; 7.96 + } 7.97 + print "HANGUP \"\" \n"; 7.98 + my $result = <STDIN>; 7.99 + &checkresult($result); 7.100 +} 7.101 + 7.102 +############ say_number ############ 7.103 +# Use this to say a number # 7.104 +# over the channel # 7.105 +# # 7.106 +#################################### 7.107 +sub say_number { 7.108 + my ($mynumber) = @_; 7.109 + chomp($mynumber); 7.110 + if ($DEBUG == 1 ) { 7.111 + print DEBUGOUT "Saying number $mynumber \n"; 7.112 + } 7.113 + print "SAY NUMBER $mynumber \"0123456789\"\n"; 7.114 + my $result = <STDIN>; 7.115 + &checkresult($result); 7.116 + $result =~ /result=(-?\d+)/; 7.117 + return $1; 7.118 +} 7.119 + 7.120 +############ say_digits ############ 7.121 +# Use this to say a digits # 7.122 +# over the channel # 7.123 +# # 7.124 +#################################### 7.125 +sub say_digits { 7.126 + my ($mynumber) = @_; 7.127 + chomp($mynumber); 7.128 + if ($DEBUG == 1 ) { 7.129 + print DEBUGOUT "Saying digits $mynumber \n"; 7.130 + } 7.131 + print "SAY DIGITS $mynumber \"0123456789\"\n"; 7.132 + my $result = <STDIN>; 7.133 + &checkresult($result); 7.134 +} 7.135 + 7.136 +############ get_choice ############ 7.137 +# Use this to receive a DTMF # 7.138 +# choice from the channel # 7.139 +# # 7.140 +#################################### 7.141 +sub get_choice { 7.142 + if ($DEBUG == 1 ) { 7.143 + print DEBUGOUT "Getting choice \n"; 7.144 + } 7.145 + print "WAIT FOR DIGIT 15000\n"; 7.146 + my $result = <STDIN>; 7.147 + &checkresult($result); 7.148 + $result =~ /result=(-?\d+)/; 7.149 + return $1; 7.150 +} 7.151 + 7.152 +############ answer ############### 7.153 +# Anser the channel # 7.154 +# # 7.155 +#################################### 7.156 +sub answer { 7.157 + if ($DEBUG == 1 ) { 7.158 + print DEBUGOUT "Answering the channel \n"; 7.159 + } 7.160 + print "ANSWER\n"; 7.161 + my $result = <STDIN>; 7.162 + &checkresult($result); 7.163 + $result =~ /result=(-?\d+)/; 7.164 + return $1; 7.165 +} 7.166 + 7.167 +######## get_data ################## 7.168 +# Feed with (file, maxnumbers) # 7.169 +# where file is the sound file # 7.170 +# to be played and maxnumbers is # 7.171 +# the maximum amount of digits to # 7.172 +# allow in the answer # 7.173 +#################################### 7.174 +sub get_data { 7.175 + my @mydata = @_; 7.176 + my $myfile = $mydata[0]; 7.177 + my $mymax = $mydata[1]; 7.178 + if ($DEBUG == 1 ) { 7.179 + print DEBUGOUT "Getting data \n"; 7.180 + } 7.181 + print "GET DATA $myfile 15000 $mymax \n"; 7.182 + my $result = <STDIN>; 7.183 + &checkresult($result); 7.184 + $result =~ /result=(-?\d+)/; 7.185 + return $1; 7.186 +} 7.187 + 7.188 +###### check_outstanding_calls ##### 7.189 +# Are there any outstanding wakeup # 7.190 +# calls for this extensions? # 7.191 +# Pass the extension to the # 7.192 +# function. The function returns # 7.193 +# a list of files # 7.194 +#################################### 7.195 +sub check_outstanding_calls { 7.196 + my $myext = @_; 7.197 + #opendir DIR, $WAKEDIR; 7.198 + opendir DIR, $OUTDIR; 7.199 + my @files = grep {/$myext/} readdir(DIR); 7.200 + closedir DIR; 7.201 + return @files; 7.202 +} 7.203 + 7.204 +######## get_extension ############# 7.205 +# Receive the AIG variable and # 7.206 +# return the extension # 7.207 +#################################### 7.208 +sub get_extension { 7.209 + my (@aig) = @_; 7.210 + if ($aig[11] == '') { 7.211 + print STDERR "No extension found in function get_exension \n"; 7.212 + return "FAIL"; 7.213 + } 7.214 + my $myext = $aig[11]; 7.215 + return $myext; 7.216 +} 7.217 + 7.218 +######## get_context ############### 7.219 +# Receive the AIG variable and # 7.220 +# return the context # 7.221 +#################################### 7.222 +sub get_context { 7.223 + my (@aig) = @_; 7.224 + if ($aig[8] == '') { 7.225 + print STDERR "No extension found in function get_exension \n"; 7.226 + return "FAIL"; 7.227 + } 7.228 + my $mycont = $aig[8]; 7.229 + return $mycont; 7.230 +} 7.231 + 7.232 +########### get_clid ############### 7.233 +# Receive the AIG variable and # 7.234 +# return the clid # 7.235 +#################################### 7.236 +sub get_clid { 7.237 + my (@aig) = @_; 7.238 + if ($aig[1] == '') { 7.239 + print STDERR "No clid found in function get_clid \n"; 7.240 + return "FAIL"; 7.241 + } 7.242 + my $myext = $aig[1]; 7.243 + return $myext; 7.244 +} 7.245 +########### init_agi ############### 7.246 +# Use this to initialize the AGI # 7.247 +# variable # 7.248 +# # 7.249 +#################################### 7.250 +sub init_agi { 7.251 + while(<STDIN>) { 7.252 + chomp; 7.253 + last unless length($_); 7.254 + if (/^agi_(\w+)\:\s+(.*)$/) { 7.255 + $AGI{$1} = $2; 7.256 + } 7.257 + } 7.258 +} 7.259 + 7.260 +############ ascii2num ############# 7.261 +# Removes 48 to get a number out # 7.262 +# of the asciss return # 7.263 +#################################### 7.264 +sub ascii2num { 7.265 + my ($asc) = @_; 7.266 + my $ret; 7.267 + $ret = $asc - 48; 7.268 + return $ret; 7.269 +} 7.270 + 7.271 + 7.272 +########### Welcome ############### 7.273 +# This is the welcome menu # 7.274 +# # 7.275 +#################################### 7.276 +sub welcome { 7.277 + my $ret = 0; 7.278 + $ret = &send_file("welcome"); 7.279 + if ($ret == 0) { 7.280 + $ret = &send_file("for-wakeup-call"); 7.281 + } 7.282 + if ($ret == 0) { 7.283 + $ret = &send_file("press-1"); 7.284 + } 7.285 + if ($ret == 0) { 7.286 + $ret = &send_file("for-a-list-of"); 7.287 + } 7.288 + if ($ret == 0) { 7.289 + $ret = &send_file("or"); 7.290 + } 7.291 + if ($ret == 0) { 7.292 + $ret = &send_file("to-cancel-wakeup"); 7.293 + } 7.294 + if ($ret != 0) { 7.295 + $ret = &ascii2num($ret); 7.296 + } 7.297 + if ($ret == 0) { 7.298 + $ret = &get_data("press-2",1); 7.299 + } 7.300 + if ($ret == 1) { 7.301 + $ret = &schedule_new(); 7.302 + } elsif ($ret == 2) { 7.303 + &manage_calls(); 7.304 + } else { 7.305 + $ret = &send_file("goodbye"); 7.306 + } 7.307 +} 7.308 + 7.309 +######### manage_calls ############# 7.310 +# This is what is called if you # 7.311 +# want to manage already scheduled # 7.312 +# wakeup calls # 7.313 +#################################### 7.314 + 7.315 +sub manage_calls { 7.316 + my $checker = "false"; 7.317 + my @calls; 7.318 + my $del; 7.319 + #my $ret; 7.320 + my $hours; 7.321 + my $minutes; 7.322 + # Send out a welcome message and ask for return 7.323 + @calls = &check_outstanding_calls($AGI{callerid}); 7.324 + if ($#calls + 1 == 0) { 7.325 + $del = &send_file("not-rqsted-wakeup"); 7.326 + $del = &send_file("goodbye"); 7.327 + } else { 7.328 + foreach (@calls) { 7.329 + $del = 0; 7.330 + my $wakefile = $_; 7.331 + my @wakeup = split /\./, $_; 7.332 + my $time = $wakeup[0]; 7.333 + $_ = $time; 7.334 + /(^[0-9][0-9])/; 7.335 + my $hours = $1; 7.336 + /^[0-9][0-9]([0-9][0-9])/; 7.337 + my $minutes = $1; 7.338 + $del = &send_file("rqsted-wakeup-for"); 7.339 + if ($del == 0) { 7.340 + $del = &say_number($hours); 7.341 + } 7.342 + if ($del == 0) { 7.343 + if ($minutes >= 10 ) { 7.344 + $del = &say_number($minutes); 7.345 + } elsif ($minutes > 0 && $minutes < 10) { 7.346 + $del = &send_file("digits/oh"); 7.347 + $del = &say_number($minutes); 7.348 + } 7.349 + } 7.350 + if ($del == 0) { 7.351 + $del = &send_file("digits/oclock"); 7.352 + } 7.353 + if ($del == 0) { 7.354 + $del = &send_file("to-cancel-wakeup"); 7.355 + } 7.356 + if ($del == 0) { 7.357 + $del = &send_file("press-1"); 7.358 + } 7.359 + if ($del == 0) { 7.360 + $del = &send_file("otherwise-press"); 7.361 + } 7.362 + if ($del != 0) { 7.363 + $del = &ascii2num($del); 7.364 + } 7.365 + if ($del == 0) { 7.366 + $del = &get_data("digits/2",1); 7.367 + } 7.368 + if ($del == 1) { 7.369 + my @sysargs = ("rm", "-f", "$WAKEDIR/$wakefile", "$OUTDIR/$wakefile"); 7.370 + system(@sysargs) == 0 7.371 + or die "system @sysargs failed: $?"; 7.372 + $del = &send_file("cancelled"); 7.373 + } 7.374 + } 7.375 + $del = &send_file("goodbye"); 7.376 + } 7.377 + 7.378 +} 7.379 + 7.380 +######## schedule_new ############## 7.381 +# This is the menu to schedule a # 7.382 +# a new wakeup call # 7.383 +#################################### 7.384 +sub schedule_new { 7.385 + my $checker = "false"; 7.386 + my $ret_var; 7.387 + my $ret_dummy = 0; 7.388 + my $time; 7.389 + my $perm; 7.390 + my $file; 7.391 + my $calltype; 7.392 + my $extension; 7.393 + my $context; 7.394 + my $hours; 7.395 + my $minutes; 7.396 + if ($DEBUG == 1 ) { 7.397 + print DEBUGOUT "From schedule_new\n"; 7.398 + } 7.399 + while ( $checker eq "false" ) { 7.400 + $ret_var = &send_file("to-rqst-wakeup-call"); 7.401 + if ($ret_var != 0) { 7.402 + my $tmp = &get_data("silence/1",3); 7.403 + $ret_var = &ascii2num($ret_var); 7.404 + $ret_var = $ret_var . $tmp; 7.405 + } else { 7.406 + $ret_var = &get_data("enter-a-time",4); 7.407 + } 7.408 +# if ($ret_var < 1300 && $ret_var >= 0100) { 7.409 +# my $pm = &get_data("1-for-am-2-for-pm",1); 7.410 +# if ($pm == 2 && $ret_var <= 1159) { 7.411 +# $ret_var = $ret_var + 1200; 7.412 +# $checker = "true"; 7.413 +# } elsif ($pm == 1 && $ret_var > 1159) { 7.414 +# $ret_var = $ret_var - 1200; 7.415 +# # Fix the zero 7.416 +# $ret_var = "00" . $ret_var; 7.417 +# $checker = "true"; 7.418 +# } else { 7.419 +# $checker = "true"; 7.420 +# } 7.421 +# } elsif ($ret_var > 2359) { 7.422 +# $ret_dummy = &send_file("please-try-again"); 7.423 +# } else { 7.424 +# $checker = "true"; 7.425 +# } 7.426 + if ($ret_var > 2359) { 7.427 + $ret_dummy = &send_file("please-try-again"); 7.428 + } else { 7.429 + $checker = "true"; 7.430 + } 7.431 + } 7.432 + $perm = 0; 7.433 + $perm = &send_file("wakeup-for-one-time"); 7.434 + if ($perm == 0) { 7.435 + $perm = &send_file("press-1"); 7.436 + } 7.437 + if ($perm == 0) { 7.438 + $perm = &send_file("for-a-daily-wakeup-call"); 7.439 + } 7.440 + if ($perm != 0) { 7.441 + $perm = &ascii2num($perm); 7.442 + } 7.443 + if ($perm == 0) { 7.444 + $perm = $perm = &get_data("press-2",1); 7.445 + } 7.446 + # Open the file and populate it with data 7.447 + $extension = $AGI{callerid}; 7.448 + $context = $AGI{context}; 7.449 + if ($perm == 2) { 7.450 + $file = "$WAKEDIR/$ret_var.perm.1.$extension.call"; 7.451 + $calltype = "perm"; 7.452 + open (CALL, '>', $file) or die "Cannot open call file for write :$!"; 7.453 + } else { 7.454 + $file = "$WAKEDIR/$ret_var.temp.1.$extension.call"; 7.455 + $calltype = "temp"; 7.456 + open (CALL, '>', $file) or die "Cannot open call file for write :$!"; 7.457 + } 7.458 + my $myprint = "channel: Local" . "/" . $extension . "@" . $context . "\n"; 7.459 + print CALL $myprint; 7.460 + print CALL "maxretries: 3\n"; 7.461 + print CALL "retrytime: 60\n"; 7.462 + print CALL "waittime: 60\n"; 7.463 + print CALL "callerid: \"AsterPBX Weckruf\" <$AGI{extension}>\n"; 7.464 + print CALL "application: AGI\n"; 7.465 + print CALL "data: wakeup|$ret_var.$calltype.1.$extension.call\n"; 7.466 + close ($CALL); 7.467 + # Now touch the file 7.468 + # Get the time variable 7.469 + $time = get_time_string($ret_var); 7.470 + my @command = ("$TOUCH", "-t", "$time", "${file}"); 7.471 + system(@command) == 0 7.472 + or die "system @command failed: $?"; 7.473 + # Move it to the OUT directory 7.474 + my @command = ("mv", "${file}", "${OUTDIR}/"); 7.475 + system(@command) == 0 7.476 + or die "system @command failed: $?"; 7.477 + 7.478 + # Stream out the wakeup 7.479 + $_ = $ret_var; 7.480 + /(^[0-9][0-9])/; 7.481 + my $hours = $1; 7.482 + /^[0-9][0-9]([0-9][0-9])/; 7.483 + my $minutes = $1; 7.484 + $ret_dummy = &send_file("rqsted-wakeup-for"); 7.485 + $ret_dummy = &say_number($hours); 7.486 + if ($minutes >= 10 ) { 7.487 + &say_number($minutes); 7.488 + } elsif ($minutes > 0 && $minutes < 10) { 7.489 + &send_file("digits/oh"); 7.490 + &say_number($minutes); 7.491 + } 7.492 + $ret_dummy = &send_file("digits/oclock"); 7.493 + $ret_dummy = &send_file("goodbye"); 7.494 + return $ret_var; 7.495 +} 7.496 + 7.497 +######## get_time_string ########### 7.498 +# This will return the time string # 7.499 +# when inputing a string like # 7.500 +# hhmi # 7.501 +#################################### 7.502 +sub get_time_string { 7.503 + my ($intime) = @_; 7.504 + my $minutes = substr($intime, 2, 4); 7.505 + my $hours = substr($intime, 0, 2); 7.506 + my $tmpepoch; 7.507 + my $day; 7.508 + my $month; 7.509 + my $ret_val; 7.510 + my $epoch = time(); 7.511 + my @timedata = localtime($epoch); 7.512 + # Insert the minutes and hours from input 7.513 + $timedata[1] = $minutes; 7.514 + $timedata[2] = $hours; 7.515 + # Get tmpepoch 7.516 + $tmpepoch = timelocal(@timedata); 7.517 + #Now compare them 7.518 + if ($tmpepoch < $epoch) { # Means it is tomorrow 7.519 + $tmpepoch += 86400; # Add 24 hours 7.520 + } 7.521 + # Now get the new timedata 7.522 + my @timedata = localtime($tmpepoch); 7.523 + $minutes = $timedata[1]; 7.524 + $hours = $timedata[2]; 7.525 + $day = $timedata[3]; 7.526 + $month = $timedata[4] + 1; 7.527 + #Correct the "First hour after midnight" problem 7.528 + if ($minutes < 10) { 7.529 + $minutes = "0" . $minutes; 7.530 + } 7.531 + if ($hours < 10) { 7.532 + $hours = "0" . $hours; 7.533 + } 7.534 + if ($day < 10) { 7.535 + $day = "0" . $day; 7.536 + } 7.537 + if ($month < 10) { 7.538 + $month = "0" . $month; 7.539 + } 7.540 + $ret_val = $month . $day . $hours . $minutes; 7.541 + return $ret_val; 7.542 +} 7.543 + 7.544 +############ new_time ############## 7.545 +# This will return the time string # 7.546 +# with a time set 10 minute into # 7.547 +# the future # 7.548 +# The string is # 7.549 +# MMDDhhmi # 7.550 +#################################### 7.551 +sub new_time { 7.552 + my ($input) = @_; 7.553 + my @timedata; 7.554 + my $minutes; 7.555 + my $hours; 7.556 + my $day; 7.557 + my $month; 7.558 + my $ret_val; 7.559 + my $epoc = time(); 7.560 + if ($input eq "10m") { 7.561 + # add 10 minutes 7.562 + $epoc += 600; 7.563 + #$epoc += 120; #just for debugs 7.564 + } else { 7.565 + # add 24 hours 7.566 + $epoc += 86400; 7.567 + } 7.568 + @timedata = localtime($epoc); 7.569 + $minutes = $timedata[1]; 7.570 + $hours = $timedata[2]; 7.571 + $day = $timedata[3]; 7.572 + $month = $timedata[4] + 1; 7.573 + #Correct the "First hour after midnight" problem 7.574 + if ($minutes < 10) { 7.575 + $minutes = "0" . $minutes; 7.576 + } 7.577 + if ($hours < 10) { 7.578 + $hours = "0" . $hours; 7.579 + } 7.580 + if ($day < 10) { 7.581 + $day = "0" . $day; 7.582 + } 7.583 + if ($month < 10) { 7.584 + $month = "0" . $month; 7.585 + } 7.586 + $ret_val = $month . $day . $hours . $minutes; 7.587 + return $ret_val; 7.588 +} 7.589 + 7.590 +########### snooze ################ 7.591 +# This is the menu to snooze the # 7.592 +# wakeup call # 7.593 +#################################### 7.594 +sub snooze { 7.595 + my ($oldfile) = @_; 7.596 + my $newfile; 7.597 + my $extension; 7.598 + my $context; 7.599 + my @filestore = split (/\./, $oldfile); 7.600 + my @permstore = split (/\./, $oldfile); 7.601 + my $time; 7.602 + my $ret_var = 0; 7.603 + my $ret_dummy; 7.604 + my $myprint; 7.605 + # Answer the channel 7.606 + &answer(); 7.607 + # Is this a reoccuring call, then add 24h 7.608 + if ($permstore[1] eq "perm") { 7.609 + $permstore[2] += 1; #Just to get a new file name 7.610 + $newfile = join(".",@permstore); 7.611 + $extension = $AGI{extension}; 7.612 + $context = $AGI{context}; 7.613 + # Open the file 7.614 + open (CALL, '>', "${WAKEDIR}/${newfile}") or die "Cannot open call file for write :$!"; 7.615 + $myprint = "channel: Local" . "/" . $extension . "@" . $context . "\n"; 7.616 + print CALL $myprint; 7.617 + print CALL "maxretries: 3\n"; 7.618 + print CALL "retrytime: 60\n"; 7.619 + print CALL "waittime: 60\n"; 7.620 + print CALL "callerid: \"AsterPBX Weckruf\" <$AGI{callerid}>\n"; 7.621 + print CALL "application: AGI\n"; 7.622 + print CALL "data: wakeup|$newfile\n"; 7.623 + close ($CALL); 7.624 + # Get a time 24h from now 7.625 + $time = &new_time("24h"); 7.626 + # Touch the file with the new time 7.627 + my @command = ("$TOUCH", "-t", "$time", "${WAKEDIR}/${newfile}"); 7.628 + system(@command) == 0 7.629 + or die "system @command failed: $?"; 7.630 + # Now move it 7.631 + my @command = ("mv", "${WAKEDIR}/${newfile}", "${OUTDIR}/${newfile}"); 7.632 + system(@command) == 0 7.633 + or die "system @command failed: $?"; 7.634 + } 7.635 + #Replace the file name time with snooze 7.636 + $filestore[1] = "snooze"; 7.637 + # Also add 10 minutes to the name 7.638 + $time = new_time("10m"); 7.639 + $filestore[0] = substr($time, 4, 8); 7.640 + # Get the new file name 7.641 + $newfile = join(".",@filestore); 7.642 + $ret_var = &send_file("this-is-yr-wakeup-call"); 7.643 + if ($ret_var == 0 ) { 7.644 + $ret_var = &send_file("to-confirm-wakeup"); 7.645 + } 7.646 + if ($ret_var == 0 ) { 7.647 + $ret_var = &send_file("press-1"); 7.648 + } 7.649 + if ($ret_var == 0 ) { 7.650 + $ret_var = &send_file("to-snooze-for"); 7.651 + } 7.652 + if ($ret_var == 0 ) { 7.653 + $ret_var = &send_file("digits/10"); 7.654 + } 7.655 + if ($ret_var == 0 ) { 7.656 + $ret_var = &send_file("minutes"); 7.657 + } 7.658 + if ($ret_var != 0 ) { 7.659 + $ret_var = &ascii2num($ret_var); 7.660 + } 7.661 + if ($ret_var == 0 ) { 7.662 + $ret_var = &get_data("press-2",1); 7.663 + } 7.664 + if ($ret_var == 2 ) { 7.665 + # Populate some variables 7.666 + $time = &new_time("10m"); 7.667 + $extension = $AGI{extension}; 7.668 + $context = $AGI{context}; 7.669 + # Open the file 7.670 + open (CALL, '>', "${WAKEDIR}/${newfile}") or die "Cannot open call file for write :$!"; 7.671 + $myprint = "channel: Local" . "/" . $extension . "@" . $context . "\n"; 7.672 + print CALL $myprint; 7.673 + print CALL "maxretries: 3\n"; 7.674 + print CALL "retrytime: 60\n"; 7.675 + print CALL "waittime: 60\n"; 7.676 + print CALL "callerid: \"AsterPBX Weckruf\" <$AGI{callerid}>\n"; 7.677 + print CALL "application: AGI\n"; 7.678 + print CALL "data: wakeup|$newfile\n"; 7.679 + close ($CALL); 7.680 + # Touch the file with the new time 7.681 + my @command = ("$TOUCH", "-t", "$time", "${WAKEDIR}/${newfile}"); 7.682 + system(@command) == 0 7.683 + or die "system @command failed: $?"; 7.684 + # Now move it 7.685 + my @command = ("mv", "${WAKEDIR}/${newfile}", "${OUTDIR}/${newfile}"); 7.686 + system(@command) == 0 7.687 + or die "system @command failed: $?"; 7.688 + $ret_dummy = &send_file("goodbye"); 7.689 + 7.690 + } elsif ($ret_var == 1) { 7.691 + $ret_dummy = &send_file("goodbye"); 7.692 + } else { 7.693 + $ret_dummy = &send_file("goodbye"); 7.694 + } 7.695 + 7.696 + # Stream out the wakeup 7.697 + return 0; 7.698 +} 7.699 + 7.700 +########### main program ########### 7.701 +# Here goes the main program # 7.702 +# # 7.703 +#################################### 7.704 + 7.705 +my $numargs = $#ARGV + 1; 7.706 +if ($DEBUG == 1) { 7.707 + open (DEBUGOUT, '>', $debugfile) or die "Cannot open $debugfile for write :$!"; 7.708 +} 7.709 + 7.710 +# Start by reading in the stuff Asterisk is sending 7.711 +&init_agi(); # Comment out in case of debug outside Asterisk 7.712 + 7.713 +# If DEBUG is set, dump the AGI variable 7.714 +if ($DEBUG == 1) { 7.715 + foreach my $i (sort keys %AGI) { 7.716 + print DEBUGOUT " -- $i = $AGI{$i}\n"; 7.717 + } 7.718 +} 7.719 + 7.720 +if ( $numargs == 0 ) { 7.721 + &welcome(); 7.722 + &hangup(); 7.723 + exit(0); 7.724 +} elsif ( $ARGV[0] eq "move" ) { 7.725 + &move(); 7.726 + &hangup(); 7.727 + exit(0); 7.728 +} else { 7.729 + &snooze($ARGV[0]); 7.730 + &hangup(); 7.731 + exit(0); 7.732 +} 7.733 + 7.734 +if ($DEBUG ==1) { 7.735 + close $DEBUGOUT; 7.736 +}