mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-02 10:22:46 +00:00
On heavy loaded system the TCP/TLS incoming calls could be disconnected by pjproject while these calls are being processed by asterisk which could use the session's memory pools. If the session in the disconnected state then the session memory pools were already freed, so we get segfault. This patch adds a lifetime control on an INVITE session to pjproject. The lifetime of the session is manipulated by calling pjsip_inv_add_ref/pjsip_inv_dec_ref. This patch uses these functions to inform pjproject that the session is in use. This patch adds check if the session state is not disconnected and also checks if the memory pool is not NULL. This patch also places tasks 'session_end' and 'session_end_completion' into session's serializer to avoid race condition. ASTERISK-26291 #close Change-Id: I4d28b1fb3b91f0492a911d110049d670fdc3c8d7
50 lines
2.0 KiB
Plaintext
50 lines
2.0 KiB
Plaintext
AC_DEFUN([PJPROJECT_SYMBOL_CHECK],
|
|
[
|
|
$1_INCLUDE="$PJPROJECT_INCLUDE"
|
|
AC_MSG_CHECKING([for $2 declared in $3])
|
|
|
|
saved_cpp="$CPPFLAGS"
|
|
CPPFLAGS="$PJPROJECT_INCLUDE"
|
|
AC_EGREP_HEADER($2, $3, [
|
|
AC_MSG_RESULT(yes)
|
|
PBX_$1=1
|
|
AC_DEFINE([HAVE_$1], 1, [Define if your system has $2 declared.])
|
|
], [
|
|
AC_MSG_RESULT(no)
|
|
])
|
|
|
|
CPPGLAGS="$saved_cpp"
|
|
$1_INCLUDE="$PJPROJECT_INCLUDE"
|
|
])
|
|
|
|
AC_DEFUN([PJPROJECT_CONFIGURE],
|
|
[
|
|
AC_MSG_CHECKING(for embedded pjproject (may have to download))
|
|
AC_MSG_RESULT(configuring)
|
|
${GNU_MAKE} --quiet --no-print-directory -C $1 configure
|
|
if test $? -ne 0 ; then
|
|
AC_MSG_RESULT(failed)
|
|
AC_MSG_NOTICE(Unable to configure $1)
|
|
AC_MSG_ERROR(Run "${GNU_MAKE} -C $1 NOISY_BUILD=yes configure" to see error details.)
|
|
fi
|
|
|
|
PJPROJECT_INCLUDE=$(${GNU_MAKE} --quiet --no-print-directory -C $1 echo_cflags)
|
|
PJPROJECT_CFLAGS="$PJPROJECT_INCLUDE"
|
|
PBX_PJPROJECT=1
|
|
PJPROJECT_BUNDLED=yes
|
|
AC_DEFINE([HAVE_PJPROJECT], 1, [Define if your system has PJPROJECT])
|
|
AC_DEFINE([HAVE_PJPROJECT_BUNDLED], 1, [Define if your system has PJPROJECT_BUNDLED])
|
|
AC_MSG_CHECKING(for embedded pjproject)
|
|
AC_MSG_RESULT(yes)
|
|
|
|
PJPROJECT_SYMBOL_CHECK([PJSIP_DLG_CREATE_UAS_AND_INC_LOCK], [pjsip_dlg_create_uas_and_inc_lock], [pjsip.h])
|
|
PJPROJECT_SYMBOL_CHECK([PJ_TRANSACTION_GRP_LOCK], [pjsip_tsx_create_uac2], [pjsip.h])
|
|
PJPROJECT_SYMBOL_CHECK([PJSIP_REPLACE_MEDIA_STREAM], [PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE], [pjmedia.h])
|
|
PJPROJECT_SYMBOL_CHECK([PJSIP_GET_DEST_INFO], [pjsip_get_dest_info], [pjsip.h])
|
|
PJPROJECT_SYMBOL_CHECK([PJ_SSL_CERT_LOAD_FROM_FILES2], [pj_ssl_cert_load_from_files2], [pjlib.h])
|
|
PJPROJECT_SYMBOL_CHECK([PJSIP_EXTERNAL_RESOLVER], [pjsip_endpt_set_ext_resolver], [pjsip.h])
|
|
AC_DEFINE([HAVE_PJSIP_TLS_TRANSPORT_PROTO], 1, [Define if your system has PJSIP_TLS_TRANSPORT_PROTO])
|
|
AC_DEFINE([HAVE_PJSIP_EVSUB_GRP_LOCK], 1, [Define if your system has PJSIP_EVSUB_GRP_LOCK])
|
|
AC_DEFINE([HAVE_PJSIP_INV_SESSION_REF], 1, [Define if your system has PJSIP_INV_SESSION_REF])
|
|
])
|