summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoconf/ast_check_pwlib.m44
-rw-r--r--codecs/codecs.xml1
-rw-r--r--codecs/gsm/src/short_term.c16
-rwxr-xr-xconfigure10
-rw-r--r--configure.ac6
-rw-r--r--main/translate.c14
-rw-r--r--res/res_pjsip.c7
-rw-r--r--res/res_pjsip_endpoint_identifier_ip.c63
8 files changed, 76 insertions, 45 deletions
diff --git a/autoconf/ast_check_pwlib.m4 b/autoconf/ast_check_pwlib.m4
index 510881f3c..beaf8db74 100644
--- a/autoconf/ast_check_pwlib.m4
+++ b/autoconf/ast_check_pwlib.m4
@@ -103,7 +103,7 @@ if test "${HAS_PWLIB:-unset}" = "unset" ; then
else
AC_CHECK_HEADER(/usr/local/include/ptlib.h, HAS_PWLIB=1, )
if test "${HAS_PWLIB:-unset}" != "unset" ; then
- AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/local/bin$PATH_SEPARATOR/usr/local/share/pwlib/make)
+ AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/local/bin$PATH_SEPARATOR/usr/local/share/ptlib/make$PATH_SEPARATOR/usr/local/share/pwlib/make)
PWLIB_INCDIR="/usr/local/include"
PWLIB_LIBDIR=`${PTLIB_CONFIG} --pwlibdir 2>/dev/null`
if test "${PWLIB_LIBDIR:-unset}" = "unset"; then
@@ -121,7 +121,7 @@ if test "${HAS_PWLIB:-unset}" = "unset" ; then
else
AC_CHECK_HEADER(/usr/include/ptlib.h, HAS_PWLIB=1, )
if test "${HAS_PWLIB:-unset}" != "unset" ; then
- AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/bin$PATH_SEPARATOR/usr/share/pwlib/make)
+ AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/bin$PATH_SEPARATOR/usr/share/ptlib/make$PATH_SEPARATOR/usr/share/pwlib/make)
PWLIB_INCDIR="/usr/include"
PWLIB_LIBDIR=`${PTLIB_CONFIG} --pwlibdir 2>/dev/null`
if test "${PWLIB_LIBDIR:-unset}" = "unset"; then
diff --git a/codecs/codecs.xml b/codecs/codecs.xml
index c3ccf00f1..0b4e2a474 100644
--- a/codecs/codecs.xml
+++ b/codecs/codecs.xml
@@ -3,7 +3,6 @@
<depend>xmlstarlet</depend>
<depend>bash</depend>
<depend>res_format_attr_opus</depend>
- <depend>curl</depend>
<defaultenabled>no</defaultenabled>
</member>
<member name="codec_silk" displayname="Download the SILK codec from Digium. See http://downloads.digium.com/pub/telephony/codec_silk/README.">
diff --git a/codecs/gsm/src/short_term.c b/codecs/gsm/src/short_term.c
index 4172d322c..d22d276ba 100644
--- a/codecs/gsm/src/short_term.c
+++ b/codecs/gsm/src/short_term.c
@@ -55,21 +55,21 @@ static void Decoding_of_the_coded_Log_Area_Ratios P2((LARc,LARpp),
*/
#undef STEP
-#define STEP( B, MIC, INVA ) \
+#define STEP( B_TIMES_TWO, MIC, INVA ) \
temp1 = GSM_ADD( *LARc++, MIC ) << 10; \
- temp1 = GSM_SUB( temp1, B << 1 ); \
+ temp1 = GSM_SUB( temp1, B_TIMES_TWO ); \
temp1 = (word)GSM_MULT_R( INVA, temp1 ); \
*LARpp++ = GSM_ADD( temp1, temp1 );
STEP( 0, -32, 13107 );
STEP( 0, -32, 13107 );
- STEP( 2048, -16, 13107 );
- STEP( -2560, -16, 13107 );
+ STEP( 4096, -16, 13107 );
+ STEP( -5120, -16, 13107 );
- STEP( 94, -8, 19223 );
- STEP( -1792, -8, 17476 );
- STEP( -341, -4, 31454 );
- STEP( -1144, -4, 29708 );
+ STEP( 188, -8, 19223 );
+ STEP( -3584, -8, 17476 );
+ STEP( -682, -4, 31454 );
+ STEP( -2288, -4, 29708 );
/* NOTE: the addition of *MIC is used to restore
* the sign of *LARc.
diff --git a/configure b/configure
index 2dd027720..cc39661f6 100755
--- a/configure
+++ b/configure
@@ -18425,7 +18425,7 @@ LDFLAGS="${saved_sanitize_LDFLAGS}"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wdeclaration-after-statement support" >&5
$as_echo_n "checking for -Wdeclaration-after-statement support... " >&6; }
-if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+if $(${CC} -Wdeclaration-after-statement -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
AST_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement
@@ -18477,7 +18477,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wno-format-truncation" >&5
$as_echo_n "checking for -Wno-format-truncation... " >&6; }
-if $(${CC} -O2 -Wno-format-truncation -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+if $(${CC} -Wno-format-truncation -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
AST_NO_FORMAT_TRUNCATION=-Wno-format-truncation
@@ -18490,7 +18490,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wshadow" >&5
$as_echo_n "checking for -Wshadow... " >&6; }
-if $(${CC} -Wshadow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+if $(${CC} -Wshadow -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
AST_SHADOW_WARNINGS=-Wshadow
@@ -28858,7 +28858,7 @@ else
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /usr/local/bin$PATH_SEPARATOR/usr/local/share/pwlib/make
+for as_dir in /usr/local/bin$PATH_SEPARATOR/usr/local/share/ptlib/make$PATH_SEPARATOR/usr/local/share/pwlib/make
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
@@ -28920,7 +28920,7 @@ else
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /usr/bin$PATH_SEPARATOR/usr/share/pwlib/make
+for as_dir in /usr/bin$PATH_SEPARATOR/usr/share/ptlib/make$PATH_SEPARATOR/usr/share/pwlib/make
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
diff --git a/configure.ac b/configure.ac
index c617cf084..e333fafa1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1196,7 +1196,7 @@ LDFLAGS="${saved_sanitize_LDFLAGS}"
AC_SUBST(AST_UNDEFINED_SANITIZER)
AC_MSG_CHECKING(for -Wdeclaration-after-statement support)
-if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+if $(${CC} -Wdeclaration-after-statement -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
AC_MSG_RESULT(yes)
AST_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement
else
@@ -1236,7 +1236,7 @@ fi
AC_SUBST(AST_NO_STRICT_OVERFLOW)
AC_MSG_CHECKING(for -Wno-format-truncation)
-if $(${CC} -O2 -Wno-format-truncation -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+if $(${CC} -Wno-format-truncation -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
AC_MSG_RESULT(yes)
AST_NO_FORMAT_TRUNCATION=-Wno-format-truncation
else
@@ -1246,7 +1246,7 @@ fi
AC_SUBST(AST_NO_FORMAT_TRUNCATION)
AC_MSG_CHECKING(for -Wshadow)
-if $(${CC} -Wshadow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+if $(${CC} -Wshadow -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
AC_MSG_RESULT(yes)
AST_SHADOW_WARNINGS=-Wshadow
else
diff --git a/main/translate.c b/main/translate.c
index 0721f07b0..240e4956a 100644
--- a/main/translate.c
+++ b/main/translate.c
@@ -34,7 +34,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <sys/time.h>
#include <sys/resource.h>
#include <math.h>
-#include <stdlib.h>
#include "asterisk/lock.h"
#include "asterisk/channel.h"
@@ -1322,6 +1321,13 @@ void ast_translator_deactivate(struct ast_translator *t)
AST_RWLIST_UNLOCK(&translators);
}
+/*! Calculate the absolute difference between sample rate of two formats. */
+#define format_sample_rate_absdiff(fmt1, fmt2) ({ \
+ unsigned int rate1 = ast_format_get_sample_rate(fmt1); \
+ unsigned int rate2 = ast_format_get_sample_rate(fmt2); \
+ (rate1 > rate2 ? rate1 - rate2 : rate2 - rate1); \
+})
+
/*! \brief Calculate our best translator source format, given costs, and a desired destination */
int ast_translator_best_choice(struct ast_format_cap *dst_cap,
struct ast_format_cap *src_cap,
@@ -1406,10 +1412,8 @@ int ast_translator_best_choice(struct ast_format_cap *dst_cap,
beststeps = matrix_get(x, y)->multistep;
} else if (matrix_get(x, y)->table_cost == besttablecost
&& matrix_get(x, y)->multistep == beststeps) {
- int gap_selected = abs(ast_format_get_sample_rate(best)
- - ast_format_get_sample_rate(bestdst));
- int gap_current = abs(ast_format_get_sample_rate(src)
- - ast_format_get_sample_rate(dst));
+ unsigned int gap_selected = format_sample_rate_absdiff(best, bestdst);
+ unsigned int gap_current = format_sample_rate_absdiff(src, dst);
if (gap_current < gap_selected) {
/* better than what we have so far */
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index 392f9a6f2..842cc20e3 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -2573,13 +2573,13 @@ int ast_sip_register_endpoint_identifier_with_name(struct ast_sip_endpoint_ident
id_list_item = ast_calloc(1, sizeof(*id_list_item));
if (!id_list_item) {
- ast_log(LOG_ERROR, "Unabled to add endpoint identifier. Out of memory.\n");
+ ast_log(LOG_ERROR, "Unable to add endpoint identifier. Out of memory.\n");
return -1;
}
id_list_item->identifier = identifier;
id_list_item->name = name;
- ast_debug(1, "Register endpoint identifier %s (%p)\n", name, identifier);
+ ast_debug(1, "Register endpoint identifier %s(%p)\n", name ?: "", identifier);
if (ast_strlen_zero(name)) {
/* if an identifier has no name then place in front */
@@ -2602,7 +2602,8 @@ int ast_sip_register_endpoint_identifier_with_name(struct ast_sip_endpoint_ident
id_list_item->priority = 0;
while ((current = strchr(current, ','))) {
++id_list_item->priority;
- if (!strncmp(prev, name, current - prev)) {
+ if (!strncmp(prev, name, current - prev)
+ && strlen(name) == current - prev) {
break;
}
prev = ++current;
diff --git a/res/res_pjsip_endpoint_identifier_ip.c b/res/res_pjsip_endpoint_identifier_ip.c
index 14716234a..5324af7b9 100644
--- a/res/res_pjsip_endpoint_identifier_ip.c
+++ b/res/res_pjsip_endpoint_identifier_ip.c
@@ -105,7 +105,7 @@ struct ip_identify_match {
struct ast_ha *matches;
/*! \brief Perform SRV resolution of hostnames */
unsigned int srv_lookups;
- /*! \brief Hosts to be resolved after applying configuration */
+ /*! \brief Hosts to be resolved when applying configuration */
struct ao2_container *hosts;
};
@@ -150,8 +150,8 @@ static int header_identify_match_check(void *obj, void *arg, int flags)
c_header = ast_strdupa(identify->match_header);
c_value = strchr(c_header, ':');
if (!c_value) {
- ast_log(LOG_WARNING, "Identify '%s' has invalid header_match: No ':' separator found!\n",
- ast_sorcery_object_get_id(identify));
+ /* This should not be possible. The object cannot be created if so. */
+ ast_assert(0);
return 0;
}
*c_value = '\0';
@@ -161,17 +161,19 @@ static int header_identify_match_check(void *obj, void *arg, int flags)
pj_header_name = pj_str(c_header);
header = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &pj_header_name, NULL);
if (!header) {
- ast_debug(3, "SIP message does not contain header '%s'\n", c_header);
+ ast_debug(3, "Identify '%s': SIP message does not have header '%s'\n",
+ ast_sorcery_object_get_id(identify),
+ c_header);
return 0;
}
pj_header_value = pj_str(c_value);
if (pj_strcmp(&pj_header_value, &header->hvalue)) {
- ast_debug(3, "SIP message contains header '%s' but value '%.*s' does not match value '%s' for endpoint '%s'\n",
+ ast_debug(3, "Identify '%s': SIP message has header '%s' but value '%.*s' does not match '%s'\n",
+ ast_sorcery_object_get_id(identify),
c_header,
(int) pj_strlen(&header->hvalue), pj_strbuf(&header->hvalue),
- c_value,
- identify->endpoint_name);
+ c_value);
return 0;
}
@@ -261,7 +263,7 @@ static int ip_identify_match_host_lookup(struct ip_identify_match *identify, con
}
for (i = 0; i < num_addrs; ++i) {
- /* Check if the address is already in the list, if so don't bother adding it again */
+ /* Check if the address is already in the list, if so don't add it again */
if (identify->matches && (ast_apply_ha(identify->matches, &addrs[i]) != AST_SENSE_ALLOW)) {
continue;
}
@@ -283,14 +285,13 @@ static int ip_identify_match_host_lookup(struct ip_identify_match *identify, con
}
/*! \brief Helper function which performs an SRV lookup and then resolves the hostname */
-static int ip_identify_match_srv_lookup(struct ip_identify_match *identify, const char *prefix, const char *host)
+static int ip_identify_match_srv_lookup(struct ip_identify_match *identify, const char *prefix, const char *host, int results)
{
char service[NI_MAXHOST];
struct srv_context *context = NULL;
int srv_ret;
const char *srvhost;
unsigned short srvport;
- int results = 0;
snprintf(service, sizeof(service), "%s.%s", prefix, host);
@@ -372,10 +373,33 @@ static int ip_identify_apply(const struct ast_sorcery *sorcery, void *obj)
char *current_string;
struct ao2_iterator i;
+ /* Validate the identify object configuration */
+ if (ast_strlen_zero(identify->endpoint_name)) {
+ ast_log(LOG_ERROR, "Identify '%s' missing required endpoint name.\n",
+ ast_sorcery_object_get_id(identify));
+ return -1;
+ }
+ if (ast_strlen_zero(identify->match_header) /* No header to match */
+ /* and no static IP addresses with a mask */
+ && !identify->matches
+ /* and no addresses to resolve */
+ && (!identify->hosts || !ao2_container_count(identify->hosts))) {
+ ast_log(LOG_ERROR, "Identify '%s' is not configured to match anything.\n",
+ ast_sorcery_object_get_id(identify));
+ return -1;
+ }
+ if (!ast_strlen_zero(identify->match_header)
+ && !strchr(identify->match_header, ':')) {
+ ast_log(LOG_ERROR, "Identify '%s' missing ':' separator in match_header '%s'.\n",
+ ast_sorcery_object_get_id(identify), identify->match_header);
+ return -1;
+ }
+
if (!identify->hosts) {
return 0;
}
+ /* Resolve the match addresses now */
i = ao2_iterator_init(identify->hosts, 0);
while ((current_string = ao2_iterator_next(&i))) {
struct ast_sockaddr address;
@@ -383,26 +407,29 @@ static int ip_identify_apply(const struct ast_sorcery *sorcery, void *obj)
/* If the provided string is not an IP address perform SRV resolution on it */
if (identify->srv_lookups && !ast_sockaddr_parse(&address, current_string, 0)) {
- results = ip_identify_match_srv_lookup(identify, "_sip._udp", current_string);
+ results = ip_identify_match_srv_lookup(identify, "_sip._udp", current_string,
+ results);
if (results != -1) {
- results += ip_identify_match_srv_lookup(identify, "_sip._tcp", current_string);
+ results = ip_identify_match_srv_lookup(identify, "_sip._tcp",
+ current_string, results);
}
if (results != -1) {
- results += ip_identify_match_srv_lookup(identify, "_sips._tcp", current_string);
+ results = ip_identify_match_srv_lookup(identify, "_sips._tcp",
+ current_string, results);
}
}
- /* If SRV falls fall back to a normal lookup on the host itself */
+ /* If SRV fails fall back to a normal lookup on the host itself */
if (!results) {
results = ip_identify_match_host_lookup(identify, current_string);
}
if (results == 0) {
- ast_log(LOG_ERROR, "Address '%s' provided on ip endpoint identifier '%s' did not resolve to any address\n",
- current_string, ast_sorcery_object_get_id(obj));
+ ast_log(LOG_WARNING, "Identify '%s' provided address '%s' did not resolve to any address\n",
+ ast_sorcery_object_get_id(identify), current_string);
} else if (results == -1) {
- ast_log(LOG_ERROR, "An error occurred when adding resolution results of '%s' on '%s'\n",
- current_string, ast_sorcery_object_get_id(obj));
+ ast_log(LOG_ERROR, "Identify '%s' failed when adding resolution results of '%s'\n",
+ ast_sorcery_object_get_id(identify), current_string);
ao2_ref(current_string, -1);
ao2_iterator_destroy(&i);
return -1;