Merge NetBSD and Courtesty tone with modifications (bug #2329)
authorMark Spencer <markster@digium.com>
Tue, 31 Aug 2004 13:32:11 +0000 (13:32 +0000)
committerMark Spencer <markster@digium.com>
Tue, 31 Aug 2004 13:32:11 +0000 (13:32 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3686 65c4cc65-6c06-0410-ace0-fbb531ad65f3

12 files changed:
Makefile
aesopt.h
apps/app_sms.c
asterisk.c
channels/Makefile
channels/chan_oss.c
channels/h323/Makefile
codecs/lpc10/lpc10.h
db1-ast/include/db.h
md5.c
res/res_features.c
utils.c

index 96c6c20..c922957 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -137,6 +137,11 @@ INCLUDE+=-I/usr/local/include
 CFLAGS+=$(shell if [ -d /usr/local/include/spandsp ]; then echo "-I/usr/local/include/spandsp"; fi)
 endif # FreeBSD
 
+ifeq (${OSARCH},NetBSD)
+CFLAGS+=-pthread
+INCLUDE+=-I/usr/local/include
+endif
+
 ifeq (${OSARCH},OpenBSD)
 CFLAGS+=-pthread
 endif
@@ -184,6 +189,9 @@ endif
 ifeq (${OSARCH},FreeBSD)
 LIBS+=-lcrypto
 endif
+ifeq (${OSARCH},NetBSD)
+LIBS+=-lpthread -lcrypto -lm -L/usr/local/lib -lncurses
+endif
 ifeq (${OSARCH},OpenBSD)
 LIBS=-lcrypto -lpthread -lm -lncurses
 endif
@@ -510,7 +518,6 @@ mpg123:
        [ -f mpg123-0.59r.tar.gz ] || wget http://www.mpg123.de/mpg123/mpg123-0.59r.tar.gz
        [ -d mpg123-0.59r ] || tar xfz mpg123-0.59r.tar.gz
        make -C mpg123-0.59r linux
-       
 
 config:
        if [ -d /etc/rc.d/init.d ]; then \
index 571b7c4..94e3e47 100755 (executable)
--- a/aesopt.h
+++ b/aesopt.h
 #if defined( __OpenBSD__ )
 #  include <machine/types.h>
 #  include <sys/endian.h>
-#elif defined( __FreeBSD__ )
+#elif defined( __FreeBSD__ ) || defined( __NetBSD__ )
 #  include <sys/types.h>
 #  include <sys/endian.h>
 #elif defined( BSD ) && ( BSD >= 199103 ) || defined(__APPLE__)
index 0f23ebc..a7b55bd 100755 (executable)
@@ -203,7 +203,7 @@ static void
 packdate (unsigned char *o, time_t w)
 {
   struct tm *t = localtime (&w);
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined( __NetBSD__ ) || defined(__APPLE__)
   int z = - t->tm_gmtoff / 3600 / 15;
 #else
   int z = timezone / 3600 / 15;
index db54f33..fc1d236 100755 (executable)
@@ -54,7 +54,7 @@
 #include <grp.h>
 #include <pwd.h>
 
-#if  defined(__FreeBSD__)
+#if  defined(__FreeBSD__) || defined( __NetBSD__ )
 #include <netdb.h>
 #endif
 
index a2d49cb..d9b6709 100755 (executable)
@@ -46,15 +46,18 @@ PTLIB=-lpt_linux_x86_r
 H323LIB=-lh323_linux_x86_r
 CHANH323LIB=-ldl
 endif
-
-ifneq (${OSARCH},Darwin)
-CHANNEL_LIBS+=chan_oss.so
-endif
 ifeq (${OSARCH},FreeBSD)
 PTLIB=-lpt_FreeBSD_x86_r
 H323LIB=-lh323_FreeBSD_x86_r
 CHANH323LIB=-pthread
 SOLINK+=-L/usr/local/lib
+endif
+ifeq (${OSARCH},NetBSD)
+PTLIB=-lpt_NetBSD_x86_r
+H323LIB=-lh323_NetBSD_x86_r
+SOLINK+=-L/usr/local/lib
+endif
+ifneq (${OSARCH},Darwin)
 CHANNEL_LIBS+=chan_oss.so
 endif
 
@@ -139,6 +142,10 @@ ifeq (${OSARCH},OpenBSD)
 chan_oss.so: chan_oss.o
        $(CC) $(SOLINK) -o $@ chan_oss.o -lossaudio
 endif
+ifeq (${OSARCH},NetBSD)
+chan_oss.so: chan_oss.o
+       $(CC) $(SOLINK) -o $@ chan_oss.o -lossaudio
+endif
 
 chan_iax2.so: chan_iax2.o iax2-parser.o iax2-provision.o
 ifeq ($(USE_MYSQL_FRIENDS),1)
index abf399a..a74a9d8 100755 (executable)
@@ -47,7 +47,7 @@
 #include "answer.h"
 
 /* Which device to use */
-#ifdef __OpenBSD__
+#if defined( __OpenBSD__ ) || defined( __NetBSD__ )
 #define DEV_DSP "/dev/audio"
 #else
 #define DEV_DSP "/dev/dsp"
@@ -375,7 +375,7 @@ static int soundcard_setoutput(int force)
                return 0;
        readmode = 0;
        if (force || time_has_passed()) {
-               ioctl(sounddev, SNDCTL_DSP_RESET);
+               ioctl(sounddev, SNDCTL_DSP_RESET, 0);
                /* Keep the same fd reserved by closing the sound device and copying stdin at the same
                   time. */
                /* dup2(0, sound); */ 
@@ -405,7 +405,7 @@ static int soundcard_setinput(int force)
                return 0;
        readmode = -1;
        if (force || time_has_passed()) {
-               ioctl(sounddev, SNDCTL_DSP_RESET);
+               ioctl(sounddev, SNDCTL_DSP_RESET, 0);
                close(sounddev);
                /* dup2(0, sound); */
                fd = open(DEV_DSP, O_RDONLY | O_NONBLOCK);
index fa9c8ea..52004c1 100755 (executable)
@@ -21,8 +21,10 @@ endif
 #
 OSARCH=$(shell uname -s)
 ifneq (${OSARCH},FreeBSD)
+ifneq (${OSARCH},NetBSD)
 CFLAGS += -march=$(shell uname -m)
 endif
+endif
 CFLAGS += -DPBYTE_ORDER=PLITTLE_ENDIAN
 
 ifeq (${OSARCH},Linux)
index 0f751c6..99c64c6 100755 (executable)
@@ -1,6 +1,9 @@
 /*
 
 $Log$
+Revision 1.18  2004/08/31 13:32:11  markster
+Merge NetBSD and Courtesty tone with modifications (bug #2329)
+
 Revision 1.17  2003/10/26 18:50:49  markster
 Make it build and run on MacOS X
 
@@ -41,7 +44,7 @@ Add broken lpc10 code...  It's not too far from working I don't think...
 
  */
 
-#if defined(unix) || defined(__unix__)
+#if defined(unix) || defined(__unix__) || defined(__NetBSD__)
 typedef short          INT16;
 typedef int            INT32;
 #endif
index 06ae36b..d1258d2 100755 (executable)
@@ -51,7 +51,7 @@
 
 #ifndef        __BIT_TYPES_DEFINED__
 #define        __BIT_TYPES_DEFINED__
-#if (!defined(__FreeBSD__) && !defined(__APPLE__))
+#if (!defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__APPLE__))
 typedef        __signed char              int8_t;
 typedef        unsigned char            u_int8_t;
 typedef        short                     int16_t;
diff --git a/md5.c b/md5.c
index 9388a82..17a00c6 100755 (executable)
--- a/md5.c
+++ b/md5.c
@@ -3,7 +3,7 @@
 #if defined( __OpenBSD__ )
 #  include <machine/types.h>
 #  include <sys/endian.h>
-#elif defined( __FreeBSD__ )
+#elif defined( __FreeBSD__ ) || defined( __NetBSD__ )
 #  include <sys/types.h>
 #  include <sys/endian.h>
 #elif defined( BSD ) && ( BSD >= 199103 ) || defined(__APPLE__)
index 4d21929..7cab65b 100755 (executable)
@@ -3,9 +3,9 @@
  *
  * Routines implementing call parking
  * 
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 1999-2004, Digium, Inc.
  *
- * Mark Spencer <markster@linux-support.net>
+ * Mark Spencer <markster@digium.com>
  *
  * This program is free software, distributed under the terms of
  * the GNU General Public License
@@ -61,6 +61,9 @@ static int parking_stop = 750;
 
 static int transferdigittimeout = DEFAULT_TRANSFER_DIGIT_TIMEOUT;
 
+/* Default courtesy tone played when party joins conference */
+static char courtesytone[256] = "";
+
 /* Registrar for operations */
 static char *registrar = "res_features";
 
@@ -692,6 +695,17 @@ static int park_exec(struct ast_channel *chan, void *data)
        }
 
        if (peer) {
+               /* Play a courtesy beep in the calling channel to prefix the bridge connecting */       
+               if (!ast_strlen_zero(courtesytone)) {
+                       if (!ast_streamfile(chan, courtesytone, chan->language)) {
+                               if (ast_waitstream(chan, "") < 0) {
+                                       ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
+                                       ast_hangup(peer);
+                                       return -1;
+                               }
+                       }
+               }
                ast_moh_stop(peer);
                res = ast_channel_make_compatible(chan, peer);
                if (res < 0) {
@@ -850,6 +864,8 @@ int load_module(void)
                                        transferdigittimeout = DEFAULT_TRANSFER_DIGIT_TIMEOUT;
                                } else
                                        transferdigittimeout = transferdigittimeout * 1000;
+                       } else if  (!strcasecmp(var->name, "courtesytone")) {
+                               strncpy(courtesytone, var->value, sizeof(courtesytone) - 1);
                        }
                        var = var->next;
                }
diff --git a/utils.c b/utils.c
index 756cdfd..fc2a0b4 100755 (executable)
--- a/utils.c
+++ b/utils.c
@@ -28,7 +28,7 @@
 static char base64[64];
 static char b2a[256];
 
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined( __NetBSD__ ) || defined(__APPLE__)
 
 /* duh? ERANGE value copied from web... */
 #define ERANGE 34