import pjsua 0.7.0

pjsua is an open source command line SIP user agent that is used as
the reference implementation for PJSIP and PJMEDIA. It has many
features, such as:

    * Mutiple identities/account registrations
    * Concurrent calls and conference (unlimited number, but only up
      to 254 sources can be mixed to a single destination)
    * Call features: call hold, call transfer (attended or unattended,
      with or without refersub).
    * SIP Presence/SIMPLE with PIDF and XPIDF support. PUBLISH support.
    * Instant messaging and message composing indication
    * DTMF digits transmission/receipt (RFC 2833)
    * WAV file playing, streaming, and recording.
    * Accoustic echo cancellation (AEC).
    * Auto-answer, auto-play file, auto-loop RTP
    * Support SIP UDP, TCP, and TLS transports. Support for DNS SRV
      resolution.
    * NAT traversal with rport and STUN.
    * Tone generation.
    * Codecs: PCMA, PCMU, GSM, Speex (including wideband/16KHz and
      ultra-wideband/32KHz), L16 (8-48KHz, mono or stereo), and iLBC.
    * Adaptive jitter buffer, adaptive silence detection, and packet
      lost concealment audio features.

With lots of testing and help from todd@, sthen@, jakemsr@, jolan@ and
Benny Prijono.

ok todd@ sthen@
This commit is contained in:
deanna 2007-10-27 04:34:23 +00:00
parent a3ed1e21ef
commit 30d0a555e3
18 changed files with 650 additions and 0 deletions

34
telephony/pjsua/Makefile Normal file
View File

@ -0,0 +1,34 @@
# $OpenBSD: Makefile,v 1.1.1.1 2007/10/27 04:34:23 deanna Exp $
COMMENT= lightweight sip client
DISTNAME= pjproject-0.7.0
PKGNAME= pjsua-0.7.0
CATEGORIES= telephony
HOMEPAGE= http://www.pjsip.org
MASTER_SITES= http://www.pjsip.org/release/0.7.0/
MAINTAINER= Deanna Phillips <deanna@openbsd.org>
WANTLIB= c crypto m ossaudio pthread ssl
USE_GMAKE= Yes
CONFIGURE_STYLE= gnu
# GPL
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
post-configure:
perl -pi -e's,%%LOCALBASE%%,${LOCALBASE},' \
${WRKSRC}/build/os-openbsd.mak
cd ${WRKSRC} && ${GMAKE} dep
CFLAGS+=-DNDEBUG
NO_REGRESS=Yes
do-install:
cp ${WRKSRC}/pjsip-apps/bin/pjsua* ${PREFIX}/bin/pjsua
.include <bsd.port.mk>

5
telephony/pjsua/distinfo Normal file
View File

@ -0,0 +1,5 @@
MD5 (pjproject-0.7.0.tar.gz) = bTAg/nuRheeFW2Eh+3Vb7g==
RMD160 (pjproject-0.7.0.tar.gz) = 7Vw5Pu7t4AC1Uu3AseaSgiTeTaU=
SHA1 (pjproject-0.7.0.tar.gz) = w5h/ZfEoT1rkvGYaL7k6u/4iY6s=
SHA256 (pjproject-0.7.0.tar.gz) = Dd2v1u5IH0Tm/tnChWAuy8b/5/LITDjkRuCAkt0nb/0=
SIZE (pjproject-0.7.0.tar.gz) = 4276564

View File

@ -0,0 +1,50 @@
$OpenBSD: patch-aconfigure,v 1.1.1.1 2007/10/27 04:34:23 deanna Exp $
--- aconfigure.orig Sat Jun 2 20:16:57 2007
+++ aconfigure Sat Jun 2 20:17:59 2007
@@ -9573,13 +9573,13 @@ if test $ac_cv_header_openssl_ssl_h = yes; then
fi
- echo "$as_me:$LINENO: checking for SSL_library_init in -lssl" >&5
-echo $ECHO_N "checking for SSL_library_init in -lssl... $ECHO_C" >&6
+ echo "$as_me:$LINENO: checking for SSL_library_init in -lssl -lcrypto" >&5
+echo $ECHO_N "checking for SSL_library_init in -lssl -lcrypto... $ECHO_C" >&6
if test "${ac_cv_lib_ssl_SSL_library_init+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lssl $LIBS"
+LIBS="-lssl -lcrypto $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -9638,16 +9638,16 @@ fi
echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_SSL_library_init" >&5
echo "${ECHO_T}$ac_cv_lib_ssl_SSL_library_init" >&6
if test $ac_cv_lib_ssl_SSL_library_init = yes; then
- libssl_present=1 && LIBS="$LIBS -lssl"
+ libssl_present=1 && LIBS="$LIBS -lssl -lcrypto"
fi
- echo "$as_me:$LINENO: checking for ERR_load_BIO_strings in -lcrypto" >&5
-echo $ECHO_N "checking for ERR_load_BIO_strings in -lcrypto... $ECHO_C" >&6
+ echo "$as_me:$LINENO: checking for ERR_load_BIO_strings in -lcrypto -lssl" >&5
+echo $ECHO_N "checking for ERR_load_BIO_strings in -lcrypto -lssl... $ECHO_C" >&6
if test "${ac_cv_lib_crypto_ERR_load_BIO_strings+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcrypto $LIBS"
+LIBS="-lcrypto -lssl $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -9706,7 +9706,7 @@ fi
echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_ERR_load_BIO_strings" >&5
echo "${ECHO_T}$ac_cv_lib_crypto_ERR_load_BIO_strings" >&6
if test $ac_cv_lib_crypto_ERR_load_BIO_strings = yes; then
- libcrypto_present=1 && LIBS="$LIBS -lcrypto"
+ libcrypto_present=1 && LIBS="$LIBS -lcrypto -lssl"
fi
if test "x$openssl_h_present" = "x1" -a "x$libssl_present" = "x1" -a "x$libcrypto_present" = "x1"; then

View File

@ -0,0 +1,58 @@
$OpenBSD: patch-build_mak_in,v 1.1.1.1 2007/10/27 04:34:23 deanna Exp $
--- build.mak.in.orig Tue Apr 17 12:16:01 2007
+++ build.mak.in Thu May 24 10:09:23 2007
@@ -1,6 +1,6 @@
# @configure_input@
export MACHINE_NAME := auto
-export OS_NAME := auto
+export OS_NAME = openbsd
export HOST_NAME := unix
export CC_NAME := gcc
export TARGET_NAME := @target@
@@ -10,33 +10,22 @@ export LINUX_POLL := @ac_linux_poll@
# Determine which party libraries to use
export APP_THIRD_PARTY_LIBS := -lresample-$(TARGET_NAME)
-ifneq (@ac_no_gsm_codec@,1)
APP_THIRD_PARTY_LIBS += -lgsmcodec-$(TARGET_NAME)
-endif
-
-ifneq (@ac_no_speex_codec@,1)
APP_THIRD_PARTY_LIBS += -lspeex-$(TARGET_NAME)
-endif
-
-ifneq (@ac_no_ilbc_codec@,1)
APP_THIRD_PARTY_LIBS += -lilbccodec-$(TARGET_NAME)
-endif
-
-ifneq ($(findstring pa,@ac_pjmedia_snd@),)
APP_THIRD_PARTY_LIBS += -lportaudio-$(TARGET_NAME)
-endif
-
# CFLAGS, LDFLAGS, and LIBS to be used by applications
export PJDIR := @ac_pjdir@
export APP_CC := $(CROSS_COMPILE)$(CC_NAME)
-export APP_CFLAGS := -DPJ_AUTOCONF=1\
- @CFLAGS@\
+export APP_CFLAGS := @CFLAGS@\
-I$(PJDIR)/pjlib/include\
-I$(PJDIR)/pjlib-util/include\
-I$(PJDIR)/pjnath/include\
-I$(PJDIR)/pjmedia/include\
- -I$(PJDIR)/pjsip/include
+ -I$(PJDIR)/pjsip/include\
+ -I$(PJDIR)/thirdparty/speex/include\
+ -I$(PJDIR)/thirdparty/portaudio/include
export APP_CXXFLAGS := $(APP_CFLAGS)
export APP_LDFLAGS := -L$(PJDIR)/pjlib/lib\
-L$(PJDIR)/pjlib-util/lib\
@@ -55,7 +44,7 @@ export APP_LDLIBS := -lpjsua-$(TARGET_NAME)\
-lpjlib-util-$(TARGET_NAME)\
$(APP_THIRD_PARTY_LIBS)\
-lpj-$(TARGET_NAME)\
- @LIBS@
+ @LIBS@ -lossaudio
export PJ_DIR := $(PJDIR)
export PJ_CC := $(APP_CC)

View File

@ -0,0 +1,5 @@
$OpenBSD: patch-build_os-openbsd_mak,v 1.1.1.1 2007/10/27 04:34:23 deanna Exp $
--- build/os-openbsd.mak.orig Fri Oct 26 13:52:15 2007
+++ build/os-openbsd.mak Fri Oct 26 13:52:24 2007
@@ -0,0 +1 @@
+export OS_LDFLAGS = -L/usr/local/lib -lm -lpthread -lssl -lcrypto -lossaudio

View File

@ -0,0 +1,25 @@
$OpenBSD: patch-pjlib_build_os-openbsd_mak,v 1.1.1.1 2007/10/27 04:34:23 deanna Exp $
--- pjlib/build/os-openbsd.mak.orig Sat Jun 2 19:16:29 2007
+++ pjlib/build/os-openbsd.mak Sat Jun 2 19:31:37 2007
@@ -0,0 +1,21 @@
+#
+# OS specific configuration for OpenBSD OS target.
+#
+
+# Determine OS specific files
+AC_OS_OBJS= file_access_unistd.o file_io_ansi.o os_core_unix.o \
+ os_error_unix.o os_time_unix.o os_timestamp_posix.o \
+ guid_simple.o ioqueue_select.o
+
+export PJLIB_OBJS += $(AC_OS_OBJS) \
+ addr_resolv_sock.o \
+ log_writer_stdout.o \
+ os_timestamp_common.o \
+ pool_policy_malloc.o sock_bsd.o sock_select.o
+
+export TEST_OBJS += main.o
+
+export TEST_LDFLAGS += -lm -lpthread -lssl -lcrypto
+
+export TARGETS = pjlib pjlib-test
+

View File

@ -0,0 +1,56 @@
$OpenBSD: patch-pjlib_include_pj_compat_os_openbsd_h,v 1.1.1.1 2007/10/27 04:34:23 deanna Exp $
--- pjlib/include/pj/compat/os_openbsd.h.orig Sat Jun 2 22:47:03 2007
+++ pjlib/include/pj/compat/os_openbsd.h Sat Jun 2 22:47:03 2007
@@ -0,0 +1,52 @@
+#ifndef __PJ_COMPAT_OS_OPENBSD_H__
+#define __PJ_COMPAT_OS_OPENBSD_H__
+
+/* Canonical OS name */
+#define PJ_OS_NAME "openbsd"
+
+/* Headers availability */
+#define PJ_HAS_ARPA_INET_H 1
+#define PJ_HAS_ASSERT_H 1
+#define PJ_HAS_CTYPE_H 1
+#define PJ_HAS_ERRNO_H 1
+#define PJ_HAS_NETDB_H 1
+#define PJ_HAS_NETINET_IN_H 1
+#define PJ_HAS_NETINET_IP_H 1
+#define PJ_HAS_SETJMP_H 1
+#define PJ_HAS_STDARG_H 1
+#define PJ_HAS_STDDEF_H 1
+#define PJ_HAS_STDIO_H 1
+#define PJ_HAS_STDLIB_H 1
+#define PJ_HAS_STRING_H 1
+#define PJ_HAS_SYS_IOCTL_H 1
+#define PJ_HAS_SYS_SELECT_H 1
+#define PJ_HAS_SYS_SOCKET_H 1
+#define PJ_HAS_SYS_TIME_H 1
+#define PJ_HAS_SYS_TIMEB_H 1
+#define PJ_HAS_SYS_TYPES_H 1
+#define PJ_HAS_TIME_H 1
+#define PJ_HAS_UNISTD_H 1
+
+#define PJ_HAS_SOCKLEN_T 1
+#define PJ_HAS_ERRNO_VAR 1
+#define PJ_HAS_SO_ERROR 1
+
+#define PJ_BLOCKING_ERROR_VAL EAGAIN
+#define PJ_BLOCKING_CONNECT_ERROR_VAL EINPROGRESS
+#define PJ_HAS_HIGH_RES_TIMER 1
+#define PJ_HAS_MALLOC 1
+
+#define PJ_ATOMIC_VALUE_TYPE long
+#define PJ_EMULATE_RWMUTEX 0
+#define PJ_THREAD_SET_STACK_SIZE 0
+#define PJ_THREAD_ALLOCATE_STACK 0
+
+#define PJ_HAS_THREADS (1)
+#define PJ_OS_HAS_CHECK_STACK 0
+#define PJSIP_UDP_SO_SNDBUF_SIZE 65335
+#define PJSIP_UDP_SO_RCVBUF_SIZE 65335
+#define PJ_SOCKADDR_HAS_LEN 1
+#define PJ_IOQUEUE_MAX_HANDLES (64)
+
+#define PJSIP_HAS_TLS_TRANSPORT 1
+#endif /* __PJ_COMPAT_OS_OPENBSD_H__ */

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-pjlib_include_pj_compat_socket_h,v 1.1.1.1 2007/10/27 04:34:23 deanna Exp $
--- pjlib/include/pj/compat/socket.h.orig Mon Apr 30 17:03:32 2007
+++ pjlib/include/pj/compat/socket.h Wed May 23 17:51:45 2007
@@ -48,6 +48,10 @@
# include <sys/select.h>
#endif
+#if defined(__OpenBSD__)
+# include <netinet/in_systm.h>
+#endif
+
#if defined(PJ_HAS_NETINET_IN_H) && PJ_HAS_NETINET_IN_H != 0
# include <netinet/in.h>
#endif

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-pjlib_include_pj_config_h,v 1.1.1.1 2007/10/27 04:34:23 deanna Exp $
--- pjlib/include/pj/config.h.orig Thu May 3 09:31:21 2007
+++ pjlib/include/pj/config.h Sat Jun 2 19:16:29 2007
@@ -120,6 +120,10 @@
* RTEMS
*/
# include <pj/compat/os_rtems.h>
+
+#elif defined(__OpenBSD__)
+# include <pj/compat/os_openbsd.h>
+
#else
# error "Please specify target os."
#endif

View File

@ -0,0 +1,17 @@
$OpenBSD: patch-pjmedia_build_os-openbsd_mak,v 1.1.1.1 2007/10/27 04:34:23 deanna Exp $
--- pjmedia/build/os-openbsd.mak.orig Sat Jun 2 19:16:29 2007
+++ pjmedia/build/os-openbsd.mak Sat Jun 2 19:37:26 2007
@@ -0,0 +1,13 @@
+AC_PJMEDIA_SND=pa_unix
+AC_PA_USE_ALSA=0
+
+export CODEC_OBJS += l16.o
+export CODEC_OBJS += gsm.o
+export CFLAGS += -I$(THIRD_PARTY)/build/speex -I$(THIRD_PARTY)/speex/include
+export CODEC_OBJS += speex_codec.o
+export PJMEDIA_OBJS += echo_speex.o
+export CODEC_OBJS += ilbc.o
+export CFLAGS += -I$(THIRD_PARTY)/build/portaudio \
+ -I$(THIRD_PARTY)/portaudio/include \
+ -DPJMEDIA_SOUND_IMPLEMENTATION=PJMEDIA_SOUND_PORTAUDIO_SOUND
+export SOUND_OBJS = pasound.o

View File

@ -0,0 +1,41 @@
$OpenBSD: patch-pjsip-apps_src_pjsua_pjsua_app_c,v 1.1.1.1 2007/10/27 04:34:23 deanna Exp $
--- pjsip-apps/src/pjsua/pjsua_app.c.orig Mon May 14 12:45:20 2007
+++ pjsip-apps/src/pjsua/pjsua_app.c Sun Jun 3 00:32:57 2007
@@ -3142,20 +3142,17 @@ pj_status_t app_destroy(void)
static void stereo_demo()
{
pjmedia_port *conf, *splitter, *ch1;
- unsigned clock;
pj_status_t status;
/* Disable existing sound device */
conf = pjsua_set_no_snd_dev();
- clock = app_config.media_cfg.clock_rate;
-
/* Create stereo-mono splitter/combiner */
status = pjmedia_splitcomb_create(app_config.pool,
- clock /* clock rate */,
+ conf->info.clock_rate /* clock rate */,
2 /* stereo */,
- clock*2*10/1000/* 10ms samples * 2ch */,
- 16 /* bits */,
+ 2 * conf->info.samples_per_frame,
+ conf->info.bits_per_sample,
0 /* options */,
&splitter);
pj_assert(status == PJ_SUCCESS);
@@ -3182,10 +3179,10 @@ static void stereo_demo()
/* Create sound device */
status = pjmedia_snd_port_create(app_config.pool, -1, -1,
- clock /* clock rate */,
+ conf->info.clock_rate,
2 /* stereo */,
- clock*2*10/1000 /* 10 ms samples * 2ch */,
- 16 /* bits */,
+ 2 * conf->info.samples_per_frame,
+ conf->info.bits_per_sample,
0, &app_config.snd);
pj_assert(status == PJ_SUCCESS);

View File

@ -0,0 +1,38 @@
$OpenBSD: patch-pjsip-apps_src_py_pjsua_setup_py,v 1.1.1.1 2007/10/27 04:34:23 deanna Exp $
--- pjsip-apps/src/py_pjsua/setup.py.orig Thu May 24 10:19:01 2007
+++ pjsip-apps/src/py_pjsua/setup.py Thu May 24 12:09:57 2007
@@ -24,11 +24,14 @@ setup(name="py_pjsua", version="0.1",
["py_pjsua.c"],
include_dirs=[pjproject + "pjsip/include",
pjproject + "pjlib/include",
- pjproject + "pjlib-util/include", pjproject + "pjmedia/include"],
+ pjproject + "pjlib-util/include", pjproject + "pjmedia/include",
+ pjproject + "pjnath/include"],
library_dirs=[pjproject + "pjsip/lib",
pjproject + "pjlib/lib",
pjproject + "pjmedia/lib",
- pjproject + "pjlib-util/lib"],
+ pjproject + "pjlib-util/lib",
+ pjproject + "pjnath/lib",
+ pjproject + "third_party/lib"],
libraries=[ "pjsua-" + target,
"pjsip-ua-" + target,
"pjsip-simple-" + target,
@@ -37,9 +40,16 @@ setup(name="py_pjsua", version="0.1",
"pjmedia-" + target,
"pjmedia-codec-" + target,
"pjlib-util-" + target,
+ "pjnath-" + target,
"pj-" + target,
+ "gsmcodec-" + target,
+ "speex-" + target,
+ "ilbccodec-" + target,
+ "portaudio-" + target,
+ "resample-" + target,
+ "pjlib-util-" + target,
"ssl",
"crypto",
- "asound"]),
+ "ossaudio"]),
])

View File

@ -0,0 +1,9 @@
$OpenBSD: patch-third_party_build_os-openbsd_mak,v 1.1.1.1 2007/10/27 04:34:23 deanna Exp $
--- third_party/build/os-openbsd.mak.orig Sat Jun 2 19:16:29 2007
+++ third_party/build/os-openbsd.mak Sat Jun 2 19:16:29 2007
@@ -0,0 +1,5 @@
+DIRS = resample
+DIRS += portaudio
+DIRS += gsm
+DIRS += speex
+DIRS += ilbc

View File

@ -0,0 +1,9 @@
$OpenBSD: patch-third_party_build_portaudio_os-openbsd_mak,v 1.1.1.1 2007/10/27 04:34:23 deanna Exp $
--- third_party/build/portaudio/os-openbsd.mak.orig Sat Jun 2 19:16:29 2007
+++ third_party/build/portaudio/os-openbsd.mak Sat Jun 2 19:16:29 2007
@@ -0,0 +1,5 @@
+PORTAUDIO_OBJS += pa_unix_oss.o pa_unix_util.o \
+ pa_unix_hostapis.o
+
+AC_PJMEDIA_SND=pa_unix
+export CFLAGS += -DPA_USE_OSS=1

View File

@ -0,0 +1,237 @@
$OpenBSD: patch-third_party_portaudio_src_hostapi_oss_pa_unix_oss_c,v 1.1.1.1 2007/10/27 04:34:23 deanna Exp $
--- third_party/portaudio/src/hostapi/oss/pa_unix_oss.c.orig Sun Mar 25 16:20:31 2007
+++ third_party/portaudio/src/hostapi/oss/pa_unix_oss.c Fri Oct 26 13:55:16 2007
@@ -1,5 +1,5 @@
/*
- * $Id: patch-third_party_portaudio_src_hostapi_oss_pa_unix_oss_c,v 1.1.1.1 2007/10/27 04:34:23 deanna Exp $
+ * $Id: patch-third_party_portaudio_src_hostapi_oss_pa_unix_oss_c,v 1.1.1.1 2007/10/27 04:34:23 deanna Exp $
* PortAudio Portable Real-Time Audio Library
* Latest Version at: http://www.portaudio.com
* OSS implementation by:
@@ -32,19 +32,19 @@
*/
/*
- * The text above constitutes the entire PortAudio license; however,
+ * The text above constitutes the entire PortAudio license; however,
* the PortAudio community also makes the following non-binding requests:
*
* Any person wishing to distribute modifications to the Software is
* requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also
- * requested that these non-binding requests be included along with the
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
* license above.
*/
/**
@file
- @ingroup hostaip_src
+ @ingroup hostapi_src
*/
#include <stdio.h>
@@ -63,18 +63,8 @@
#include <limits.h>
#include <semaphore.h>
-#ifdef HAVE_SYS_SOUNDCARD_H
-# include <sys/soundcard.h>
-# define DEVICE_NAME_BASE "/dev/dsp"
-#elif defined(HAVE_LINUX_SOUNDCARD_H)
-# include <linux/soundcard.h>
-# define DEVICE_NAME_BASE "/dev/dsp"
-#elif defined(HAVE_MACHINE_SOUNDCARD_H)
-# include <machine/soundcard.h> /* JH20010905 */
+# include <soundcard.h>
# define DEVICE_NAME_BASE "/dev/audio"
-#else
-# error No sound card header file
-#endif
#include "portaudio.h"
#include "pa_util.h"
@@ -84,6 +74,7 @@
#include "pa_cpuload.h"
#include "pa_process.h"
#include "pa_unix_util.h"
+#include "pa_debugprint.h"
static int sysErr_;
static pthread_t mainThread_;
@@ -113,7 +104,7 @@ static pthread_t mainThread_;
*/
static int Get_AFMT_S16_NE( void )
{
- long testData = 1;
+ long testData = 1;
char *ptr = (char *) &testData;
int isLittle = ( *ptr == 1 ); /* Does address point to least significant byte? */
return isLittle ? AFMT_S16_LE : AFMT_S16_BE;
@@ -384,7 +375,7 @@ static PaError QueryDirection( const char *deviceName,
{
maxNumChannels = (stereo) ? 2 : 1;
}
- PA_DEBUG(( "%s: use SNDCTL_DSP_STEREO, maxNumChannels = %d\n", __FUNCTION__, maxNumChannels ))
+ PA_DEBUG(( "%s: use SNDCTL_DSP_STEREO, maxNumChannels = %d\n", __FUNCTION__, maxNumChannels ));
}
/* During channel negotiation, the last ioctl() may have failed. This can
@@ -402,8 +393,12 @@ static PaError QueryDirection( const char *deviceName,
sr = 44100;
if( ioctl( devHandle, SNDCTL_DSP_SPEED, &sr ) < 0 )
{
- result = paUnanticipatedHostError;
- goto error;
+ sr = 48000;
+ if( ioctl( devHandle, SNDCTL_DSP_SPEED, &sr ) < 0 )
+ {
+ result = paUnanticipatedHostError;
+ goto error;
+ }
}
*defaultSampleRate = sr;
@@ -507,9 +502,9 @@ static PaError BuildDeviceList( PaOSSHostApiRepresenta
/* Find devices by calling QueryDevice on each
* potential device names. When we find a valid one,
* add it to a linked list.
- * A: Can there only be 10 devices? */
+ * A: Set an arbitrary of 100 devices, should probably be a smarter way. */
- for( i = 0; i < 10; i++ )
+ for( i = 0; i < 100; i++ )
{
char deviceName[32];
PaDeviceInfo *deviceInfo;
@@ -809,9 +804,11 @@ static PaError OpenDevices( const char *idevName, cons
ENSURE_( *idev = open( idevName, flags ), paDeviceUnavailable );
PA_ENSURE( ModifyBlocking( *idev, 1 ) ); /* Blocking */
+#ifndef __OpenBSD__
/* Initially disable */
enableBits = ~PCM_ENABLE_INPUT;
ENSURE_( ioctl( *idev, SNDCTL_DSP_SETTRIGGER, &enableBits ), paUnanticipatedHostError );
+#endif
}
if( odevName )
{
@@ -820,9 +817,11 @@ static PaError OpenDevices( const char *idevName, cons
ENSURE_( *odev = open( odevName, flags ), paDeviceUnavailable );
PA_ENSURE( ModifyBlocking( *odev, 1 ) ); /* Blocking */
+#ifndef __OpenBSD__
/* Initially disable */
enableBits = ~PCM_ENABLE_OUTPUT;
ENSURE_( ioctl( *odev, SNDCTL_DSP_SETTRIGGER, &enableBits ), paUnanticipatedHostError );
+#endif
}
else
{
@@ -975,8 +974,8 @@ static int CalcHigherLogTwo( int n )
return log2;
}
-static PaError PaOssStreamComponent_Configure( PaOssStreamComponent *component, double sampleRate, unsigned long framesPerBuffer,
- StreamMode streamMode, PaOssStreamComponent *master )
+static PaError PaOssStreamComponent_Configure( PaOssStreamComponent *component, double sampleRate, unsigned long
+ framesPerBuffer, StreamMode streamMode, PaOssStreamComponent *master )
{
PaError result = paNoError;
int temp, nativeFormat;
@@ -986,7 +985,7 @@ static PaError PaOssStreamComponent_Configure( PaOssSt
int frgmt;
int numBufs;
int bytesPerBuf;
- double bufSz;
+ unsigned long bufSz;
unsigned long fragSz;
audio_buf_info bufInfo;
@@ -998,21 +997,21 @@ static PaError PaOssStreamComponent_Configure( PaOssSt
* The hardware need not respect the requested fragment size, so we may have to adapt.
*/
if( framesPerBuffer == paFramesPerBufferUnspecified )
- {
- bufSz = component->latency * sampleRate;
+ {
+ bufSz = (unsigned long)(component->latency * sampleRate);
fragSz = bufSz / 4;
}
else
{
fragSz = framesPerBuffer;
- bufSz = component->latency * sampleRate + fragSz; /* Latency + 1 buffer */
+ bufSz = (unsigned long)(component->latency * sampleRate) + fragSz; /* Latency + 1 buffer */
}
PA_ENSURE( GetAvailableFormats( component, &availableFormats ) );
hostFormat = PaUtil_SelectClosestAvailableFormat( availableFormats, component->userFormat );
/* OSS demands at least 2 buffers, and 16 bytes per buffer */
- numBufs = PA_MAX( bufSz / fragSz, 2 );
+ numBufs = (int)PA_MAX( bufSz / fragSz, 2 );
bytesPerBuf = PA_MAX( fragSz * Pa_GetSampleSize( hostFormat ) * chans, 16 );
/* The fragment parameters are encoded like this:
@@ -1119,7 +1118,8 @@ static PaError PaOssStream_Configure( PaOssStream *str
if( stream->capture )
{
PaOssStreamComponent *component = stream->capture;
- PaOssStreamComponent_Configure( component, sampleRate, framesPerBuffer, StreamMode_In, NULL );
+ PA_ENSURE( PaOssStreamComponent_Configure( component, sampleRate, framesPerBuffer, StreamMode_In,
+ NULL ) );
assert( component->hostChannelCount > 0 );
assert( component->hostFrames > 0 );
@@ -1187,6 +1187,7 @@ static PaError OpenStream( struct PaUtilHostApiReprese
const PaDeviceInfo *inputDeviceInfo = 0, *outputDeviceInfo = 0;
int bpInitialized = 0;
double inLatency = 0., outLatency = 0.;
+ int i = 0;
/* validate platform specific flags */
if( (streamFlags & paPlatformSpecificFlags) != 0 )
@@ -1222,7 +1223,14 @@ static PaError OpenStream( struct PaUtilHostApiReprese
return paInvalidChannelCount;
}
}
-
+
+#if 0
+ /* Round framesPerBuffer to the next power-of-two to make OSS happy. */
+ framesPerBuffer &= INT_MAX;
+ for (i = 1; framesPerBuffer > i; i <<= 1) ;
+ framesPerBuffer = i;
+#endif
+
/* allocate and do basic initialization of the stream structure */
PA_UNLESS( stream = (PaOssStream*)PaUtil_AllocateMemory( sizeof(PaOssStream) ), paInsufficientMemory );
PA_ENSURE( PaOssStream_Initialize( stream, inputParameters, outputParameters, streamCallback, userData, streamFlags, ossHostApi ) );
@@ -1594,7 +1602,8 @@ static void *PaOSS_AudioThreadProc( void *userData )
*/
if( !initiateProcessing )
{
- PA_ENSURE( PaOssStream_WaitForFrames( stream, &framesAvail ) ); /* Wait on available frames */
+ /* Wait on available frames */
+ PA_ENSURE( PaOssStream_WaitForFrames( stream, &framesAvail ) );
assert( framesAvail % stream->framesPerHostBuffer == 0 );
}
else
@@ -1933,11 +1942,11 @@ static signed long GetStreamReadAvailable( PaStream* s
static signed long GetStreamWriteAvailable( PaStream* s )
{
PaOssStream *stream = (PaOssStream*)s;
- int delay = 0;
+ struct count_info delay;
- if( ioctl( stream->playback->fd, SNDCTL_DSP_GETODELAY, &delay ) < 0 )
+ if( ioctl( stream->playback->fd, SNDCTL_DSP_GETOPTR, &delay ) < 0 )
return paUnanticipatedHostError;
-
- return (PaOssStreamComponent_BufferSize( stream->playback ) - delay) / PaOssStreamComponent_FrameSize( stream->playback );
+
+ return (PaOssStreamComponent_BufferSize( stream->playback ) - delay.ptr) / PaOssStreamComponent_FrameSize( stream->playback );
}

23
telephony/pjsua/pkg/DESCR Normal file
View File

@ -0,0 +1,23 @@
pjsua is an open source command line SIP user agent that is used as
the reference implementation for PJSIP and PJMEDIA. It has many
features, such as:
* Mutiple identities/account registrations
* Concurrent calls and conference (unlimited number, but only up
to 254 sources can be mixed to a single destination)
* Call features: call hold, call transfer (attended or unattended,
with or without refersub).
* SIP Presence/SIMPLE with PIDF and XPIDF support. PUBLISH support.
* Instant messaging and message composing indication
* DTMF digits transmission/receipt (RFC 2833)
* WAV file playing, streaming, and recording.
* Accoustic echo cancellation (AEC).
* Auto-answer, auto-play file, auto-loop RTP
* Support SIP UDP, TCP, and TLS transports. Support for DNS SRV
resolution.
* NAT traversal with rport and STUN.
* Tone generation.
* Codecs: PCMA, PCMU, GSM, Speex (including wideband/16KHz and
ultra-wideband/32KHz), L16 (8-48KHz, mono or stereo), and iLBC.
* Adaptive jitter buffer, adaptive silence detection, and packet
lost concealment audio features.

View File

@ -0,0 +1,13 @@
# sample config file for freeworlddialup, through NAT
# --clock-rate=44100
# --registrar=sip:fwd.pulver.com
# --id=sip:858996@fwd.pulver.com
# --realm=fwd.pulver.com
# --username=858996
# --password=XXXX
# --ip-addr=public IP
# --stun-srv=stun.fwdnet.net:3478
For more documentation, see:
http://www.pjsip.org/cgi-bin/showpage.cgi?pjsua

View File

@ -0,0 +1,2 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2007/10/27 04:34:23 deanna Exp $
bin/pjsua