]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
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 96c6c2019743021d968614c336ded9e7ea2c40bd..c9229574889d565892caafe811f8337ca5fdab8c 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 571b7c45290556c95543130b88574c0cac373fb3..94e3e47f152788e1ce109f4cbf9e41cfbacdc645 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 0f23ebce2c783c1b696f7caef4bcc8c5bb418ed1..a7b55bd463f0009da88a19d05b929efb451e13cc 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 db54f330b2cb1994deb68b89a7d21f532e39cfb7..fc1d2363cca7cc89b803422c6bf8b3cea94dafd9 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 a2d49cbb74b46a71a015b01313c90051fc32c856..d9b6709993bc46687f9c9be3efbdffde6432b943 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 abf399ad1508dd70c9362c6636f47c4137738db6..a74a9d847e8a7f972d87b90f5bf9d6b63e326803 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 fa9c8ea11f79d4f1c3826e9f06257f1871768acd..52004c1fd75ad02651118a5524c08333a4050f2e 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 0f751c6de1ea76057a4a0f2318888b3f086b2f85..99c64c624bcec2cd2ad04a9af82ac2ccdff41368 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 06ae36b82b80ccd0ebf24a49bfdf4e10e7c637e6..d1258d2a63c829e19431ab6d71f13067355ed7ff 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 9388a820e49a849a9b7c48b3c1dd85ef37bb76ae..17a00c6fcb0e8ba5c966a404dccca62eefb6c697 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 4d219298a2d0b47576f99ceba161a834f6edeb11..7cab65b10a30df12c606f6bcd2bd411460041313 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 756cdfd1911fddc9b8ed553455d5181cb98e5dea..fc2a0b419d2a56567ce78dd1ff823412a0e7a7e5 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