summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--comms/asterisk/Makefile20
-rw-r--r--comms/asterisk/PLIST3
-rw-r--r--comms/asterisk/distinfo39
-rw-r--r--comms/asterisk/files/smf/manifest.xml35
-rw-r--r--comms/asterisk/options.mk8
-rw-r--r--comms/asterisk/patches/patch-channels_chan__unistim.c13
-rw-r--r--comms/asterisk/patches/patch-channels_sip_sdp__crypto.c25
-rw-r--r--comms/asterisk/patches/patch-codecs_codec__dahdi.c15
-rw-r--r--comms/asterisk/patches/patch-configure30
-rw-r--r--comms/asterisk/patches/patch-configure.ac31
-rw-r--r--comms/asterisk/patches/patch-funcs_func__env.c13
-rw-r--r--comms/asterisk/patches/patch-include_asterisk_compat.h13
-rw-r--r--comms/asterisk/patches/patch-include_asterisk_poll-compat.h13
-rw-r--r--comms/asterisk/patches/patch-main_cdr.c6
-rw-r--r--comms/asterisk/patches/patch-main_channel.c22
-rw-r--r--comms/asterisk/patches/patch-main_pbx.c17
-rw-r--r--comms/asterisk/patches/patch-main_sched.c16
-rw-r--r--comms/asterisk/patches/patch-main_stdtime_localtime.c29
-rw-r--r--comms/asterisk/patches/patch-res_pjproject_pjlib_include_pj_config.h32
-rw-r--r--comms/asterisk/patches/patch-res_pjproject_pjlib_include_pj_sock__select.h21
-rw-r--r--comms/asterisk/patches/patch-res_pjproject_pjlib_src_pj_sock__select.c52
-rw-r--r--comms/asterisk/patches/patch-res_pjproject_third__party_portaudio_src_hostapi_alsa_pa__linux__alsa.c13
-rw-r--r--comms/asterisk/patches/patch-res_pjproject_third__party_portaudio_src_hostapi_oss_pa__unix__oss.c13
-rw-r--r--comms/asterisk/patches/patch-res_res__timing__kqueue.c431
24 files changed, 850 insertions, 60 deletions
diff --git a/comms/asterisk/Makefile b/comms/asterisk/Makefile
index 1b33a5951dd..48cdeb0595a 100644
--- a/comms/asterisk/Makefile
+++ b/comms/asterisk/Makefile
@@ -1,13 +1,12 @@
-# $NetBSD: Makefile,v 1.128 2015/10/10 01:58:01 ryoon Exp $
+# $NetBSD: Makefile,v 1.129 2015/10/27 08:49:01 jnemeth Exp $
#
# NOTE: when updating this package, there are two places that sound
# tarballs need to be checked
-DISTNAME= asterisk-11.19.0
+DISTNAME= asterisk-11.20.0
DIST_SUBDIR= ${PKGNAME_NOREV}
DISTFILES= ${DEFAULT_DISTFILES}
EXTRACT_ONLY= ${DISTNAME}.tar.gz
-PKGREVISION= 2
CATEGORIES= comms net audio
MASTER_SITES= http://downloads.asterisk.org/pub/telephony/asterisk/ \
http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/ \
@@ -38,8 +37,15 @@ CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
CONFIGURE_ARGS+= --without-gtk2
# XXX remove when lang/lua gets builtin.mk
CONFIGURE_ARGS+= --without-lua
-#JMN doesn't build properly on NetBSD, remove when -current is fixed
+
+.if (${OPSYS} == "NetBSD" && \
+ (empty(OS_VERSION:M6.99.[4-9]?) && empty(OS_VERSION:M[7-9].*)))
CONFIGURE_ARGS+= --without-srtp
+.else
+CONFIGURE_ARGS+= --with-srtp
+PLIST.srtp= YES
+.include "../../comms/srtp/buildlink3.mk"
+.endif
INSTALL_TARGET= install samples
INSTALLATION_DIRS+= lib/pkgconfig share/doc/${PKGBASE}
@@ -178,8 +184,9 @@ CONF_FILES_PERMS= # empty
CONF_FILES_PERMS+= ${ASTEXAMPLEDIR}/${f:Q} ${PKG_SYSCONFDIR}/${f:Q} ${ASTERISK_USER} ${ASTERISK_GROUP} 0644
.endfor
+.if !empty(PKG_OPTIONS:Masterisk-config)
# if we put all the files in $CONF_FILES, the message is _way_ too long.
-.for f in acl.conf adsi.conf agents.conf alarmreceiver.conf alsa.conf \
+. for f in acl.conf adsi.conf agents.conf alarmreceiver.conf alsa.conf \
amd.conf app_mysql.conf asterisk.adsi calendar.conf ccss.conf \
cdr.conf cdr_adaptive_odbc.conf cdr_custom.conf \
cdr_manager.conf cdr_mysql.conf cdr_odbc.conf cdr_pgsql.conf \
@@ -204,7 +211,8 @@ CONF_FILES_PERMS+= ${ASTEXAMPLEDIR}/${f:Q} ${PKG_SYSCONFDIR}/${f:Q} ${ASTERISK_U
smdi.conf telcordia-1.adsi udptl.conf unistim.conf users.conf \
voicemail.conf vpb.conf xmpp.conf
CONF_FILES_PERMS+= ${ASTEXAMPLEDIR}/${f:Q} ${PKG_SYSCONFDIR}/${f:Q} ${ASTERISK_USER} ${ASTERISK_GROUP} 0644
-.endfor
+. endfor
+.endif
PTHREAD_OPTS+= require native
diff --git a/comms/asterisk/PLIST b/comms/asterisk/PLIST
index 00e48b028ae..0afbe20d648 100644
--- a/comms/asterisk/PLIST
+++ b/comms/asterisk/PLIST
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.10 2015/08/09 04:07:13 jnemeth Exp $
+@comment $NetBSD: PLIST,v 1.11 2015/10/27 08:49:01 jnemeth Exp $
include/asterisk.h
include/asterisk/_private.h
include/asterisk/abstract_jb.h
@@ -356,6 +356,7 @@ lib/asterisk/modules/res_security_log.so
lib/asterisk/modules/res_smdi.so
${PLIST.snmp}lib/asterisk/modules/res_snmp.so
lib/asterisk/modules/res_speech.so
+${PLIST.srtp}lib/asterisk/modules/res_srtp.so
lib/asterisk/modules/res_stun_monitor.so
${PLIST.kqueue}lib/asterisk/modules/res_timing_kqueue.so
lib/asterisk/modules/res_timing_pthread.so
diff --git a/comms/asterisk/distinfo b/comms/asterisk/distinfo
index 3b51739c199..211e60f2054 100644
--- a/comms/asterisk/distinfo
+++ b/comms/asterisk/distinfo
@@ -1,11 +1,11 @@
-$NetBSD: distinfo,v 1.74 2015/08/09 04:07:13 jnemeth Exp $
+$NetBSD: distinfo,v 1.75 2015/10/27 08:49:01 jnemeth Exp $
-SHA1 (asterisk-11.19.0/asterisk-11.19.0.tar.gz) = e35b9d910cb549b0bea20dbad60760f230bd3881
-RMD160 (asterisk-11.19.0/asterisk-11.19.0.tar.gz) = 1dca1ddf50233b57f8f1edcaace76ccd56ca2e7e
-Size (asterisk-11.19.0/asterisk-11.19.0.tar.gz) = 34852510 bytes
-SHA1 (asterisk-11.19.0/asterisk-extra-sounds-en-gsm-1.4.15.tar.gz) = fbb94494e31fc08eee8fdf2ce7d12eb274018050
-RMD160 (asterisk-11.19.0/asterisk-extra-sounds-en-gsm-1.4.15.tar.gz) = 53656a3d6771602504f220ad312093e3503e1150
-Size (asterisk-11.19.0/asterisk-extra-sounds-en-gsm-1.4.15.tar.gz) = 4409969 bytes
+SHA1 (asterisk-11.20.0/asterisk-11.20.0.tar.gz) = 350db38ab34b21ac8f51f6b917c15e3be2a777e4
+RMD160 (asterisk-11.20.0/asterisk-11.20.0.tar.gz) = c5257f4fa5dfa0091609b6517881cf5da671c04d
+Size (asterisk-11.20.0/asterisk-11.20.0.tar.gz) = 34864289 bytes
+SHA1 (asterisk-11.20.0/asterisk-extra-sounds-en-gsm-1.4.15.tar.gz) = fbb94494e31fc08eee8fdf2ce7d12eb274018050
+RMD160 (asterisk-11.20.0/asterisk-extra-sounds-en-gsm-1.4.15.tar.gz) = 53656a3d6771602504f220ad312093e3503e1150
+Size (asterisk-11.20.0/asterisk-extra-sounds-en-gsm-1.4.15.tar.gz) = 4409969 bytes
SHA1 (patch-Makefile) = 5fd774779d3c8d85936beca8a3407dd3011af2dc
SHA1 (patch-addons_chan__ooh323.c) = 57f61a2edf0f9f022e03837230ee572ec9cf47b4
SHA1 (patch-apps_app__confbridge.c) = c815905994355a19c32e8e3e2eb5dc9f1679eb29
@@ -25,21 +25,28 @@ SHA1 (patch-cel_cel__pgsql.c) = f295eca04505d011c6548cdb29ddc292d4540714
SHA1 (patch-channels_chan__motif.c) = db6c97ba02a441633338d492032d78cd86f094f5
SHA1 (patch-channels_chan__oss.c) = 0be259a83c4425d08b693a54c43896da039df721
SHA1 (patch-channels_chan__sip.c) = e711bcb65336ed1803ed92989889258f1d416f6b
-SHA1 (patch-configure) = 88619fe9072ff69ed8da0a1917ac3852d10998a4
-SHA1 (patch-configure.ac) = 2fdae524cfc95f152b86a32405b80f6edae6fa20
+SHA1 (patch-channels_chan__unistim.c) = adb4dd1967ffdffbc0f8b9b52678b59b52ec5b77
+SHA1 (patch-channels_sip_sdp__crypto.c) = decb6cfe0d6893db912a9087b2155c225db5e1e8
+SHA1 (patch-codecs_codec__dahdi.c) = f412e1f60cb49076b8cabcd747c0f0168f1fa9e7
+SHA1 (patch-configure) = 21958865e2edac21723472fcd74c9fffc338c938
+SHA1 (patch-configure.ac) = 0d74aeb75f6ef59256e6228cd20b231039e98afc
SHA1 (patch-contrib_scripts_vmail.cgi) = 650b9bbf3e322d1ad351932cfe6f747baa8f35e4
+SHA1 (patch-funcs_func__env.c) = 30ec2c804ea69c4825fe0a888f9e982c7418c528
SHA1 (patch-funcs_func__strings.c) = 4c1db693d845691492b77bbf489764d362de2087
SHA1 (patch-include_asterisk_autoconfig.h.in) = 09a8f8d5398612fdadba25f221b16c19429f81e2
+SHA1 (patch-include_asterisk_compat.h) = 2935fe6be76b3af0f27f368b0540a78d34fbfbed
SHA1 (patch-include_asterisk_endian.h) = 41c1a9a9e02fe394bc9261f5559e931b1378ea28
SHA1 (patch-include_asterisk_lock.h) = cb1404e56de4708836091c224df439158119764c
+SHA1 (patch-include_asterisk_poll-compat.h) = e426dec60c8478856e2ebd4227ef48def3f41ca1
SHA1 (patch-include_asterisk_strings.h) = fc5987a98429ca470f7e9bdcf170d49b0c1f3407
SHA1 (patch-include_asterisk_utils.h) = 07e70fe0adf39cd9a7f94c735b9a3fa72ae3df89
SHA1 (patch-main_Makefile) = 5f9238a528d2b96777e17a4ac6d3e7876dfffb98
SHA1 (patch-main_acl.c) = 1eac532a15127c25981d2db9462a8ccce2c58620
SHA1 (patch-main_asterisk.c) = bfdbd5299b7279ef080a015a9a10627aa929dd49
SHA1 (patch-main_astmm.c) = 27ff06a6eae9396bde2babeff53d004202d0632a
-SHA1 (patch-main_cdr.c) = 3d98a342bdbde81109cccd18943b48168768be77
+SHA1 (patch-main_cdr.c) = ee96972504a2b4cb01129928e5fc35b7f1f99b9b
SHA1 (patch-main_cel.c) = 909ace2328c15cda2934dadac35889351be7c4f7
+SHA1 (patch-main_channel.c) = f1218badff1354961b49c9e5f35ca2db7d1e4511
SHA1 (patch-main_config__options.c) = e49a946da99546684e8988ca4301bcacbb415987
SHA1 (patch-main_features.c) = 1c11207c60ce53c1101141e07ae04d0ddb838450
SHA1 (patch-main_format.c) = a6d446c3de883cf3ef768d03d39e8d8db068b750
@@ -48,9 +55,9 @@ SHA1 (patch-main_logger.c) = 3c64602c9453c157157f8a0c63056be30ede99c5
SHA1 (patch-main_manager.c) = 6700814350f6960ac7543f587ba6c27a443eeef2
SHA1 (patch-main_named__acl.c) = 48c23ed0e558299679bbfc9e564383f9f7dd181f
SHA1 (patch-main_netsock.c) = 015796266b9806425180c9bb05a1907116ef086d
-SHA1 (patch-main_pbx.c) = a3151ae6c09ed69c588dc67cf39c862e10a15bf2
-SHA1 (patch-main_sched.c) = 73759369470b575e73ca78f9cff096ebb477c9b1
-SHA1 (patch-main_stdtime_localtime.c) = 4b01b34cc2a541487f744b3901c536419c95b394
+SHA1 (patch-main_pbx.c) = 049e9883ebbb4e8b2c8913e9e8f310717f6c2168
+SHA1 (patch-main_sched.c) = 2e95b8ee6b81fbed55ca0506f84f701c512728fc
+SHA1 (patch-main_stdtime_localtime.c) = afbdecc7fdf3b8ea3020a2282003b63d89adb0f3
SHA1 (patch-main_test.c) = 3f239ed7611facbd937057f056ebc7495403dbaf
SHA1 (patch-main_udptl.c) = 260586e4203b4bf51737ba171cbfe57621de8728
SHA1 (patch-main_utils.c) = df8bfd592f82b9b5c2c95a6860d2dca7003f66ca
@@ -59,10 +66,16 @@ SHA1 (patch-res_Makefile) = 2b3fa69b155a88e9026005fa6d89f651541bde8a
SHA1 (patch-res_pjproject_aconfigure) = 0095894c5daac2dec6a9ec745c0ecb8d46c0b73a
SHA1 (patch-res_pjproject_aconfigure.ac) = cbabe4a5f1888e180c93404324ddb96728dc20b9
SHA1 (patch-res_pjproject_build.symbian_makedef.sh) = 37781fe307564ad827e9be67f507f84230ebf299
+SHA1 (patch-res_pjproject_pjlib_include_pj_config.h) = 699ff47d099530030b94803fe83c16a3a177d6c1
+SHA1 (patch-res_pjproject_pjlib_include_pj_sock__select.h) = 60d0745710ddb7669f45a2ffcc6329ab3bfd5d28
+SHA1 (patch-res_pjproject_pjlib_src_pj_sock__select.c) = defc9c86574d295175bad2d5826b01291116a2cd
+SHA1 (patch-res_pjproject_third__party_portaudio_src_hostapi_alsa_pa__linux__alsa.c) = 75da38cbe5fd8c4bbb0c1e0825a78c89e29be138
+SHA1 (patch-res_pjproject_third__party_portaudio_src_hostapi_oss_pa__unix__oss.c) = 5f3ccac5939b01cf6957b7072bc9ad4679f63e5c
SHA1 (patch-res_res__calendar.c) = a4c491d8c77f88d0834d0eb52622f7c6e4f3428b
SHA1 (patch-res_res__calendar__caldav.c) = 673e8a256fc748338f35c7deddbf283809d19904
SHA1 (patch-res_res__calendar__icalendar.c) = 3258522abbdc5c0cfe76868f73f16931118983e5
SHA1 (patch-res_res__config__pgsql.c) = 719fa8939ca0e6cae256dd1b19a11405f475a620
+SHA1 (patch-res_res__timing__kqueue.c) = 36dba3fb1081bccc872145a4d9601e179ac2981a
SHA1 (patch-res_res__xmpp.c) = 25ce66a0536a290598b4c11f14c7ab94f6577af5
SHA1 (patch-sounds_Makefile) = 792c2e25e1c8334fe8c9038b8b630376a5894c31
SHA1 (patch-tests_test__abstract__jb.c) = 42cfa303fc2e399aa9fe3bebf51464d0776e171c
diff --git a/comms/asterisk/files/smf/manifest.xml b/comms/asterisk/files/smf/manifest.xml
new file mode 100644
index 00000000000..c864833cac6
--- /dev/null
+++ b/comms/asterisk/files/smf/manifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<service_bundle type="manifest" name="@SMF_NAME@">
+ <service name="@SMF_PREFIX@/@SMF_NAME@" type="service" version="1">
+ <create_default_instance enabled="false" />
+ <single_instance />
+ <dependency name='network' grouping='require_all' restart_on='error' type='service'>
+ <service_fmri value='svc:/milestone/network:default' />
+ </dependency>
+ <dependency name='filesystem-local' grouping='require_all' restart_on='none' type='service'>
+ <service_fmri value='svc:/system/filesystem/local:default' />
+ </dependency>
+ <method_context>
+ <method_environment>
+ <envvar name="LD_PRELOAD_32" value="/usr/lib/extendedFILE.so.1" />
+ </method_environment>
+ </method_context>
+ <exec_method type="method" name="start" exec="@PREFIX@/sbin/asterisk" timeout_seconds="60" />
+ <exec_method type="method" name="stop" exec="@PREFIX@/sbin/asterisk -nr -x 'core stop gracefully' >/dev/null" timeout_seconds="60" />
+ <exec_method type="method" name="refresh" exec="@PREFIX@/sbin/asterisk -nr -x 'core reload' >/dev/null" timeout_seconds="60" />
+ <property_group name="startd" type="framework">
+ <propval name="duration" type="astring" value="contract" />
+ <propval name="ignore_error" type="astring" value="core,signal" />
+ </property_group>
+ <property_group name="application" type="application">
+ <propval name="config_file" type="astring" value="@PKG_SYSCONFDIR@/asterisk.conf" />
+ </property_group>
+ <stability value="Evolving" />
+ <template>
+ <common_name>
+ <loctext xml:lang="C">Asterisk PBX</loctext>
+ </common_name>
+ </template>
+ </service>
+</service_bundle>
diff --git a/comms/asterisk/options.mk b/comms/asterisk/options.mk
index fc3da08421b..d8c2620ed34 100644
--- a/comms/asterisk/options.mk
+++ b/comms/asterisk/options.mk
@@ -1,15 +1,15 @@
-# $NetBSD: options.mk,v 1.7 2015/08/09 04:07:13 jnemeth Exp $
+# $NetBSD: options.mk,v 1.8 2015/10/27 08:49:01 jnemeth Exp $
PKG_OPTIONS_VAR= PKG_OPTIONS.asterisk
PKG_SUPPORTED_OPTIONS= zaptel x11 unixodbc ilbc webvmail ldap spandsp
-PKG_SUPPORTED_OPTIONS+= jabber speex snmp pgsql
+PKG_SUPPORTED_OPTIONS+= jabber speex snmp pgsql asterisk-config
PKG_OPTIONS_LEGACY_OPTS+= gtk:x11
-PKG_SUGGESTED_OPTIONS= ldap jabber speex
+PKG_SUGGESTED_OPTIONS= ldap jabber speex asterisk-config
.include "../../mk/bsd.options.mk"
PLIST_VARS+= zaptel x11 unixodbc webvmail ldap spandsp jabber
-PLIST_VARS+= speex snmp pgsql
+PLIST_VARS+= speex snmp pgsql srtp
# Asterisk now uses DAHDI, not zaptel; not implemented yet...
#.if !empty(PKG_OPTIONS:Mzaptel)
diff --git a/comms/asterisk/patches/patch-channels_chan__unistim.c b/comms/asterisk/patches/patch-channels_chan__unistim.c
new file mode 100644
index 00000000000..507a0b6c6f7
--- /dev/null
+++ b/comms/asterisk/patches/patch-channels_chan__unistim.c
@@ -0,0 +1,13 @@
+$NetBSD: patch-channels_chan__unistim.c,v 1.1 2015/10/27 08:49:01 jnemeth Exp $
+
+--- channels/chan_unistim.c.orig 2015-10-09 22:23:39.000000000 +0000
++++ channels/chan_unistim.c
+@@ -984,7 +984,7 @@ static int get_to_address(int fd, struct
+ memcpy(&toAddr->sin_addr, &ip_msg.address, sizeof(struct in_addr));
+ return err;
+ #else
+- memcpy(&toAddr, &public_ip, sizeof(&toAddr));
++ memcpy(toAddr, &public_ip, sizeof(struct sockaddr_in));
+ return 0;
+ #endif
+ }
diff --git a/comms/asterisk/patches/patch-channels_sip_sdp__crypto.c b/comms/asterisk/patches/patch-channels_sip_sdp__crypto.c
new file mode 100644
index 00000000000..3122b5d1b5a
--- /dev/null
+++ b/comms/asterisk/patches/patch-channels_sip_sdp__crypto.c
@@ -0,0 +1,25 @@
+$NetBSD: patch-channels_sip_sdp__crypto.c,v 1.1 2015/10/27 08:49:01 jnemeth Exp $
+
+--- channels/sip/sdp_crypto.c.orig 2015-10-09 22:23:39.000000000 +0000
++++ channels/sip/sdp_crypto.c
+@@ -187,6 +187,7 @@ err:
+
+ int sdp_crypto_process(struct sdp_crypto *p, const char *attr, struct ast_rtp_instance *rtp, struct sip_srtp *srtp)
+ {
++ char buf[10];
+ char *str = NULL;
+ char *tag = NULL;
+ char *suite = NULL;
+@@ -220,8 +221,10 @@ int sdp_crypto_process(struct sdp_crypto
+ return -1;
+ }
+
+- /* RFC4568 9.1 - tag is 1-9 digits, greater than zero */
+- if (sscanf(tag, "%30d", &p->tag) != 1 || p->tag <= 0 || p->tag > 999999999) {
++ /* RFC4568 9.1 - tag is 1-9 digits */
++ p->tag = atoi(tag);
++ snprintf(buf, sizeof(buf), "%d", p->tag);
++ if (strcmp(buf, tag) || p->tag < 0 || p->tag > 999999999) {
+ ast_log(LOG_WARNING, "Unacceptable a=crypto tag: %s\n", tag);
+ return -1;
+ }
diff --git a/comms/asterisk/patches/patch-codecs_codec__dahdi.c b/comms/asterisk/patches/patch-codecs_codec__dahdi.c
new file mode 100644
index 00000000000..484ecb07b2a
--- /dev/null
+++ b/comms/asterisk/patches/patch-codecs_codec__dahdi.c
@@ -0,0 +1,15 @@
+$NetBSD: patch-codecs_codec__dahdi.c,v 1.1 2015/10/27 08:49:01 jnemeth Exp $
+
+--- codecs/codec_dahdi.c.orig 2015-10-09 22:23:39.000000000 +0000
++++ codecs/codec_dahdi.c
+@@ -37,9 +37,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revisi
+
+ #include <fcntl.h>
+ #include <netinet/in.h>
++#include <poll.h>
+ #include <sys/ioctl.h>
+ #include <sys/mman.h>
+-#include <sys/poll.h>
+ #include <dahdi/user.h>
+
+ #include "asterisk/lock.h"
diff --git a/comms/asterisk/patches/patch-configure b/comms/asterisk/patches/patch-configure
index 3e961b42765..1d794a364a0 100644
--- a/comms/asterisk/patches/patch-configure
+++ b/comms/asterisk/patches/patch-configure
@@ -1,8 +1,17 @@
-$NetBSD: patch-configure,v 1.4 2013/06/14 04:26:55 jnemeth Exp $
+$NetBSD: patch-configure,v 1.5 2015/10/27 08:49:01 jnemeth Exp $
---- configure.orig 2013-02-27 12:22:30.000000000 +0000
+--- configure.orig 2015-10-09 22:23:39.000000000 +0000
+++ configure
-@@ -14200,7 +14200,7 @@ fi
+@@ -12409,7 +12409,7 @@ fi
+ done
+
+
+-ac_fn_c_check_header_mongrel "$LINENO" "sys/poll.h" "ac_cv_header_sys_poll_h" "$ac_includes_default"
++ac_fn_c_check_header_mongrel "$LINENO" "poll.h" "ac_cv_header_sys_poll_h" "$ac_includes_default"
+ if test "x$ac_cv_header_sys_poll_h" = xyes; then :
+
+ else
+@@ -14464,7 +14464,7 @@ fi
done
@@ -11,7 +20,16 @@ $NetBSD: patch-configure,v 1.4 2013/06/14 04:26:55 jnemeth Exp $
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-@@ -16195,16 +16195,16 @@ if $(${CC} -march=native -S -o /dev/null
+@@ -14645,7 +14645,7 @@ rm -f core conftest.err conftest.$ac_obj
+ LDFLAGS=${old_LDFLAGS}
+ rm -f conftest.dynamics
+
+-ac_fn_c_check_header_mongrel "$LINENO" "sys/poll.h" "ac_cv_header_sys_poll_h" "$ac_includes_default"
++ac_fn_c_check_header_mongrel "$LINENO" "poll.h" "ac_cv_header_sys_poll_h" "$ac_includes_default"
+ if test "x$ac_cv_header_sys_poll_h" = xyes; then :
+ HAS_POLL=1
+
+@@ -16459,16 +16459,16 @@ if $(${CC} -march=native -S -o /dev/null
if test "${CONFIG_CFLAGS}" = ""; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
@@ -31,7 +49,7 @@ $NetBSD: patch-configure,v 1.4 2013/06/14 04:26:55 jnemeth Exp $
fi
-@@ -16729,6 +16729,148 @@ fi
+@@ -16968,6 +16968,148 @@ fi
@@ -180,7 +198,7 @@ $NetBSD: patch-configure,v 1.4 2013/06/14 04:26:55 jnemeth Exp $
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-@@ -17871,6 +18013,8 @@ $as_echo_n "checking if \"struct ifaddrs
+@@ -18218,6 +18360,8 @@ $as_echo_n "checking if \"struct ifaddrs
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
diff --git a/comms/asterisk/patches/patch-configure.ac b/comms/asterisk/patches/patch-configure.ac
index f47a0e313c4..de95ab0947e 100644
--- a/comms/asterisk/patches/patch-configure.ac
+++ b/comms/asterisk/patches/patch-configure.ac
@@ -1,8 +1,17 @@
-$NetBSD: patch-configure.ac,v 1.2 2013/06/14 04:26:55 jnemeth Exp $
+$NetBSD: patch-configure.ac,v 1.3 2015/10/27 08:49:01 jnemeth Exp $
---- configure.ac.orig 2013-02-26 19:45:09.000000000 +0000
+--- configure.ac.orig 2015-10-09 22:23:39.000000000 +0000
+++ configure.ac
-@@ -584,7 +584,7 @@ AC_FUNC_STRNLEN
+@@ -543,7 +543,7 @@ AC_CHECK_HEADERS([xlocale.h])
+
+ AC_CHECK_HEADERS([winsock.h winsock2.h])
+
+-AC_CHECK_HEADER([sys/poll.h],
++AC_CHECK_HEADER([poll.h],
+ [],
+ AC_DEFINE([AST_POLL_COMPAT], 1, [Define to 1 if internal poll should be used.]))
+
+@@ -597,7 +597,7 @@ AC_FUNC_STRNLEN
AC_FUNC_STRTOD
AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
@@ -11,7 +20,19 @@ $NetBSD: patch-configure.ac,v 1.2 2013/06/14 04:26:55 jnemeth Exp $
# NOTE: we use AC_CHECK_LIB to get -lm into the arguments for later checks,
# so that AC_CHECK_FUNCS can detect functions in that library.
-@@ -1036,7 +1036,7 @@ if $(${CC} -march=native -S -o /dev/null
+@@ -648,9 +648,9 @@ AC_SUBST(PBX_DYNAMIC_LIST)
+ LDFLAGS=${old_LDFLAGS}
+ rm -f conftest.dynamics
+
+-AC_CHECK_HEADER([sys/poll.h],
++AC_CHECK_HEADER([poll.h],
+ [HAS_POLL=1]
+- AC_DEFINE([HAVE_SYS_POLL_H], 1, [Define to 1 if your system has working sys/poll.h]),
++ AC_DEFINE([HAVE_SYS_POLL_H], 1, [Define to 1 if your system has working poll.h]),
+ )
+
+ AC_ARG_ENABLE([internal-poll],
+@@ -1049,7 +1049,7 @@ if $(${CC} -march=native -S -o /dev/null
fi
else
AC_MSG_RESULT(no)
@@ -20,7 +41,7 @@ $NetBSD: patch-configure.ac,v 1.2 2013/06/14 04:26:55 jnemeth Exp $
fi
AC_SUBST(AST_NATIVE_ARCH)
-@@ -1160,6 +1160,9 @@ AST_C_DEFINE_CHECK([IP_MTU_DISCOVER], [I
+@@ -1162,6 +1162,9 @@ AST_C_DEFINE_CHECK([IP_MTU_DISCOVER], [I
AC_CHECK_HEADER([libkern/OSAtomic.h],
[AC_DEFINE_UNQUOTED([HAVE_OSX_ATOMICS], 1, [Define to 1 if OSX atomic operations are supported.])])
diff --git a/comms/asterisk/patches/patch-funcs_func__env.c b/comms/asterisk/patches/patch-funcs_func__env.c
new file mode 100644
index 00000000000..653ddfbaef8
--- /dev/null
+++ b/comms/asterisk/patches/patch-funcs_func__env.c
@@ -0,0 +1,13 @@
+$NetBSD: patch-funcs_func__env.c,v 1.1 2015/10/27 08:49:01 jnemeth Exp $
+
+--- funcs/func_env.c.orig 2015-10-09 22:23:39.000000000 +0000
++++ funcs/func_env.c
+@@ -309,7 +309,7 @@ static int stat_read(struct ast_channel
+ snprintf(buf, len, "%d", (int) s.st_ctime);
+ break;
+ case 'm':
+- snprintf(buf, len, "%o", s.st_mode);
++ snprintf(buf, len, "%o", (unsigned int) s.st_mode);
+ break;
+ }
+ }
diff --git a/comms/asterisk/patches/patch-include_asterisk_compat.h b/comms/asterisk/patches/patch-include_asterisk_compat.h
new file mode 100644
index 00000000000..72330224bab
--- /dev/null
+++ b/comms/asterisk/patches/patch-include_asterisk_compat.h
@@ -0,0 +1,13 @@
+$NetBSD: patch-include_asterisk_compat.h,v 1.1 2015/10/27 08:49:01 jnemeth Exp $
+
+--- include/asterisk/compat.h.orig 2015-10-09 22:23:39.000000000 +0000
++++ include/asterisk/compat.h
+@@ -68,7 +68,7 @@
+ #endif
+
+ #ifndef AST_POLL_COMPAT
+-#include <sys/poll.h>
++#include <poll.h>
+ #else
+ #include "asterisk/poll-compat.h"
+ #endif
diff --git a/comms/asterisk/patches/patch-include_asterisk_poll-compat.h b/comms/asterisk/patches/patch-include_asterisk_poll-compat.h
new file mode 100644
index 00000000000..3146b11cd50
--- /dev/null
+++ b/comms/asterisk/patches/patch-include_asterisk_poll-compat.h
@@ -0,0 +1,13 @@
+$NetBSD: patch-include_asterisk_poll-compat.h,v 1.1 2015/10/27 08:49:01 jnemeth Exp $
+
+--- include/asterisk/poll-compat.h.orig 2015-10-09 22:23:39.000000000 +0000
++++ include/asterisk/poll-compat.h
+@@ -83,7 +83,7 @@
+
+ #ifndef AST_POLL_COMPAT
+
+-#include <sys/poll.h>
++#include <poll.h>
+
+ #define ast_poll(a, b, c) poll(a, b, c)
+
diff --git a/comms/asterisk/patches/patch-main_cdr.c b/comms/asterisk/patches/patch-main_cdr.c
index 1802cc8f7c5..d56691a6c2f 100644
--- a/comms/asterisk/patches/patch-main_cdr.c
+++ b/comms/asterisk/patches/patch-main_cdr.c
@@ -1,6 +1,6 @@
-$NetBSD: patch-main_cdr.c,v 1.1 2015/05/19 07:52:14 jnemeth Exp $
+$NetBSD: patch-main_cdr.c,v 1.2 2015/10/27 08:49:01 jnemeth Exp $
---- main/cdr.c.orig 2013-08-06 08:19:42.000000000 +0000
+--- main/cdr.c.orig 2015-10-09 22:23:39.000000000 +0000
+++ main/cdr.c
@@ -260,7 +260,7 @@ static const char *ast_cdr_getvar_intern
static void cdr_get_tv(struct timeval when, const char *fmt, char *buf, int bufsize)
@@ -23,7 +23,7 @@ $NetBSD: patch-main_cdr.c,v 1.1 2015/05/19 07:52:14 jnemeth Exp $
} else if (!strcasecmp(name, "disposition")) {
if (raw) {
- snprintf(workspace, workspacelen, "%ld", cdr->disposition);
-+ snprintf(workspace, workspacelen, "%jd", cdr->disposition);
++ snprintf(workspace, workspacelen, "%jd", (intmax_t)cdr->disposition);
} else {
ast_copy_string(workspace, ast_cdr_disp2str(cdr->disposition), workspacelen);
}
diff --git a/comms/asterisk/patches/patch-main_channel.c b/comms/asterisk/patches/patch-main_channel.c
new file mode 100644
index 00000000000..19313fc41b9
--- /dev/null
+++ b/comms/asterisk/patches/patch-main_channel.c
@@ -0,0 +1,22 @@
+$NetBSD: patch-main_channel.c,v 1.1 2015/10/27 08:49:01 jnemeth Exp $
+
+--- main/channel.c.orig 2015-10-24 19:56:31.000000000 +0000
++++ main/channel.c
+@@ -5907,15 +5907,8 @@ static int set_security_requirements(con
+ ast_channel_unlock(r);
+
+ for (i = 0; i < 2; i++) {
+- if (ops[i][1]) {
+- if (ast_channel_setoption(out, ops[i][0], &ops[i][1], sizeof(ops[i][1]), 0)) {
+- /* We require a security feature, but the channel won't provide it */
+- return -1;
+- }
+- } else {
+- /* We don't care if we can't clear the option on a channel that doesn't support it */
+- ast_channel_setoption(out, ops[i][0], &ops[i][1], sizeof(ops[i][1]), 0);
+- }
++ /* We don't care if we can't clear the option on a channel that doesn't support it */
++ ast_channel_setoption(out, ops[i][0], &ops[i][1], sizeof(ops[i][1]), 0);
+ }
+
+ return 0;
diff --git a/comms/asterisk/patches/patch-main_pbx.c b/comms/asterisk/patches/patch-main_pbx.c
index c74c661aebb..3f439d0ec63 100644
--- a/comms/asterisk/patches/patch-main_pbx.c
+++ b/comms/asterisk/patches/patch-main_pbx.c
@@ -1,8 +1,8 @@
-$NetBSD: patch-main_pbx.c,v 1.1 2015/05/19 07:52:14 jnemeth Exp $
+$NetBSD: patch-main_pbx.c,v 1.2 2015/10/27 08:49:01 jnemeth Exp $
---- main/pbx.c.orig 2015-01-30 16:55:39.000000000 +0000
+--- main/pbx.c.orig 2015-10-09 22:23:39.000000000 +0000
+++ main/pbx.c
-@@ -11201,7 +11201,7 @@ static int testtime_write(struct ast_cha
+@@ -11427,7 +11427,7 @@ static int testtime_write(struct ast_cha
sscanf(remainder, "%79s", timezone);
tv = ast_mktime(&tm, S_OR(timezone, NULL));
@@ -11,7 +11,16 @@ $NetBSD: patch-main_pbx.c,v 1.1 2015/05/19 07:52:14 jnemeth Exp $
pbx_builtin_setvar_helper(chan, "__TESTTIME", result);
return 0;
}
-@@ -11235,7 +11235,7 @@ static int pbx_builtin_gotoiftime(struct
+@@ -11446,7 +11446,7 @@ static int pbx_builtin_gotoiftime(struct
+ struct ast_timing timing;
+ const char *ctime;
+ struct timeval tv = ast_tvnow();
+- long timesecs;
++ intmax_t timesecs;
+
+ if (!chan) {
+ ast_log(LOG_WARNING, "GotoIfTime requires a channel on which to operate\n");
+@@ -11461,7 +11461,7 @@ static int pbx_builtin_gotoiftime(struct
ts = s = ast_strdupa(data);
ast_channel_lock(chan);
diff --git a/comms/asterisk/patches/patch-main_sched.c b/comms/asterisk/patches/patch-main_sched.c
index 87feedad59e..23b332da647 100644
--- a/comms/asterisk/patches/patch-main_sched.c
+++ b/comms/asterisk/patches/patch-main_sched.c
@@ -1,8 +1,8 @@
-$NetBSD: patch-main_sched.c,v 1.1 2012/12/11 08:22:49 jnemeth Exp $
+$NetBSD: patch-main_sched.c,v 1.2 2015/10/27 08:49:01 jnemeth Exp $
---- main/sched.c.orig 2012-06-15 16:20:16.000000000 +0000
+--- main/sched.c.orig 2015-10-09 22:23:39.000000000 +0000
+++ main/sched.c
-@@ -349,7 +349,7 @@ static int sched_settime(struct timeval
+@@ -474,7 +474,7 @@ static int sched_settime(struct timeval
{
struct timeval now = ast_tvnow();
@@ -11,19 +11,17 @@ $NetBSD: patch-main_sched.c,v 1.1 2012/12/11 08:22:49 jnemeth Exp $
if (ast_tvzero(*t)) /* not supplied, default to now */
*t = now;
*t = ast_tvadd(*t, ast_samp2tv(when, 1000));
-@@ -557,12 +557,12 @@ void ast_sched_dump(struct ast_sched_con
+@@ -688,11 +688,11 @@ void ast_sched_dump(struct ast_sched_con
struct timeval delta;
q = ast_heap_peek(con->sched_heap, x);
delta = ast_tvsub(q->when, when);
- ast_debug(1, "|%.4d | %-15p | %-15p | %.6ld : %.6ld |\n",
-+ ast_debug(1, "|%.4d | %-15p | %-15p | %.6jd : %.6jd |\n",
- q->id,
++ ast_debug(1, "|%.4d | %-15p | %-15p | %.6jd : %.6ld |\n",
+ q->sched_id->id,
q->callback,
q->data,
- (long)delta.tv_sec,
-- (long int)delta.tv_usec);
+ (intmax_t)delta.tv_sec,
-+ (intmax_t)delta.tv_usec);
+ (long int)delta.tv_usec);
}
ast_mutex_unlock(&con->lock);
- ast_debug(1, "=============================================================\n");
diff --git a/comms/asterisk/patches/patch-main_stdtime_localtime.c b/comms/asterisk/patches/patch-main_stdtime_localtime.c
index cd51555d3ba..159851498ea 100644
--- a/comms/asterisk/patches/patch-main_stdtime_localtime.c
+++ b/comms/asterisk/patches/patch-main_stdtime_localtime.c
@@ -1,8 +1,19 @@
-$NetBSD: patch-main_stdtime_localtime.c,v 1.2 2015/05/19 07:52:14 jnemeth Exp $
+$NetBSD: patch-main_stdtime_localtime.c,v 1.3 2015/10/27 08:49:01 jnemeth Exp $
---- main/stdtime/localtime.c.orig 2015-03-10 17:42:57.000000000 +0000
+--- main/stdtime/localtime.c.orig 2015-10-09 22:23:39.000000000 +0000
+++ main/stdtime/localtime.c
-@@ -733,7 +733,7 @@ static void *notify_daemon(void *data)
+@@ -67,6 +67,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revisi
+ #include <sys/stat.h>
+ #include <fcntl.h>
+ #endif
++#ifdef __sun
++#include <time.h>
++#include <xlocale.h>
++#endif
+
+ #include "private.h"
+ #include "tzfile.h"
+@@ -733,7 +737,7 @@ static void *notify_daemon(void *data)
if (st.st_mtime > cur->mtime[0] || lst.st_mtime > cur->mtime[1]) {
#ifdef TEST_FRAMEWORK
if (test) {
@@ -11,7 +22,7 @@ $NetBSD: patch-main_stdtime_localtime.c,v 1.2 2015/05/19 07:52:14 jnemeth Exp $
} else
#endif
{
-@@ -2417,6 +2417,23 @@ static struct locale_entry *find_by_name
+@@ -2417,6 +2421,23 @@ static struct locale_entry *find_by_name
return NULL;
}
@@ -35,7 +46,7 @@ $NetBSD: patch-main_stdtime_localtime.c,v 1.2 2015/05/19 07:52:14 jnemeth Exp $
static const char *store_by_locale(locale_t prevlocale)
{
struct locale_entry *cur;
-@@ -2474,6 +2491,7 @@ const char *ast_setlocale(const char *lo
+@@ -2474,6 +2495,7 @@ const char *ast_setlocale(const char *lo
AST_LIST_UNLOCK(&localelist);
return store_by_locale(prevlocale);
}
@@ -43,7 +54,7 @@ $NetBSD: patch-main_stdtime_localtime.c,v 1.2 2015/05/19 07:52:14 jnemeth Exp $
#else
const char *ast_setlocale(const char *unused)
{
-@@ -2487,7 +2505,9 @@ int ast_strftime_locale(char *buf, size_
+@@ -2487,7 +2509,9 @@ int ast_strftime_locale(char *buf, size_
char *format = ast_calloc(1, fmtlen), *fptr = format, *newfmt;
int decimals = -1, i, res;
long fraction;
@@ -53,7 +64,7 @@ $NetBSD: patch-main_stdtime_localtime.c,v 1.2 2015/05/19 07:52:14 jnemeth Exp $
buf[0] = '\0';/* Ensure the buffer is initialized. */
if (!format) {
-@@ -2542,6 +2562,14 @@ defcase: *fptr++ = *tmp;
+@@ -2542,6 +2566,14 @@ defcase: *fptr++ = *tmp;
}
*fptr = '\0';
#undef strftime
@@ -68,7 +79,7 @@ $NetBSD: patch-main_stdtime_localtime.c,v 1.2 2015/05/19 07:52:14 jnemeth Exp $
if (locale) {
prevlocale = ast_setlocale(locale);
}
-@@ -2549,6 +2577,7 @@ defcase: *fptr++ = *tmp;
+@@ -2549,6 +2581,7 @@ defcase: *fptr++ = *tmp;
if (locale) {
ast_setlocale(prevlocale);
}
@@ -76,7 +87,7 @@ $NetBSD: patch-main_stdtime_localtime.c,v 1.2 2015/05/19 07:52:14 jnemeth Exp $
ast_free(format);
return res;
}
-@@ -2562,11 +2591,22 @@ char *ast_strptime_locale(const char *s,
+@@ -2562,11 +2595,22 @@ char *ast_strptime_locale(const char *s,
{
struct tm tm2 = { 0, };
char *res;
diff --git a/comms/asterisk/patches/patch-res_pjproject_pjlib_include_pj_config.h b/comms/asterisk/patches/patch-res_pjproject_pjlib_include_pj_config.h
new file mode 100644
index 00000000000..411b78a895c
--- /dev/null
+++ b/comms/asterisk/patches/patch-res_pjproject_pjlib_include_pj_config.h
@@ -0,0 +1,32 @@
+$NetBSD: patch-res_pjproject_pjlib_include_pj_config.h,v 1.1 2015/10/27 08:49:01 jnemeth Exp $
+
+--- res/pjproject/pjlib/include/pj/config.h.orig 2015-10-09 22:23:39.000000000 +0000
++++ res/pjproject/pjlib/include/pj/config.h
+@@ -555,7 +555,7 @@
+ * the underlying implementation changes.
+ */
+ #ifndef PJ_IOQUEUE_MAX_HANDLES
+-# define PJ_IOQUEUE_MAX_HANDLES (64)
++# define PJ_IOQUEUE_MAX_HANDLES (1024)
+ #endif
+
+
+@@ -622,16 +622,10 @@
+
+ /**
+ * Determine if FD_SETSIZE is changeable/set-able. If so, then we will
+- * set it to PJ_IOQUEUE_MAX_HANDLES. Currently we detect this by checking
+- * for Winsock.
++ * set it to PJ_IOQUEUE_MAX_HANDLES. Assumed to be supported by default.
+ */
+ #ifndef PJ_FD_SETSIZE_SETABLE
+-# if (defined(PJ_HAS_WINSOCK_H) && PJ_HAS_WINSOCK_H!=0) || \
+- (defined(PJ_HAS_WINSOCK2_H) && PJ_HAS_WINSOCK2_H!=0)
+-# define PJ_FD_SETSIZE_SETABLE 1
+-# else
+-# define PJ_FD_SETSIZE_SETABLE 0
+-# endif
++# define PJ_FD_SETSIZE_SETABLE 1
+ #endif
+
+ /**
diff --git a/comms/asterisk/patches/patch-res_pjproject_pjlib_include_pj_sock__select.h b/comms/asterisk/patches/patch-res_pjproject_pjlib_include_pj_sock__select.h
new file mode 100644
index 00000000000..49ec691674c
--- /dev/null
+++ b/comms/asterisk/patches/patch-res_pjproject_pjlib_include_pj_sock__select.h
@@ -0,0 +1,21 @@
+$NetBSD: patch-res_pjproject_pjlib_include_pj_sock__select.h,v 1.1 2015/10/27 08:49:01 jnemeth Exp $
+
+--- res/pjproject/pjlib/include/pj/sock_select.h.orig 2015-10-09 22:23:39.000000000 +0000
++++ res/pjproject/pjlib/include/pj/sock_select.h
+@@ -25,6 +25,7 @@
+ * @brief Socket select().
+ */
+
++#include <limits.h>
+ #include <pj/types.h>
+
+ PJ_BEGIN_DECL
+@@ -55,7 +56,7 @@ PJ_BEGIN_DECL
+ */
+ typedef struct pj_fd_set_t
+ {
+- pj_sock_t data[PJ_IOQUEUE_MAX_HANDLES+ 4]; /**< Opaque buffer for fd_set */
++ pj_sock_t data[PJ_IOQUEUE_MAX_HANDLES / sizeof(pj_sock_t) / CHAR_BIT + 4]; /**< Opaque buffer for fd_set */
+ } pj_fd_set_t;
+
+
diff --git a/comms/asterisk/patches/patch-res_pjproject_pjlib_src_pj_sock__select.c b/comms/asterisk/patches/patch-res_pjproject_pjlib_src_pj_sock__select.c
new file mode 100644
index 00000000000..9659c81bec1
--- /dev/null
+++ b/comms/asterisk/patches/patch-res_pjproject_pjlib_src_pj_sock__select.c
@@ -0,0 +1,52 @@
+$NetBSD: patch-res_pjproject_pjlib_src_pj_sock__select.c,v 1.1 2015/10/27 08:49:01 jnemeth Exp $
+
+--- res/pjproject/pjlib/src/pj/sock_select.c.orig 2015-10-09 22:23:39.000000000 +0000
++++ res/pjproject/pjlib/src/pj/sock_select.c
+@@ -40,10 +40,11 @@
+ #define PART_FDSET_OR_NULL(ps) (ps ? PART_FDSET(ps) : NULL)
+ #define PART_COUNT(ps) (ps->data[0])
+
++typedef char pj_assert_fd_set_t[(sizeof(pj_fd_set_t)-sizeof(pj_sock_t) >= sizeof(fd_set)) ? 1 : -1];
++
+ PJ_DEF(void) PJ_FD_ZERO(pj_fd_set_t *fdsetp)
+ {
+ PJ_CHECK_STACK();
+- pj_assert(sizeof(pj_fd_set_t)-sizeof(pj_sock_t) >= sizeof(fd_set));
+
+ FD_ZERO(PART_FDSET(fdsetp));
+ PART_COUNT(fdsetp) = 0;
+@@ -53,7 +54,6 @@ PJ_DEF(void) PJ_FD_ZERO(pj_fd_set_t *fds
+ PJ_DEF(void) PJ_FD_SET(pj_sock_t fd, pj_fd_set_t *fdsetp)
+ {
+ PJ_CHECK_STACK();
+- pj_assert(sizeof(pj_fd_set_t)-sizeof(pj_sock_t) >= sizeof(fd_set));
+
+ if (!PJ_FD_ISSET(fd, fdsetp))
+ ++PART_COUNT(fdsetp);
+@@ -64,7 +64,6 @@ PJ_DEF(void) PJ_FD_SET(pj_sock_t fd, pj_
+ PJ_DEF(void) PJ_FD_CLR(pj_sock_t fd, pj_fd_set_t *fdsetp)
+ {
+ PJ_CHECK_STACK();
+- pj_assert(sizeof(pj_fd_set_t)-sizeof(pj_sock_t) >= sizeof(fd_set));
+
+ if (PJ_FD_ISSET(fd, fdsetp))
+ --PART_COUNT(fdsetp);
+@@ -75,8 +74,6 @@ PJ_DEF(void) PJ_FD_CLR(pj_sock_t fd, pj_
+ PJ_DEF(pj_bool_t) PJ_FD_ISSET(pj_sock_t fd, const pj_fd_set_t *fdsetp)
+ {
+ PJ_CHECK_STACK();
+- PJ_ASSERT_RETURN(sizeof(pj_fd_set_t)-sizeof(pj_sock_t) >= sizeof(fd_set),
+- 0);
+
+ return FD_ISSET(fd, PART_FDSET(fdsetp));
+ }
+@@ -96,9 +93,6 @@ PJ_DEF(int) pj_sock_select( int n,
+
+ PJ_CHECK_STACK();
+
+- PJ_ASSERT_RETURN(sizeof(pj_fd_set_t)-sizeof(pj_sock_t) >= sizeof(fd_set),
+- PJ_EBUG);
+-
+ if (timeout) {
+ os_timeout.tv_sec = timeout->sec;
+ os_timeout.tv_usec = timeout->msec * 1000;
diff --git a/comms/asterisk/patches/patch-res_pjproject_third__party_portaudio_src_hostapi_alsa_pa__linux__alsa.c b/comms/asterisk/patches/patch-res_pjproject_third__party_portaudio_src_hostapi_alsa_pa__linux__alsa.c
new file mode 100644
index 00000000000..a64486c6a2c
--- /dev/null
+++ b/comms/asterisk/patches/patch-res_pjproject_third__party_portaudio_src_hostapi_alsa_pa__linux__alsa.c
@@ -0,0 +1,13 @@
+$NetBSD: patch-res_pjproject_third__party_portaudio_src_hostapi_alsa_pa__linux__alsa.c,v 1.1 2015/10/27 08:49:01 jnemeth Exp $
+
+--- res/pjproject/third_party/portaudio/src/hostapi/alsa/pa_linux_alsa.c.orig 2015-10-09 22:23:39.000000000 +0000
++++ res/pjproject/third_party/portaudio/src/hostapi/alsa/pa_linux_alsa.c
+@@ -53,7 +53,7 @@
+ #undef ALSA_PCM_NEW_HW_PARAMS_API
+ #undef ALSA_PCM_NEW_SW_PARAMS_API
+
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <string.h> /* strlen() */
+ #include <limits.h>
+ #include <math.h>
diff --git a/comms/asterisk/patches/patch-res_pjproject_third__party_portaudio_src_hostapi_oss_pa__unix__oss.c b/comms/asterisk/patches/patch-res_pjproject_third__party_portaudio_src_hostapi_oss_pa__unix__oss.c
new file mode 100644
index 00000000000..3583ca16af6
--- /dev/null
+++ b/comms/asterisk/patches/patch-res_pjproject_third__party_portaudio_src_hostapi_oss_pa__unix__oss.c
@@ -0,0 +1,13 @@
+$NetBSD: patch-res_pjproject_third__party_portaudio_src_hostapi_oss_pa__unix__oss.c,v 1.1 2015/10/27 08:49:01 jnemeth Exp $
+
+--- res/pjproject/third_party/portaudio/src/hostapi/oss/pa_unix_oss.c.orig 2015-10-09 22:23:39.000000000 +0000
++++ res/pjproject/third_party/portaudio/src/hostapi/oss/pa_unix_oss.c
+@@ -59,7 +59,7 @@
+ #include <errno.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <limits.h>
+ #include <semaphore.h>
+
diff --git a/comms/asterisk/patches/patch-res_res__timing__kqueue.c b/comms/asterisk/patches/patch-res_res__timing__kqueue.c
new file mode 100644
index 00000000000..8258b31c773
--- /dev/null
+++ b/comms/asterisk/patches/patch-res_res__timing__kqueue.c
@@ -0,0 +1,431 @@
+$NetBSD: patch-res_res__timing__kqueue.c,v 1.1 2015/10/27 08:49:01 jnemeth Exp $
+
+--- res/res_timing_kqueue.c.orig 2015-10-09 22:23:39.000000000 +0000
++++ res/res_timing_kqueue.c
+@@ -71,9 +71,12 @@ static struct ast_timing_interface kqueu
+ static struct ao2_container *kqueue_timers;
+
+ struct kqueue_timer {
++ intptr_t period;
+ int handle;
+- uint64_t nsecs;
+- uint64_t unacked;
++#ifndef EVFILT_USER
++ int continuous_fd;
++ unsigned int continuous_fd_valid:1;
++#endif
+ unsigned int is_continuous:1;
+ };
+
+@@ -90,6 +93,78 @@ static int kqueue_timer_cmp(void *obj, v
+ return timer1->handle == timer2->handle ? CMP_MATCH | CMP_STOP : 0;
+ }
+
++#ifdef EVFILT_USER
++#define CONTINUOUS_EVFILT_TYPE EVFILT_USER
++static int kqueue_timer_init_continuous_event(struct kqueue_timer *timer)
++{
++ return 0;
++}
++
++static int kqueue_timer_enable_continuous_event(struct kqueue_timer *timer)
++{
++ struct kevent kev[2];
++
++ EV_SET(&kev[0], (uintptr_t)timer, EVFILT_USER, EV_ADD | EV_ENABLE,
++ 0, 0, NULL);
++ EV_SET(&kev[1], (uintptr_t)timer, EVFILT_USER, 0, NOTE_TRIGGER,
++ 0, NULL);
++ return kevent(timer->handle, kev, 2, NULL, 0, NULL);
++}
++
++static int kqueue_timer_disable_continuous_event(struct kqueue_timer *timer)
++{
++ struct kevent kev;
++
++ EV_SET(&kev, (uintptr_t)timer, EVFILT_USER, EV_DELETE, 0, 0, NULL);
++ return kevent(timer->handle, &kev, 1, NULL, 0, NULL);
++}
++
++static void kqueue_timer_fini_continuous_event(struct kqueue_timer *timer)
++{
++}
++
++#else /* EVFILT_USER */
++
++#define CONTINUOUS_EVFILT_TYPE EVFILT_READ
++static int kqueue_timer_init_continuous_event(struct kqueue_timer *timer)
++{
++ int pipefds[2];
++ int retval;
++
++ retval = pipe(pipefds);
++ if (retval == 0) {
++ timer->continuous_fd = pipefds[0];
++ timer->continuous_fd_valid = 1;
++ close(pipefds[1]);
++ }
++ return retval;
++}
++
++static void kqueue_timer_fini_continuous_event(struct kqueue_timer *timer)
++{
++ if (timer->continuous_fd_valid) {
++ close(timer->continuous_fd);
++ }
++}
++
++static int kqueue_timer_enable_continuous_event(struct kqueue_timer *timer)
++{
++ struct kevent kev;
++
++ EV_SET(&kev, timer->continuous_fd, EVFILT_READ, EV_ADD | EV_ENABLE,
++ 0, 0, NULL);
++ return kevent(timer->handle, &kev, 1, NULL, 0, NULL);
++}
++
++static int kqueue_timer_disable_continuous_event(struct kqueue_timer *timer)
++{
++ struct kevent kev;
++
++ EV_SET(&kev, timer->continuous_fd, EVFILT_READ, EV_DELETE, 0, 0, NULL);
++ return kevent(timer->handle, &kev, 1, NULL, 0, NULL);
++}
++#endif
++
+ static void timer_destroy(void *obj)
+ {
+ struct kqueue_timer *timer = obj;
+@@ -120,15 +195,25 @@ static int kqueue_timer_open(void)
+ int handle;
+
+ if (!(timer = ao2_alloc(sizeof(*timer), timer_destroy))) {
+- ast_log(LOG_ERROR, "Could not allocate memory for kqueue_timer structure\n");
++ ast_log(LOG_ERROR, "Alloc failed for kqueue_timer structure\n");
+ return -1;
+ }
++
+ if ((timer->handle = handle = kqueue()) < 0) {
+- ast_log(LOG_ERROR, "Failed to create kqueue timer: %s\n", strerror(errno));
++ ast_log(LOG_ERROR, "Failed to create kqueue fd: %s\n",
++ strerror(errno));
+ ao2_ref(timer, -1);
+ return -1;
+ }
+
++ if (kqueue_timer_init_continuous_event(timer) != 0) {
++ ast_log(LOG_ERROR, "Failed to create continuous event: %s\n",
++ strerror(errno));
++ ao2_ref(timer, -1);
++ return -1;
++ }
++ ast_debug(5, "[%d]: Create timer\n", timer->handle);
++
+ ao2_link(kqueue_timers, timer);
+ /* Get rid of the reference from the allocation */
+ ao2_ref(timer, -1);
+@@ -143,54 +228,86 @@ static void kqueue_timer_close(int handl
+ return;
+ }
+
++ ast_debug(5, "[%d]: Timer close\n", our_timer->handle);
+ ao2_unlink(kqueue_timers, our_timer);
+ ao2_ref(our_timer, -1);
+ }
+
+-static void kqueue_set_nsecs(struct kqueue_timer *our_timer, uint64_t nsecs)
++/*
++ * Use the highest precision available that does not overflow
++ * the datatype kevent is using for time.
++ */
++static intptr_t kqueue_scale_period(unsigned int period_ns, int *units)
+ {
+- struct timespec nowait = { 0, 1 };
+-#ifdef HAVE_KEVENT64
+- struct kevent64_s kev;
+-
+- EV_SET64(&kev, our_timer->handle, EVFILT_TIMER, EV_ADD | EV_ENABLE, NOTE_NSECONDS,
+- nsecs, 0, 0, 0);
+- kevent64(our_timer->handle, &kev, 1, NULL, 0, 0, &nowait);
+-#else
+- struct kevent kev;
+-
+- EV_SET(&kev, our_timer->handle, EVFILT_TIMER, EV_ADD | EV_ENABLE,
+-#ifdef NOTE_NSECONDS
+- nsecs <= 0xFFffFFff ? NOTE_NSECONDS :
+-#endif
+-#ifdef NOTE_USECONDS
+- NOTE_USECONDS
+-#else /* Milliseconds, if no constants are defined */
+- 0
+-#endif
+- ,
++ uint64_t period = period_ns;
++ *units = 0;
+ #ifdef NOTE_NSECONDS
+- nsecs <= 0xFFffFFff ? nsecs :
+-#endif
++ if (period < INTPTR_MAX) {
++ *units = NOTE_NSECONDS;
++ } else {
+ #ifdef NOTE_USECONDS
+- nsecs / 1000
+-#else /* Milliseconds, if nothing else is defined */
+- nsecs / 1000000
+-#endif
+- , NULL);
+- kevent(our_timer->handle, &kev, 1, NULL, 0, &nowait);
++ period /= 1000;
++ if (period < INTPTR_MAX) {
++ *units = NOTE_USECONDS;
++ } else {
++ period /= 1000;
++#ifdef NOTE_MSECONDS
++ *units = NOTE_MSECONDS;
++#endif /* NOTE_MSECONDS */
++ }
++#else /* NOTE_USECONDS */
++ period /= 1000000;
++#ifdef NOTE_MSECONDS
++ *units = NOTE_MSECONDS;
++#endif /* NOTE_MSECONDS */
++#endif /* NOTE_USECONDS */
++ }
++#else /* NOTE_NSECONDS */
++ period /= 1000000;
+ #endif
++ if (period > INTPTR_MAX) {
++ period = INTPTR_MAX;
++ }
++ return period;
+ }
+
+ static int kqueue_timer_set_rate(int handle, unsigned int rate)
+ {
++ struct kevent kev;
+ struct kqueue_timer *our_timer;
++ uint64_t period_ns;
++ int flags;
++ int units;
++ int retval;
+
+ if (!(our_timer = lookup_timer(handle))) {
+ return -1;
+ }
+
+- kqueue_set_nsecs(our_timer, (our_timer->nsecs = rate ? (long) (1000000000 / rate) : 0L));
++ if (rate == 0) {
++ if (our_timer->period == 0) {
++ ao2_ref(our_timer, -1);
++ return 0;
++ }
++ flags = EV_DELETE;
++ our_timer->period = 0;
++ units = 0;
++ } else {
++ flags = EV_ADD | EV_ENABLE;
++ period_ns = (uint64_t)1000000000 / rate;
++ our_timer->period = kqueue_scale_period(period_ns, &units);
++ }
++ ast_debug(5, "[%d]: Set rate %u:%ju\n",
++ our_timer->handle, units, (uintmax_t)our_timer->period);
++ EV_SET(&kev, our_timer->handle, EVFILT_TIMER, flags, units,
++ our_timer->period, NULL);
++ retval = kevent(our_timer->handle, &kev, 1, NULL, 0, NULL);
++
++ if (retval == -1) {
++ ast_log(LOG_ERROR, "[%d]: Error queueing timer: %s\n",
++ our_timer->handle, strerror(errno));
++ }
++
+ ao2_ref(our_timer, -1);
+
+ return 0;
+@@ -198,75 +315,113 @@ static int kqueue_timer_set_rate(int han
+
+ static int kqueue_timer_ack(int handle, unsigned int quantity)
+ {
++ static struct timespec ts_nowait = { 0, 0 };
+ struct kqueue_timer *our_timer;
++ struct kevent kev[2];
++ int i, retval;
+
+ if (!(our_timer = lookup_timer(handle))) {
+ return -1;
+ }
+
+- if (our_timer->unacked < quantity) {
+- ast_debug(1, "Acking more events than have expired?!!\n");
+- our_timer->unacked = 0;
++ retval = kevent(our_timer->handle, NULL, 0, kev, 2, &ts_nowait);
++ if (retval == -1) {
++ ast_log(LOG_ERROR, "[%d]: Error sampling kqueue: %s\n",
++ our_timer->handle, strerror(errno));
+ ao2_ref(our_timer, -1);
+ return -1;
+- } else {
+- our_timer->unacked -= quantity;
++ }
++
++ for (i = 0; i < retval; i++) {
++ switch (kev[i].filter) {
++ case EVFILT_TIMER:
++ if (kev[i].data > quantity) {
++ ast_log(LOG_ERROR, "[%d]: Missed %ju\n",
++ our_timer->handle,
++ (uintmax_t)kev[i].data - quantity);
++ }
++ break;
++ case CONTINUOUS_EVFILT_TYPE:
++ if (!our_timer->is_continuous) {
++ ast_log(LOG_ERROR,
++ "[%d]: Spurious user event\n",
++ our_timer->handle);
++ }
++ break;
++ default:
++ ast_log(LOG_ERROR, "[%d]: Spurious kevent type %d.\n",
++ our_timer->handle, kev[i].filter);
++ }
+ }
+
+ ao2_ref(our_timer, -1);
++
+ return 0;
+ }
+
+ static int kqueue_timer_enable_continuous(int handle)
+ {
+ struct kqueue_timer *our_timer;
++ int retval;
+
+ if (!(our_timer = lookup_timer(handle))) {
+ return -1;
+ }
+
+- kqueue_set_nsecs(our_timer, 1);
+- our_timer->is_continuous = 1;
+- our_timer->unacked = 0;
++ if (!our_timer->is_continuous) {
++ ast_debug(5, "[%d]: Enable continuous\n", our_timer->handle);
++ retval = kqueue_timer_enable_continuous_event(our_timer);
++ if (retval == -1) {
++ ast_log(LOG_ERROR,
++ "[%d]: Error signalling continuous event: %s\n",
++ our_timer->handle, strerror(errno));
++ }
++ our_timer->is_continuous = 1;
++ }
++
+ ao2_ref(our_timer, -1);
++
+ return 0;
+ }
+
+ static int kqueue_timer_disable_continuous(int handle)
+ {
+ struct kqueue_timer *our_timer;
++ int retval;
+
+ if (!(our_timer = lookup_timer(handle))) {
+ return -1;
+ }
+
+- kqueue_set_nsecs(our_timer, our_timer->nsecs);
+- our_timer->is_continuous = 0;
+- our_timer->unacked = 0;
++ if (our_timer->is_continuous) {
++ ast_debug(5, "[%d]: Disable Continuous\n", our_timer->handle);
++ retval = kqueue_timer_disable_continuous_event(our_timer);
++ if (retval == -1) {
++ ast_log(LOG_ERROR,
++ "[%d]: Error clearing continuous event: %s\n",
++ our_timer->handle, strerror(errno));
++ }
++ our_timer->is_continuous = 0;
++ }
++
+ ao2_ref(our_timer, -1);
++
+ return 0;
+ }
+
+ static enum ast_timer_event kqueue_timer_get_event(int handle)
+ {
+- enum ast_timer_event res = -1;
+ struct kqueue_timer *our_timer;
+- struct timespec sixty_seconds = { 60, 0 };
+- struct kevent kev;
++ enum ast_timer_event res;
+
+ if (!(our_timer = lookup_timer(handle))) {
+- return -1;
++ return AST_TIMING_EVENT_EXPIRED;
+ }
+
+- /* If we have non-ACKed events, just return immediately */
+- if (our_timer->unacked == 0) {
+- if (kevent(handle, NULL, 0, &kev, 1, &sixty_seconds) > 0) {
+- our_timer->unacked += kev.data;
+- }
+- }
+-
+- if (our_timer->unacked > 0) {
+- res = our_timer->is_continuous ? AST_TIMING_EVENT_CONTINUOUS : AST_TIMING_EVENT_EXPIRED;
++ if (our_timer->is_continuous) {
++ res = AST_TIMING_EVENT_CONTINUOUS;
++ } else {
++ res = AST_TIMING_EVENT_EXPIRED;
+ }
+
+ ao2_ref(our_timer, -1);
+@@ -275,8 +430,7 @@ static enum ast_timer_event kqueue_timer
+
+ static unsigned int kqueue_timer_get_max_rate(int handle)
+ {
+- /* Actually, the max rate is 2^64-1 seconds, but that's not representable in a 32-bit integer. */
+- return UINT_MAX;
++ return INTPTR_MAX > UINT_MAX ? UINT_MAX : INTPTR_MAX;
+ }
+
+ #ifdef TEST_FRAMEWORK
+@@ -331,13 +485,12 @@ AST_TEST_DEFINE(test_kqueue_timing)
+ res = AST_TEST_FAIL;
+ break;
+ }
+-#if 0
+- if (kt->unacked == 0) {
+- ast_test_status_update(test, "Unacked events is 0, but there should be at least 1.\n");
+- res = AST_TEST_FAIL;
++ if (kqueue_timer_ack(handle, 1) != 0) {
++ ast_test_status_update(test, "Acking event failed.\n");
++ res = AST_TEST_FAiL;
+ break;
+ }
+-#endif
++
+ kqueue_timer_enable_continuous(handle);
+ start = ast_tvnow();
+ for (i = 0; i < 100; i++) {
+@@ -351,15 +504,15 @@ AST_TEST_DEFINE(test_kqueue_timing)
+ res = AST_TEST_FAIL;
+ break;
+ }
++ if (kqueue_timer_ack(handle, 1) != 0) {
++ ast_test_status_update(test, "Acking event failed.\n");
++ res = AST_TEST_FAIL;
++ }
++
+ }
++
+ diff = ast_tvdiff_us(ast_tvnow(), start);
+ ast_test_status_update(test, "diff is %llu\n", diff);
+- /*
+- if (abs(diff - kt->unacked) == 0) {
+- ast_test_status_update(test, "Unacked events should be around 1000, not %llu\n", kt->unacked);
+- res = AST_TEST_FAIL;
+- }
+- */
+ } while (0);
+ kqueue_timer_close(handle);
+ return res;