summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitreview1
-rw-r--r--README.md (renamed from README)212
-rw-r--r--addons/ooh323c/src/ooCalls.c2
-rw-r--r--apps/app_skel.c3
-rw-r--r--channels/chan_sip.c4
-rw-r--r--configs/samples/features.conf.sample4
-rwxr-xr-xconfigure19
-rw-r--r--configure.ac1
-rw-r--r--include/asterisk/autoconfig.h.in4
-rw-r--r--include/asterisk/cli.h26
-rw-r--r--main/abstract_jb.c4
-rw-r--r--main/aoc.c24
-rw-r--r--main/app.c13
-rw-r--r--main/cli.c78
-rw-r--r--res/res_format_attr_h263.c3
-rw-r--r--res/res_format_attr_h264.c3
-rw-r--r--res/res_hep_pjsip.c3
-rw-r--r--res/res_hep_rtcp.c3
-rw-r--r--res/res_mwi_external_ami.c2
-rw-r--r--res/res_parking.c1
-rw-r--r--res/res_pjsip_endpoint_identifier_anonymous.c3
-rw-r--r--res/res_rtp_asterisk.c98
-rw-r--r--tests/test_substitution.c19
-rw-r--r--third-party/pjproject/configure.m41
-rw-r--r--third-party/pjproject/patches/0040-183_without_to_tag.patch17
25 files changed, 315 insertions, 233 deletions
diff --git a/.gitreview b/.gitreview
index f9ef0502a..4e9f18655 100644
--- a/.gitreview
+++ b/.gitreview
@@ -2,3 +2,4 @@
host=gerrit.asterisk.org
port=29418
project=asterisk.git
+defaultbranch=13
diff --git a/README b/README.md
index 871ae962a..b75d7295e 100644
--- a/README
+++ b/README.md
@@ -1,15 +1,9 @@
-===============================================================================
-=== The Asterisk(R) Open Source PBX
-===
-=== by Mark Spencer <markster@digium.com>
-=== and the Asterisk.org developer community
-===
-=== Copyright (C) 2001-2009 Digium, Inc.
-=== and other copyright holders.
-===============================================================================
-
--------------------------------------------------------------------------------
---- SECURITY ------------------------------------------------------------------
+# The Asterisk(R) Open Source PBX
+```text
+ By Mark Spencer <markster@digium.com> and the Asterisk.org developer community.
+ Copyright (C) 2001-2009 Digium, Inc. and other copyright holders.
+```
+## SECURITY
It is imperative that you read and fully understand the contents of
the security information document before you attempt to configure and run
@@ -19,80 +13,62 @@ an Asterisk server.
version of the documentation in doc/tex/asterisk.pdf. Alternatively, pull up
the HTML version of the documentation in doc/tex/asterisk/index.html. The
source for the security document is available in doc/tex/security.tex.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
---- WHAT IS ASTERISK ? --------------------------------------------------------
+## WHAT IS ASTERISK ?
Asterisk is an Open Source PBX and telephony toolkit. It is, in a
sense, middleware between Internet and telephony channels on the bottom,
and Internet and telephony applications at the top. However, Asterisk supports
more telephony interfaces than just Internet telephony. Asterisk also has a
-vast amount of support for traditional PSTN telephony, as well. For more
-information on the project itself, please visit the Asterisk home page at:
+vast amount of support for traditional PSTN telephony, as well.
- https://www.asterisk.org
-
- The official Asterisk wiki can be found at:
-
- https://wiki.asterisk.org
-
- In addition you'll find lots of information compiled by the Asterisk
-community on this Wiki:
-
- https://www.voip-info.org/wiki-Asterisk
+ For more information on the project itself, please visit the Asterisk
+[home page] and the official [wiki]. In addition you'll find lots
+of information compiled by the Asterisk community at [voip-info.org].
There is a book on Asterisk published by O'Reilly under the Creative Commons
License. It is available in book stores as well as in a downloadable version on
-the http://www.asteriskdocs.org web site.
--------------------------------------------------------------------------------
+the [asteriskdocs.org] web site.
+
+## SUPPORTED OPERATING SYSTEMS
--------------------------------------------------------------------------------
---- SUPPORTED OPERATING SYSTEMS -----------------------------------------------
+### Linux
---- Linux
The Asterisk Open Source PBX is developed and tested primarily on the
GNU/Linux operating system, and is supported on every major GNU/Linux
distribution.
---- Others
+### Others
+
Asterisk has also been 'ported' and reportedly runs properly on other
operating systems as well, including Sun Solaris, Apple's Mac OS X, Cygwin,
and the BSD variants.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
---- GETTING STARTED -----------------------------------------------------------
+## GETTING STARTED
First, be sure you've got supported hardware (but note that you don't need
ANY special hardware, not even a sound card) to install and run Asterisk.
- Supported telephony hardware includes:
+Supported telephony hardware includes:
+* All Analog and Digital Interface cards from [Digium]
+* QuickNet Internet PhoneJack and LineJack (http://www.quicknet.net)
+* any full duplex sound card supported by ALSA, OSS, or PortAudio
+* any ISDN card supported by mISDN on Linux
+* The Xorcom Astribank channel bank
+* VoiceTronix OpenLine products
- * All Analog and Digital Interface cards from Digium (www.digium.com)
- * QuickNet Internet PhoneJack and LineJack (http://www.quicknet.net)
- * any full duplex sound card supported by ALSA, OSS, or PortAudio
- * any ISDN card supported by mISDN on Linux
- * The Xorcom Astribank channel bank
- * VoiceTronix OpenLine products
-
--------------------------------------------------------------------------------
-
--------------------------------------------------------------------------------
---- UPGRADING FROM AN EARLIER VERSION -----------------------------------------
+### UPGRADING FROM AN EARLIER VERSION
If you are updating from a previous version of Asterisk, make sure you
-read the UPGRADE.txt file in the source directory. There are some files
+read the [UPGRADE.txt] file in the source directory. There are some files
and configuration options that you will have to change, even though we
made every effort possible to maintain backwards compatibility.
In order to discover new features to use, please check the configuration
-examples in the /configs directory of the source code distribution. For a
-list of new features in this version of Asterisk, see the CHANGES file.
--------------------------------------------------------------------------------
+examples in the [configs] directory of the source code distribution. For a
+list of new features in this version of Asterisk, see the [CHANGES] file.
--------------------------------------------------------------------------------
---- NEW INSTALLATIONS ---------------------------------------------------------
+### NEW INSTALLATIONS
Ensure that your system contains a compatible compiler and development
libraries. Asterisk requires either the GNU Compiler Collection (GCC) version
@@ -101,55 +77,54 @@ the gcc language extensions. In addition, your system needs to have the C
library headers available, and the headers and libraries for ncurses.
There are many modules that have additional dependencies. To see what
-libraries are being looked for, see ./configure --help, or run
-"make menuselect" to view the dependencies for specific modules.
+libraries are being looked for, see `./configure --help`, or run
+`make menuselect` to view the dependencies for specific modules.
On many distributions, these dependencies are installed by packages with names
-like 'glibc-devel', 'ncurses-devel', 'openssl-devel' and 'zlib-devel'
+like 'glibc-devel', 'ncurses-devel', 'openssl-devel' and 'zlib-devel'
or similar.
- So, let's proceed:
-
-1) Read this README file.
+So, let's proceed:
+1. Read this file.
- There are more documents than this one in the doc/ directory. You may also
+ There are more documents than this one in the [doc] directory. You may also
want to check the configuration files that contain examples and reference
-guides. They are all in the configs/ directory.
+guides in the [configs] directory.
-2) Run "./configure"
+2. Run `./configure`
Execute the configure script to guess values for system-dependent
variables used during compilation.
-3) Run "make menuselect" [optional]
+3. Run `make menuselect` _\[optional]_
This is needed if you want to select the modules that will be compiled and to
check dependencies for various optional modules.
-4) Run "make"
+4. Run `make`
- Assuming the build completes successfully:
+Assuming the build completes successfully:
-5) Run "make install"
+5. Run `make install`
If this is your first time working with Asterisk, you may wish to install
the sample PBX, with demonstration extensions, etc. If so, run:
-6) "make samples"
+6. Run `make samples`
Doing so will overwrite any existing configuration files you have installed.
- Finally, you can launch Asterisk in the foreground mode (not a daemon) with:
-
-# asterisk -vvvc
-
+7. Finally, you can launch Asterisk in the foreground mode (not a daemon) with:
+```
+ # asterisk -vvvc
+```
You'll see a bunch of verbose messages fly by your screen as Asterisk
initializes (that's the "very very verbose" mode). When it's ready, if
you specified the "c" then you'll get a command line console, that looks
like this:
-
-*CLI>
-
+```
+ *CLI>
+```
You can type "core show help" at any time to get help with the system. For help
with a specific command, type "core show help <command>". To start the PBX using
your sound card, you can type "console dial" to dial the PBX. Then you can use
@@ -162,56 +137,53 @@ then it won't work right (not yet).
information on how to start and stop Asterisk, as well as all the command
line options for starting Asterisk.
- Feel free to look over the configuration files in /etc/asterisk, where you
+ Feel free to look over the configuration files in `/etc/asterisk`, where you
will find a lot of information about what you can do with Asterisk.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
---- ABOUT CONFIGURATION FILES -------------------------------------------------
+### ABOUT CONFIGURATION FILES
All Asterisk configuration files share a common format. Comments are
delimited by ';' (since '#' of course, being a DTMF digit, may occur in
many places). A configuration file is divided into sections whose names
appear in []'s. Each section typically contains two types of statements,
those of the form 'variable = value', and those of the form 'object =>
-parameters'. Internally the use of '=' and '=>' is exactly the same, so
+parameters'. Internally the use of '=' and '=>' is exactly the same, so
they're used only to help make the configuration file easier to
understand, and do not affect how it is actually parsed.
Entries of the form 'variable=value' set the value of some parameter in
-asterisk. For example, in dahdi.conf, one might specify:
-
+asterisk. For example, in [chan_dahdi.conf], one might specify:
+```
switchtype=national
-
+```
In order to indicate to Asterisk that the switch they are connecting to is
of the type "national". In general, the parameter will apply to
instantiations which occur below its specification. For example, if the
configuration file read:
-
+```
switchtype = national
channel => 1-4
channel => 10-12
switchtype = dms100
channel => 25-47
+```
The "national" switchtype would be applied to channels one through
four and channels 10 through 12, whereas the "dms100" switchtype would
apply to channels 25 through 47.
-
+
The "object => parameters" instantiates an object with the given
parameters. For example, the line "channel => 25-47" creates objects for
the channels 25 through 47 of the card, obtaining the settings
from the variables specified above.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
---- SPECIAL NOTE ON TIME ------------------------------------------------------
-
+### SPECIAL NOTE ON TIME
+
Those using SIP phones should be aware that Asterisk is sensitive to
large jumps in time. Manually changing the system time using date(1)
(or other similar commands) may cause SIP registrations and other
internal processes to fail. If your system cannot keep accurate time
-by itself use NTP (http://www.ntp.org/) to keep the system clock
+by itself use [NTP] to keep the system clock
synchronized to "real time". NTP is designed to keep the system clock
synchronized by speeding up or slowing down the system clock until it
is synchronized to "real time" rather than by jumping the time and
@@ -228,10 +200,8 @@ on UTC. UTC does not use daylight savings time.
Also note that this issue is separate from the clocking of TDM
channels, and is known to at least affect SIP registrations.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
---- FILE DESCRIPTORS ----------------------------------------------------------
+### FILE DESCRIPTORS
Depending on the size of your system and your configuration,
Asterisk can consume a large number of file descriptors. In UNIX,
@@ -247,50 +217,56 @@ calls that your system can handle. For example, if the limit is set
at 1024 (a common default value) Asterisk can handle approximately 150
SIP calls simultaneously. To change the number of file descriptors
follow the instructions for your system below:
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
---- PAM-based Linux System ----------------------------------------------------
+#### PAM-BASED LINUX SYSTEM
If your system uses PAM (Pluggable Authentication Modules) edit
-/etc/security/limits.conf. Add these lines to the bottom of the file:
-
+`/etc/security/limits.conf`. Add these lines to the bottom of the file:
+```text
root soft nofile 4096
root hard nofile 8196
asterisk soft nofile 4096
asterisk hard nofile 8196
+```
(adjust the numbers to taste). You may need to reboot the system for
these changes to take effect.
-== Generic UNIX System ==
+#### GENERIC UNIX SYSTEM
If there are no instructions specifically adapted to your system
-above you can try adding the command "ulimit -n 8192" to the script
+above you can try adding the command `ulimit -n 8192` to the script
that starts Asterisk.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
---- MORE INFORMATION ----------------------------------------------------------
+## MORE INFORMATION
- See the doc directory for more documentation on various features. Again,
-please read all the configuration samples that include documentation on
-the configuration options.
+ See the [doc] directory for more documentation on various features.
+Again, please read all the configuration samples that include documentation
+on the configuration options.
- If this release of Asterisk was downloaded from a tarball, then some
-additional documentation should have been included.
- * doc/tex/asterisk.pdf --- PDF version of the documentation
- * doc/tex/asterisk/index.html --- HTML version of the documentation
+ Finally, you may wish to visit the [support] site and join the [mailing
+list] if you're interested in getting more information.
- Finally, you may wish to visit the web site and join the mailing list if
-you're interested in getting more information.
+Welcome to the growing worldwide community of Asterisk users!
+```
+ Mark Spencer, and the Asterisk.org development community
+```
- https://www.asterisk.org/support
+---
- Welcome to the growing worldwide community of Asterisk users!
--------------------------------------------------------------------------------
+Asterisk is a trademark of Digium, Inc.
---- Mark Spencer, and the Asterisk.org development community
+[home page]: https://www.asterisk.org
+[support]: https://www.asterisk.org/support
+[wiki]: https://wiki.asterisk.org/
+[mailing list]: http://lists.digium.com/mailman/listinfo/asterisk-users
+[chan_dahdi.conf]: configs/samples/chan_dahdi.conf.sample
+[voip-info.org]: http://www.voip-info.org/wiki-Asterisk
+[asteriskdocs.org]: http://www.asteriskdocs.org
+[NTP]: http://www.ntp.org/
+[Digium]: https://www.digium.com/
+[UPGRADE.txt]: UPGRADE.txt
+[CHANGES]: CHANGES
+[configs]: configs
+[doc]: doc
--------------------------------------------------------------------------------
-Asterisk is a trademark of Digium, Inc.
diff --git a/addons/ooh323c/src/ooCalls.c b/addons/ooh323c/src/ooCalls.c
index f43a0bf45..528aa300c 100644
--- a/addons/ooh323c/src/ooCalls.c
+++ b/addons/ooh323c/src/ooCalls.c
@@ -28,6 +28,7 @@
#include "ooGkClient.h"
#include "ooh323ep.h"
#include "ooCalls.h"
+#include "ooCmdChannel.h"
/** Global endpoint structure */
extern OOH323EndPoint gH323ep;
@@ -172,6 +173,7 @@ OOH323CallData* ooCreateCall(char* type, char*callToken)
call->msdRetries = 0;
call->pFastStartRes = NULL;
call->usrData = NULL;
+ ooCreateCallCmdConnection(call);
OOTRACEINFO3("Created a new call (%s, %s)\n", call->callType,
call->callToken);
/* Add new call to calllist */
diff --git a/apps/app_skel.c b/apps/app_skel.c
index 3da3db0fc..12afdc726 100644
--- a/apps/app_skel.c
+++ b/apps/app_skel.c
@@ -757,10 +757,9 @@ error:
return AST_MODULE_LOAD_DECLINE;
}
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Skeleton (sample) Application",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Skeleton (sample) Application",
.support_level = AST_MODULE_SUPPORT_CORE,
.load = load_module,
.unload = unload_module,
.reload = reload_module,
- .load_pri = AST_MODPRI_DEFAULT,
);
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index a615b68ab..559e5c05b 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -13010,7 +13010,7 @@ static void add_ice_to_sdp(struct ast_rtp_instance *instance, struct ast_str **a
while ((candidate = ao2_iterator_next(&i))) {
ast_str_append(a_buf, 0, "a=candidate:%s %u %s %d ", candidate->foundation, candidate->id, candidate->transport, candidate->priority);
- ast_str_append(a_buf, 0, "%s ", ast_sockaddr_stringify_host(&candidate->address));
+ ast_str_append(a_buf, 0, "%s ", ast_sockaddr_stringify_addr_remote(&candidate->address));
ast_str_append(a_buf, 0, "%s typ ", ast_sockaddr_stringify_port(&candidate->address));
@@ -13023,7 +13023,7 @@ static void add_ice_to_sdp(struct ast_rtp_instance *instance, struct ast_str **a
}
if (!ast_sockaddr_isnull(&candidate->relay_address)) {
- ast_str_append(a_buf, 0, " raddr %s ", ast_sockaddr_stringify_host(&candidate->relay_address));
+ ast_str_append(a_buf, 0, " raddr %s ", ast_sockaddr_stringify_addr_remote(&candidate->relay_address));
ast_str_append(a_buf, 0, "rport %s", ast_sockaddr_stringify_port(&candidate->relay_address));
}
diff --git a/configs/samples/features.conf.sample b/configs/samples/features.conf.sample
index 223d69358..5806e4c04 100644
--- a/configs/samples/features.conf.sample
+++ b/configs/samples/features.conf.sample
@@ -72,8 +72,8 @@
; means run the application on the opposite channel from the one that
; has activated the feature.
; ActivatedBy -> ActivatedBy is no longer honored. The feature is activated by which
-; channel DYNAMIC_FEATURES includes the feature is on. Use predial
-; to set different values of DYNAMIC_FEATURES on the channels.
+; channel DYNAMIC_FEATURES includes the feature is on. Use a pre-dial
+; handler to set different values for DYNAMIC_FEATURES on the channels.
; Historic values are: "caller", "callee", and "both".
; Application -> This is the application to execute.
; AppArguments -> These are the arguments to be passed into the application. If you need
diff --git a/configure b/configure
index 8c13476e5..a07d8785d 100755
--- a/configure
+++ b/configure
@@ -928,10 +928,6 @@ PBX_PJSIP_TSX_LAYER_FIND_TSX2
PJSIP_TSX_LAYER_FIND_TSX2_DIR
PJSIP_TSX_LAYER_FIND_TSX2_INCLUDE
PJSIP_TSX_LAYER_FIND_TSX2_LIB
-PBX_PJSIP_EVSUB_SET_UAS_TIMEOUT
-PJSIP_EVSUB_SET_UAS_TIMEOUT_DIR
-PJSIP_EVSUB_SET_UAS_TIMEOUT_INCLUDE
-PJSIP_EVSUB_SET_UAS_TIMEOUT_LIB
PBX_PJSIP_AUTH_CLT_DEINIT
PJSIP_AUTH_CLT_DEINIT_DIR
PJSIP_AUTH_CLT_DEINIT_INCLUDE
@@ -9421,9 +9417,6 @@ $as_echo "#define HAVE_PJSIP_INV_SESSION_REF 1" >>confdefs.h
$as_echo "#define HAVE_PJSIP_AUTH_CLT_DEINIT 1" >>confdefs.h
-$as_echo "#define HAVE_PJSIP_EVSUB_SET_UAS_TIMEOUT 1" >>confdefs.h
-
-
$as_echo "#define HAVE_PJSIP_TSX_LAYER_FIND_TSX2 1" >>confdefs.h
@@ -11622,18 +11615,6 @@ PBX_PJSIP_AUTH_CLT_DEINIT=0
-PJSIP_EVSUB_SET_UAS_TIMEOUT_DESCRIP="PJSIP EVSUB Set UAS Timeout support"
-PJSIP_EVSUB_SET_UAS_TIMEOUT_OPTION=pjsip
-PJSIP_EVSUB_SET_UAS_TIMEOUT_DIR=${PJPROJECT_DIR}
-
-PBX_PJSIP_EVSUB_SET_UAS_TIMEOUT=0
-
-
-
-
-
-
-
PJSIP_TSX_LAYER_FIND_TSX2_DESCRIP="pjsip_tsx_layer_find_tsx2 support"
PJSIP_TSX_LAYER_FIND_TSX2_OPTION=pjsip
PJSIP_TSX_LAYER_FIND_TSX2_DIR=${PJPROJECT_DIR}
diff --git a/configure.ac b/configure.ac
index 8f164a297..7af35df4e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -521,7 +521,6 @@ AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_TLS_TRANSPORT_PROTO], [PJSIP TLS Transport pro
AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_EVSUB_GRP_LOCK], [PJSIP EVSUB Group Lock support], [PJPROJECT], [pjsip])
AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_INV_SESSION_REF], [PJSIP INVITE Session Reference Count support], [PJPROJECT], [pjsip])
AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_AUTH_CLT_DEINIT], [pjsip_auth_clt_deinit support], [PJPROJECT], [pjsip])
-AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_EVSUB_SET_UAS_TIMEOUT], [PJSIP EVSUB Set UAS Timeout support], [PJPROJECT], [pjsip])
AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_TSX_LAYER_FIND_TSX2], [pjsip_tsx_layer_find_tsx2 support], [PJPROJECT], [pjsip])
fi
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index d142fe93c..00846ebab 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -607,10 +607,6 @@
/* Define to 1 if PJPROJECT has the PJSIP EVSUB Group Lock support feature. */
#undef HAVE_PJSIP_EVSUB_GRP_LOCK
-/* Define to 1 if PJPROJECT has the PJSIP EVSUB Set UAS Timeout support
- feature. */
-#undef HAVE_PJSIP_EVSUB_SET_UAS_TIMEOUT
-
/* Define to 1 if PJPROJECT has the PJSIP External Resolver Support feature.
*/
#undef HAVE_PJSIP_EXTERNAL_RESOLVER
diff --git a/include/asterisk/cli.h b/include/asterisk/cli.h
index 7bf473c61..c2401a85d 100644
--- a/include/asterisk/cli.h
+++ b/include/asterisk/cli.h
@@ -282,6 +282,9 @@ int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len);
* Useful for readline, that's about it
* \retval 0 on success
* \retval -1 on failure
+ *
+ * Only call this function to proxy the CLI generator to
+ * another.
*/
char *ast_cli_generator(const char *, const char *, int);
@@ -297,6 +300,9 @@ int ast_cli_generatornummatches(const char *, const char *);
* Subsequent entries are all possible values, followed by a NULL.
* All strings and the array itself are malloc'ed and must be freed
* by the caller.
+ *
+ * \warning This function cannot be called recursively so it will always
+ * fail if called from a CLI_GENERATE callback.
*/
char **ast_cli_completion_matches(const char *, const char *);
@@ -318,10 +324,30 @@ char **ast_cli_completion_matches(const char *, const char *);
* by the caller.
*
* \note The vector is sorted and does not contain any duplicates.
+ *
+ * \warning This function cannot be called recursively so it will always
+ * fail if called from a CLI_GENERATE callback.
*/
struct ast_vector_string *ast_cli_completion_vector(const char *text, const char *word);
/*!
+ * \brief Add a result to a request for completion options.
+ *
+ * \param value A completion option text.
+ *
+ * \retval 0 Success
+ * \retval -1 Failure
+ *
+ * This is an alternative to returning individual values from CLI_GENERATE. Instead
+ * of repeatedly being asked for the next match and having to start over, you can
+ * call this function repeatedly from your own stateful loop. When all matches have
+ * been added you can return NULL from the CLI_GENERATE function.
+ *
+ * \note This function always eventually results in calling ast_free on \a value.
+ */
+int ast_cli_completion_add(char *value);
+
+/*!
* \brief Command completion for the list of active channels.
*
* This can be called from a CLI command completion function that wants to
diff --git a/main/abstract_jb.c b/main/abstract_jb.c
index 1c9eb5172..6e776c0cc 100644
--- a/main/abstract_jb.c
+++ b/main/abstract_jb.c
@@ -445,7 +445,7 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr)
/* Create a frame log file */
if (ast_test_flag(jbconf, AST_JB_LOG)) {
- RAII_VAR(struct ast_channel *, bridged, ast_channel_bridge_peer(chan), ast_channel_cleanup);
+ struct ast_channel *bridged = ast_channel_bridge_peer(chan);
char safe_logfile[30] = "/tmp/logfile-XXXXXX";
int safe_fd;
@@ -481,6 +481,8 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr)
jb_framelog("JB_PUT_FIRST {now=%ld}: Dropped frame with ts=%ld and len=%ld\n",
now, frr->ts, frr->len);
}
+
+ ast_channel_cleanup(bridged);
}
ast_verb(3, "%s jitterbuffer created on channel %s\n", jbimpl->name, ast_channel_name(chan));
diff --git a/main/aoc.c b/main/aoc.c
index 707dbb00f..725e91071 100644
--- a/main/aoc.c
+++ b/main/aoc.c
@@ -1664,7 +1664,7 @@ static struct ast_json *currency_to_json(const char *name, int cost,
static struct ast_json *charge_to_json(const struct ast_aoc_decoded *decoded)
{
- RAII_VAR(struct ast_json *, obj, NULL, ast_json_unref);
+ struct ast_json *obj;
const char *obj_type;
if (decoded->charge_type != AST_AOC_CHARGE_CURRENCY &&
@@ -1686,7 +1686,7 @@ static struct ast_json *charge_to_json(const struct ast_aoc_decoded *decoded)
"Type", aoc_charge_type_str(decoded->charge_type),
"BillingID", aoc_billingid_str(decoded->billing_id),
"TotalType", aoc_type_of_totaling_str(decoded->total_type),
- obj_type, ast_json_ref(obj));
+ obj_type, obj);
}
static struct ast_json *association_to_json(const struct ast_aoc_decoded *decoded)
@@ -1715,8 +1715,8 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
for (i = 0; i < decoded->aoc_s_count; ++i) {
struct ast_json *rate;
- RAII_VAR(struct ast_json *, type, NULL, ast_json_unref);
- RAII_VAR(struct ast_json *, currency, NULL, ast_json_unref);
+ struct ast_json *type = NULL;
+ struct ast_json *currency;
const char *charge_item = aoc_charged_item_str(
decoded->aoc_s_entries[i].charged_item);
@@ -1731,8 +1731,8 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
switch (decoded->aoc_s_entries[i].rate_type) {
case AST_AOC_RATE_TYPE_DURATION:
{
- RAII_VAR(struct ast_json *, time, NULL, ast_json_unref);
- RAII_VAR(struct ast_json *, granularity, NULL, ast_json_unref);
+ struct ast_json *time;
+ struct ast_json *granularity = NULL;
currency = currency_to_json(
decoded->aoc_s_entries[i].rate.duration.currency_name,
@@ -1750,11 +1750,11 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
}
type = ast_json_pack("{s:o, s:s, s:o, s:o}",
- "Currency", ast_json_ref(currency),
+ "Currency", currency,
"ChargingType", decoded->aoc_s_entries[i].rate.duration.charging_type
? "StepFunction" : "ContinuousCharging",
- "Time", ast_json_ref(time),
- "Granularity", granularity ? ast_json_ref(granularity) : ast_json_null());
+ "Time", time,
+ "Granularity", granularity ?: ast_json_null());
break;
}
@@ -1764,7 +1764,7 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
decoded->aoc_s_entries[i].rate.flat.amount,
decoded->aoc_s_entries[i].rate.flat.multiplier);
- type = ast_json_pack("{s:o}", "Currency", ast_json_ref(currency));
+ type = ast_json_pack("{s:o}", "Currency", currency);
break;
case AST_AOC_RATE_TYPE_VOLUME:
currency = currency_to_json(
@@ -1775,7 +1775,7 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
type = ast_json_pack("{s:s, s:o}",
"Unit", aoc_volume_unit_str(
decoded->aoc_s_entries[i].rate.volume.volume_unit),
- "Currency", ast_json_ref(currency));
+ "Currency", currency);
break;
case AST_AOC_RATE_TYPE_SPECIAL_CODE:
type = ast_json_pack("{s:i}",
@@ -1787,7 +1787,7 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
rate = ast_json_pack("{s:s, s:o}",
"Chargeable", charge_item,
- aoc_rate_type_str(decoded->aoc_s_entries[i].rate_type), ast_json_ref(type));
+ aoc_rate_type_str(decoded->aoc_s_entries[i].rate_type), type);
if (ast_json_array_append(rates, rate)) {
break;
}
diff --git a/main/app.c b/main/app.c
index 8ea6f82d9..04aca2b8c 100644
--- a/main/app.c
+++ b/main/app.c
@@ -3149,7 +3149,7 @@ struct stasis_topic *ast_mwi_topic(const char *uniqueid)
struct ast_mwi_state *ast_mwi_create(const char *mailbox, const char *context)
{
- RAII_VAR(struct ast_mwi_state *, mwi_state, NULL, ao2_cleanup);
+ struct ast_mwi_state *mwi_state;
ast_assert(!ast_strlen_zero(mailbox));
@@ -3159,6 +3159,7 @@ struct ast_mwi_state *ast_mwi_create(const char *mailbox, const char *context)
}
if (ast_string_field_init(mwi_state, 256)) {
+ ao2_ref(mwi_state, -1);
return NULL;
}
if (!ast_strlen_zero(context)) {
@@ -3167,7 +3168,6 @@ struct ast_mwi_state *ast_mwi_create(const char *mailbox, const char *context)
ast_string_field_set(mwi_state, uniqueid, mailbox);
}
- ao2_ref(mwi_state, +1);
return mwi_state;
}
@@ -3340,8 +3340,8 @@ struct stasis_message *ast_mwi_blob_create(struct ast_mwi_state *mwi_state,
struct stasis_message_type *message_type,
struct ast_json *blob)
{
- RAII_VAR(struct ast_mwi_blob *, obj, NULL, ao2_cleanup);
- RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
+ struct ast_mwi_blob *obj;
+ struct stasis_message *msg;
ast_assert(blob != NULL);
@@ -3360,11 +3360,8 @@ struct stasis_message *ast_mwi_blob_create(struct ast_mwi_state *mwi_state,
/* This is not a normal MWI event. Only used by the MinivmNotify app. */
msg = stasis_message_create(message_type, obj);
- if (!msg) {
- return NULL;
- }
+ ao2_ref(obj, -1);
- ao2_ref(msg, +1);
return msg;
}
diff --git a/main/cli.c b/main/cli.c
index f3411860c..8e0cc3bd3 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -2463,18 +2463,17 @@ static char *parse_args(const char *s, int *argc, const char *argv[], int max, i
/*! \brief Return the number of unique matches for the generator */
int ast_cli_generatornummatches(const char *text, const char *word)
{
- int matches = 0, i = 0;
- char *buf = NULL, *oldbuf = NULL;
-
- while ((buf = ast_cli_generator(text, word, i++))) {
- if (!oldbuf || strcmp(buf,oldbuf))
- matches++;
- if (oldbuf)
- ast_free(oldbuf);
- oldbuf = buf;
- }
- if (oldbuf)
- ast_free(oldbuf);
+ int matches;
+ struct ast_vector_string *vec = ast_cli_completion_vector(text, word);
+
+ if (!vec) {
+ return 0;
+ }
+
+ matches = AST_VECTOR_SIZE(vec) - 1;
+ AST_VECTOR_CALLBACK_VOID(vec, ast_free);
+ AST_VECTOR_PTR_FREE(vec);
+
return matches;
}
@@ -2501,6 +2500,44 @@ char **ast_cli_completion_matches(const char *text, const char *word)
return match_list;
}
+AST_THREADSTORAGE_RAW(completion_storage);
+
+/*!
+ * \internal
+ * \brief Add a value to the vector.
+ *
+ * \param vec Vector to add \a value to. Must be from threadstorage.
+ * \param value The value to add.
+ *
+ * \retval 0 Success
+ * \retval -1 Failure
+ */
+static int cli_completion_vector_add(struct ast_vector_string *vec, char *value)
+{
+ if (!value) {
+ return 0;
+ }
+
+ if (!vec || AST_VECTOR_ADD_SORTED(vec, value, strcasecmp)) {
+ if (vec) {
+ ast_threadstorage_set_ptr(&completion_storage, NULL);
+
+ AST_VECTOR_CALLBACK_VOID(vec, ast_free);
+ AST_VECTOR_FREE(vec);
+ }
+ ast_free(value);
+
+ return -1;
+ }
+
+ return 0;
+}
+
+int ast_cli_completion_add(char *value)
+{
+ return cli_completion_vector_add(ast_threadstorage_get_ptr(&completion_storage), value);
+}
+
struct ast_vector_string *ast_cli_completion_vector(const char *text, const char *word)
{
char *retstr, *prevstr;
@@ -2508,13 +2545,23 @@ struct ast_vector_string *ast_cli_completion_vector(const char *text, const char
size_t which = 0;
struct ast_vector_string *vec = ast_calloc(1, sizeof(*vec));
+ /* Recursion into this function is a coding error. */
+ ast_assert(!ast_threadstorage_get_ptr(&completion_storage));
+
if (!vec) {
return NULL;
}
+ if (ast_threadstorage_set_ptr(&completion_storage, vec)) {
+ ast_log(LOG_ERROR, "Failed to initialize threadstorage for completion.\n");
+ ast_free(vec);
+
+ return NULL;
+ }
+
while ((retstr = ast_cli_generator(text, word, which)) != NULL) {
- if (AST_VECTOR_ADD_SORTED(vec, retstr, strcasecmp)) {
- ast_free(retstr);
+ if (cli_completion_vector_add(vec, retstr)) {
+ ast_threadstorage_set_ptr(&completion_storage, NULL);
goto vector_cleanup;
}
@@ -2522,6 +2569,8 @@ struct ast_vector_string *ast_cli_completion_vector(const char *text, const char
++which;
}
+ ast_threadstorage_set_ptr(&completion_storage, NULL);
+
if (!AST_VECTOR_SIZE(vec)) {
AST_VECTOR_PTR_FREE(vec);
@@ -2560,6 +2609,7 @@ struct ast_vector_string *ast_cli_completion_vector(const char *text, const char
retstr = ast_strndup(AST_VECTOR_GET(vec, 0), max_equal);
if (!retstr || AST_VECTOR_INSERT_AT(vec, 0, retstr)) {
ast_free(retstr);
+
goto vector_cleanup;
}
diff --git a/res/res_format_attr_h263.c b/res/res_format_attr_h263.c
index f5eef9386..a1f82216b 100644
--- a/res/res_format_attr_h263.c
+++ b/res/res_format_attr_h263.c
@@ -271,9 +271,8 @@ static int load_module(void)
return AST_MODULE_LOAD_SUCCESS;
}
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "H.263 Format Attribute Module",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "H.263 Format Attribute Module",
.support_level = AST_MODULE_SUPPORT_CORE,
.load = load_module,
.unload = unload_module,
- .load_pri = AST_MODPRI_DEFAULT,
);
diff --git a/res/res_format_attr_h264.c b/res/res_format_attr_h264.c
index 4a39fcc77..702a13e67 100644
--- a/res/res_format_attr_h264.c
+++ b/res/res_format_attr_h264.c
@@ -332,9 +332,8 @@ static int load_module(void)
return AST_MODULE_LOAD_SUCCESS;
}
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "H.264 Format Attribute Module",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "H.264 Format Attribute Module",
.support_level = AST_MODULE_SUPPORT_CORE,
.load = load_module,
.unload = unload_module,
- .load_pri = AST_MODPRI_DEFAULT,
);
diff --git a/res/res_hep_pjsip.c b/res/res_hep_pjsip.c
index 1d99fcc17..0301ac3a5 100644
--- a/res/res_hep_pjsip.c
+++ b/res/res_hep_pjsip.c
@@ -251,9 +251,8 @@ static int unload_module(void)
return 0;
}
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "PJSIP HEPv3 Logger",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "PJSIP HEPv3 Logger",
.support_level = AST_MODULE_SUPPORT_EXTENDED,
.load = load_module,
.unload = unload_module,
- .load_pri = AST_MODPRI_DEFAULT,
);
diff --git a/res/res_hep_rtcp.c b/res/res_hep_rtcp.c
index bddcafbdd..d799b4620 100644
--- a/res/res_hep_rtcp.c
+++ b/res/res_hep_rtcp.c
@@ -182,9 +182,8 @@ static int unload_module(void)
return 0;
}
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "RTCP HEPv3 Logger",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "RTCP HEPv3 Logger",
.support_level = AST_MODULE_SUPPORT_EXTENDED,
.load = load_module,
.unload = unload_module,
- .load_pri = AST_MODPRI_DEFAULT,
);
diff --git a/res/res_mwi_external_ami.c b/res/res_mwi_external_ami.c
index 0f86173d9..0479f8bcf 100644
--- a/res/res_mwi_external_ami.c
+++ b/res/res_mwi_external_ami.c
@@ -368,7 +368,7 @@ static int load_module(void)
return AST_MODULE_LOAD_SUCCESS;
}
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "AMI support for external MWI",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "AMI support for external MWI",
.support_level = AST_MODULE_SUPPORT_CORE,
.load = load_module,
.unload = unload_module,
diff --git a/res/res_parking.c b/res/res_parking.c
index fbe256c93..593134b60 100644
--- a/res/res_parking.c
+++ b/res/res_parking.c
@@ -1300,4 +1300,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Call Parking Resource
.load = load_module,
.unload = unload_module,
.reload = reload_module,
+ .load_pri = 0,
);
diff --git a/res/res_pjsip_endpoint_identifier_anonymous.c b/res/res_pjsip_endpoint_identifier_anonymous.c
index 2a47cbe3f..791358374 100644
--- a/res/res_pjsip_endpoint_identifier_anonymous.c
+++ b/res/res_pjsip_endpoint_identifier_anonymous.c
@@ -128,9 +128,8 @@ static int unload_module(void)
return 0;
}
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "PJSIP Anonymous endpoint identifier",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "PJSIP Anonymous endpoint identifier",
.support_level = AST_MODULE_SUPPORT_CORE,
.load = load_module,
.unload = unload_module,
- .load_pri = AST_MODPRI_DEFAULT,
);
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index a9bdf6887..7724fc63b 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -114,6 +114,20 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#define ZFONE_PROFILE_ID 0x505a
#define DEFAULT_LEARNING_MIN_SEQUENTIAL 4
+/*!
+ * \brief Calculate the min learning duration in ms.
+ *
+ * \details
+ * The min supported packet size represents 10 ms and we need to account
+ * for some jitter and fast clocks while learning. Some messed up devices
+ * have very bad jitter for a small packet sample size. Jitter can also
+ * be introduced by the network itself.
+ *
+ * So we'll allow packets to come in every 9ms on average for fast clocking
+ * with the last one coming in 5ms early for jitter.
+ */
+#define CALC_LEARNING_MIN_DURATION(count) (((count) - 1) * 9 - 5)
+#define DEFAULT_LEARNING_MIN_DURATION CALC_LEARNING_MIN_DURATION(DEFAULT_LEARNING_MIN_SEQUENTIAL)
#define SRTP_MASTER_KEY_LEN 16
#define SRTP_MASTER_SALT_LEN 14
@@ -150,6 +164,7 @@ static int nochecksums;
#endif
static int strictrtp = DEFAULT_STRICT_RTP; /*!< Only accept RTP frames from a defined source. If we receive an indication of a changing source, enter learning mode. */
static int learning_min_sequential = DEFAULT_LEARNING_MIN_SEQUENTIAL; /*!< Number of sequential RTP frames needed from a single source during learning mode to accept new source. */
+static int learning_min_duration = DEFAULT_LEARNING_MIN_DURATION; /*!< Lowest acceptable timeout between the first and the last sequential RTP frame. */
#ifdef HAVE_PJPROJECT
static int icesupport = DEFAULT_ICESUPPORT;
static struct sockaddr_in stunaddr;
@@ -230,7 +245,7 @@ static AST_RWLIST_HEAD_STATIC(host_candidates, ast_ice_host_candidate);
struct rtp_learning_info {
struct ast_sockaddr proposed_address; /*!< Proposed remote address for strict RTP */
struct timeval start; /*!< The time learning mode was started */
- struct timeval received; /*!< The time of the last received packet */
+ struct timeval received; /*!< The time of the first received packet */
int max_seq; /*!< The highest sequence number received */
int packets; /*!< The number of remaining packets before the source is accepted */
};
@@ -2782,25 +2797,28 @@ static void rtp_learning_seq_init(struct rtp_learning_info *info, uint16_t seq)
*/
static int rtp_learning_rtp_seq_update(struct rtp_learning_info *info, uint16_t seq)
{
- /*
- * During the learning mode the minimum amount of media we'll accept is
- * 10ms so give a reasonable 5ms buffer just in case we get it sporadically.
- */
- if (!ast_tvzero(info->received) && ast_tvdiff_ms(ast_tvnow(), info->received) < 5) {
- /*
- * Reject a flood of packets as acceptable for learning.
- * Reset the needed packets.
- */
- info->packets = learning_min_sequential - 1;
- } else if (seq == (uint16_t) (info->max_seq + 1)) {
+ if (seq == (uint16_t) (info->max_seq + 1)) {
/* packet is in sequence */
info->packets--;
} else {
/* Sequence discontinuity; reset */
info->packets = learning_min_sequential - 1;
+ info->received = ast_tvnow();
+ }
+
+ /*
+ * Protect against packet floods by checking that we
+ * received the packet sequence in at least the minimum
+ * allowed time.
+ */
+ if (ast_tvzero(info->received)) {
+ info->received = ast_tvnow();
+ } else if (!info->packets && (ast_tvdiff_ms(ast_tvnow(), info->received) < learning_min_duration )) {
+ /* Packet flood; reset */
+ info->packets = learning_min_sequential - 1;
+ info->received = ast_tvnow();
}
info->max_seq = seq;
- info->received = ast_tvnow();
return info->packets;
}
@@ -2910,8 +2928,8 @@ static void rtp_add_candidates_to_ice(struct ast_rtp_instance *instance, struct
}
/* If configured to use a STUN server to get our external mapped address do so */
- if (stunaddr.sin_addr.s_addr && count && ast_sockaddr_is_ipv4(addr)
- && !stun_address_is_blacklisted(addr)) {
+ if (count && stunaddr.sin_addr.s_addr && !stun_address_is_blacklisted(addr) &&
+ (ast_sockaddr_is_ipv4(addr) || ast_sockaddr_is_any(addr))) {
struct sockaddr_in answer;
int rsp;
@@ -2925,27 +2943,40 @@ static void rtp_add_candidates_to_ice(struct ast_rtp_instance *instance, struct
ao2_lock(instance);
if (!rsp) {
pj_sockaddr base;
- pj_sockaddr ext;
- pj_str_t mapped = pj_str(ast_strdupa(ast_inet_ntoa(answer.sin_addr)));
- int srflx = 1;
-
- /* Use the first local host candidate as the base */
- pj_sockaddr_cp(&base, &address[basepos]);
- pj_sockaddr_init(pj_AF_INET(), &ext, &mapped, ntohs(answer.sin_port));
-
- /* If the returned address is the same as one of our host candidates, don't send the srflx */
- for (pos = 0; pos < count; pos++) {
- if ((pj_sockaddr_cmp(&address[pos], &ext) == 0) && !rtp_address_is_ice_blacklisted(&address[pos])) {
- srflx = 0;
+ /* Use the first local IPv4 host candidate as the base */
+ for (pos = basepos; pos < count; pos++) {
+ if (address[pos].addr.sa_family == PJ_AF_INET &&
+ !rtp_address_is_ice_blacklisted(&address[pos])) {
+ pj_sockaddr_cp(&base, &address[pos]);
break;
}
}
- if (srflx) {
- ast_rtp_ice_add_cand(instance, rtp, component, transport,
- PJ_ICE_CAND_TYPE_SRFLX, 65535, &ext, &base, &base,
- pj_sockaddr_get_len(&ext));
+ if (pos < count) {
+ pj_sockaddr ext;
+ pj_str_t mapped = pj_str(ast_strdupa(ast_inet_ntoa(answer.sin_addr)));
+ int srflx = 1;
+
+ pj_sockaddr_init(pj_AF_INET(), &ext, &mapped, ntohs(answer.sin_port));
+
+ /*
+ * If the returned address is the same as one of our host
+ * candidates, don't send the srflx
+ */
+ for (pos = 0; pos < count; pos++) {
+ if (pj_sockaddr_cmp(&address[pos], &ext) == 0 &&
+ !rtp_address_is_ice_blacklisted(&address[pos])) {
+ srflx = 0;
+ break;
+ }
+ }
+
+ if (srflx) {
+ ast_rtp_ice_add_cand(instance, rtp, component, transport,
+ PJ_ICE_CAND_TYPE_SRFLX, 65535, &ext, &base, &base,
+ pj_sockaddr_get_len(&ext));
+ }
}
}
}
@@ -6483,6 +6514,7 @@ static int rtp_reload(int reload)
dtmftimeout = DEFAULT_DTMF_TIMEOUT;
strictrtp = DEFAULT_STRICT_RTP;
learning_min_sequential = DEFAULT_LEARNING_MIN_SEQUENTIAL;
+ learning_min_duration = DEFAULT_LEARNING_MIN_DURATION;
/** This resource is not "reloaded" so much as unloaded and loaded again.
* In the case of the TURN related variables, the memory referenced by a
@@ -6547,10 +6579,12 @@ static int rtp_reload(int reload)
strictrtp = ast_true(s);
}
if ((s = ast_variable_retrieve(cfg, "general", "probation"))) {
- if ((sscanf(s, "%d", &learning_min_sequential) <= 0) || learning_min_sequential <= 0) {
+ if ((sscanf(s, "%d", &learning_min_sequential) != 1) || learning_min_sequential <= 1) {
ast_log(LOG_WARNING, "Value for 'probation' could not be read, using default of '%d' instead\n",
DEFAULT_LEARNING_MIN_SEQUENTIAL);
+ learning_min_sequential = DEFAULT_LEARNING_MIN_SEQUENTIAL;
}
+ learning_min_duration = CALC_LEARNING_MIN_DURATION(learning_min_sequential);
}
#ifdef HAVE_PJPROJECT
if ((s = ast_variable_retrieve(cfg, "general", "icesupport"))) {
diff --git a/tests/test_substitution.c b/tests/test_substitution.c
index 2635430a4..96ca29c74 100644
--- a/tests/test_substitution.c
+++ b/tests/test_substitution.c
@@ -45,6 +45,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/stringfields.h"
#include "asterisk/threadstorage.h"
#include "asterisk/test.h"
+#include "asterisk/vector.h"
static enum ast_test_result_state test_chan_integer(struct ast_test *test,
struct ast_channel *c, int *ifield, const char *expression)
@@ -227,6 +228,7 @@ AST_TEST_DEFINE(test_substitution)
struct ast_channel *c;
int i;
enum ast_test_result_state res = AST_TEST_PASS;
+ struct ast_vector_string *funcs;
switch (cmd) {
case TEST_INIT:
@@ -304,11 +306,12 @@ AST_TEST_DEFINE(test_substitution)
#undef TEST
/* For testing dialplan functions */
- for (i = 0; ; i++) {
- char *cmd = ast_cli_generator("core show function", "", i);
- if (cmd == NULL) {
- break;
- }
+ funcs = ast_cli_completion_vector("core show function", "");
+
+ /* Skip "best match" element 0 */
+ for (i = 1; funcs && i < AST_VECTOR_SIZE(funcs); i++) {
+ char *cmd = AST_VECTOR_GET(funcs, i);
+
if (strcmp(cmd, "CHANNEL") && strcmp(cmd, "CALLERID") && strncmp(cmd, "CURL", 4) &&
strncmp(cmd, "AES", 3) && strncmp(cmd, "BASE64", 6) &&
strcmp(cmd, "CDR") && strcmp(cmd, "ENV") && strcmp(cmd, "GLOBAL") &&
@@ -323,10 +326,14 @@ AST_TEST_DEFINE(test_substitution)
}
}
}
- ast_free(cmd);
}
+ if (funcs) {
+ AST_VECTOR_CALLBACK_VOID(funcs, ast_free);
+ AST_VECTOR_PTR_FREE(funcs);
+ }
ast_hangup(c);
+
return res;
}
diff --git a/third-party/pjproject/configure.m4 b/third-party/pjproject/configure.m4
index 73887041c..c1edaf9aa 100644
--- a/third-party/pjproject/configure.m4
+++ b/third-party/pjproject/configure.m4
@@ -86,7 +86,6 @@ AC_DEFUN([_PJPROJECT_CONFIGURE],
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])
AC_DEFINE([HAVE_PJSIP_AUTH_CLT_DEINIT], 1, [Define if your system has pjsip_auth_clt_deinit declared.])
- AC_DEFINE([HAVE_PJSIP_EVSUB_SET_UAS_TIMEOUT], 1, [Define if your system has pjsip_evsub_set_uas_timeout declared.])
AC_DEFINE([HAVE_PJSIP_TSX_LAYER_FIND_TSX2], 1, [Define if your system has pjsip_tsx_layer_find_tsx2 declared.])
AC_SUBST([PJPROJECT_BUNDLED])
diff --git a/third-party/pjproject/patches/0040-183_without_to_tag.patch b/third-party/pjproject/patches/0040-183_without_to_tag.patch
new file mode 100644
index 000000000..e8692fe1b
--- /dev/null
+++ b/third-party/pjproject/patches/0040-183_without_to_tag.patch
@@ -0,0 +1,17 @@
+diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c
+index c9686a0..fc52a63 100644
+--- a/pjsip/src/pjsip-ua/sip_inv.c
++++ b/pjsip/src/pjsip-ua/sip_inv.c
+@@ -4156,9 +4156,10 @@ static void inv_on_state_calling( pjsip_inv_session *inv, pjsip_event *e)
+ status = pjsip_inv_send_msg(inv, cancel);
+ }
+
+- if (dlg->remote.info->tag.slen) {
++ if (tsx->status_code != 100) {
+
+- inv_set_state(inv, PJSIP_INV_STATE_EARLY, e);
++ if (dlg->remote.info->tag.slen)
++ inv_set_state(inv, PJSIP_INV_STATE_EARLY, e);
+
+ inv_check_sdp_in_incoming_msg(inv, tsx,
+ e->body.tsx_state.src.rdata);