On Saturday 13 September 2003 15:10, Brad Waite wrote:
> I've perused the list archives and there's several mentions of
> successful ports to FreeBSD. Where can I get the patches/ports?
Didn't take me much to get it to compile and run on FreeBSD (patch
attached). It may, however, take a bit more effort to get everything to
work correctly. Obviously, I've tried no calls.
-Tilghman
Index: Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/Makefile,v
retrieving revision 1.28
diff -u -r1.28 Makefile
--- Makefile 13 Sep 2003 20:51:48 -0000 1.28
+++ Makefile 13 Sep 2003 22:34:42 -0000
@@ -131,7 +131,7 @@
ifeq (${OSARCH},Linux)
LIBS=-ldl
endif
-LIBS+=-lpthread -lncurses -lm -lresolv #-lnjamd
+LIBS+=-pthread -lncurses -lm #-lresolv #-lnjamd
OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
translate.o file.o say.o pbx.o cli.o md5.o term.o \
ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
Index: enum.c
===================================================================
RCS file: /usr/cvsroot/asterisk/enum.c,v
retrieving revision 1.8
diff -u -r1.8 enum.c
--- enum.c 1 Sep 2003 15:36:52 -0000 1.8
+++ enum.c 13 Sep 2003 22:34:43 -0000
@@ -379,8 +379,12 @@
int ret = -1;
struct enum_search *s = NULL;
int version = -1;
+#ifdef __FreeBSD__
+ res_init();
+#else
struct __res_state enumstate;
res_ninit(&enumstate);
+#endif
if (chan && ast_autoservice_start(chan) < 0)
return -1;
@@ -411,7 +415,11 @@
ast_mutex_unlock(&enumlock);
if (!s)
break;
+#ifdef __FreeBSD__
+ res = res_search(tmp, C_IN, T_NAPTR, answer, sizeof(answer));
+#else
res = res_nsearch(&enumstate, tmp, C_IN, T_NAPTR, answer, sizeof(answer));
+#endif
if (res > 0)
break;
}
@@ -429,7 +437,9 @@
}
if (chan)
ret |= ast_autoservice_stop(chan);
+#ifndef __FreeBSD__
res_nclose(&enumstate);
+#endif
return ret;
}
Index: srv.c
===================================================================
RCS file: /usr/cvsroot/asterisk/srv.c,v
retrieving revision 1.2
diff -u -r1.2 srv.c
--- srv.c 13 Aug 2003 23:56:16 -0000 1.2
+++ srv.c 13 Sep 2003 22:34:43 -0000
@@ -249,10 +249,18 @@
if (*port)
*port = 0;
+#ifdef __FreeBSD__
+ res_init();
+#else
res_ninit(&srvstate);
+#endif
if (chan && ast_autoservice_start(chan) < 0)
return -1;
+#ifdef __FreeBSD__
+ res = res_search(service, C_IN, T_SRV, answer, sizeof(answer));
+#else
res = res_nsearch(&srvstate, service, C_IN, T_SRV, answer, sizeof(answer));
+#endif
if (res > 0) {
if ((res = parse_answer(host, hostlen, port, answer, res))) {
ast_log(LOG_WARNING, "Parse error returned %d\n", res);
@@ -267,6 +275,8 @@
}
if (chan)
ret |= ast_autoservice_stop(chan);
+#ifndef __FreeBSD__
res_nclose(&srvstate);
+#endif
return ret;
}
Index: apps/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/Makefile,v
retrieving revision 1.16
diff -u -r1.16 Makefile
--- apps/Makefile 4 Sep 2003 04:40:37 -0000 1.16
+++ apps/Makefile 13 Sep 2003 22:34:43 -0000
@@ -27,7 +27,7 @@
endif
#APPS=app_dial.so app_playback.so app_directory.so app_intercom.so app_mp3.so
-APPS=app_dial.so app_playback.so app_voicemail.so app_directory.so app_intercom.so app_mp3.so \
+APPS=app_dial.so app_playback.so app_voicemail.so app_directory.so app_mp3.so \
app_system.so app_echo.so app_record.so app_image.so app_url.so app_disa.so \
app_agi.so app_qcall.so app_adsiprog.so app_getcpeid.so app_milliwatt.so \
app_zapateller.so app_datetime.so app_setcallerid.so app_festival.so \
@@ -37,6 +37,9 @@
app_waitforring.so app_privacy.so app_db.so app_chanisavail.so \
app_enumlookup.so app_voicemail2.so app_transfer.so app_setcidnum.so
+ifneq ($(OSARCH),FreeBSD)
+APPS+=app_intercom.so
+endif
#APPS+=app_sql_postgres.so
#APPS+=app_sql_odbc.so
Index: apps/app_mp3.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_mp3.c,v
retrieving revision 1.5
diff -u -r1.5 app_mp3.c
--- apps/app_mp3.c 8 Sep 2003 16:48:06 -0000 1.5
+++ apps/app_mp3.c 13 Sep 2003 22:34:43 -0000
@@ -28,7 +28,11 @@
#include <pthread.h>
#include <sys/time.h>
+#ifdef __FreeBSD__
+#define MPG_123 "/usr/local/bin/mpg123"
+#else
#define MPG_123 "/usr/bin/mpg123"
+#endif
static char *tdesc = "Silly MP3 Application";
Index: channels/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/Makefile,v
retrieving revision 1.10
diff -u -r1.10 Makefile
--- channels/Makefile 11 Sep 2003 19:45:43 -0000 1.10
+++ channels/Makefile 13 Sep 2003 22:34:43 -0000
@@ -14,7 +14,7 @@
OSARCH=$(shell uname -s)
CHANNEL_LIBS=chan_modem.so chan_iax.so chan_sip.so \
- chan_modem_aopen.so chan_oss.so \
+ chan_modem_aopen.so \
chan_modem_bestdata.so chan_modem_i4l.so \
chan_agent.so chan_mgcp.so chan_iax2.so \
chan_local.so chan_skinny.so
@@ -27,6 +27,9 @@
CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/ixjuser.h ] && echo chan_phone.so)
CHANNEL_LIBS+=$(shell [ -f h323/libchanh323.a ] && echo chan_h323.so)
+ifneq ($(OSARCH),FreeBSD)
+CHANNEL_LIBS+=chan_oss.so
+endif
CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
CFLAGS+=$(shell [ ! -f /usr/include/linux/if_wanpipe.h ] && echo " -DOLD_SANGOMA_API")
CHANNEL_LIBS+=$(shell [ -f /usr/include/alsa/asoundlib.h ] && echo "chan_alsa.so")
@@ -95,7 +98,7 @@
ifeq (${OSARCH},Linux)
$(CC) -shared -Xlinker -x -o $@ chan_iax2.o iax2-parser.o
else
- $(CC) -shared -Xlinker -x -o $@ chan_iax2.o iax2-parser.o -lossaudio
+ $(CC) -shared -Xlinker -x -o $@ chan_iax2.o iax2-parser.o
endif
chan_zap.o: $(CHANZAP)
Index: codecs/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/codecs/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- codecs/Makefile 6 May 2003 00:00:20 -0000 1.5
+++ codecs/Makefile 13 Sep 2003 22:34:43 -0000
@@ -19,7 +19,9 @@
#MODG723=codec_g723_1.so codec_g723_1b.so
MODG723=$(shell [ -f g723.1/coder.c ] && echo "codec_g723_1.so")
MODG723+=$(shell [ -f g723.1b/coder2.c ] && echo "codec_g723_1b.so")
+ifneq (${OSARCH},FreeBSD)
MODSPEEX=$(shell [ -f /usr/include/speex.h ] || [ -f /usr/local/include/speex.h ] && echo "codec_speex.so")
+endif
MODILBC=$(shell [ -f ilbc/iLBC_decode.h ] && echo "codec_ilbc.so")
CFLAGS+=-fPIC
Index: codecs/gsm/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/codecs/gsm/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- codecs/gsm/Makefile 27 Apr 2003 18:13:11 -0000 1.3
+++ codecs/gsm/Makefile 13 Sep 2003 22:34:44 -0000
@@ -54,7 +54,12 @@
# CC = /usr/lang/acc
# CCFLAGS = -c -O
-CC = gcc -ansi -pedantic $(OPTIMIZE) -march=$(PROC) -fschedule-insns2 -fomit-frame-pointer
+CC = gcc -ansi -pedantic $(OPTIMIZE) -fschedule-insns2 -fomit-frame-pointer
+
+ifneq ($(OSARCH),FreeBSD)
+CC += -march=$(PROC)
+endif
+
CCFLAGS += -c -DNeedFunctionPrototypes=1 -finline-functions -funroll-loops -fPIC
LD = $(CC)
Index: codecs/lpc10/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/codecs/lpc10/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- codecs/lpc10/Makefile 27 Apr 2003 18:13:11 -0000 1.3
+++ codecs/lpc10/Makefile 13 Sep 2003 22:34:44 -0000
@@ -27,7 +27,9 @@
#fix for PPC processors
ifneq ($(PROC),ppc)
- CFLAGS+= -march=$(PROC)
+ ifneq ($(OSARCH),FreeBSD)
+ CFLAGS+= -march=$(PROC)
+ endif
endif
LIB = $(LIB_TARGET_DIR)/liblpc10.a
Index: codecs/mp3/include/L3.h
===================================================================
RCS file: /usr/cvsroot/asterisk/codecs/mp3/include/L3.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 L3.h
--- codecs/mp3/include/L3.h 12 Feb 2003 13:59:14 -0000 1.1.1.1
+++ codecs/mp3/include/L3.h 13 Sep 2003 22:34:44 -0000
@@ -33,6 +33,10 @@
******************************************************************/
+#ifdef __FreeBSD__
+#include <machine/endian.h>
+#endif
+
#define GLOBAL_GAIN_SCALE (4*15)
/* #define GLOBAL_GAIN_SCALE 0 */
Index: res/res_musiconhold.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_musiconhold.c,v
retrieving revision 1.8
diff -u -r1.8 res_musiconhold.c
--- res/res_musiconhold.c 8 Sep 2003 16:48:07 -0000 1.8
+++ res/res_musiconhold.c 13 Sep 2003 22:34:45 -0000
@@ -94,7 +94,11 @@
static ast_mutex_t moh_lock = AST_MUTEX_INITIALIZER;
+#ifdef __FreeBSD__
+#define MPG_123 "/usr/local/bin/mpg123"
+#else
#define MPG_123 "/usr/bin/mpg123"
+#endif
#define MAX_MP3S 256
static void child_handler(int sig)
;
; Asterisk configuration file
;
; Module Loader configuration file
;
[modules]
autoload=yes
;
; If you want, load the GTK console right away.
; Don't load the KDE console since
; it's not as sophisticated right now.
;
noload => pbx_gtkconsole.so
;load => pbx_gtkconsole.so
noload => pbx_kdeconsole.so
;
; Intercom application is obsoleted by
; chan_oss. Don't load it.
;
noload => app_intercom.so
;
; Explicitly load the chan_modem.so early on to be sure
; it loads before any of the chan_modem_* 's afte rit
;
noload => chan_modem.so
noload => chan_modem_aopen.so
noload => chan_modem_bestdata.so
noload => chan_modem_i4l.so
load => res_musiconhold.so
; Module names listed in "global" section will have symbols globally
; exported to modules loaded after them.
;
[global]
chan_modem.so=no