aboutsummaryrefslogtreecommitdiff
path: root/net/asterisk-oh323
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2011-11-09 01:36:27 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2011-11-09 01:36:27 +0000
commit30f8bdc0a0c2588567730e6ce0d836dbf5a88e6f (patch)
treed29cc58bf292b29c2afb4636ab4cad907fb92832 /net/asterisk-oh323
parent1ec74787a69ea44701c0fe282a3945d9a042056c (diff)
downloadports-30f8bdc0a0c2588567730e6ce0d836dbf5a88e6f.tar.gz
ports-30f8bdc0a0c2588567730e6ce0d836dbf5a88e6f.zip
Notes
Diffstat (limited to 'net/asterisk-oh323')
-rw-r--r--net/asterisk-oh323/Makefile43
-rw-r--r--net/asterisk-oh323/distinfo2
-rw-r--r--net/asterisk-oh323/files/codecnego.diff99
-rw-r--r--net/asterisk-oh323/files/patch-Makefile54
-rw-r--r--net/asterisk-oh323/files/patch-asterisk-driver::Makefile128
-rw-r--r--net/asterisk-oh323/files/patch-asterisk-driver::chan_oh323.c94
-rw-r--r--net/asterisk-oh323/files/patch-rules.mak51
-rw-r--r--net/asterisk-oh323/files/patch-wrapper::Makefile57
-rw-r--r--net/asterisk-oh323/files/patch-wrapper::asteriskaudio.cxx10
-rw-r--r--net/asterisk-oh323/files/patch-wrapper::check_ver27
-rw-r--r--net/asterisk-oh323/files/patch-wrapper::openh323flags.mak12
-rw-r--r--net/asterisk-oh323/files/patch-wrapper::wrapconnection.cxx10
-rw-r--r--net/asterisk-oh323/files/patch-wrapper::wrapendpoint.cxx10
-rw-r--r--net/asterisk-oh323/files/patch-wrapper::wrapper.cxx10
-rw-r--r--net/asterisk-oh323/pkg-descr3
-rw-r--r--net/asterisk-oh323/pkg-message9
-rw-r--r--net/asterisk-oh323/pkg-plist6
17 files changed, 625 insertions, 0 deletions
diff --git a/net/asterisk-oh323/Makefile b/net/asterisk-oh323/Makefile
new file mode 100644
index 000000000000..0fce7e51804f
--- /dev/null
+++ b/net/asterisk-oh323/Makefile
@@ -0,0 +1,43 @@
+# New ports collection makefile for: asterisk-oh323
+# Date created: 17 Jun 2005
+# Whom: Andriy Pylypenko <bamby@portaone.com>
+#
+# $FreeBSD$
+#
+
+PORTNAME= asterisk-oh323
+PORTVERSION= 0.7.3.1
+PORTREVISION= 4
+CATEGORIES= net
+MASTER_SITES= http://www.b2bua.org/chrome/site/
+
+MAINTAINER= bamby@sippysoft.com
+COMMENT= A H.323 support module for the Asterisk soft PBX
+
+BUILD_DEPENDS= ${LOCALBASE}/sbin/asterisk:${PORTSDIR}/net/asterisk14
+LIB_DEPENDS= pt_r.1:${PORTSDIR}/devel/pwlib\
+ h323_r.1:${PORTSDIR}/net/openh323
+
+ONLY_FOR_ARCHS= i386 amd64 powerpc
+USE_GMAKE= yes
+MAKE_ENV= MKDIR="${MKDIR}" \
+ PWLIBDIR=${LOCALBASE}/share/pwlib \
+ OPENH323DIR=${LOCALBASE}/share/openh323 \
+ CPP="${CXX}" \
+ SYSLIBDIR=${LOCALBASE}/lib
+
+.include <bsd.port.pre.mk>
+
+# XXX: bsd.gcc.mk now defines CPP
+CPP= "${CXX}"
+
+pre-configure:
+ if ${GREP} -sq fixup_codecs ${LOCALBASE}/include/asterisk/channel.h; \
+ then \
+ ${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/codecnego.diff; \
+ fi
+
+post-install:
+ @${CAT} ${PKGMESSAGE}
+
+.include <bsd.port.post.mk>
diff --git a/net/asterisk-oh323/distinfo b/net/asterisk-oh323/distinfo
new file mode 100644
index 000000000000..34cad5d544ba
--- /dev/null
+++ b/net/asterisk-oh323/distinfo
@@ -0,0 +1,2 @@
+SHA256 (asterisk-oh323-0.7.3.1.tar.gz) = 723525b07e119b5e4c55f4bab240994b2e9b061c65fa2fcf5650b75873a82d98
+SIZE (asterisk-oh323-0.7.3.1.tar.gz) = 92142
diff --git a/net/asterisk-oh323/files/codecnego.diff b/net/asterisk-oh323/files/codecnego.diff
new file mode 100644
index 000000000000..9d600ce2530e
--- /dev/null
+++ b/net/asterisk-oh323/files/codecnego.diff
@@ -0,0 +1,99 @@
+--- asterisk-driver/chan_oh323.c.orig 2008-03-21 15:06:22.000000000 +0200
++++ asterisk-driver/chan_oh323.c 2008-03-21 15:17:00.000000000 +0200
+@@ -966,7 +966,7 @@
+
+ /******************************************************************************/
+
+-static struct ast_channel *oh323_request(const char *type, int format, void *data, int *cause);
++static struct ast_channel *oh323_request(const char *type, const struct ast_codec_pref *formats, void *data, int *cause);
+ static int oh323_text(struct ast_channel *c, const char *text);
+ static int oh323_call(struct ast_channel *c, char *dest, int timeout);
+ static int oh323_hangup(struct ast_channel *c);
+@@ -2425,11 +2425,11 @@
+ }
+
+ /* Check for format changes */
+- if (f->subclass != i->owner->nativeformats) {
++ if (!(f->subclass & ast_codec_pref_bits(&i->owner->nativeformats))) {
+ ast_log(LOG_NOTICE, "%s: Format changed to %s (native %s).\n",
+ c->name,
+ ast_getformatname(f->subclass),
+- ast_getformatname(c->nativeformats));
++ ast_codec_pref_dump(buf, sizeof(buf), &c->nativeformats));
+ if (ast_set_write_format(c, f->subclass) < 0) {
+ ast_mutex_unlock(&oh323_tab_lock);
+ return(-1);
+@@ -2830,8 +2830,8 @@
+
+ /* Set our native format */
+ /* XXX: Only one should be selected */
+- tmp->nativeformats = oh323_capability;
+- fmt = oh323_codec_choose(tmp->nativeformats);
++ ast_codec_pref_append_missing2(&tmp->nativeformats, oh323_capability);
++ fmt = oh323_codec_choose(ast_codec_pref_index_audio(&tmp->nativeformats, 0));
+ /*fmt = ast_best_codec(tmp->nativeformats);*/
+
+ tmp->writeformat = fmt;
+@@ -2943,23 +2943,16 @@
+ * This function limits the number of outbound H.323 calls.
+ * Return NULL on error, the pointer to the channel on success.
+ */
+-static struct ast_channel *oh323_request(const char *type, int format, void *data, int *cause)
++static struct ast_channel *oh323_request(const char *type, const struct ast_codec_pref *formats, void *data, int *cause)
+ {
+- int i=0, count, simcount, oldformat;
++ int i=0, count, simcount;
+ struct ast_channel *c;
+ char *dest = data;
++ char tmp[100];
+
+ if (option_debug)
+ ast_log(LOG_DEBUG, "In oh323_request: type=%s, format=%d, data=%s.\n",
+- type, format, (char *)data);
+-
+- /* Check the format requested */
+- oldformat = format;
+- format &= oh323_full_capability;
+- if (!format) {
+- ast_log(LOG_ERROR, "Asked to get a channel of unsupported format '%d'\n", format);
+- return NULL;
+- }
++ type, ast_codec_pref_bits(formats), (char *)data);
+
+ ast_mutex_lock(&oh323_tab_lock);
+
+@@ -3019,12 +3012,12 @@
+ oh323_tab[i]->owner = c;
+
+ /* Specify our native formats */
+- c->nativeformats = format;
+- c->rawwriteformat = format;
+- c->rawreadformat = format;
++ memcpy(&c->nativeformats, formats, sizeof(*formats));
++ c->rawwriteformat =
++ c->rawreadformat = ast_codec_pref_index_audio(formats, 0);
+ if (option_debug)
+ ast_log(LOG_DEBUG, "%s: Native format changed to %s.\n",
+- c->name, ast_getformatname(format));
++ c->name, ast_codec_pref_dump(tmp, sizeof(tmp), formats));
+
+ ast_mutex_unlock(&oh323_tab_lock);
+ return c;
+@@ -3455,7 +3448,7 @@
+ ast_log(LOG_DEBUG, "Setting channel '%s' native format to %s!\n",
+ oh323_tab[i]->owner->name,
+ ast_getformatname(oh323_tab[i]->capability));
+- oh323_tab[i]->owner->nativeformats = oh323_tab[i]->capability;
++ ast_codec_pref_append_missing2(&oh323_tab[i]->owner->nativeformats, oh323_tab[i]->capability);
+ }
+
+ /* Set environment variables */
+@@ -3528,7 +3521,7 @@
+ ast_log(LOG_DEBUG, "Setting channel '%s' native format to %s!\n",
+ oh323_tab[i]->owner->name,
+ ast_getformatname(oh323_tab[i]->capability));
+- oh323_tab[i]->owner->nativeformats = oh323_tab[i]->capability;
++ ast_codec_pref_append_missing2(&oh323_tab[i]->owner->nativeformats, oh323_tab[i]->capability);
+ if (oh323_tab[i]->tx_smooth) {
+ ast_smoother_free(oh323_tab[i]->tx_smooth);
+ oh323_tab[i]->tx_smooth = NULL;
diff --git a/net/asterisk-oh323/files/patch-Makefile b/net/asterisk-oh323/files/patch-Makefile
new file mode 100644
index 000000000000..61fa3ecf34c5
--- /dev/null
+++ b/net/asterisk-oh323/files/patch-Makefile
@@ -0,0 +1,54 @@
+--- Makefile.orig 2008-03-20 16:49:39.000000000 +0200
++++ Makefile 2008-03-20 17:58:09.000000000 +0200
+@@ -41,7 +41,7 @@
+ # Install everything under this directory. If this is empty, then everything
+ # will be installed under /
+ #
+-DESTDIR=/root/src/asterisk-oh323/debian-420641/slash
++DESTDIR=$(PREFIX)
+
+ #
+ # Set PWLIBDIR variable to the directory containing the sources of
+@@ -51,7 +51,7 @@
+ # compile asterisk-oh323. Do not use the installed library of your
+ # distribution. It won't work.
+ #
+-PWLIBDIR=/root/src/asterisk-oh323/debian-420641/pwlib
++PWLIBDIR?=/root/src/asterisk-oh323/debian-420641/pwlib
+
+ #
+ # Set OPENH323LIBDIR variable to the directory containing the sources of
+@@ -61,13 +61,13 @@
+ # compile asterisk-oh323. Do not use the installed library of your
+ # distribution. It won't work.
+ #
+-OPENH323DIR=/root/src/asterisk-oh323/debian-420641/openh323
++OPENH323DIR?=/root/src/asterisk-oh323/debian-420641/openh323
+
+ #
+ # Set ASTERISKINCDIR variable to the directory containing the include files of
+ # Asterisk PBX.
+ #
+-ASTERISKINCDIR=/root/src/asterisk-oh323/debian-420641/slash/include
++ASTERISKINCDIR=$(LOCALBASE)/include
+
+ #
+ # Set ASTERISKMODDIR variable to the directory where ASTERISK's modules reside.
+@@ -93,7 +93,7 @@
+ #
+ # Note: This directory is created under $DESTDIR.
+ #
+-OH323WRAPLIBDIR=/usr/lib
++OH323WRAPLIBDIR=/lib
+
+ #
+ # Set WRAPTRACING to 1 to enable tracing information from the OpenH323Wrap
+@@ -120,7 +120,7 @@
+ # With this flag on the channel driver is huge, in size, but Asterisk boots
+ # faster!
+ #
+-OH323STAT=1
++#OH323STAT=1
+
+ #
+ # Define options that were used during Asterisk compilation. It is
diff --git a/net/asterisk-oh323/files/patch-asterisk-driver::Makefile b/net/asterisk-oh323/files/patch-asterisk-driver::Makefile
new file mode 100644
index 000000000000..5e04c0e91046
--- /dev/null
+++ b/net/asterisk-oh323/files/patch-asterisk-driver::Makefile
@@ -0,0 +1,128 @@
+
+$FreeBSD$
+
+--- asterisk-driver/Makefile.orig
++++ asterisk-driver/Makefile
+@@ -34,23 +34,23 @@
+ ifndef SKIP_SUFFIX
+ ifeq ($(OH323STAT),1)
+ ifeq ($(OH323BUILDTYPE),debug) # Static, debug
+- LIBPTPATH=$(word 1,$(shell ls $(PWLIBDIR)/lib/libpt*_d_s.a))
++ LIBPTPATH=$(word 1,$(shell ls $(SYSLIBDIR)/libpt*_d_s.a))
+ else # Static, opt
+- LIBPTPATH=$(word 1,$(shell ls $(PWLIBDIR)/lib/libpt*_r_s.a))
++ LIBPTPATH=$(word 1,$(shell ls $(SYSLIBDIR)/libpt*_r_s.a))
+ endif
+ else
+ ifeq ($(OH323BUILDTYPE),debug) # Shared, debug
+- LIBPTPATH=$(word 1,$(shell ls $(PWLIBDIR)/lib/libpt*d.so))
++ LIBPTPATH=$(word 1,$(shell ls $(SYSLIBDIR)/libpt*d.so))
+ else # Shared, opt
+- LIBPTPATH=$(word 1,$(shell ls $(PWLIBDIR)/lib/libpt*r.so))
++ LIBPTPATH=$(word 1,$(shell ls $(SYSLIBDIR)/libpt*r.so))
+ endif
+ endif
+ LIBPTNAME=$(subst lib,,$(basename $(notdir $(LIBPTPATH))))
+ else
+ ifeq ($(OH323STAT),1)
+- LIBPTPATH=$(word 1,$(shell ls $(PWLIBDIR)/lib/$(LIBPT_BASE).a))
++ LIBPTPATH=$(word 1,$(shell ls $(SYSLIBDIR)/$(LIBPT_BASE).a))
+ else
+- LIBPTPATH=$(word 1,$(shell ls $(PWLIBDIR)/lib/$(LIBPT_BASE).so))
++ LIBPTPATH=$(word 1,$(shell ls $(SYSLIBDIR)/$(LIBPT_BASE).so))
+ endif
+ LIBPTNAME=$(subst lib,,$(basename $(notdir $(LIBPTPATH))))
+ endif
+@@ -59,42 +59,42 @@
+ ifndef SKIP_SUFFIX
+ ifeq ($(OH323STAT),1)
+ ifeq ($(OH323BUILDTYPE),debug) # Static, debug
+- LIBH323PATH=$(word 1,$(shell ls $(OPENH323DIR)/lib/libh323*_d_s.a))
++ LIBH323PATH=$(word 1,$(shell ls $(SYSLIBDIR)/libh323*_d_s.a))
+ else
+ ifeq ($(OH323BUILDTYPE),opt) # Static, opt
+- LIBH323PATH=$(word 1,$(shell ls $(OPENH323DIR)/lib/libh323*_r_s.a))
++ LIBH323PATH=$(word 1,$(shell ls $(SYSLIBDIR)/libh323*_r_s.a))
+ else # Static, opt, no trace
+- LIBH323PATH=$(word 1,$(shell ls $(OPENH323DIR)/lib/libh323*_n_s.a))
++ LIBH323PATH=$(word 1,$(shell ls $(SYSLIBDIR)/libh323*_n_s.a))
+ endif
+ endif
+ else
+ ifeq ($(OH323BUILDTYPE),debug) # Shared, debug
+- LIBH323PATH=$(word 1,$(shell ls $(OPENH323DIR)/lib/libh323*d.so))
++ LIBH323PATH=$(word 1,$(shell ls $(SYSLIBDIR)/libh323*d.so))
+ else
+ ifeq ($(OH323BUILDTYPE),opt) # Shared, opt
+- LIBH323PATH=$(word 1,$(shell ls $(OPENH323DIR)/lib/libh323*r.so))
++ LIBH323PATH=$(word 1,$(shell ls $(SYSLIBDIR)/libh323*r.so))
+ else # Shared, opt, no trace
+- LIBH323PATH=$(word 1,$(shell ls $(OPENH323DIR)/lib/libh323*n.so))
++ LIBH323PATH=$(word 1,$(shell ls $(SYSLIBDIR)/libh323*n.so))
+ endif
+ endif
+ endif
+ LIBH323NAME=$(subst lib,,$(basename $(notdir $(LIBH323PATH))))
+ else
+ ifeq ($(OH323STAT),1)
+- LIBH323PATH=$(word 1,$(shell ls $(OPENH323DIR)/lib/$(LIBH323_BASE).a))
++ LIBH323PATH=$(word 1,$(shell ls $(SYSLIBDIR)/$(LIBH323_BASE).a))
+ else
+- LIBH323PATH=$(word 1,$(shell ls $(OPENH323DIR)/lib/$(LIBH323_BASE).so))
++ LIBH323PATH=$(word 1,$(shell ls $(SYSLIBDIR)/$(LIBH323_BASE).so))
+ endif
+ LIBH323NAME=$(subst lib,,$(basename $(notdir $(LIBH323PATH))))
+ endif
+ LIBH323=$(LIBH323NAME)
+
+ ifndef SKIP_EXTLIBS
+- EXTLIBS=$(shell $(PWLIBDIR)/make/ptlib-config --libs)
++ EXTLIBS=$(shell $(PWLIBDIR)/make/ptlib-config --ldflags --libs)
+ endif
+
+ CFLAGS += -pipe -Wstrict-prototypes -Wmissing-prototypes \
+- -Wmissing-declarations -D_REENTRANT -D_GNU_SOURCE -fPIC -g -O6 \
++ -Wmissing-declarations -D_REENTRANT -D_GNU_SOURCE -fPIC -g \
+ -fomit-frame-pointer -DAST_MODULE=\"chan_oh323.so\"
+
+ DRVDEPS=$(shell ls *.h)
+@@ -116,6 +116,7 @@
+ if [ ! -d $(DESTDIR)$(ASTERISKETCDIR) ]; then \
+ $(INSTALL) -d $(DESTDIR)$(ASTERISKETCDIR); \
+ fi
++ $(INSTALL) -m 0644 oh323.conf.sample $(DESTDIR)$(ASTERISKETCDIR)/
+ if [ ! -f $(DESTDIR)$(ASTERISKETCDIR)/oh323.conf ]; then \
+ $(INSTALL) -m 0644 oh323.conf.sample $(DESTDIR)$(ASTERISKETCDIR)/oh323.conf; \
+ fi
+@@ -151,19 +152,27 @@
+ @if [ ! -f "$(LIBH323PATH)" ]; then \
+ echo "ERROR: No OPENH323 library found!"; exit 1; \
+ fi
++ifeq ($(OH323NOWRAP),1)
++ $(CC) -shared -Xlinker -x -g -o $@ $(TARGET_OBJ) \
++ ../wrapper/*.o \
++ -L$(SYSLIBDIR) -l$(LIBH323) \
++ -L$(SYSLIBDIR) -l$(LIBPT) \
++ -lstdc++ $(EXTLIBS)
++else
+ ifeq ($(OH323STAT),1)
+ $(CC) -shared -Xlinker -x -g -o $@ $(TARGET_OBJ) \
+ -L../wrapper -loh323wrap_s \
+- -L$(OPENH323DIR)/lib -l$(LIBH323) \
+- -L$(PWLIBDIR)/lib -l$(LIBPT) \
++ -L$(SYSLIBDIR) -l$(LIBH323) \
++ -L$(SYSLIBDIR) -l$(LIBPT) \
+ -lstdc++ $(EXTLIBS)
+ else
+ $(CC) -shared -Xlinker -x -g -o $@ $(TARGET_OBJ) \
+ -L../wrapper -loh323wrap \
+- -L$(OPENH323DIR)/lib -l$(LIBH323) \
+- -L$(PWLIBDIR)/lib -l$(LIBPT) \
++ -L$(SYSLIBDIR) -l$(LIBH323) \
++ -L$(SYSLIBDIR) -l$(LIBPT) \
+ -lstdc++ $(EXTLIBS)
+ endif
++endif
+
+ %.o: %.c $(DRVDEPS)
+ $(CC) $(CFLAGS) $(ASTERISKINCLUDE) -c -o $@ $<
diff --git a/net/asterisk-oh323/files/patch-asterisk-driver::chan_oh323.c b/net/asterisk-oh323/files/patch-asterisk-driver::chan_oh323.c
new file mode 100644
index 000000000000..58f0a863a327
--- /dev/null
+++ b/net/asterisk-oh323/files/patch-asterisk-driver::chan_oh323.c
@@ -0,0 +1,94 @@
+
+$FreeBSD$
+
+--- asterisk-driver/chan_oh323.c.orig
++++ asterisk-driver/chan_oh323.c
+@@ -34,6 +34,7 @@
+ #include <string.h>
+ #include <sys/socket.h>
+ #include <sys/time.h>
++#include <stdio.h>
+ #include <errno.h>
+ #include <unistd.h>
+ #include <stdlib.h>
+@@ -43,6 +44,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <math.h>
++#include <netinet/in_systm.h>
+ #include <netinet/ip.h>
+ #include <sys/signal.h>
+
+@@ -83,6 +85,8 @@
+ #include "asterisk/threadstorage.h"
+ #include "asterisk/translate.h"
+
++#define CRASH abort()
++
+ #include "wrapper.hxx"
+ #include "oh323.h"
+
+@@ -954,8 +958,8 @@
+ static void oh323_format2codecset(int, int *, int);
+ static int context_from_alias(char *, char **);
+ static int context_from_prefix(char *, char **);
+-static int oh323_release(void *);
+-static int oh323_exec_request(void *data);
++static int oh323_release(const void *);
++static int oh323_exec_request(const void *data);
+ static struct oh323_ep *find_oh323_ep(char *epname, char *host, char *user);
+ void oh323_atexit(void);
+ unsigned int generate_uid(void);
+@@ -1595,6 +1599,8 @@
+ ast_log(LOG_DEBUG, "%s: Call progress.\n", c->name);
+ p->fr.frametype = AST_FRAME_CONTROL;
+ p->fr.subclass = AST_CONTROL_PROGRESS;
++/* The code below is broken with asterisk 1.4.23.1 */
++#if 0
+ /* -- Call transfer */
+ } else if (e->type == OH323EXC_CALL_TRANSFER) {
+ /* XXX Asterisk MUST read first the frame returned by this exception
+@@ -1608,6 +1614,7 @@
+ memcpy(c->dtmfq, e->data, strlen(e->data));
+ write(p->event_pipe[1], notify_buf, 1);
+ }
++#endif
+ /* -- Call establishment notification */
+ } else if (e->type == OH323EXC_CALL_ESTABLISHED) {
+ memset(p->rtp.local_addr, 0, sizeof(p->rtp.local_addr));
+@@ -4110,7 +4117,7 @@
+ /******************************************************************************/
+ /* Monitoring thread and queue call-back functions ****************************/
+
+-static int oh323_exec_request(void *data)
++static int oh323_exec_request(const void *data)
+ {
+ struct request_oh323 *e;
+ int res, i;
+@@ -4217,7 +4224,7 @@
+ return(0);
+ }
+
+-static int oh323_release(void *data)
++static int oh323_release(const void *data)
+ {
+ struct chan_oh323_pvt *pvt = (struct chan_oh323_pvt *)data;
+ int index;
+@@ -4240,7 +4247,7 @@
+ return(0);
+ }
+
+-static int oh323_gk_check(void *data)
++static int oh323_gk_check(const void *data)
+ {
+ char gkname[256];
+
+@@ -4443,7 +4450,7 @@
+ return(-1);
+ }
+ }
+- monitor_thread = -2;
++ monitor_thread = AST_PTHREADT_STOP;
+ } else {
+ ast_log(LOG_WARNING, "Unable to lock the monitor.\n");
+ return(-1);
diff --git a/net/asterisk-oh323/files/patch-rules.mak b/net/asterisk-oh323/files/patch-rules.mak
new file mode 100644
index 000000000000..01f6a470fd15
--- /dev/null
+++ b/net/asterisk-oh323/files/patch-rules.mak
@@ -0,0 +1,51 @@
+
+$FreeBSD$
+
+--- rules.mak.orig
++++ rules.mak
+@@ -42,9 +42,9 @@
+ SUBDIRS = wrapper asterisk-driver
+ .PHONY: all build install clean subdirs_build subdir_install subdir_clean \
+ rpm rpm_clean help $(SUBDIRS)
+-CC = gcc
+-CPP = g++
+-MAKE = make
++CC ?= gcc
++CPP ?= g++
++MAKE ?= make
+ INSTALL = install
+ TOUCH = touch
+ AR = ar
+@@ -63,8 +63,8 @@
+
+ # Set the C++ compiler flags (for wrapper compilation)
+ # and C compiler flags (for channel driver compilation)
+-CPPFLAGS = -Wall -felide-constructors -x c++ -Os
+-CFLAGS = -Wall
++CPPFLAGS += $(CXXFLAGS) -Wall -felide-constructors -x c++
++CFLAGS += -Wall
+ ifeq ($(OH323BUILDTYPE),optnotrace)
+ OPENH323USERFLAGS := NOTRACE=1
+ endif
+@@ -78,9 +78,9 @@
+ CFLAGS += -DUSE_OLD_CAPABILITIES_API=1
+ endif
+
+-ifneq ($(PROC),)
+-CFLAGS += -march=$(PROC)
+-endif
++#ifneq ($(PROC))
++#CFLAGS += -march=$(PROC)
++#endif
+
+ ifdef HAS_OH323MODS
+ CPPFLAGS += -DHAS_OH323MODS
+@@ -108,7 +108,7 @@
+
+ clean: subdirs_clean rpm_clean
+
+-all: subdirs_build subdirs_strip subdirs_install
++all: subdirs_build subdirs_strip
+
+ subdirs_build:
+ for x in $(SUBDIRS); do $(MAKE) -C $$x build || exit 1 ; done
diff --git a/net/asterisk-oh323/files/patch-wrapper::Makefile b/net/asterisk-oh323/files/patch-wrapper::Makefile
new file mode 100644
index 000000000000..aa053eb28a87
--- /dev/null
+++ b/net/asterisk-oh323/files/patch-wrapper::Makefile
@@ -0,0 +1,57 @@
+--- wrapper/Makefile.orig Thu Mar 20 16:49:39 2008
++++ wrapper/Makefile Fri Mar 21 11:56:29 2008
+@@ -33,7 +33,7 @@
+ .PHONY: .pwlib_version .openh323_version
+
+ OPENH323USERFLAGS =
+-STDCCFLAGS :=
++STDCCFLAGS := -fPIC
+
+ ifdef NOVIDEO
+ OPENH323USERFLAGS += NOVIDEO=1
+@@ -62,7 +62,7 @@
+ ifdef OH323_SUPPRESS_H235
+ STDCCFLAGS += -DOH323_SUPPRESS_H235
+ endif
+-OPENH323FLAGS = $(shell make $(OPENH323USERFLAGS) -f openh323flags.mak \
++OPENH323FLAGS := $(shell $(MAKE) $(OPENH323USERFLAGS) -f openh323flags.mak \
+ --no-print-directory -s \
+ PWLIBDIR=$(PWLIBDIR) OPENH323DIR=$(OPENH323DIR) oh323ccflags)
+ CPPFLAGS += $(OPENH323FLAGS)
+@@ -100,25 +100,29 @@
+ @if [ "$(OPENH323_VERSION)" = "UNKNOWN" ]; then \
+ echo "*** Cannot determine the version of OPENH323!"; exit 1; \
+ fi
++ifneq ($(OH323NOWRAP),1)
+ ifeq ($(OH323STAT),1)
+ $(AR) rc liboh323wrap_s.a $(WRAPOBJECTS)
+ else
+- $(CC) -shared -Wl,-soname,liboh323wrap.so -o liboh323wrap.so $(WRAPOBJECTS)
++ $(CC) -shared -Wl,-soname,liboh323wrap.so.1 -o liboh323wrap.so.1 $(WRAPOBJECTS)
++ ln -sfh liboh323wrap.so.1 liboh323wrap.so
++endif
+ endif
+
+ strip:
+
+ install:
++ifneq ($(OH323NOWRAP),1)
+ if [ ! -d $(DESTDIR)$(OH323WRAPLIBDIR) ]; then \
+- $(INSTALL) -d $(DESTDIR)$(OH323WRAPLIBDIR); \
++ $(MKDIR) $(DESTDIR)$(OH323WRAPLIBDIR); \
+ fi
+ ifeq ($(OH323STAT),1)
+- $(INSTALL) -m 0644 liboh323wrap_s.a $(DESTDIR)$(OH323WRAPLIBDIR)
++ $(BSD_INSTALL_PROGRAM) liboh323wrap_s.a $(DESTDIR)$(OH323WRAPLIBDIR)
+ else
+- $(INSTALL) liboh323wrap.so $(DESTDIR)$(OH323WRAPLIBDIR)
+- cd $(DESTDIR)$(OH323WRAPLIBDIR); rm -f ./liboh323wrap.so.1; rm -f ./liboh323wrap.so.1.1
+- cd $(DESTDIR)$(OH323WRAPLIBDIR); ln -s liboh323wrap.so liboh323wrap.so.1
+- cd $(DESTDIR)$(OH323WRAPLIBDIR); ln -s liboh323wrap.so liboh323wrap.so.1.1
++ $(BSD_INSTALL_PROGRAM) liboh323wrap.so.1 $(DESTDIR)$(OH323WRAPLIBDIR)
++ cd $(DESTDIR)$(OH323WRAPLIBDIR); rm -f ./liboh323wrap.so
++ cd $(DESTDIR)$(OH323WRAPLIBDIR); ln -s liboh323wrap.so.1 liboh323wrap.so
++endif
+ endif
+
+ clean:
diff --git a/net/asterisk-oh323/files/patch-wrapper::asteriskaudio.cxx b/net/asterisk-oh323/files/patch-wrapper::asteriskaudio.cxx
new file mode 100644
index 000000000000..ae87418a4bd0
--- /dev/null
+++ b/net/asterisk-oh323/files/patch-wrapper::asteriskaudio.cxx
@@ -0,0 +1,10 @@
+--- wrapper/asteriskaudio.cxx.orig 2008-03-20 17:26:57.000000000 +0200
++++ wrapper/asteriskaudio.cxx 2008-03-20 17:30:38.000000000 +0200
+@@ -29,6 +29,7 @@
+ */
+
+ #include <ptlib.h>
++#include <ptlib/sound.h>
+ #include <sys/time.h>
+ #include <rtp.h>
+
diff --git a/net/asterisk-oh323/files/patch-wrapper::check_ver b/net/asterisk-oh323/files/patch-wrapper::check_ver
new file mode 100644
index 000000000000..90d14a6c4391
--- /dev/null
+++ b/net/asterisk-oh323/files/patch-wrapper::check_ver
@@ -0,0 +1,27 @@
+--- wrapper/check_ver.orig Thu Apr 13 14:02:00 2006
++++ wrapper/check_ver Thu Apr 13 14:11:54 2006
+@@ -1,10 +1,17 @@
+ #!/bin/sh
+
+-if [ -f .$2_version ]; then
+- mv .$2_version .$2_version.old
++if [ -f .${2}_version ]; then
++ mv .${2}_version .${2}_version.old
+ fi
+-
+-MAJOR_VER=`cat $1/version.h | grep "#define MAJOR_VERSION" | awk -F\ '{print $3}'`
+-MINOR_VER=`cat $1/version.h | grep "#define MINOR_VERSION" | awk -F\ '{print $3}'`
+-BUILD_NUM=`cat $1/version.h | grep "#define BUILD_NUMBER" | awk -F\ '{print $3}'`
+-echo -e "$MAJOR_VER.$MINOR_VER.$BUILD_NUM" > .$2_version
++case ${2} in
++ pwlib)
++ grep "PWLIB_VERSION" ${1}/../../include/ptbuildopts.h | \
++ awk -F\ '{print $3}' > .${2}_version
++ ;;
++ openh323)
++ grep "OPENH323_VERSION" ${1}/../../include/${2}/${2}buildopts.h | \
++ awk -F\ '{print $3}' > .${2}_version
++ ;;
++ *)
++ ;;
++esac
diff --git a/net/asterisk-oh323/files/patch-wrapper::openh323flags.mak b/net/asterisk-oh323/files/patch-wrapper::openh323flags.mak
new file mode 100644
index 000000000000..0915466c8ea8
--- /dev/null
+++ b/net/asterisk-oh323/files/patch-wrapper::openh323flags.mak
@@ -0,0 +1,12 @@
+--- wrapper/openh323flags.mak.orig 2008-03-20 16:49:39.000000000 +0200
++++ wrapper/openh323flags.mak 2008-05-16 11:18:00.000000000 +0300
+@@ -1,6 +1,9 @@
+
+ include $(OPENH323DIR)/openh323u.mak
+
++obj_r/*.dep:
++ @true # suppress implicit rule
++
+ oh323ccflags:
+ @echo $(STDCCFLAGS)
+
diff --git a/net/asterisk-oh323/files/patch-wrapper::wrapconnection.cxx b/net/asterisk-oh323/files/patch-wrapper::wrapconnection.cxx
new file mode 100644
index 000000000000..1ca4df6a7625
--- /dev/null
+++ b/net/asterisk-oh323/files/patch-wrapper::wrapconnection.cxx
@@ -0,0 +1,10 @@
+--- wrapper/wrapconnection.cxx.orig 2008-03-20 17:31:59.000000000 +0200
++++ wrapper/wrapconnection.cxx 2008-03-20 17:32:19.000000000 +0200
+@@ -30,6 +30,7 @@
+ /************************************************************************/
+
+ #include <ptlib.h>
++#include <ptlib/sound.h>
+ #include <h323.h>
+ #include <h323pdu.h>
+ #include <mediafmt.h>
diff --git a/net/asterisk-oh323/files/patch-wrapper::wrapendpoint.cxx b/net/asterisk-oh323/files/patch-wrapper::wrapendpoint.cxx
new file mode 100644
index 000000000000..da2254da834c
--- /dev/null
+++ b/net/asterisk-oh323/files/patch-wrapper::wrapendpoint.cxx
@@ -0,0 +1,10 @@
+--- wrapper/wrapendpoint.cxx.orig 2008-03-20 17:33:42.000000000 +0200
++++ wrapper/wrapendpoint.cxx 2008-03-20 17:33:54.000000000 +0200
+@@ -30,6 +30,7 @@
+ /************************************************************************/
+
+ #include <ptlib.h>
++#include <ptlib/sound.h>
+ #include <h323.h>
+ #include <h323pdu.h>
+ #include <mediafmt.h>
diff --git a/net/asterisk-oh323/files/patch-wrapper::wrapper.cxx b/net/asterisk-oh323/files/patch-wrapper::wrapper.cxx
new file mode 100644
index 000000000000..39ff0e86dcfa
--- /dev/null
+++ b/net/asterisk-oh323/files/patch-wrapper::wrapper.cxx
@@ -0,0 +1,10 @@
+--- wrapper/wrapper.cxx.orig 2008-03-20 17:35:37.000000000 +0200
++++ wrapper/wrapper.cxx 2008-03-20 17:35:50.000000000 +0200
+@@ -31,6 +31,7 @@
+ /* INCLUDE FILES ********************************************************/
+
+ #include <ptlib.h>
++#include <ptlib/sound.h>
+ #include <h323.h>
+ #include <h323pdu.h>
+ #include <mediafmt.h>
diff --git a/net/asterisk-oh323/pkg-descr b/net/asterisk-oh323/pkg-descr
new file mode 100644
index 000000000000..4613d0e43137
--- /dev/null
+++ b/net/asterisk-oh323/pkg-descr
@@ -0,0 +1,3 @@
+Alternative implementation of H.323 protocol support for Asterisk PBX.
+
+WWW: http://www.inaccessnetworks.com/ian/projects/asterisk-oh323/
diff --git a/net/asterisk-oh323/pkg-message b/net/asterisk-oh323/pkg-message
new file mode 100644
index 000000000000..3e89d18ed561
--- /dev/null
+++ b/net/asterisk-oh323/pkg-message
@@ -0,0 +1,9 @@
+
+*********************************************
+* *
+* Do not forget to disable loading *
+* the chan_h323 module as it will most *
+* likely prevent the Asterisk from working! *
+* *
+*********************************************
+
diff --git a/net/asterisk-oh323/pkg-plist b/net/asterisk-oh323/pkg-plist
new file mode 100644
index 000000000000..4593300c7d01
--- /dev/null
+++ b/net/asterisk-oh323/pkg-plist
@@ -0,0 +1,6 @@
+@unexec if cmp -s %D/etc/asterisk/oh323.conf %D/etc/asterisk/oh323.conf.sample; then rm -f %D/etc/asterisk/oh323.conf; fi
+etc/asterisk/oh323.conf.sample
+@exec [ -f %B/oh323.conf ] || cp %B/%f %B/oh323.conf
+lib/asterisk/modules/chan_oh323.so
+lib/liboh323wrap.so
+lib/liboh323wrap.so.1