Commit 546749516b for asterisk.org

commit 546749516b24475e4d222007814d5cc026b8dbd8
Author: George Joseph <gjoseph@sangoma.com>
Date:   Thu Jul 2 09:51:06 2026 -0600

    Bundled pjproject: Make it easier to override options in config_site.h.

    Bundled pjproject uses ./third-party/pjproject/patches/config_site.h to set
    many pjproject build options like PJ_IOQUEUE_MAX_HANDLES, PJSIP_MAX_URL_SIZE,
    etc. Editing that file however, causes the git tree to become dirty which
    is inconvenient.  So...

    * Updated the Asterisk configure scripts to pass the PJPROJECT_CFLAGS variable
    down to the pjproject configure scripts.  See the UserNote below for details.

    * Updated ./third-party/pjproject/patches/config_site.h to allow the following
    options to be overridden:
    PJ_MAX_HOSTNAME, PJSIP_MAX_URL_SIZE, PJ_IOQUEUE_MAX_HANDLES.
    Other options in config_site.h are not overridable because they can have a
    bad effect on the overall operation of pjproject.  This may be revisited in
    the future.  Options not already set in config_site.h can still be set.

    * Fixed an issue where if the Linux `epoll` facility is used (which it is by
    default) the default PJ_IOQUEUE_MAX_HANDLES and PJSIP_MAX_TRANSPORTS were
    being left at 1024 instead of being icnreased to 5000.

    * The `pjproject show buildopts` CLI command previously only showed options from
    the top level `PJ` pjproject layer but now also shows many from the `PJSIP`
    layer.  Many of these, such as PJSIP_MAX_TRANSPORTS, can be set using
    PJPROJECT_CFLAGS provided they're not already unconditionally set in
    config_site.h.

    * The `pjsip dump endpt` CLI command previously required that the pjproject
    log level be already set to at least 3 or no output would be produced.  The
    command now does that automatically then sets it back to whatever it was.
    This isn't strictly related to this PR but was just nagging me.

    UserNote: Bundled pjproject: It's now possible to override some of the pjproject
    build options contained in ./third-party/pjproject/patches/config_site.h by
    adding PJPROJECT_CFLAGS to your Asterisk ./configure command line.  For example:
    `./configure ... PJPROJECT_CFLAGS='-DPJ_OPT1=8192 -DPJ_OPT2=512'`
    Any option in config_site.h that's wrapped in a `#ifndef` block can be overridden
    and many of the `PJSIP` options displayed by `pjproject show buildopts` can be
    set.  WARNING: Adjusting these options without understanding their effect can
    cripple your Asterisk instances.  You shouldn't adjust them unless you need
    to solve a specific issue.

    Resolves: #2011

diff --git a/configure b/configure
index d7e4fa67ba..ede97cc9d2 100755
--- a/configure
+++ b/configure
@@ -3936,8 +3936,8 @@ ac_cxx_conftest_cxx11_main='
 }
 {
   // Unicode literals
-  char const *utf8 = u8"UTF-8 string \u2500";
-  char16_t const *utf16 = u"UTF-8 string \u2500";
+  auto const *utf8 = u8"UTF-8 string \u2500";
+  char16_t const *utf16 = u"UTF-16 string \u2500";
   char32_t const *utf32 = U"UTF-32 string \u2500";
 }
 '
@@ -19518,6 +19518,9 @@ printf "%s\n" "no" >&6; }
 		PKG_CONFIG=""
 	fi
 fi
+if test -z "$PKG_CONFIG"; then
+	as_fn_error $? "pkg-config not found" "$LINENO" 5
+fi

 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for bison that supports parse-param" >&5
 printf %s "checking for bison that supports parse-param... " >&6; }
@@ -21210,12 +21213,12 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        OPENSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "openssl >= 1.1.0" 2>&1`
+                OPENSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "openssl >= 1.1.0" 2>&1`
         else
-	        OPENSSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "openssl >= 1.1.0" 2>&1`
+                OPENSSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "openssl >= 1.1.0" 2>&1`
         fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$OPENSSL_PKG_ERRORS" >&5
+        # Put the nasty error message in config.log where it belongs
+        echo "$OPENSSL_PKG_ERRORS" >&5


             PBX_OPENSSL=0
@@ -21229,8 +21232,8 @@ printf "%s\n" "no" >&6; }


 else
-	OPENSSL_CFLAGS=$pkg_cv_OPENSSL_CFLAGS
-	OPENSSL_LIBS=$pkg_cv_OPENSSL_LIBS
+        OPENSSL_CFLAGS=$pkg_cv_OPENSSL_CFLAGS
+        OPENSSL_LIBS=$pkg_cv_OPENSSL_LIBS
         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 printf "%s\n" "yes" >&6; }

@@ -21301,12 +21304,12 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        OPENSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "openssl11" 2>&1`
+                OPENSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "openssl11" 2>&1`
         else
-	        OPENSSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "openssl11" 2>&1`
+                OPENSSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "openssl11" 2>&1`
         fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$OPENSSL_PKG_ERRORS" >&5
+        # Put the nasty error message in config.log where it belongs
+        echo "$OPENSSL_PKG_ERRORS" >&5


             PBX_OPENSSL=0
@@ -21320,8 +21323,8 @@ printf "%s\n" "no" >&6; }


 else
-	OPENSSL_CFLAGS=$pkg_cv_OPENSSL_CFLAGS
-	OPENSSL_LIBS=$pkg_cv_OPENSSL_LIBS
+        OPENSSL_CFLAGS=$pkg_cv_OPENSSL_CFLAGS
+        OPENSSL_LIBS=$pkg_cv_OPENSSL_LIBS
         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 printf "%s\n" "yes" >&6; }

@@ -21397,12 +21400,12 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        OPENSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "openssl" 2>&1`
+                OPENSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "openssl" 2>&1`
         else
-	        OPENSSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "openssl" 2>&1`
+                OPENSSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "openssl" 2>&1`
         fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$OPENSSL_PKG_ERRORS" >&5
+        # Put the nasty error message in config.log where it belongs
+        echo "$OPENSSL_PKG_ERRORS" >&5


             PBX_OPENSSL=0
@@ -21416,8 +21419,8 @@ printf "%s\n" "no" >&6; }


 else
-	OPENSSL_CFLAGS=$pkg_cv_OPENSSL_CFLAGS
-	OPENSSL_LIBS=$pkg_cv_OPENSSL_LIBS
+        OPENSSL_CFLAGS=$pkg_cv_OPENSSL_CFLAGS
+        OPENSSL_LIBS=$pkg_cv_OPENSSL_LIBS
         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 printf "%s\n" "yes" >&6; }

@@ -22010,7 +22013,7 @@ printf %s "checking for bundled pjproject... " >&6; }
 			EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" \
 			PJPROJECT_BUNDLED_OOT="${PJPROJECT_BUNDLED_OOT}" \
 			echo_cflags)
-		PJPROJECT_CFLAGS="$PJPROJECT_INCLUDE"
+
 		PBX_PJPROJECT=1


@@ -26037,12 +26040,12 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        LIBEDIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libedit" 2>&1`
+                LIBEDIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libedit" 2>&1`
         else
-	        LIBEDIT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libedit" 2>&1`
+                LIBEDIT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libedit" 2>&1`
         fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$LIBEDIT_PKG_ERRORS" >&5
+        # Put the nasty error message in config.log where it belongs
+        echo "$LIBEDIT_PKG_ERRORS" >&5


             PBX_LIBEDIT=0
@@ -26056,8 +26059,8 @@ printf "%s\n" "no" >&6; }


 else
-	LIBEDIT_CFLAGS=$pkg_cv_LIBEDIT_CFLAGS
-	LIBEDIT_LIBS=$pkg_cv_LIBEDIT_LIBS
+        LIBEDIT_CFLAGS=$pkg_cv_LIBEDIT_CFLAGS
+        LIBEDIT_LIBS=$pkg_cv_LIBEDIT_LIBS
         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 printf "%s\n" "yes" >&6; }

@@ -26530,12 +26533,12 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        JANSSON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "jansson >= 2.11" 2>&1`
+                JANSSON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "jansson >= 2.11" 2>&1`
         else
-	        JANSSON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "jansson >= 2.11" 2>&1`
+                JANSSON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "jansson >= 2.11" 2>&1`
         fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$JANSSON_PKG_ERRORS" >&5
+        # Put the nasty error message in config.log where it belongs
+        echo "$JANSSON_PKG_ERRORS" >&5


             PBX_JANSSON=0
@@ -26549,8 +26552,8 @@ printf "%s\n" "no" >&6; }


 else
-	JANSSON_CFLAGS=$pkg_cv_JANSSON_CFLAGS
-	JANSSON_LIBS=$pkg_cv_JANSSON_LIBS
+        JANSSON_CFLAGS=$pkg_cv_JANSSON_CFLAGS
+        JANSSON_LIBS=$pkg_cv_JANSSON_LIBS
         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 printf "%s\n" "yes" >&6; }

@@ -26774,12 +26777,12 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        LIBJWT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libjwt >= $LIBJWT_VERSION" 2>&1`
+                LIBJWT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libjwt >= $LIBJWT_VERSION" 2>&1`
         else
-	        LIBJWT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libjwt >= $LIBJWT_VERSION" 2>&1`
+                LIBJWT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libjwt >= $LIBJWT_VERSION" 2>&1`
         fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$LIBJWT_PKG_ERRORS" >&5
+        # Put the nasty error message in config.log where it belongs
+        echo "$LIBJWT_PKG_ERRORS" >&5


             PBX_LIBJWT=0
@@ -26793,8 +26796,8 @@ printf "%s\n" "no" >&6; }


 else
-	LIBJWT_CFLAGS=$pkg_cv_LIBJWT_CFLAGS
-	LIBJWT_LIBS=$pkg_cv_LIBJWT_LIBS
+        LIBJWT_CFLAGS=$pkg_cv_LIBJWT_CFLAGS
+        LIBJWT_LIBS=$pkg_cv_LIBJWT_LIBS
         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 printf "%s\n" "yes" >&6; }

@@ -26963,12 +26966,12 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        LIBXML2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libxml-2.0" 2>&1`
+                LIBXML2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libxml-2.0" 2>&1`
         else
-	        LIBXML2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libxml-2.0" 2>&1`
+                LIBXML2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libxml-2.0" 2>&1`
         fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$LIBXML2_PKG_ERRORS" >&5
+        # Put the nasty error message in config.log where it belongs
+        echo "$LIBXML2_PKG_ERRORS" >&5


             PBX_LIBXML2=0
@@ -26982,8 +26985,8 @@ printf "%s\n" "no" >&6; }


 else
-	LIBXML2_CFLAGS=$pkg_cv_LIBXML2_CFLAGS
-	LIBXML2_LIBS=$pkg_cv_LIBXML2_LIBS
+        LIBXML2_CFLAGS=$pkg_cv_LIBXML2_CFLAGS
+        LIBXML2_LIBS=$pkg_cv_LIBXML2_LIBS
         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 printf "%s\n" "yes" >&6; }

@@ -34427,12 +34430,12 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        ILBC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libilbc < 3" 2>&1`
+                ILBC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libilbc < 3" 2>&1`
         else
-	        ILBC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libilbc < 3" 2>&1`
+                ILBC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libilbc < 3" 2>&1`
         fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$ILBC_PKG_ERRORS" >&5
+        # Put the nasty error message in config.log where it belongs
+        echo "$ILBC_PKG_ERRORS" >&5


             PBX_ILBC=0
@@ -34446,8 +34449,8 @@ printf "%s\n" "no" >&6; }


 else
-	ILBC_CFLAGS=$pkg_cv_ILBC_CFLAGS
-	ILBC_LIBS=$pkg_cv_ILBC_LIBS
+        ILBC_CFLAGS=$pkg_cv_ILBC_CFLAGS
+        ILBC_LIBS=$pkg_cv_ILBC_LIBS
         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 printf "%s\n" "yes" >&6; }

@@ -36803,12 +36806,12 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        NETSNMP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "netsnmp-agent" 2>&1`
+                NETSNMP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "netsnmp-agent" 2>&1`
         else
-	        NETSNMP_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "netsnmp-agent" 2>&1`
+                NETSNMP_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "netsnmp-agent" 2>&1`
         fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$NETSNMP_PKG_ERRORS" >&5
+        # Put the nasty error message in config.log where it belongs
+        echo "$NETSNMP_PKG_ERRORS" >&5


             PBX_NETSNMP=0
@@ -36822,8 +36825,8 @@ printf "%s\n" "no" >&6; }


 else
-	NETSNMP_CFLAGS=$pkg_cv_NETSNMP_CFLAGS
-	NETSNMP_LIBS=$pkg_cv_NETSNMP_LIBS
+        NETSNMP_CFLAGS=$pkg_cv_NETSNMP_CFLAGS
+        NETSNMP_LIBS=$pkg_cv_NETSNMP_LIBS
         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 printf "%s\n" "yes" >&6; }

@@ -38326,12 +38329,12 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        PJPROJECT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpjproject" 2>&1`
+                PJPROJECT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpjproject" 2>&1`
         else
-	        PJPROJECT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpjproject" 2>&1`
+                PJPROJECT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpjproject" 2>&1`
         fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$PJPROJECT_PKG_ERRORS" >&5
+        # Put the nasty error message in config.log where it belongs
+        echo "$PJPROJECT_PKG_ERRORS" >&5


             PBX_PJPROJECT=0
@@ -38345,8 +38348,8 @@ printf "%s\n" "no" >&6; }


 else
-	PJPROJECT_CFLAGS=$pkg_cv_PJPROJECT_CFLAGS
-	PJPROJECT_LIBS=$pkg_cv_PJPROJECT_LIBS
+        PJPROJECT_CFLAGS=$pkg_cv_PJPROJECT_CFLAGS
+        PJPROJECT_LIBS=$pkg_cv_PJPROJECT_LIBS
         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 printf "%s\n" "yes" >&6; }

@@ -40125,12 +40128,12 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        PORTAUDIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "portaudio-2.0" 2>&1`
+                PORTAUDIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "portaudio-2.0" 2>&1`
         else
-	        PORTAUDIO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "portaudio-2.0" 2>&1`
+                PORTAUDIO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "portaudio-2.0" 2>&1`
         fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$PORTAUDIO_PKG_ERRORS" >&5
+        # Put the nasty error message in config.log where it belongs
+        echo "$PORTAUDIO_PKG_ERRORS" >&5


             PBX_PORTAUDIO=0
@@ -40144,8 +40147,8 @@ printf "%s\n" "no" >&6; }


 else
-	PORTAUDIO_CFLAGS=$pkg_cv_PORTAUDIO_CFLAGS
-	PORTAUDIO_LIBS=$pkg_cv_PORTAUDIO_LIBS
+        PORTAUDIO_CFLAGS=$pkg_cv_PORTAUDIO_CFLAGS
+        PORTAUDIO_LIBS=$pkg_cv_PORTAUDIO_LIBS
         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 printf "%s\n" "yes" >&6; }

@@ -46478,12 +46481,12 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        GMIME_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gmime-$ver" 2>&1`
+                GMIME_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gmime-$ver" 2>&1`
         else
-	        GMIME_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gmime-$ver" 2>&1`
+                GMIME_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gmime-$ver" 2>&1`
         fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$GMIME_PKG_ERRORS" >&5
+        # Put the nasty error message in config.log where it belongs
+        echo "$GMIME_PKG_ERRORS" >&5


             PBX_GMIME=0
@@ -46497,8 +46500,8 @@ printf "%s\n" "no" >&6; }


 else
-	GMIME_CFLAGS=$pkg_cv_GMIME_CFLAGS
-	GMIME_LIBS=$pkg_cv_GMIME_LIBS
+        GMIME_CFLAGS=$pkg_cv_GMIME_CFLAGS
+        GMIME_LIBS=$pkg_cv_GMIME_LIBS
         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 printf "%s\n" "yes" >&6; }

@@ -47846,12 +47849,12 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        GTK2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gtk+-2.0" 2>&1`
+                GTK2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gtk+-2.0" 2>&1`
         else
-	        GTK2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gtk+-2.0" 2>&1`
+                GTK2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gtk+-2.0" 2>&1`
         fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$GTK2_PKG_ERRORS" >&5
+        # Put the nasty error message in config.log where it belongs
+        echo "$GTK2_PKG_ERRORS" >&5


             PBX_GTK2=0
@@ -47865,8 +47868,8 @@ printf "%s\n" "no" >&6; }


 else
-	GTK2_CFLAGS=$pkg_cv_GTK2_CFLAGS
-	GTK2_LIBS=$pkg_cv_GTK2_LIBS
+        GTK2_CFLAGS=$pkg_cv_GTK2_CFLAGS
+        GTK2_LIBS=$pkg_cv_GTK2_LIBS
         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 printf "%s\n" "yes" >&6; }

@@ -47957,12 +47960,12 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libsystemd" 2>&1`
+                SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libsystemd" 2>&1`
         else
-	        SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libsystemd" 2>&1`
+                SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libsystemd" 2>&1`
         fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$SYSTEMD_PKG_ERRORS" >&5
+        # Put the nasty error message in config.log where it belongs
+        echo "$SYSTEMD_PKG_ERRORS" >&5


             PBX_SYSTEMD=0
@@ -47976,8 +47979,8 @@ printf "%s\n" "no" >&6; }


 else
-	SYSTEMD_CFLAGS=$pkg_cv_SYSTEMD_CFLAGS
-	SYSTEMD_LIBS=$pkg_cv_SYSTEMD_LIBS
+        SYSTEMD_CFLAGS=$pkg_cv_SYSTEMD_CFLAGS
+        SYSTEMD_LIBS=$pkg_cv_SYSTEMD_LIBS
         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 printf "%s\n" "yes" >&6; }

diff --git a/makeopts.in b/makeopts.in
index bc0d65e84e..279ed47356 100644
--- a/makeopts.in
+++ b/makeopts.in
@@ -235,6 +235,7 @@ PJPROJECT_INCLUDE=@PJPROJECT_INCLUDE@
 PJPROJECT_LIB=@PJPROJECT_LIB@
 PJPROJECT_DIR=@PJPROJECT_DIR@
 PJPROJECT_CONFIGURE_OPTS=@PJPROJECT_CONFIGURE_OPTS@
+PJPROJECT_CFLAGS=@PJPROJECT_CFLAGS@

 POPT_INCLUDE=@POPT_INCLUDE@
 POPT_LIB=@POPT_LIB@
diff --git a/res/res_pjproject.c b/res/res_pjproject.c
index 80ba7e1828..b611d76953 100644
--- a/res/res_pjproject.c
+++ b/res/res_pjproject.c
@@ -791,6 +791,8 @@ static int load_module(void)
 	pj_log_set_decor(0);
 	pj_log_set_level(MAX_PJ_LOG_MAX_LEVEL);/* Set level to guarantee the dump output. */
 	pj_dump_config();
+	pjsip_dump_config();
+
 	pj_log_set_decor(PJ_LOG_HAS_SENDER | PJ_LOG_HAS_INDENT);
 	pj_log_set_log_func(log_forwarder);
 	if (ast_pjproject_max_log_level < ast_option_pjproject_log_level) {
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index 3e8df40cd4..18c68a33c4 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -355,9 +355,13 @@ static int do_cli_dump_endpt(void *v_a)
 {
 	struct ast_cli_args *a = v_a;

+	if (ast_option_pjproject_log_level < 3) {
+		pj_log_set_level(3);
+	}
 	ast_pjproject_log_intercept_begin(a->fd);
 	pjsip_endpt_dump(ast_sip_get_pjsip_endpoint(), a->argc == 4 ? PJ_TRUE : PJ_FALSE);
 	ast_pjproject_log_intercept_end();
+	pj_log_set_level(ast_option_pjproject_log_level);

 	return 0;
 }
diff --git a/third-party/pjproject/Makefile.rules b/third-party/pjproject/Makefile.rules
index 42c6e4b66e..f6790bd216 100644
--- a/third-party/pjproject/Makefile.rules
+++ b/third-party/pjproject/Makefile.rules
@@ -47,4 +47,7 @@ endif

 ifeq ($(shell uname -s),Linux)
     PJPROJECT_CONFIG_OPTS +=  --enable-epoll
+    PJPROJECT_CFLAGS += -DPJ_HAS_LINUX_EPOLL=1
 endif
+
+PJPROJECT_CONFIG_OPTS += CFLAGS="$(PJPROJECT_CFLAGS)"
diff --git a/third-party/pjproject/configure.m4 b/third-party/pjproject/configure.m4
index 94622f2b5e..8c3c50fcf2 100644
--- a/third-party/pjproject/configure.m4
+++ b/third-party/pjproject/configure.m4
@@ -113,7 +113,7 @@ AC_DEFUN([_PJPROJECT_CONFIGURE],
 			EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" \
 			PJPROJECT_BUNDLED_OOT="${PJPROJECT_BUNDLED_OOT}" \
 			echo_cflags)
-		PJPROJECT_CFLAGS="$PJPROJECT_INCLUDE"
+
 		PBX_PJPROJECT=1

 		AC_DEFINE([HAVE_PJPROJECT], 1, [Define if your system has PJPROJECT])
diff --git a/third-party/pjproject/patches/config_site.h b/third-party/pjproject/patches/config_site.h
index 2456c3c0a0..6d06fd3742 100644
--- a/third-party/pjproject/patches/config_site.h
+++ b/third-party/pjproject/patches/config_site.h
@@ -25,13 +25,22 @@
 #define NDEBUG 1
 #endif

+#ifndef PJ_MAX_HOSTNAME
 #define PJ_MAX_HOSTNAME (256)
+#endif
+
+#ifndef PJSIP_MAX_URL_SIZE
 #define PJSIP_MAX_URL_SIZE (512)
+#endif
+
+#ifndef PJ_IOQUEUE_MAX_HANDLES
 #ifdef PJ_HAS_LINUX_EPOLL
 #define PJ_IOQUEUE_MAX_HANDLES	(5000)
 #else
 #define PJ_IOQUEUE_MAX_HANDLES	(FD_SETSIZE)
 #endif
+#endif
+
 #define PJ_IOQUEUE_HAS_SAFE_UNREG 1
 #define PJ_IOQUEUE_MAX_EVENTS_IN_SINGLE_POLL (16)