diff options
-rw-r--r-- | CHANGES | 6 | ||||
-rw-r--r-- | channels/chan_pjsip.c | 15 | ||||
-rw-r--r-- | configs/samples/codecs.conf.sample | 6 | ||||
-rwxr-xr-x | configure | 8 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | main/crypt.c | 2 | ||||
-rw-r--r-- | main/iostream.c | 4 | ||||
-rw-r--r-- | main/libasteriskssl.c | 4 | ||||
-rw-r--r-- | res/res_pjsip_mwi.c | 6 | ||||
-rw-r--r-- | res/res_pjsip_sdp_rtp.c | 16 |
10 files changed, 53 insertions, 17 deletions
@@ -43,6 +43,12 @@ chan_pjsip function any contact which is considered unreachable due to qualify being enabled will no longer be called. + * The asymmetric_rtp_codec option now also controls whether chan_pjsip will + send media as-is without transcoding if the codec has been negotiated in the + SDP. If set to "no" then Asterisk will only ever send the preferred codec + from the SDP, unless the remote side sends a different codec and we will + switch to match. + ------------------------------------------------------------------------------ --- Functionality changes from Asterisk 14.4.0 to Asterisk 14.5.0 ------------ ------------------------------------------------------------------------------ diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c index 3f65a13de..83dc77f38 100644 --- a/channels/chan_pjsip.c +++ b/channels/chan_pjsip.c @@ -735,11 +735,24 @@ static struct ast_frame *chan_pjsip_read(struct ast_channel *ast) if (!session->endpoint->asymmetric_rtp_codec && ast_format_cmp(ast_channel_rawwriteformat(ast), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) { - /* For maximum compatibility we ensure that the write format matches that of the received media */ + struct ast_format_cap *caps; + + /* For maximum compatibility we ensure that the formats match that of the received media */ ast_debug(1, "Oooh, got a frame with format of %s on channel '%s' when we're sending '%s', switching to match\n", ast_format_get_name(f->subclass.format), ast_channel_name(ast), ast_format_get_name(ast_channel_rawwriteformat(ast))); + + caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT); + if (caps) { + ast_format_cap_append_from_cap(caps, ast_channel_nativeformats(ast), AST_MEDIA_TYPE_UNKNOWN); + ast_format_cap_remove_by_type(caps, AST_MEDIA_TYPE_AUDIO); + ast_format_cap_append(caps, f->subclass.format, 0); + ast_channel_nativeformats_set(ast, caps); + ao2_ref(caps, -1); + } + ast_set_write_format_path(ast, ast_channel_writeformat(ast), f->subclass.format); + ast_set_read_format_path(ast, ast_channel_readformat(ast), f->subclass.format); if (ast_channel_is_bridged(ast)) { ast_channel_set_unbridged_nolock(ast, 1); diff --git a/configs/samples/codecs.conf.sample b/configs/samples/codecs.conf.sample index e40aa35a3..9b7af3e36 100644 --- a/configs/samples/codecs.conf.sample +++ b/configs/samples/codecs.conf.sample @@ -165,9 +165,9 @@ packetloss_percentage=10; ;complexity= ; Encoder's computational complexity. Can be any number between 0 ; and 10, inclusive. Note, 10 equals the highest complexity. ; (default: 10) -;max_bandwitdth= ; Encoder's maximum bandwidth allowed. Sets an upper bandwidth - ; bound on the encoder. Can be any of the following: narrow, - ; medium, wide, super_wide, full. (default: full) +;max_bandwidth= ; Encoder's maximum bandwidth allowed. Sets an upper bandwidth + ; bound on the encoder. Can be any of the following: narrow, + ; medium, wide, super_wide, full. (default: full) ;signal= ; Encoder's signal type. Aids in mode selection on the encoder: Can ; be any of the following: auto, voice, music. (default: auto) ;application= ; Encoder's application type. Can be any of the following: voip, @@ -18025,10 +18025,9 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have usable eventfd support" >&5 $as_echo_n "checking if we have usable eventfd support... " >&6; } if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: cross-compile" >&5 +$as_echo "cross-compile" >&6; } + else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -18050,7 +18049,6 @@ $as_echo "#define HAVE_EVENTFD 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext diff --git a/configure.ac b/configure.ac index 07aa1670d..ecbe87093 100644 --- a/configure.ac +++ b/configure.ac @@ -1131,7 +1131,8 @@ AC_RUN_IFELSE( [return eventfd(0, EFD_NONBLOCK | EFD_SEMAPHORE) == -1;])], AC_MSG_RESULT(yes) AC_DEFINE([HAVE_EVENTFD], 1, [Define to 1 if your system supports eventfd and the EFD_NONBLOCK and EFD_SEMAPHORE flags.]), - AC_MSG_RESULT(no) + AC_MSG_RESULT(no), + AC_MSG_RESULT(cross-compile) ) AST_GCC_ATTRIBUTE(pure) diff --git a/main/crypt.c b/main/crypt.c index 924618205..131ebbd60 100644 --- a/main/crypt.c +++ b/main/crypt.c @@ -29,7 +29,7 @@ #include "asterisk.h" #include <unistd.h> -#if defined(HAVE_CRYPT_R) +#if defined(HAVE_CRYPT_R) && !defined(__FreeBSD__) #include <crypt.h> #endif diff --git a/main/iostream.c b/main/iostream.c index 06414cf43..2a2601d38 100644 --- a/main/iostream.c +++ b/main/iostream.c @@ -508,13 +508,13 @@ int ast_iostream_close(struct ast_iostream *stream) ERR_error_string(sslerr, err), ssl_error_to_string(sslerr, res)); } -#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L +#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) if (!SSL_is_server(stream->ssl)) { #else if (!stream->ssl->server) { #endif /* For client threads, ensure that the error stack is cleared */ -#if !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x10100000L +#if !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) #if OPENSSL_VERSION_NUMBER >= 0x10000000L ERR_remove_thread_state(NULL); #else diff --git a/main/libasteriskssl.c b/main/libasteriskssl.c index 0ed05e3dc..9da63de4c 100644 --- a/main/libasteriskssl.c +++ b/main/libasteriskssl.c @@ -72,7 +72,7 @@ static void ssl_lock(int mode, int n, const char *file, int line) } } -#if !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x10100000L +#if !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) int SSL_library_init(void) { #if defined(AST_DEVMODE) @@ -127,7 +127,7 @@ void ERR_free_strings(void) int ast_ssl_init(void) { #if defined(HAVE_OPENSSL) && defined(OPENSSL_VERSION_NUMBER) && \ - OPENSSL_VERSION_NUMBER < 0x10100000L + (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)) unsigned int i; int (*real_SSL_library_init)(void); void (*real_CRYPTO_set_id_callback)(unsigned long (*)(void)); diff --git a/res/res_pjsip_mwi.c b/res/res_pjsip_mwi.c index e625df77a..3dfccef86 100644 --- a/res/res_pjsip_mwi.c +++ b/res/res_pjsip_mwi.c @@ -1278,7 +1278,9 @@ static struct ast_sorcery_observer global_observer = { static int reload(void) { - create_mwi_subscriptions(); + if (!ast_sip_get_mwi_disable_initial_unsolicited()) { + create_mwi_subscriptions(); + } return 0; } @@ -1301,13 +1303,13 @@ static int load_module(void) ast_sip_unregister_subscription_handler(&mwi_handler); return AST_MODULE_LOAD_DECLINE; } - create_mwi_subscriptions(); ast_sorcery_observer_add(ast_sip_get_sorcery(), "contact", &mwi_contact_observer); ast_sorcery_observer_add(ast_sip_get_sorcery(), "global", &global_observer); ast_sorcery_reload_object(ast_sip_get_sorcery(), "global"); if (!ast_sip_get_mwi_disable_initial_unsolicited()) { + create_mwi_subscriptions(); if (ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) { ast_sip_push_task(NULL, send_initial_notify_all, NULL); } else { diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c index 97e365c10..c5a673aa4 100644 --- a/res/res_pjsip_sdp_rtp.c +++ b/res/res_pjsip_sdp_rtp.c @@ -410,13 +410,29 @@ static int set_caps(struct ast_sip_session *session, ast_format_cap_append_from_cap(caps, ast_channel_nativeformats(session->channel), AST_MEDIA_TYPE_UNKNOWN); ast_format_cap_remove_by_type(caps, media_type); + if (session->endpoint->preferred_codec_only){ struct ast_format *preferred_fmt = ast_format_cap_get_format(joint, 0); ast_format_cap_append(caps, preferred_fmt, 0); ao2_ref(preferred_fmt, -1); + } else if (!session->endpoint->asymmetric_rtp_codec) { + struct ast_format *best; + /* + * If we don't allow the sending codec to be changed on our side + * then get the best codec from the joint capabilities of the media + * type and use only that. This ensures the core won't start sending + * out a format that we aren't currently sending. + */ + + best = ast_format_cap_get_best_by_type(joint, media_type); + if (best) { + ast_format_cap_append(caps, best, ast_format_cap_get_framing(joint)); + ao2_ref(best, -1); + } } else { ast_format_cap_append_from_cap(caps, joint, media_type); } + /* * Apply the new formats to the channel, potentially changing * raw read/write formats and translation path while doing so. |