Index: Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/Makefile,v
retrieving revision 1.75
diff -u -r1.75 Makefile
--- Makefile 14 Jan 2004 06:48:38 -0000 1.75
+++ Makefile 5 Feb 2004 13:34:01 -0000
@@ -23,6 +23,10 @@
  else
  ifeq (${OSARCH},FreeBSD)
  PROC=$(shell uname -m)
+else
+ifeq (${OSARCH},OpenBSD)
+PROC=$(shell uname -m)
+endif
  endif
  endif
  # Pentium Pro Optimize
Index: aesopt.h
===================================================================
RCS file: /usr/cvsroot/asterisk/aesopt.h,v
retrieving revision 1.2
diff -u -r1.2 aesopt.h
--- aesopt.h 7 Jan 2004 20:45:50 -0000 1.2
+++ aesopt.h 5 Feb 2004 13:34:02 -0000
@@ -148,7 +148,10 @@
 
  /*  PLATFORM SPECIFIC INCLUDES */
 
-#if defined( __FreeBSD__ ) || defined( __OpenBSD__ )
+#if defined( __OpenBSD__ )
+#  include <machine/types.h>
+#  include <sys/endian.h>
+#elif defined( __FreeBSD__ )
  #  include <sys/endian.h>
  #elif defined( BSD ) && ( BSD >= 199103 )
  #  include <machine/endian.h>
Index: channels/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/Makefile,v
retrieving revision 1.37
diff -u -r1.37 Makefile
--- channels/Makefile 23 Jan 2004 20:57:48 -0000 1.37
+++ channels/Makefile 5 Feb 2004 13:34:02 -0000
@@ -52,6 +52,15 @@
 
  ifeq ($(USE_MYSQL_FRIENDS),1)
  CFLAGS+=-DMYSQL_FRIENDS
+ifeq (${OSARCH},OpenBSD)
+MYSQLLIB=-L/usr/local/lib/mysql -lmysqlclient
+else
+MYSQLLIB=-L/usr/lib/mysql -lmysqlclient
+endif
+endif
+
+ifeq (${OSARCH},OpenBSD)
+CFLAGS+=-I/usr/local/include
  endif
 
  CFLAGS+=#-DVOFRDUMPER
@@ -70,6 +79,20 @@
  PWLIBDIR=$(HOME)/pwlib
  endif
 
+ifeq (${OSARCH},OpenBSD)
+PTLIB=pt_OpenBSD_x86_r
+H323LIB=h323_OpenBSD_x86_r
+else
+PTLIB=pt_linux_x86_r
+H323LIB=h323_linux_x86_r
+endif
+
+ifeq (${OSARCH},OpenBSD)
+CHANH323LIB=-L/usr/local/lib
+else
+CHANH323LIB=-ldl
+endif
+
  #CFLAGS+=$(shell [ -f $(ZAPDIR)/libzap.a ] && echo "-I$(ZAPDIR)")
 
  all: depend $(CHANNEL_LIBS)
@@ -106,14 +129,14 @@
 
  chan_iax2.so: chan_iax2.o iax2-parser.o
  ifeq ($(USE_MYSQL_FRIENDS),1)
- $(CC) $(SOLINK) -o $@ chan_iax2.o iax2-parser.o -lmysqlclient -lz
+ $(CC) $(SOLINK) -o $@ chan_iax2.o iax2-parser.o $(MYSQLLIB) -lz
  else
   $(CC) $(SOLINK) -o $@ chan_iax2.o iax2-parser.o
  endif
 
  chan_iax.so: chan_iax.o
  ifeq ($(USE_MYSQL_FRIENDS),1)
- $(CC) $(SOLINK) -o $@ chan_iax.o -L/usr/lib/mysql -lmysqlclient -lz
+ $(CC) $(SOLINK) -o $@ chan_iax.o $(MYSQLLIB) -lz
  else
   $(CC) $(SOLINK) -o $@ chan_iax.o
  endif
@@ -126,7 +149,7 @@
 
  chan_sip.so: chan_sip.o
  ifeq ($(USE_MYSQL_FRIENDS),1)
- $(CC) $(SOLINK) -o $@ chan_sip.o -L/usr/lib/mysql -lmysqlclient -lz
+ $(CC) $(SOLINK) -o $@ chan_sip.o $(MYSQLLIB) -lz
  else
   $(CC) $(SOLINK) -o $@ chan_sip.o
  endif
@@ -147,7 +170,7 @@
    $(CXX) $(SOLINK) -o $@ $< -lvpb -lpthread -lm -ldl
 
  chan_h323.so: chan_h323.o h323/libchanh323.a
- $(CC) $(SOLINK) -o $@ $< h323/libchanh323.a -L$(PWLIBDIR)/lib  -lpt_linux_x86_r -L$(OPENH323DIR)/lib -lh323_linux_x86_r -L/usr/lib -lpthread -ldl -lcrypto -lssl -lexpat
+ $(CC) $(SOLINK) -o $@ $< h323/libchanh323.a $(CHANH323LIB) -L$(PWLIBDIR)/lib  -l$(PTLIB) -L$(OPENH323DIR)/lib -l$(H323LIB) -L/usr/lib -lpthread -lcrypto -lssl -lexpat
 
 
  #chan_modem.so : chan_modem.o
Index: channels/chan_h323.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_h323.c,v
retrieving revision 1.31
diff -u -r1.31 chan_h323.c
--- channels/chan_h323.c 13 Jan 2004 09:24:26 -0000 1.31
+++ channels/chan_h323.c 5 Feb 2004 13:34:03 -0000
@@ -26,6 +26,11 @@
  * Version Info: $Id: chan_h323.c,v 1.31 2004/01/13 09:24:26 jeremy Exp $
  */
 
+#ifdef __OpenBSD__
+#ifndef IPTOS_MINCOST
+#define IPTOS_MINCOST 0x02
+#endif
+#endif
 
  #include <stdio.h>
  #include <pthread.h>
@@ -54,6 +59,9 @@
  #include <fcntl.h>
  #include <netdb.h>
  #include <sys/signal.h>
+#ifdef __OpenBSD__
+#include <netinet/in_systm.h>
+#endif
  #include <netinet/ip.h>
 
 
Index: channels/h323/Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/h323/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- channels/h323/Makefile 11 Jan 2004 02:22:32 -0000 1.11
+++ channels/h323/Makefile 5 Feb 2004 13:34:04 -0000
@@ -1,4 +1,5 @@
  # include the Makefile of OpenH323
+OSARCH=$(shell uname -s)
 
  ifndef OPENH323DIR
  OPENH323DIR=$(HOME)/openh323
@@ -28,7 +29,12 @@
  #
  CFLAGS += -DNDEBUG -DDO_CRASH -DDEBUG_THREADS
  CFLAGS += -pipe -Wall -fPIC -Wmissing-prototypes -Wmissing-declarations
-CFLAGS += -DP_LINUX  -D_REENTRANT -D_GNU_SOURCE
+ifeq (${OSARCH},OpenBSD)
+CFLAGS += -DP_OPENBSD=200311
+else
+CFLAGS += -DP_LINUX
+endif
+CFLAGS += -D_REENTRANT -D_GNU_SOURCE
  CFLAGS += -DP_HAS_SEMAPHORES -DP_SSL -DP_PTHREADS
  CFLAGS += -DPHAS_TEMPLATES -DPTRACING -DP_USE_PRAGMA
  CFLAGS += -I../../include
Index: include/asterisk/frame.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/frame.h,v
retrieving revision 1.27
diff -u -r1.27 frame.h
--- include/asterisk/frame.h 4 Nov 2003 02:40:09 -0000 1.27
+++ include/asterisk/frame.h 5 Feb 2004 13:34:04 -0000
@@ -27,6 +27,9 @@
  #ifdef __linux__
  #include <endian.h>
  #elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
+#if defined(__OpenBSD__)
+#include <machine/types.h>
+#endif
  #include <machine/endian.h>
  #define __BYTE_ORDER BYTE_ORDER
  #define __LITTLE_ENDIAN LITTLE_ENDIA