]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
8 years agoUpdate for certified/13.13-cert1 certified/13.13-cert1
George Joseph [Mon, 13 Feb 2017 19:25:52 +0000 (14:25 -0500)] 
Update for certified/13.13-cert1

8 years agoUpdate for certified/13.13-cert1-rc4 certified/13.13-cert1-rc4
George Joseph [Wed, 8 Feb 2017 18:58:00 +0000 (13:58 -0500)] 
Update for certified/13.13-cert1-rc4

8 years agoRevert "Update qualifies when AOR configuration changes." 05/4905/1
Mark Michelson [Wed, 8 Feb 2017 17:50:11 +0000 (11:50 -0600)] 
Revert "Update qualifies when AOR configuration changes."

This reverts commit 6492e91392b8fd394193e411c6eb64b45486093f.

The change in question was intended to prevent the need to reload in
order to update qualifies on contacts when an AOR changes. However, this
ended up causing a deadlock instead.

Change-Id: I1a835c90a5bb65b6dc3a1e94cddc12a4afc3d71e

8 years agoUpdate for certified/13.13-cert1-rc3 certified/13.13-cert1-rc3
Mark Michelson [Fri, 3 Feb 2017 19:58:32 +0000 (14:58 -0500)] 
Update for certified/13.13-cert1-rc3

8 years agoMerge "Update qualifies when AOR configuration changes." into certified/13.13
zuul [Fri, 3 Feb 2017 15:24:33 +0000 (09:24 -0600)] 
Merge "Update qualifies when AOR configuration changes." into certified/13.13

8 years agoMerge "channel.c: Fix unbalanced read queue deadlocking local channels." into certifi...
zuul [Fri, 3 Feb 2017 05:54:09 +0000 (23:54 -0600)] 
Merge "channel.c: Fix unbalanced read queue deadlocking local channels." into certified/13.13

8 years agoMerge "astobj2.c: Add excessive ref count trap." into certified/13.13
George Joseph [Fri, 3 Feb 2017 05:27:55 +0000 (23:27 -0600)] 
Merge "astobj2.c: Add excessive ref count trap." into certified/13.13

8 years agoMerge "res_agi: Prevent an AGI from eating frames it should not. (Re-do)" into certif...
zuul [Fri, 3 Feb 2017 05:21:39 +0000 (23:21 -0600)] 
Merge "res_agi: Prevent an AGI from eating frames it should not. (Re-do)" into certified/13.13

8 years agoMerge "Add reload options to CLI/AMI stale object commands." into certified/13.13
Joshua Colp [Fri, 3 Feb 2017 00:08:35 +0000 (18:08 -0600)] 
Merge "Add reload options to CLI/AMI stale object commands." into certified/13.13

8 years agochannel.c: Fix unbalanced read queue deadlocking local channels. 83/4883/1
Richard Mudgett [Wed, 1 Feb 2017 00:28:15 +0000 (18:28 -0600)] 
channel.c: Fix unbalanced read queue deadlocking local channels.

Using the timerfd timing module can cause channel freezing, lingering, or
deadlock issues.  The problem is because this is the only timing module
that uses an associated alert-pipe.  When the alert-pipe becomes
unbalanced with respect to the number of frames in the read queue bad
things can happen.  If the alert-pipe has fewer alerts queued than the
read queue then nothing might wake up the thread to handle received frames
from the channel driver.  For local channels this is the only way to wake
up the thread to handle received frames.  Being unbalanced in the other
direction is less of an issue as it will cause unnecessary reads into the
channel driver.

ASTERISK-26716 is an example of this deadlock which was indirectly fixed
by the change that found the need for this patch.

* In channel.c:__ast_queue_frame(): Adding frame lists to the read queue
did not add the same number of alerts to the alert-pipe.  Correspondingly,
when there is an exceptionally long queue event, any removed frames did
not also remove the corresponding number of alerts from the alert-pipe.

ASTERISK-26632 #close

Change-Id: Ia98137c5bf6e9d6d202ce0eb36441851875863f6

8 years agores_agi: Prevent an AGI from eating frames it should not. (Re-do) 82/4882/1
Richard Mudgett [Tue, 31 Jan 2017 22:38:49 +0000 (16:38 -0600)] 
res_agi: Prevent an AGI from eating frames it should not. (Re-do)

A dialplan intercept routine is equivalent to an interrupt routine.  As
such, the routine must be done quickly and you do not have access to the
media stream.  These restrictions are necessary because the media stream
is the responsibility of some other code and interfering with or delaying
that processing is bad.  A possible future dialplan processing
architecture change may allow the interception routine to run in a
different thread from the main thread handling the media and remove the
execution time restriction.

* Made res_agi.c:run_agi() running an AGI in an interception routine run
in DeadAGI mode.  No touchy channel frames.

ASTERISK-25951

ASTERISK-26343

ASTERISK-26716

Change-Id: I638f147ca7a7f2590d7194a8ef4090eb191e4e43

8 years agoFrame deferral: Revert API refactoring. 81/4881/1
Richard Mudgett [Tue, 31 Jan 2017 22:32:18 +0000 (16:32 -0600)] 
Frame deferral: Revert API refactoring.

There are several issues with deferring frames that are caused by the
refactoring.

1) The code deferring frames mishandles adding a deferred frame to the
deferred queue.  As a result the deferred queue can only be one frame
long.

2) Deferrable frames can come directly from the channel driver as well as
the read queue.  These frames need to be added to the deferred queue.

3) Whoever is deferring frames is really only doing the __ast_read() to
collect deferred frames and doesn't care about the returned frames except
to detect a hangup event.  When frame deferral is completed we must make
the normal frame processing see the hangup as a frame anyway.  As such,
there is no need to have varying hangup frame deferral methods.  We also
need to be aware of the AST_SOFTHANGUP_ASYNCGOTO hangup that isn't real.
That fake hangup is to cause the PBX thread to break out of loops to go
execute a new dialplan location.

4) To properly deal with deferrable frames from the channel driver as
pointed out by (2) above, means that it is possible to process a dialplan
interception routine while frames are deferred because of the
AST_CONTROL_READ_ACTION control frame.  Deferring frames is not
implemented as a re-entrant operation so you could have the unsupported
case of two sections of code thinking they have control of the media
stream.

A worse problem is because of the bad implementation of the AMI PlayDTMF
action.  It can cause two threads to be deferring frames on the same
channel at the same time.  (ASTERISK_25940)

* Rather than fix all these problems simply revert the API refactoring as
there is going to be only autoservice and safe_sleep deferring frames
anyway.

ASTERISK-26343

ASTERISK-26716 #close

Change-Id: I45069c779aa3a35b6c863f65245a6df2c7865496

8 years agoastobj2.c: Add excessive ref count trap. 71/4871/1
Richard Mudgett [Tue, 10 Jan 2017 23:37:38 +0000 (17:37 -0600)] 
astobj2.c: Add excessive ref count trap.

Change-Id: I32e6a589cf9009450e4ff7cb85c07c9d9ef7fe4a

8 years agores_pjsip: Handle invocation of callback on outgoing request when error occurs. 68/4868/1
Joshua Colp [Tue, 31 Jan 2017 17:17:50 +0000 (17:17 +0000)] 
res_pjsip: Handle invocation of callback on outgoing request when error occurs.

There are some error cases in PJSIP when sending a request that will
result in the callback for the request being invoked.  The code did not
handle this case and assumed on every error case that the callback was not
invoked.

The code has been changed to check whether the callback has been invoked
and if so to absorb the error and treat it as a success.

ASTERISK-26679
ASTERISK-26699

Change-Id: I563982ba204da5aa1428989a11c06dd9087fea91

8 years agoUpdate qualifies when AOR configuration changes. 61/4861/1
Mark Michelson [Wed, 1 Feb 2017 19:54:50 +0000 (13:54 -0600)] 
Update qualifies when AOR configuration changes.

Prior to this change, qualifies would only update in the following
cases:
* A reload of res_pjsip.so was issued.
* A dynamic contact was re-registered after its AOR's qualify_frequency
  had been changed
This does not work well if you are using realtime for your AORs. You can
update your database to have a new qualify_frequency, but the permanent
contacts on that AOR will not have their qualifies updated. And the
dynamic contacts on that AOR will not have their qualifies updated until
the next registration, which could be a long time.

This change seeks to fix this problem by making it so that whenever AOR
configuration is applied, the contacts pertaining to that AOR have their
qualifies updated.

Additions from this patch:
* AOR sorcery objects now have an apply handler that calls into a newly
  added function in the OPTIONS code. This causes all contacts
  associated with that AOR to re-schedule qualifies.
* When it is time to qualify a contact, the OPTIONS code checks to see
  if the AOR can still be retrieved. If not, then qualification is
  canceled on the contact.

Alterations from this patch:
* The registrar code no longer updates contact's qualify_frequence and
  qualify_timeout. There is no point to this since those values already
  get updated when the AOR changes.
* Reloading res_pjsip.so no longer calls the OPTIONS initialization
  function. Reloading res_pjsip.so results in re-loading AORs, which
  results in re-scheduling qualifies.

Change-Id: I2e7c3316da28f389c45954f24c4e9389abac1121

8 years agodebug_utilities: Install ast_logescalator to /var/lib/asterisk/scripts 50/4850/1
George Joseph [Tue, 31 Jan 2017 18:46:08 +0000 (11:46 -0700)] 
debug_utilities: Install ast_logescalator to /var/lib/asterisk/scripts

Forgot to install it with the original patch

Change-Id: I8bdb540a6694971ae5fe21f48d532332c6482e4c

8 years agodebug_utilities: Add ast_logescalator 34/4834/4
George Joseph [Wed, 25 Jan 2017 12:50:43 +0000 (05:50 -0700)] 
debug_utilities:  Add ast_logescalator

The escalator works by creating a set of startup commands in cli.conf
that set up logger channels and issue the debug commands for the
subsystems specified.  If asterisk is running when it is executed,
the same commands will be issued to the running instance.  The original
cli.conf is saved before any changes are made and can be restored by
executing '$prog --reset'.

The log output will be stored in...
$astlogdir/message.$uniqueid
$astlogdir/debug.$uniqueid
$astlogdir/dtmf.$uniqueid
$astlogdir/fax.$uniqueid
$astlogdir/security.$uniqueid
$astlogdir/pjsip_history.$uniqueid
$astlogdir/sip_history.$uniqueid

Some minor tweaks were made to chan_sip, and res_pjsip_history
so their history output could be send to a log channel as packets
are captured.

A minor tweak was also made to manager so events are output to verbose
when "manager set debug on" is issued.

Change-Id: I799f8e5013b86dc5282961b27383d134bf09e543

8 years agoMerge "PJPROJECT logging: Fix detection of max supported log level." into certified...
George Joseph [Fri, 27 Jan 2017 00:52:54 +0000 (18:52 -0600)] 
Merge "PJPROJECT logging: Fix detection of max supported log level." into certified/13.13

8 years agoMerge "ari: Implement 'debug all' and request/response logging" into certified/13.13
George Joseph [Fri, 27 Jan 2017 00:20:34 +0000 (18:20 -0600)] 
Merge "ari: Implement 'debug all' and request/response logging" into certified/13.13

8 years agoAdd reload options to CLI/AMI stale object commands. 19/4819/1
Mark Michelson [Wed, 25 Jan 2017 21:26:53 +0000 (15:26 -0600)] 
Add reload options to CLI/AMI stale object commands.

Marking an object as stale in a memory cache is supposed to prime the
cache so that the next time the item is retrieved, the stale item is
deleted from the cache and a background task is run to re-populate the
cache with a fresh version of the object.

The problem is, there are some object types out there for which there is
no natural reason that they would be retrieved from the backend with any
regularity. Outbound PJSIP registrations are a good example of this. At
startup, they are read, and an object-specific state is created that
refers to the initially-retrieved object for all time.

Adding the "reload" option to the CLI/AMI commands gives the cache the
opportunity to manually re-retrieve the object from the backend, both
storing the new object in the cache and applying the new object's
configuration to the module that uses that object.

Change-Id: Ieb1fe7270ceed491f057ec5cbf0e097bde96c5c8

8 years agoapp_queue: Ensure member is removed from pending when hanging up. 13/4813/1
Martin Tomec [Fri, 9 Dec 2016 18:23:37 +0000 (19:23 +0100)] 
app_queue: Ensure member is removed from pending when hanging up.

In some cases member is added to pending_members, and the channel
is hung up before any extension state change. So the member would
stay in pending_members forever. So when we call do_hang, we
should also remove member from pending.

ASTERISK-26621 #close

Change-Id: Iae476b5c06481db18ebe0fa594b3e80fdc9a7d54
(cherry picked from commit d13be4eff699449172efbd9fed0ee97f6a790b6a)

8 years agoPJPROJECT logging: Fix detection of max supported log level. 70/4770/2
Richard Mudgett [Sat, 21 Jan 2017 03:13:34 +0000 (21:13 -0600)] 
PJPROJECT logging: Fix detection of max supported log level.

The mechanism used for detecting the maximum log level compiled into the
linked pjproject did not work.  The API call simply stores the requested
level into an integer and does no range checking.  Asterisk was assuming
that there was range checking and limited the new value to the allowable
range.  To get the actual maximum log level compiled into the linked
pjproject we need to get and save off the initial set log level from
pjproject.  This is the maximum log level supported.

* Get and save off the initial log level setting before altering it to the
desired level on startup.  This has to be done by a macro rather than
calling a core function to avoid incorrectly linking pjproject.

* Split the initial log level warning messages to warn if the linked
pjproject cannot support the requested startup level and if it is too low
to get the pjproject buildopts for "pjproject show buildopts".

* Adjust the CLI "pjproject set log level" to check the saved max log
level and to generate normal output messages instead of a warning message.

ASTERISK-26743 #close

Change-Id: I40aa76653e2a1dece66c3f8734594b4f0471cfb4

8 years agoari: Implement 'debug all' and request/response logging 50/4750/2
George Joseph [Thu, 19 Jan 2017 15:05:36 +0000 (08:05 -0700)] 
ari: Implement 'debug all' and request/response logging

The 'ari set debug' command has been enhanced to accept 'all' as an
application name.  This allows dumping of all apps even if an app
hasn't registered yet.  To accomplish this, a new global_debug global
variable was added to res/stasis/app.c and new APIs were added to
set and query the value.

'ari set debug' now displays requests and responses as well as events.
This required refactoring the existing debug code.

* The implementation for 'ari set debug' was moved from stasis/cli.{c,h}
  to ari/cli.{c,h}, and stasis/cli.{c,h} were deleted.
* In order to print the body of incoming requests even if a request
  failed, the consumption of the body was moved from the ari stubs
  to ast_ari_callback in res_ari.c and the moustache templates were
  then regenerated.  The body is now passed to ast_ari_invoke and then
  on to the handlers.  This results in code savings since that template
  was inserted multiple times into all the stubs.

An additional change was made to the ao2_str_container implementation
to add partial key searching and a sort function.  The existing cli
code assumed it was already there when it wasn't so the tab completion
was never working.

Change-Id: Ief936f747ce47f1fb14035fbe61152cf766406bf

8 years agopjproject_bundled: Fix setting max log level 60/4760/2
George Joseph [Mon, 23 Jan 2017 15:10:50 +0000 (08:10 -0700)] 
pjproject_bundled: Fix setting max log level

An earlier attempt to prevent pjsua from spitting out an extra 6795
lines of debug output every time the testsuite called it was also
turning off the ability for asterisk to output debug info when it
needed to.  This patch reverts the earlier fix and instead adds
a pjproject patch that sets the startup log level to 1 for pjsua
pjsystest and the pjsua python binding.  This is an asterisk-only
patch that does not affect pjproject functionality and will not be
submitted upstream.

Change-Id: I347a8b58b2626f2906ccfc1d339e907627a0c9e8

8 years agoMerge "debug_utilities: Create ast_loggrabber" into certified/13.13
zuul [Fri, 20 Jan 2017 19:45:32 +0000 (13:45 -0600)] 
Merge "debug_utilities:  Create ast_loggrabber" into certified/13.13

8 years agodebug_utilities: Create ast_loggrabber 24/4724/3
George Joseph [Fri, 13 Jan 2017 17:03:15 +0000 (10:03 -0700)] 
debug_utilities:  Create ast_loggrabber

ast_loggrabber gathers log files from customizable search patterns,
optionally converts POSIX timestamps to a readable format and
tarballs the results.

Also a few tweaks were made to ast_coredumper.

Change-Id: I8bfe1468ada24c1344ce4abab7b002a59a659495
(cherry picked from commit 5fa1c56d7e76999aa14f133a33f6b168e7c3b99c)

8 years agoUpdate for certified/13.13-cert1-rc2 certified/13.13-cert1-rc2
Mark Michelson [Thu, 19 Jan 2017 19:18:36 +0000 (14:18 -0500)] 
Update for certified/13.13-cert1-rc2

8 years agoMerge "pjproject_bundled: Fix compilation with MALLOC_DEBUG" into certified/13.13
Joshua Colp [Wed, 18 Jan 2017 01:18:00 +0000 (19:18 -0600)] 
Merge "pjproject_bundled:  Fix compilation with MALLOC_DEBUG" into certified/13.13

8 years agoMerge "pjproject_bundled: Compile pjsua with max log level = 2" into certified/13.13
Joshua Colp [Wed, 18 Jan 2017 01:17:57 +0000 (19:17 -0600)] 
Merge "pjproject_bundled:  Compile pjsua with max log level = 2" into certified/13.13

8 years agoMerge "debug_utilities: Create the ast_coredumper utility" into certified/13.13
Joshua Colp [Tue, 17 Jan 2017 21:57:53 +0000 (15:57 -0600)] 
Merge "debug_utilities:  Create the ast_coredumper utility" into certified/13.13

8 years agopjproject_bundled: Fix compilation with MALLOC_DEBUG 28/4728/1
George Joseph [Sun, 8 Jan 2017 16:29:01 +0000 (09:29 -0700)] 
pjproject_bundled:  Fix compilation with MALLOC_DEBUG

When MALLOC_DEBUG was specified, make was failing.  Immediately
remaking would work.  The issues was in the ordering of the make
dependencies.

Change-Id: If6030b54fc693f3179f32bfd20c6b5d5f1b3f7cd
(cherry picked from commit f8cd73ec3c159f2e6c464952c92d8fdb69394371)

8 years agopjproject_bundled: Compile pjsua with max log level = 2 27/4727/1
George Joseph [Tue, 3 Jan 2017 21:14:09 +0000 (14:14 -0700)] 
pjproject_bundled:  Compile pjsua with max log level = 2

A while back, we changed config_site.h to set PJ_LOG_MAX_LEVEL = 6.
This allowed us to control the log level better from inside Asterisk.
An unfortunate side effect of this was that the pjsua binary and
python bindings were also compiled with log level set to 6 so whenever
a testsuite test that uses pjsua runs, it spits out 6795 lines of
debug in an instant even before the test starts.  I believe this
overruns the Jenkins capture buffer and prevents the test from
properly terminating.  In turn, this results in the testsuite just
hanging until the job is killed.  It's more frequent on the higher
end agents because they can spit out the messages faster.

Unfortunately, the messages are all spit out before we have control
of the python pj.Lib instance where we can set logging levels so the
only alternative was to actually compile pjsua and _pjsua.so with an
overridden PJ_LOG_MAX_LEVEL.  Although defining a lower max level was
done in the Makefile, the define in config_site.h had to be wrapped
with "#ifndef" so the change would take effect.

Change-Id: I2af9e7d48dde1927279c586c9c725d868fe6f3ff
(cherry picked from commit d7e5a747c312de18647213359103ce6022776864)

8 years agopjproject_bundled: Make build single threaded 25/4725/2
George Joseph [Sun, 18 Dec 2016 21:23:17 +0000 (14:23 -0700)] 
pjproject_bundled:  Make build single threaded

There were just too many issues in various environments with
multi threaded building of pjproject.  It doesn't really speed
things up anyway since asterisk is already being compiled in
parallel.

Change-Id: Ie5648fb91bb89b4224b6bf43a0daa1af793c4ce1
(cherry picked from commit 815f7551550908c83220196ba08742af0c745772)

8 years agoPJPROJECT logging: Made easier to get available logging levels. 26/4726/1
Richard Mudgett [Thu, 24 Nov 2016 00:27:54 +0000 (18:27 -0600)] 
PJPROJECT logging: Made easier to get available logging levels.

Use of the new logging is as simple as issuing the new CLI command or
setting the new pjproject.conf option.

Other options that can affect the logging are how you have the pjproject
log levels mapped to Asterisk log types in pjproject.conf and if you have
configured Asterisk to log the DEBUG type messages.  Altering the
pjproject.conf level mapping shouldn't be necessary for most installations
as the default mapping is sensible.  Configuring Asterisk to log the DEBUG
message type is standard practice for collecting debug information.

* Added CLI "pjproject set log level" command to dynamically adjust the
maximum pjproject log message level.

* Added CLI "pjproject show log level" command to see the currently set
maximum pjproject log message level.

* Added pjproject.conf startup section "log_level" option to set the
initial maximum pjproject log message level so all messages could be
captured from initialization.

* Set PJ_LOG_MAX_LEVEL to 6 to compile in all defined logging levels into
bundled pjproject.  Pjproject will use the currently set run time log
level to determine if a log message is generated just like Asterisk
verbose and debug logging levels.

* In log_forwarder(), made always log enabled and mapped pjproject log
messages.  DEBUG mapped log messages are no longer gated by the current
Asterisk debug logging level.

* Removed RAII_VAR() from res_pjproject.c:get_log_level().

ASTERISK-26630 #close

Change-Id: I6dca12979f482ffb0450aaf58db0fe0f6d2e5389

8 years agodebug_utilities: Create the ast_coredumper utility 23/4723/1
George Joseph [Wed, 11 Jan 2017 00:10:39 +0000 (17:10 -0700)] 
debug_utilities:  Create the ast_coredumper utility

This utility allows easy manipulation of asterisk coredumps.

* Configurable search paths and patterns for existing coredumps
* Can generate a consistent coredump from the running instance
* Can dump the lock_infos table from a coredump
* Dumps backtraces to separate files...
  - thread apply 1 bt full -> <coredump>.thread1.txt
  - thread apply all bt -> <coredump>.brief.txt
  - thread apply all bt full -> <coredump>.full.txt
  - lock_infos table -> <coredump>.locks.txt
* Can tarball corefiles and optionally delete them after processing
* Can tarball results files and optionally delete them after processing
* Converts ':' in coredump and results file names '-' to facilitate
  uploading.  Jira for instance, won't accept file names with colons
  in them.

Tested on Fedora24+, Ubuntu14+, Debian6+, CentOS6+ and FreeBSD9+[1].

[1] For *BSDs, the "devel/gdb" package might have to be installed to
get a recent gdb.  The utility will check all instances of gdb
it finds in $PATH and if one isn't found that can run python, it
prints a friendly error.

Change-Id: I935d37ab9db85ef923f32b05579897f0893d33cd
(cherry picked from commit 47474cfd54a9185c1433464ccfd6301427a03957)

8 years agoMerge "res_rtp_asterisk.c: Fix uninitialized memory crash." into certified/13.13
Joshua Colp [Mon, 9 Jan 2017 13:22:12 +0000 (07:22 -0600)] 
Merge "res_rtp_asterisk.c: Fix uninitialized memory crash." into certified/13.13

8 years agoMerge "chan_rtp.c: Fix uninitialized memory crash." into certified/13.13
Joshua Colp [Mon, 9 Jan 2017 13:21:32 +0000 (07:21 -0600)] 
Merge "chan_rtp.c: Fix uninitialized memory crash." into certified/13.13

8 years agoMerge "res_rtp_asterisk.c: Initialize ourip passed to ast_find_ourip()." into certifi...
zuul [Fri, 6 Jan 2017 19:16:08 +0000 (13:16 -0600)] 
Merge "res_rtp_asterisk.c: Initialize ourip passed to ast_find_ourip()." into certified/13.13

8 years agoMerge "acl.c: Improve ast_ouraddrfor() diagnostic messages." into certified/13.13
George Joseph [Thu, 5 Jan 2017 04:09:36 +0000 (22:09 -0600)] 
Merge "acl.c: Improve ast_ouraddrfor() diagnostic messages." into certified/13.13

8 years agoMerge "chan_pjsip: Use session for retrieving CHANNEL() information." into certified...
George Joseph [Wed, 4 Jan 2017 22:25:37 +0000 (16:25 -0600)] 
Merge "chan_pjsip: Use session for retrieving CHANNEL() information." into certified/13.13

8 years agochan_pjsip: Use session for retrieving CHANNEL() information. 74/4674/3
Joshua Colp [Thu, 22 Dec 2016 22:00:58 +0000 (22:00 +0000)] 
chan_pjsip: Use session for retrieving CHANNEL() information.

The CHANNEL() dialplan function implementation for PJSIP allows
querying of PJSIP specific information. This used the channel
passed in to get the PJSIP session and associated information.
It is possible for this channel to be masqueraded and end
up as a different channel type by the time the information
request is actually acted upon.

This change retrieves the PJSIP session safely and accesses
data from it (including channel). This provides a guarantee
that the session and channel will not be altered when the
request is being acted upon.

ASTERISK-26673

Change-Id: I335e12b89e1820cafdd92b3e7526b8ba649eb7e6

8 years agobridge_native_rtp.c: Fix native rtp bridge data race. 81/4681/1
Richard Mudgett [Fri, 23 Dec 2016 18:10:40 +0000 (12:10 -0600)] 
bridge_native_rtp.c: Fix native rtp bridge data race.

native_rtp_bridge_compatible() didn't lock the bridge channels before
checking the channels for native bridging ability.  As a result, one of
the channel's native format capabilities structure got replaced out from
under the native bridge check.  Use of a stale pointer to freed memory
causes bad things to happen.

MALLOC_DEBUG, DO_CRASH, and the
tests/channels/pjsip/transfers/blind_transfer/caller_direct_media
testsuite test caught this.

* Add missing channel locking in native_rtp_bridge_compatible().

Change-Id: If25fdb3ac8e85563c4857fb8216b3d9dc3d0fa53

8 years agores_rtp_asterisk.c: Fix uninitialized memory crash. 70/4670/1
Richard Mudgett [Wed, 21 Dec 2016 22:28:00 +0000 (16:28 -0600)] 
res_rtp_asterisk.c: Fix uninitialized memory crash.

ast_rtp_remote_address_set() could pass an uninitialized 'us' parameter to
ast_ouraddrfor().  If ast_ouraddrfor() returns an error then the 'us'
parameter may not get initialized.  Thus when the code tries to save the
'us' parameter to the local address we could try to copy a ridiculous
sized memory buffer and segfault.

* Made pass an initialized 'us' parameter to ast_ouraddrfor().

* Optimized out the 'us' struct variable.

ASTERISK-26672 #close

Change-Id: I4acea5dcdf0813da2c7d3e11c2d6067d160d17dc

8 years agochan_rtp.c: Fix uninitialized memory crash. 69/4669/1
Richard Mudgett [Wed, 21 Dec 2016 23:54:42 +0000 (17:54 -0600)] 
chan_rtp.c: Fix uninitialized memory crash.

unicast_rtp_request() could pass an uninitialized 'us' parameter to
ast_ouraddrfor().  If ast_ouraddrfor() returns an error then the 'us'
parameter may not get initialized.  Thus when the code tries to save the
'us' parameter to the local address we could try to copy a ridiculous
sized memory buffer and segfault.

* Made pass an initialized 'us' parameter to ast_ouraddrfor() and abort
the UnicastRTP channel request if it fails.

ASTERISK-26672

Change-Id: I1ef7a7c09f4da4f15dcb6de660d2bcac5f2a95c0

8 years agores_rtp_asterisk.c: Initialize ourip passed to ast_find_ourip(). 68/4668/1
Richard Mudgett [Wed, 21 Dec 2016 23:55:48 +0000 (17:55 -0600)] 
res_rtp_asterisk.c: Initialize ourip passed to ast_find_ourip().

We access uninitialized memory when the 'ourip' parameter does not
have an initial guess to our IP address.

ASTERISK-26672

Change-Id: I35507ea1ad7455d2be188f6ccdd4add7bd150e15

8 years agoacl.c: Improve ast_ouraddrfor() diagnostic messages. 67/4667/1
Richard Mudgett [Wed, 21 Dec 2016 22:25:00 +0000 (16:25 -0600)] 
acl.c: Improve ast_ouraddrfor() diagnostic messages.

* Made not generate strings unless they will actually be used.

ASTERISK-26672

Change-Id: I155fbe7fdff5ce47dfe5326f3baf5446849702c3

8 years agoMerge "res_pjsip: Add/update ERROR msg if invalid URI." into certified/13.13
zuul [Tue, 20 Dec 2016 05:26:34 +0000 (23:26 -0600)] 
Merge "res_pjsip: Add/update ERROR msg if invalid URI." into certified/13.13

8 years agoMerge "MESSAGE: Flush Message/ast_msg_queue channel alert pipe." into certified/13.13
zuul [Tue, 20 Dec 2016 05:26:00 +0000 (23:26 -0600)] 
Merge "MESSAGE: Flush Message/ast_msg_queue channel alert pipe." into certified/13.13

8 years agoMerge "chan_dahdi.c: Fix bounds check regression." into certified/13.13
George Joseph [Tue, 20 Dec 2016 04:22:11 +0000 (22:22 -0600)] 
Merge "chan_dahdi.c: Fix bounds check regression." into certified/13.13

8 years agochan_dahdi.c: Fix bounds check regression. 32/4632/1
Richard Mudgett [Wed, 14 Dec 2016 20:21:47 +0000 (14:21 -0600)] 
chan_dahdi.c: Fix bounds check regression.

Caused by ASTERISK-25494

Change-Id: I1fc408c1a083745ff59da5c4113041bbfce54bcb

8 years agores_pjsip: Add/update ERROR msg if invalid URI. 28/4628/1
Richard Mudgett [Tue, 13 Dec 2016 20:34:54 +0000 (14:34 -0600)] 
res_pjsip: Add/update ERROR msg if invalid URI.

ASTERISK-24499

Change-Id: Ie305153e47e922233b2ff24715e0e326e5fa3a6c

8 years agoMESSAGE: Flush Message/ast_msg_queue channel alert pipe. 27/4627/1
Richard Mudgett [Tue, 13 Dec 2016 00:38:42 +0000 (18:38 -0600)] 
MESSAGE: Flush Message/ast_msg_queue channel alert pipe.

ASTERISK-25083

Change-Id: Id54baa57a8dbca84e29f28bcd2ffc0a5ac12d8b2

8 years agores_sorcery_memory_cache: Change an error to a debug message 20/4620/1
George Joseph [Tue, 13 Dec 2016 20:06:34 +0000 (13:06 -0700)] 
res_sorcery_memory_cache:  Change an error to a debug message

When a sorcery user calls ast_sorcery_delete on an object that
may have already expired from the cache, res_sorcery_memory_cache
spits out an ERROR.  Since this can happen frequently and validly when
an inbound registration expires after the cache entry expired, the
errors are unnecessary and misleading.  Changed to a debug/1.

Change-Id: Idf3a67038c16e3da814cf612ff4d6d18ad29ecd7

8 years agoMerge "res_pjsip_registrar: AMI Add RegistrationInboundContactStatuses command" into...
zuul [Fri, 9 Dec 2016 03:12:38 +0000 (21:12 -0600)] 
Merge "res_pjsip_registrar: AMI Add RegistrationInboundContactStatuses command" into certified/13.13

8 years agoMerge "res_format_attr_opus: Fix crash when fmtp contains spaces." into certified...
Kevin Harwell [Thu, 8 Dec 2016 17:07:35 +0000 (11:07 -0600)] 
Merge "res_format_attr_opus: Fix crash when fmtp contains spaces." into certified/13.13

8 years agochan_sip: Do not allow non-SP/HTAB between header key and colon. 85/4585/1
Walter Doekes [Wed, 30 Nov 2016 15:31:39 +0000 (16:31 +0100)] 
chan_sip: Do not allow non-SP/HTAB between header key and colon.

RFC says SIP headers look like:

    HCOLON  =  *( SP / HTAB ) ":" SWS
    SWS     =  [LWS]                    ; sep whitespace
    LWS     =  [*WSP CRLF] 1*WSP        ; linear whitespace
    WSP     =  SP / HTAB                ; from rfc2234

chan_sip implemented this:

    HCOLON  =  *( LOWCTL / SP ) ":" SWS
    LOWCTL  = %x00-1F                   ; CTL without DEL

This discrepancy meant that SIP proxies in front of Asterisk with
chan_sip could pass on unknown headers with \x00-\x1F in them, which
would be treated by Asterisk as a different (known) header.  For
example, the "To\x01:" header would gladly be forwarded by some proxies
as irrelevant, but chan_sip would treat it as the relevant "To:" header.

Those relying on a SIP proxy to scrub certain headers could mistakenly
get unexpected and unvalidated data fed to Asterisk.

This change fixes so chan_sip only considers SP/HTAB as valid tokens
before the colon, making it agree on the headers with other speakers of
SIP.

ASTERISK-26433 #close
AST-2016-009

Change-Id: I78086fbc524ac733b8f7f78cb423c91075fd489b

8 years agores_format_attr_opus: Fix crash when fmtp contains spaces. 81/4581/1
Joshua Colp [Tue, 15 Nov 2016 00:18:21 +0000 (00:18 +0000)] 
res_format_attr_opus: Fix crash when fmtp contains spaces.

When an opus offer or answer was received that contained an
fmtp line with spaces between the attributes the module would
fail to properly parse it and crash due to recursion.

This change makes the module handle the space properly and
also removes the recursion requirement.

ASTERISK-26579

Change-Id: I01f53e5d9fa9f1925a7365f8d25071b5b3ac2dc3

8 years agores_pjsip_registrar: AMI Add RegistrationInboundContactStatuses command 70/4570/2
George Joseph [Tue, 6 Dec 2016 20:54:25 +0000 (13:54 -0700)] 
res_pjsip_registrar: AMI Add RegistrationInboundContactStatuses command

The PJSIPShowRegistrationsInbound AMI command was just dumping out
all AORs which was pretty useless and resource heavy since it had
to get all endpoints, then all aors for each endpoint, then all
contacts for each aor.

PJSIPShowRegistrationInboundContactStatuses sends ContactStatusDetail
events which meets the intended purpose of the other command and has
significantly less overhead.  Also, some additional fields that were
added to Contact since the original creation of the ContactStatusDetail
event have been added to the end of the event.

For compatibility purposes, PJSIPShowRegistrationsInbound is left
intact.

ASTERISK-26644 #close

Change-Id: I326f12c9ecb52bf37ba03f0748749de4da01490a

8 years agoMerge "Bundled pjproject: Fix finding SIP transactions." into certified/13.13
Joshua Colp [Wed, 7 Dec 2016 19:38:41 +0000 (13:38 -0600)] 
Merge "Bundled pjproject:  Fix finding SIP transactions." into certified/13.13

8 years agoBundled pjproject: Fix finding SIP transactions. 68/4568/2
Richard Mudgett [Tue, 6 Dec 2016 22:45:38 +0000 (16:45 -0600)] 
Bundled pjproject:  Fix finding SIP transactions.

Occasionally SIP message transactions are not found when they should be.
In the particular case an incoming INVITE transaction is CANCELed but the
INVITE transaction cannot be found so a 481 response is returned for the
CANCEL.  The problematic calls have a '_' character in the Via branch
parameter.

The problem is in the pjproject PJ_HASH_USE_OWN_TOLOWER feature's code.
The problem with the "own tolower" code is that it does not calculate the
same hash value as when the pj_tolower() function is used.  The "own
tolower" code will erroneously modify the ASCII characters '@', '[', '\\',
']', '^', and '_'.  Calls to pj_hash_calc_tolower() can use the
PJ_HASH_USE_OWN_TOLOWER substitute algorithm when enabled.  Calls to
pj_hash_get_lower(), pj_hash_set_lower(), and pj_hash_set_np_lower() call
find_entry() which never uses the PJ_HASH_USE_OWN_TOLOWER algorithm.  As a
result you may not be able to find a hash tabled entry because the
calculated hash values would differ.

* Simply disable PJ_HASH_USE_OWN_TOLOWER.

ASTERISK-26490 #close

Change-Id: If89bfdb5f301b8b685881a9a2a6e0c3c5af32253

8 years agopjproject_bundled: Fix missing inclusion of symbols 60/4560/1
George Joseph [Tue, 6 Dec 2016 18:06:45 +0000 (11:06 -0700)] 
pjproject_bundled:  Fix missing inclusion of symbols

Added back in a -g3, and an -O3 when DONT_OPTIMIZE is not set, to
the CFLAGS.  Not sure how they went missing.

Also fixed an uninstall problem where we weren't removing the
symlink from libasteriskpj.so.2 to libasteriskpj.so.  While I was
there, I fixed it for libasteriskssl as well.

Change-Id: I9e00873b1e9082d05b5549d974534b48a2142556

8 years agoFrame deferral: Re-queue deferred frames one-at-a-time. 33/4533/1
Mark Michelson [Wed, 30 Nov 2016 16:48:39 +0000 (10:48 -0600)] 
Frame deferral: Re-queue deferred frames one-at-a-time.

The recent change that made frame deferral into an API had a behavior
change to it. When frame deferral was completed, we would take all of
the deferred frames and queue them all onto the channel in one call to
ast_queue_frame_head(). Before frame deferral was API-ized, places that
performed manual frame deferral would actually take each deferred frame
and queue them onto the channel.

This change in behavior caused the confbridge_recording test to start
failing consistently. Without going too crazily deep into the details,
a channel was getting "stuck" in an ast_safe_sleep(). An AMI redirect
was attempting to break it out of the sleep, but because there were more
frames in the channel read queue than expected, the channel ended up
being unable to break from its sleep loop.

By restoring the behavior of individual frame queuing after deferral,
the test starts passing again.

Note, this points to a potential underlying issue pointing to an
"unbalance" that can occur when queuing multiple frames at once,
and so a follow-up issue is being created to investigate that
possibility.

Change-Id: Ied5dacacda06d343dea751ed5814a03364fe5a7d

8 years agobuild_tools: Fix download_externals to handle certified branches 06/4506/1
George Joseph [Mon, 28 Nov 2016 17:03:23 +0000 (10:03 -0700)] 
build_tools:  Fix download_externals to handle certified branches

download_externals wasn't handling the "certified/13.x" version
correctly.

Change-Id: I124d195bb117ca36fd7bf1150c630f3b474a9d9a

8 years agoUpdate for certified/13.13-cert1-rc1 certified/13.13-cert1-rc1
Kevin Harwell [Wed, 23 Nov 2016 21:58:56 +0000 (16:58 -0500)] 
Update for certified/13.13-cert1-rc1

8 years agoapp_talkdectect: Now core supported, enable for cert
Kevin Harwell [Wed, 23 Nov 2016 21:20:31 +0000 (15:20 -0600)] 
app_talkdectect: Now core supported, enable for cert

Change-Id: Ic0b2cacb21a6e11a25ebbff7e508e106ea156f6c

8 years agoDisable extended support modules
Kevin Harwell [Wed, 23 Nov 2016 21:01:09 +0000 (15:01 -0600)] 
Disable extended support modules

Change-Id: Ib6b4f9451b5b68b738d8ab07a27de1c87c28f819

8 years ago.version: Update for certified/13.13
Kevin Harwell [Wed, 23 Nov 2016 20:57:35 +0000 (14:57 -0600)] 
.version: Update for certified/13.13

Change-Id: Ia1a0f035359d88b8885c7aca22f0d70b73aeb05d

8 years agoUpdate for 13.13.0 13.13.0
Kevin Harwell [Wed, 23 Nov 2016 15:26:01 +0000 (10:26 -0500)] 
Update for 13.13.0

8 years agoUpdate for 13.13.0-rc2 13.13.0-rc2
Kevin Harwell [Tue, 22 Nov 2016 18:02:41 +0000 (13:02 -0500)] 
Update for 13.13.0-rc2

8 years agoMerge branch '13.13' of ssh://gerrit.asterisk.org:29418/asterisk into 13.13
Kevin Harwell [Tue, 22 Nov 2016 18:02:14 +0000 (12:02 -0600)] 
Merge branch '13.13' of ssh://gerrit.asterisk.org:29418/asterisk into 13.13

8 years agobuild: Backport addition of librt check to configure.ac 88/4488/1
George Joseph [Mon, 21 Nov 2016 15:40:59 +0000 (08:40 -0700)] 
build:  Backport addition of librt check to configure.ac

A while back, a master-only change was made to check for librt which
should probably have been cherry-picked to 13 at that time.  Sometime
between then and now, part of that change did make it into 13 but it
was incomplete and non-functional.  This patch backports the rest
of the librt check and allows the link of libasteriskpj to use the
results.

Change-Id: I1424008fd8c90f389dda53162ec4a340b253a3c1

8 years agoUpdate for 13.13.0
Kevin Harwell [Tue, 22 Nov 2016 17:20:29 +0000 (12:20 -0500)] 
Update for 13.13.0

8 years agoUpdate for 13.13.0-rc1 13.13.0-rc1
Joshua Colp [Fri, 18 Nov 2016 18:59:31 +0000 (13:59 -0500)] 
Update for 13.13.0-rc1

8 years agoMerge "build: Various OpenBSD issues" into 13
Joshua Colp [Fri, 18 Nov 2016 18:37:59 +0000 (12:37 -0600)] 
Merge "build:  Various OpenBSD issues" into 13

8 years agoMerge "Bump ARI version to 1.10.0" into 13
Joshua Colp [Fri, 18 Nov 2016 18:35:45 +0000 (12:35 -0600)] 
Merge "Bump ARI version to 1.10.0" into 13

8 years agoBump ARI version to 1.10.0 74/4474/3
Mark Michelson [Fri, 18 Nov 2016 15:45:27 +0000 (09:45 -0600)] 
Bump ARI version to 1.10.0

The video-related bridge changes mean that the version needs to be
bumped.

Change-Id: I41c4495068562bef03aa76728f188b8ac4bd393d

8 years agomanager: update minor version 67/4467/1
Mark Michelson [Thu, 17 Nov 2016 16:50:58 +0000 (10:50 -0600)] 
manager: update minor version

Based on bridge video AMI event changes, bump the minor version of AMI.

Change-Id: I02586bd6cafc0baa33ea98c2f75356c0f5e03435

8 years agoMerge "res_pjsip_outbound_authenticator_digest.c: Fix memory pool leak." into 13
zuul [Thu, 17 Nov 2016 05:20:10 +0000 (23:20 -0600)] 
Merge "res_pjsip_outbound_authenticator_digest.c: Fix memory pool leak." into 13

8 years agoMerge "res_format_attr_opus: Fix fmtp generation." into 13
George Joseph [Thu, 17 Nov 2016 04:41:00 +0000 (22:41 -0600)] 
Merge "res_format_attr_opus: Fix fmtp generation." into 13

8 years agobuild: Various OpenBSD issues 65/4465/1
George Joseph [Thu, 17 Nov 2016 02:24:08 +0000 (19:24 -0700)] 
build:  Various OpenBSD issues

OpenBSD's 'find' doesn't take the -delete argument so you have to pipe
through 'xargs rm -rf'.

'echo -e' doesn't like \t starting a line. It just prints 't' which
causes the libasteriskpj.exports file to be garbage.  They were just
cosmetic so they were removed.

librt doesn't exist so the link of libasteriskpj.so fails. It's not
actually needed for linux anyway so -lrt was removed from the link.

res_rtp_asterisk was failing to load because of an undefined
DTLS_method. '|| defined(LIBRESSL_VERSION_NUMBER)' was added to the #if
so DTLSv1_method is used instead.

ASTERISK-26608

Change-Id: I926ec95b0b69633231e3ad1d6e803b977272c49c

8 years agoMerge "channel: Fix issues in hangup scenarios caused by frame deferral" into 13
George Joseph [Wed, 16 Nov 2016 23:42:17 +0000 (17:42 -0600)] 
Merge "channel:  Fix issues in hangup scenarios caused by frame deferral" into 13

8 years agochannel: Fix issues in hangup scenarios caused by frame deferral 22/4422/4
George Joseph [Tue, 15 Nov 2016 00:45:01 +0000 (17:45 -0700)] 
channel:  Fix issues in hangup scenarios caused by frame deferral

ASTERISK-26343

Change-Id: I06dbf7366e26028251964143454a77d017bb61c8

8 years agoMerge "codec_opus: Fix warning when Opus negotiated but codec_opus not loaded." into 13
Joshua Colp [Wed, 16 Nov 2016 23:40:36 +0000 (17:40 -0600)] 
Merge "codec_opus: Fix warning when Opus negotiated but codec_opus not loaded." into 13

8 years agoMerge "res/ari/resource_bridges: Add the ability to manipulate the video source"...
zuul [Wed, 16 Nov 2016 22:48:14 +0000 (16:48 -0600)] 
Merge "res/ari/resource_bridges: Add the ability to manipulate the video source" into 13

8 years agores_format_attr_opus: Fix fmtp generation. 60/4460/1
Mark Michelson [Wed, 16 Nov 2016 21:42:39 +0000 (15:42 -0600)] 
res_format_attr_opus: Fix fmtp generation.

res_format_attr_opus assumed that the string being passed into it was
empty. It tried to determine if the only thing it had written was

a=fmtp:<num>

And if it had, it would reset the string. Its calculation was off when
working with chan_sip, though. chan_sip passes the entire built SDP
rather than an empty string. This resulted in always putting an empty
fmtp line in the SDP.

ASTERISK-26520 #close
Reported by scgm11

Change-Id: Ib2e8712d26a47067e5f36d5973577added01dbb5

8 years agoMerge "Revert "Revert "channel: Use frame deferral API for safe sleep.""" into 13
Joshua Colp [Wed, 16 Nov 2016 21:39:00 +0000 (15:39 -0600)] 
Merge "Revert "Revert "channel: Use frame deferral API for safe sleep.""" into 13

8 years agoMerge "Revert "Revert "autoservice: Use frame deferral API""" into 13
Joshua Colp [Wed, 16 Nov 2016 21:38:55 +0000 (15:38 -0600)] 
Merge "Revert "Revert "autoservice: Use frame deferral API""" into 13

8 years agoMerge "Revert "Revert "AGI: Only defer frames when in an interception routine.""...
zuul [Wed, 16 Nov 2016 21:06:25 +0000 (15:06 -0600)] 
Merge "Revert "Revert "AGI: Only defer frames when in an interception routine.""" into 13

8 years agoMerge "Revert "Revert "Add API for channel frame deferral.""" into 13
zuul [Wed, 16 Nov 2016 21:06:24 +0000 (15:06 -0600)] 
Merge "Revert "Revert "Add API for channel frame deferral.""" into 13

8 years agoMerge "apps/app_echo: Only relay a single video source change frame" into 13
zuul [Wed, 16 Nov 2016 21:06:23 +0000 (15:06 -0600)] 
Merge "apps/app_echo: Only relay a single video source change frame" into 13

8 years agocodec_opus: Fix warning when Opus negotiated but codec_opus not loaded. 54/4454/2
Richard Mudgett [Tue, 15 Nov 2016 22:23:35 +0000 (16:23 -0600)] 
codec_opus: Fix warning when Opus negotiated but codec_opus not loaded.

When Opus is negotiated but not loaded, the log is spammed with messages
because the system does not know how to calculate the number of samples in
a frame.

* Suppress the warning by supplying a function that assumes 20ms of
samples in the frame.  For pass through support it doesn't really seem to
matter what number of samples is returned anyway.

ASTERISK-26605 #close

Change-Id: Icf2273692f040dc2c45b01e72a790d11092f9e0f

8 years agoMerge "Add X.509 subject alternative name support to TLS certificate verification...
Joshua Colp [Wed, 16 Nov 2016 19:14:42 +0000 (13:14 -0600)] 
Merge "Add X.509 subject alternative name support to TLS certificate verification." into 13

8 years agoMerge "cli: Fix ast_el_read_char to work with libedit >= 3.1" into 13
Joshua Colp [Wed, 16 Nov 2016 18:50:15 +0000 (12:50 -0600)] 
Merge "cli:  Fix ast_el_read_char to work with libedit >= 3.1" into 13

8 years agores_pjsip_outbound_authenticator_digest.c: Fix memory pool leak. 42/4442/2
Richard Mudgett [Mon, 14 Nov 2016 20:36:52 +0000 (14:36 -0600)] 
res_pjsip_outbound_authenticator_digest.c: Fix memory pool leak.

Responding to authentication challenges leaks PJSIP memory pools.

The leak was introduced with a pjproject 2.5.5 API change.
https://trac.pjsip.org/repos/ticket/1929 changed the API usage of
pjsip_auth_clt_init() to require the new API pjsip_auth_clt_deinit() to
clean up cached authentication allocations that get allocated with
pjsip_auth_clt_reinit_req().

ASTERISK-26516 #close

Change-Id: I4473141b8c3961d0dc91c382beb3876b3efb45c8

8 years agoMerge "file.c/__ast_file_read_dirs: Fix issues on filesystems without d_type" into 13
Joshua Colp [Wed, 16 Nov 2016 17:12:16 +0000 (11:12 -0600)] 
Merge "file.c/__ast_file_read_dirs:  Fix issues on filesystems without d_type" into 13

8 years agofile.c/__ast_file_read_dirs: Fix issues on filesystems without d_type 46/4446/4
George Joseph [Tue, 15 Nov 2016 18:01:04 +0000 (11:01 -0700)] 
file.c/__ast_file_read_dirs:  Fix issues on filesystems without d_type

One of the code paths in __ast_file_read_dirs will only get executed if
the OS doesn't support dirent->d_type OR if the filesystem the
particular file is on doesn't support it.  So, while standard Linux
systems support the field, some filesystems like XFS do not.  In this
case, we need to call stat() to determine whether the directory entry
is a file or directory so we append the filename to the supplied
directory path and call stat.  We forgot to truncate path back to just
the directory afterwards though so we were passing a complete file name
to the callback in the dir_name parameter instead of just the directory
name.

The logic has been re-written to only create a full_path if we need to
call stat() or if we need to descend into another directory.

Change-Id: I54e4228bd8355fad65200c6df3ec4c9c8a98dfba

8 years agoAdd X.509 subject alternative name support to TLS certificate 51/4451/1
Maciej Szmigiero [Thu, 14 May 2015 22:12:41 +0000 (00:12 +0200)] 
Add X.509 subject alternative name support to TLS certificate
verification.

This way one X.509 certificate can be used for hosts that
can be reached under multiple DNS names or for multiple hosts.

Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name>
ASTERISK-25063 #close

Change-Id: I13302c80490a0b44c43f1b45376c9bd7b15a538f

8 years agopjproject: Use a much higher limit for PJ_ICE_MAX_CHECKS 33/4433/1
Matt Jordan [Mon, 14 Nov 2016 21:57:08 +0000 (15:57 -0600)] 
pjproject: Use a much higher limit for PJ_ICE_MAX_CHECKS

The PJ_ICE_MAX_CHECKS constant is used by pjproject to determine how
many pairs of local/remote candidates will be made. If for some reason
we reach this upper bound, ICE will generally fail and no media will
flow between the browser and Asterisk.

This patch makes PJ_ICE_MAX_CHECKS set to the total possible number of
pairs of candidates we'd theoretically allow, which is
PJ_ICE_MAX_CAND^2. Prior to this patch, we simply multiplied
PJ_ICE_MAX_CAND by two; on systems with multiple interfaces (I blame
Docker), this is far too low to allow WebRTC calls to succeed.

Setting this to be PJ_ICE_MAX_CAND^2 allowed WebRTC calls to succeed
even when the system Asterisk was running on had quite a few virtual
interfaces.

Change-Id: Icd4f17de0ac9d3a83dddfc8bf1cb7616bc107d55

8 years agoapps/app_echo: Only relay a single video source change frame 32/4432/1
Matt Jordan [Mon, 14 Nov 2016 21:32:14 +0000 (15:32 -0600)] 
apps/app_echo: Only relay a single video source change frame

In 9785e8d0, app_echo was updated to relay video source updates to the
channel for the purposes of displaying video in WebRTC tests.
Unfortunately, this can cause a Kafkaesque nightmare if two or more
Local channels are in a bridge together where their ends are in
app_echo. When this situation occurs, a video update sent into app_echo
will cause the video update to be relayed to the other Local channels,
causing another round of video updates, etc. In not much time at all,
the channel length queues will be overwhelmed, channel alert pipes will
fail, and all hell will break loose as Asterisk merrily continues to
throw more video update requests onto the channels.

This patch updates app_echo to *only* relay a single video update. Once
a video update has been made, all further video updates are dropped.
This meets the intended purpose of the original patch: if we get a video
update and we're in app_echo, go ahead and ask the sender to update
themselves. However, once we've got that video stream sync'd up, don't
keep spamming the world.

Change-Id: I9210780b08d4c17ddb38599d1c64453adfc34f74

8 years agores/ari/resource_bridges: Add the ability to manipulate the video source 31/4431/1
Matt Jordan [Tue, 8 Nov 2016 16:11:41 +0000 (10:11 -0600)] 
res/ari/resource_bridges: Add the ability to manipulate the video source

In multi-party bridges, Asterisk currently supports two video modes:
 * Follow the talker, in which the speaker with the most energy is shown
   to all participants but the speaker, and the speaker sees the
   previous video source
 * Explicitly set video sources, in which all participants see a locked
   video source

Prior to this patch, ARI had no ability to manipulate the video source.
This isn't important for two-party bridges, in which Asterisk merely
relays the video between the participants. However, in a multi-party
bridge, it can be advantageous to allow an external application to
manipulate the video source.

This patch provides two new routes to accomplish this:
(1) setVideoSource: POST /bridges/{bridgeId}/videoSource/{channelId}
    Sets a video source to an explicit channel
(2) clearVideoSource: DELETE /bridges/{bridgeId}/videoSource
    Removes any explicit video source, and sets the video mode to talk
    detection

ASTERISK-26595 #close

Change-Id: I98e455d5bffc08ea5e8d6b84ccaf063c714e6621