]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
10 years agoFix compilations errors on 64-bit OpenBSD systems
Matthew Jordan [Sun, 22 Mar 2015 23:55:25 +0000 (23:55 +0000)] 
Fix compilations errors on 64-bit OpenBSD systems

In versiong 5.5, OpenBSD went to 64-bit time values. This requires a cast to
(long) when printing members of certain time structs.

Review: https://reviewboard.asterisk.org/r/4507

ASTERISK-24879 #close
Reported by: snuffy
Tested by: snuffy
patches:
  openbsd-time64.diff uploaded by snuffy (License 5024)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@433268 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoFix compilation issues for OpenBSD
Matthew Jordan [Sun, 22 Mar 2015 20:32:17 +0000 (20:32 +0000)] 
Fix compilation issues for OpenBSD

This patch addresses compilation issues for OpenBSD. Specifically, it
addresses:
 * It allows including <sys/vmmeter.h> in asterisk.c
 * Provides a needed (size_t) cast in xmldoc.c

In 13+, it also addresses a conditional inclusion in loader.c.

Review: https://reviewboard.asterisk.org/r/4506

ASTERISK-24880 #close
Reported by: snuffy
Tested by: snuffy
patches:
  misc-openbsd.diff uploaded by snuffy (License 5024)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@433245 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agofuncs/func_env: Fix regression caused in FILE read operation
Matthew Jordan [Thu, 19 Mar 2015 19:19:32 +0000 (19:19 +0000)] 
funcs/func_env: Fix regression caused in FILE read operation

When r432935 was merged, it did correctly fix a situation where a FILE read
operation on the middle of a file buffer would not read the requested length
in the parameters passed to the FILE function. Unfortunately, it would also
allow the FILE function to append more bytes than what was available in the
buffer if the length exceeded the end of the buffer length.

This patch takes the minimum of the remaining bytes in the buffer along with
the calculated length to append provided by the original patch, and uses
that as the length to append in the return result. This patch also updates
the unit tests with the scenarios that were originally pointed out in
ASTERISK-21765 that the original implementation treated incorrectly.

ASTERISK-21765

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@433173 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agologger: Apply default console logging when configuration cannot be loaded.
Corey Farrell [Thu, 19 Mar 2015 10:19:11 +0000 (10:19 +0000)] 
logger: Apply default console logging when configuration cannot be loaded.

When logger.conf is missing or invalid enable console logging and display
an error message.

ASTERISK-24817 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4497/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@433122 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agochan_sip: Fix dialog reference leaked to scheduler for reinvite_timeout.
Corey Farrell [Thu, 19 Mar 2015 09:39:28 +0000 (09:39 +0000)] 
chan_sip: Fix dialog reference leaked to scheduler for reinvite_timeout.

Release the scheduler reference to the dialog for reinvite timeout during
dialog_unlink_all.

ASTERISK-24876 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4491/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@433112 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoVarious: backport of bugfixes found via chaos
Scott Griepentrog [Tue, 17 Mar 2015 22:28:41 +0000 (22:28 +0000)] 
Various: backport of bugfixes found via chaos

Using DEBUG_CHAOS several instances of a null
pointer crash, and one uninitialized variable
were uncovered and fixed.  Also added details
on why Asterisk failed to initialize.

This is a backport of the fixes from Asterisk
13.

Review: https://reviewboard.asterisk.org/r/4468/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@433086 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoAudit ast_sockaddr_resolve() usage for memory leaks.
Richard Mudgett [Tue, 17 Mar 2015 21:43:32 +0000 (21:43 +0000)] 
Audit ast_sockaddr_resolve() usage for memory leaks.

Valgrind found some memory leaks associated with ast_sockaddr_resolve().
Most of the leaks had already been fixed by earlier memory leak hunt
patches.  This patch performs an audit of ast_sockaddr_resolve() and found
one more.

* Fix ast_sockaddr_resolve() memory leak in
apps/app_externalivr.c:app_exec().

* Made main/netsock2.c:ast_sockaddr_resolve() always set the addrs
parameter for safety so the pointer will never be uninitialized on return.
The same goes for res/res_pjsip_acl.c:extract_contact_addr().

Review: https://reviewboard.asterisk.org/r/4509/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@433056 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agomain/frame: Don't report empty disallow values as an error
Matthew Jordan [Sat, 14 Mar 2015 02:27:13 +0000 (02:27 +0000)] 
main/frame: Don't report empty disallow values as an error

In realtime, it is normal to have a database with both 'allow' and 'disallow'
columns in the schema. It is perfectly valid to have an 'allow' value of
'!all,g722,ulaw,alaw' and no 'disallow' value. Unlike in static conf files,
you can't *not* provide the disallow value. Thus, the empty disallow value
causes a spurious WARNING message, which is kind of annoying.

This patch makes it so that a 'disallow' value with no ... value ... is
ignored. Granted, you can still screw this up as well, as technically
specifying 'disallow=all,!ulaw' allows only ulaw, and then you would have no
'allow' value in your database. But really, why would you do that? WHY?

ASTERISK-16779 #close
Reported by: Atis Lezdins

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432970 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agofunc_curl: Don't hold exclusive lock when performing HTTP request.
Joshua Colp [Sat, 14 Mar 2015 01:59:31 +0000 (01:59 +0000)] 
func_curl: Don't hold exclusive lock when performing HTTP request.

This code originally kept a lock held when performing the HTTP
request to ensure that the options provided to curl remain valid.
This doesn't seem to be necessary these days and holding the lock
caused requests to happen sequentially instead of in parallel.

ASTERISK-18708 #close
Reported by: Dave Cabot

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432948 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agocore: Fix tab completion of "core set debug channel" CLI command.
Joshua Colp [Sat, 14 Mar 2015 01:36:18 +0000 (01:36 +0000)] 
core: Fix tab completion of "core set debug channel" CLI command.

The "core set debug channel" CLI command mistakenly had source filenames
added to its tab completion. This occurred because the CLI generator fell back
to the "core set debug" command which permits setting debug at a source
filename level.

ASTERISK-21038 #close
Reported by: Richard Kenner

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432944 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoFILE: fix retrieval of file contents when offset is specified
Matthew Jordan [Sat, 14 Mar 2015 01:21:00 +0000 (01:21 +0000)] 
FILE: fix retrieval of file contents when offset is specified

The loop that reads in a file was not correctly using the offset when
determining what bytes to append to the output. This patch corrects
the logic such that the correct portion of the file is extracted when an
offset is specified.

ASTERISK-21765
Reported by: John Zhong
Tested by: Matt Jordan, Di-Shi Sun
patches:
  file_read_390821.patch uploaded by Di-Shi Sun (License 5076)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432935 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoapps/app_amd: Document maximum_word_length option; fix AMDCAUSE documentation
Matthew Jordan [Sat, 14 Mar 2015 00:16:56 +0000 (00:16 +0000)] 
apps/app_amd: Document maximum_word_length option; fix AMDCAUSE documentation

This patch corrects the documentation for the AMD application. Specifically:
* It documents the maximum_word_length option, which limits the maximum allowed
  length of a single utterance.
* It clarifies the AMDCAUSE values MAXWORDS and MAXWORDLENGTH. MAXWORDLENGTH
  was documented as MAXWORDS, while MAXWORDS was undocumented.

Thanks to the issue reporter, Frank DiGennaro, for pointing out the issues.

ASTERISK-19470 #close
Reported by: Frank DiGennaro

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432918 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agomain/audiohook: Update internal sample rate on reads
Matthew Jordan [Thu, 12 Mar 2015 12:57:03 +0000 (12:57 +0000)] 
main/audiohook: Update internal sample rate on reads

When an audiohook is created (which is used by the various Spy applications
and Snoop channel in Asterisk 13+), it initially is given a sample rate of
8kHz. It is expected, however, that this rate may change based on the media
that passes through the audiohook. However, the read/write operations on the
audiohook behave very differently.

When a frame is written to the audiohook, the format of the frame is checked
against the internal sample rate. If the rate of the format does not match
the internal sample rate, the internal sample rate is updated and a new SLIN
format is chosen based on that sample rate. This works just fine.

When a frame is read, however, we do something quite different. If the format
rate matches the internal sample rate, all is fine. However, if the rates
don't match, the audiohook attempts to "fix up" the number of samples that
were requested. This can result in some seriously large number of samples
being requested from the read/write factories.

Consider the worst case - 192kHz SLIN. If we attempt to read 20ms worth of
audio produced at that rate, we'd request 3840 samples (192000 / (1000 / 20)).
However, if the audiohook is still expecting an internal sample rate of 8000,
we'll attempt to "fix up" the requested samples to:

  samples_converted = samples * (ast_format_get_sample_rate(format) /
                                 (float) audiohook->hook_internal_samp_rate);

  which is:

  92160 = 3840 * (192000 / 8000)

This results in us attempting to read 92160 samples from our factories, as
opposed to the 3840 that we actually wanted. On a 64-bit machine, this
miraculously survives - despite allocating up to two buffers of length 92160
on the stack. The 32-bit machines aren't quite so lucky. Even in the case where
this works, we will either (a) get way more samples than we wanted; or (b) get
about 3840 samples, assuming the timing is pretty good on the machine.

Either way, the calculation being performed is wrong, based on the API users
expectations.

My first inclination was to allocate the buffers on the heap. As it is,
however, there's at least two drawbacks with doing this:
(1) It's a bit complicated, as the size of the buffers may change during the
    lifetime of the audiohook (ew).
(2) The stack is faster (yay); the heap is slower (boo).

Since our calculation is flat out wrong in the first place, this patch fixes
this issue by instead updating the internal sample rate based on the format
passed into the read operation. This causes us to read the correct number of
samples, and has the added benefit of setting the audihook with the right
SLIN format.

Note that this issue was caught by the Asterisk Test Suite as a result of
r432195 in the 13 branch. Because this issue is also theoretically possible
in Asterisk 11, the change is being made here as well.

Review: https://reviewboard.asterisk.org/r/4475/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432810 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoAdd support for the clang compiler; update RAII_VAR to use BlocksRuntime
Matthew Jordan [Thu, 12 Mar 2015 12:26:57 +0000 (12:26 +0000)] 
Add support for the clang compiler; update RAII_VAR to use BlocksRuntime

RAII_VAR, which is used extensively in Asterisk to manage reference counted
resources, uses a GCC extension to automatically invoke a cleanup function
when a variable loses scope. While this functionality is incredibly useful
and has prevented a large number of memory leaks, it also prevents Asterisk
from being compiled with clang.

This patch updates the RAII_VAR macro such that it can be compiled with clang.
It makes use of the BlocksRuntime, which allows for a closure to be created
that performs the actual cleanup.

Note that this does not attempt to address the numerous warnings that the clang
compiler catches in Asterisk.

Much thanks for this patch goes to:
* The folks on StackOverflow who asked this question and Leushenko for
  providing the answer that formed the basis of this code:
  http://stackoverflow.com/questions/24959440/rewrite-gcc-cleanup-macro-with-nested-function-for-clang
* Diederik de Groot, who has been extremely patient in working on getting this
  patch into Asterisk.

Review: https://reviewboard.asterisk.org/r/4370/

ASTERISK-24133
ASTERISK-23666
ASTERISK-20399
ASTERISK-20850 #close
Reported by: Diederik de Groot
patches:
  RAII_CLANG.patch uploaded by Diederik de Groot (License 6600)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432807 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agores/res_config_odbc: Fix improper escaping of backslashes with MySQL
Matthew Jordan [Tue, 10 Mar 2015 21:32:25 +0000 (21:32 +0000)] 
res/res_config_odbc: Fix improper escaping of backslashes with MySQL

When escaping backslashes with MySQL, the proper way to escape the characters
in a LIKE clause is to escape the '\' four times, i.e., '\\\\'. To quote the
MySQL manual:

"Because MySQL uses C escape syntax in strings (for example, “\n” to represent
a newline character), you must double any “\” that you use in LIKE strings.
For example, to search for “\n”, specify it as “\\n”. To search for “\”,
specify it as “\\\\”; this is because the backslashes are stripped once by the
parser and again when the pattern match is made, leaving a single backslash to
be matched against."

ASTERISK-24808 #close
Reported by: Javier Acosta
patches:
  res_config_odbc.diff uploaded by Javier Acosta (License 6690)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432720 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoapp_voicemail: Fix crash with IMAP backends when greetings aren't present
Matthew Jordan [Tue, 10 Mar 2015 18:11:26 +0000 (18:11 +0000)] 
app_voicemail: Fix crash with IMAP backends when greetings aren't present

When an IMAP backend is in use and greetings are set to be used, but aren't
present for a user in their IMAP folder, Asterisk will crash. This occurs
due to the mailstream being set to the 'greetings' folder and being left
in that particular state, regardless of the success/failure of the attempt
to access the folder the mailstream points to. Later access of the mailstream
assumes that it points to the 'INBOX' (or some other folder), resulting in
either a crash (if the greetings folder didn't exist and the mailstream is
invalid) or an inability to read messages from the 'INBOX' folder.

This patch restores the mailstream to its correct state after accessing the
greetings. This fixes the crash, and sets the mailstream to the state that
VoiceMailMain expects.

Note that while ASTERISK-23390 also contained a patch for this issue, the
patch on ASTERISK-24786 is the one being merged here.

Review: https://reviewboard.asterisk.org/r/4459/

ASTERISK-23390 #close
Reported by: Ben Smithurst

ASTERISK-24786 #close
Reported by: Graham Barnett
Tested by: Graham Barnett
patches:
  app_voicemail.c.patch.SIGSEGV3rev2 uploaded by Graham Barnett (License 6685)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432695 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agolocaltime: Fix file descriptor leak on kqueue(2) systems
Matthew Jordan [Tue, 10 Mar 2015 17:42:57 +0000 (17:42 +0000)] 
localtime: Fix file descriptor leak on kqueue(2) systems

The localtime management in the Asterisk core contains a thread that watches
for changes in the local timezone. On systems where the directory containing
/etc/localtime is modified frequently, the thread monitoring the changes will
be woken up to determine if any changes in timezone have occurred. When using
kqueue(2), this can cause a leak of file descriptors due to some improper
management of resources.

This patch updates the kqueue(2) handling in localtime, such that is no longer
leaks resources.

Review: https://reviewboard.asterisk.org/r/4450/

ASTERISK-24739 #close
Reported by: Ed Hynan
patches:
  11.15.0-u.diff uploaded by Ed Hynan (Licnese 6680)
  11.7.0-u.diff uploaded by Ed Hynan (License 6680)
  svn-trunk-Jan-26-2015-u.diff uploaded by Ed Hynan (License 6680)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432691 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agochan_dahdi/sig_analog: Fix distinctive ring detection to suck less.
Richard Mudgett [Fri, 6 Mar 2015 19:52:04 +0000 (19:52 +0000)] 
chan_dahdi/sig_analog: Fix distinctive ring detection to suck less.

The distinctive ring feature interferes with detecting Caller ID and
appears to have been broken for years.  What happens is if you have a
ring-ring cadence as used in the UK you get too many DAHDI events for the
distinctive ring pattern array and Caller ID detection is aborted.  I
think when Zapata/DAHDI added the ring begin event it broke distinctive
ring.  More events happen than before and the code does no filtering of
which event times are recorded in the pattern array.

* Made distinctive ring only record the ringt count when the ring ends
instead of on just any DAHDI event.  Distinctive ring can be ring,
ring-ring, ring-ring-ring, or different ring durations for the up to three
rings.

* Fixed the distinctive ring detection enable (chan_dahdi.conf option
usedistinctiveringdetection) to be per port instead of somewhat per port
and somewhat global.  This has been broken since v1.8.

* Fixed using the default distinctive ring context when the detected
pattern does not match any configured dringX patterns.  The default
context did not get set when the previous call was a matched distinctive
ring pattern and the current call is not matched.  This has been broken
since v1.8.

* Made distinctive ring have no effect on Caller ID detection when it is
disabled.  Caller ID detection just monitors for 10 seconds before giving
up.

* Fixed leak of struct callerid_state memory when a polarity reversal
during Caller ID detection causes the incoming call to be aborted.

DAHDI-1143
AST-1545
ASTERISK-24825 #close
Reported by: Richard Mudgett

ASTERISK-17588
Reported by: Daniel Flounders

Review: https://reviewboard.asterisk.org/r/4444/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432530 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agochan_sip: Fix realtime locking inversion when poking a just built peer.
Richard Mudgett [Fri, 6 Mar 2015 19:17:45 +0000 (19:17 +0000)] 
chan_sip: Fix realtime locking inversion when poking a just built peer.

When a realtime peer is built it can cause a locking inversion when the
just built peer is poked.  If the CLI command "sip show channels" is
periodically executed then a deadlock can happen because of the locking
inversion.

* Push the peer poke off onto the scheduler thread to avoid the locking
inversion of the just built realtime peer.

AST-1540
ASTERISK-24838 #close
Reported by: Richard Mudgett

Review: https://reviewboard.asterisk.org/r/4454/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432526 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoapp_voicemail: Fix compile breaking in app_voicemail with IMAP_STORAGE.
George Joseph [Thu, 5 Mar 2015 16:35:22 +0000 (16:35 +0000)] 
app_voicemail: Fix compile breaking in app_voicemail with IMAP_STORAGE.

There is a leftover "assert" in app_voicemail/__messagecount that references
variables that don't exist.  This causes the compile to fail when
--enable-dev-mode and IMAP_STORAGE are selected.

This patch removes the assert.

Tested-by: George Joseph
Review: https://reviewboard.asterisk.org/r/4461/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432484 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoapp_chanspy, channel: fix frame leaks
Kevin Harwell [Thu, 26 Feb 2015 17:06:01 +0000 (17:06 +0000)] 
app_chanspy, channel: fix frame leaks

Fixed a couple of frame leaks that were found during testing.

ASTERISK-24828 #close
Reported by: John Hardin
Review: https://reviewboard.asterisk.org/r/4445/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432362 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agomake: Remove 'res_features' from libraries to link against with cygwin/mingw32
Matthew Jordan [Thu, 26 Feb 2015 04:56:28 +0000 (04:56 +0000)] 
make: Remove 'res_features' from libraries to link against with cygwin/mingw32

Both the apps and channels Makefiles still listed 'res_features' as modules to
link against when compiling for cygwin or mingw32. This module hasn't existed
for quite some time.

ASTERISK-18105 #close
Reported by: feyfre

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432341 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agochannels/chan_sip: Don't send a BYE after final response when PBX thread fails
Matthew Jordan [Thu, 26 Feb 2015 03:02:24 +0000 (03:02 +0000)] 
channels/chan_sip: Don't send a BYE after final response when PBX thread fails

When Asterisk fails to start a PBX thread for a new channel - for example, when
the maxcalls setting in asterisk.conf is exceeded - we currently send a final
response, and then attempt to send a BYE request to the UA. Since that's all
sorts of wrong, this patch fixes that by setting sipalreadygone on the sip_pvt
such that we don't get stuck sending BYE requests to something that does not
want it.

Note that this patch is a slight modification of the one on ASTERISK-15434.
For clarity, it explicitly calls sipalreadygone with the calls to transmit a
final response.

ASTERISK-21845
ASTERISK-15434 #close
Reported by: Makoto Dei
Tested by: Matt Jordan
patches:
  sip-pbxstart-failed.patch uploaded by Makoto Dei (License 5027)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432320 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoconfigure: Promote SQLite3 "not installed" warning to error
Matthew Jordan [Wed, 25 Feb 2015 23:08:43 +0000 (23:08 +0000)] 
configure: Promote SQLite3 "not installed" warning to error

Since Asterisk won't build without the library, not having it is definitely
an error. Thanks to Kyle Kurz for pointing this out.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432280 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agochannels/chan_sip: Clarify WARNING message in mismatched SRTP scenario
Matthew Jordan [Wed, 25 Feb 2015 23:02:17 +0000 (23:02 +0000)] 
channels/chan_sip: Clarify WARNING message in mismatched SRTP scenario

When we receive an SDP as part of an offer/answer for a peer/friend has been
configured to require encryption, and that SDP offer/answer failed to provide
acceptable crypto attributes, we currently issue a WARNING that uses the phrase
"we" and "requested". In this case, both of those terms are ambiguous - the
user will probably think "we" is Asterisk (it most likely isn't) and it may
not be a "request", so much as an SDP that was received in some fashion.

This patch makes the WARNING messages slightly less bad and a bit more
accurate as well.

ASTERISK-23214 #close
Reported by: Rusty Newton

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432277 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agochannels/sip/sdp_crypto: Handle SRTP keys negotiated with key lifetime/MKI
Matthew Jordan [Wed, 25 Feb 2015 21:13:39 +0000 (21:13 +0000)] 
channels/sip/sdp_crypto: Handle SRTP keys negotiated with key lifetime/MKI

Prior to this patch, SDP offers negotiating SDES-SRTP crypto attributes would
be rejected if those crypto attributes contained either a key lifetime or a
MKI parameter. While from a theoretical point of view this was defensible -
Asterisk does not support key lifetimes or multiple crypto keys - from a
practical point of view, this is quite a problem. A large number of endpoints
offer lifetimes/MKI, which Asterisk can tolerate so long as it doesn't actually
have to support anything more than a single key or refresh the key.
In reality, this is (so far as we've seen) always the case.

This patch is a forward port of Olle's work in the lingon-srtp-key-lifetime-1.8
branch. To quote Olle from ASTERISK-17721, it handles lifetime/MKI parameters
in the following fashion:

> The Lingon branch now handle lifetime and MKI parameters.
>
> We only accept lifetimes up to max for the crypto and higher than 10 hours
> for packetization of 20 ms (50 pps).
>
> We only handle MKI with index 1.
>
> We do not really bother with counting packets and reinviting at end of
> lifetime, so the min of 10 hours kind of takes care of most calls. If there
> are longer ones, we rely on the other side for re-invites.
>
> It's still not perfect, but I personally think this is an improvement. A
> configuration option for minimum lifetime accepted could be added.

When the patch was ported forward, I decided against adding a configuration
option as Olle's handling was more than sufficient for every case I've seen
come through the issue tracker or through interoperability testing. We can
revisit that decision if it proves to be false.

A few small other tweaks were made to the surrounding code to reduce
indentation and provide better type safety for the 'tag' parameter.

Review: https://reviewboard.asterisk.org/r/4419/
Review: https://reviewboard.asterisk.org/r/4418/

ASTERISK-17721 #close
Reported by: Terry Wilson

ASTERISK-17899 #close
Reported by: Dwayne Hubbard
patches:
  lingon-srtp-key-lifetime-1.8.diff uploaded by oej (License 5267)

ASTERISK-20233
Reported by: tootai

ASTERISK-22748
Reported by: Alejandro Mejia

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432239 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoIncrease WebSocket frame size and improve large read handling
David M. Lee [Wed, 25 Feb 2015 20:43:16 +0000 (20:43 +0000)] 
Increase WebSocket frame size and improve large read handling

Some WebSocket applications, like [chan_respoke][], require a larger
frame size than the default 8k; this patch bumps the default to 16k.
This patch also fixes some problems exacerbated by large frames.

The sanity counter was decremented on every fread attempt in
ws_safe_read(), regardless of whether data was read from the socket or
not. For large frames, this could result in loss of sanity prior to
reading the entire frame. (16k frame / 1448 bytes per segment = 12
segments).

This patch changes the sanity counter so that it only decrements when
fread() doesn't read any bytes. This more closely matches the original
intention of ws_safe_read(), given that the error message is
"Websocket seems unresponsive".

This patch also properly logs EOF conditions, so disconnects are no
longer confused with unresponsive connections.

 [chan_respoke]: https://github.com/respoke/chan_respoke

Review: https://reviewboard.asterisk.org/r/4431/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432236 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agochannels/chan_sip: Fix crash when transmitting packet after thread shutdown
Matthew Jordan [Tue, 24 Feb 2015 22:14:02 +0000 (22:14 +0000)] 
channels/chan_sip: Fix crash when transmitting packet after thread shutdown

When the monitor thread is stopped, its pthread ID is set to a specific value
(AST_PTHREADT_STOP) so that later portions of the code can determine whether
or not it is safe to manipulate the thread. Unfortunately, __sip_reliable_xmit
failed to check for that value, checking instead only for AST_PTHREAD_STOP.
Passing the invalid yet very specific value to pthread_kill causes a crash.

This patch adds a check for AST_PTHREADT_STOP in __sip_reliable_xmit such that
it doesn't attempt to poke the thread if the thread has already been stopped.

ASTERISK-24800 #close
Reported by: JoshE

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432198 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agobridge_softmix: G.729 codec license held
Kevin Harwell [Tue, 24 Feb 2015 18:22:58 +0000 (18:22 +0000)] 
bridge_softmix: G.729 codec license held

When more than one call using the same codec type enters into a softmix bridge
and no audio is present for a channel the bridge optimizes the out frame by
using the same one for all channels with the same codec type. Unfortunately,
when that number (channels with same codec type) dropped to <= 1 the codec
was not dereferenced. At least not until all parties left the bridge. Thus in
the case of G.729 the license was not released. This patch ensures that the
codec is dereferenced immediately when the optimization no longer applies.

ASTERISK-24797 #close
Reported by: Luke Hulsey
Review: https://reviewboard.asterisk.org/r/4429/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432174 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoapps/app_voicemail: Demote an ERROR message to a WARNING message
Matthew Jordan [Sat, 21 Feb 2015 17:34:52 +0000 (17:34 +0000)] 
apps/app_voicemail: Demote an ERROR message to a WARNING message

When using IMAP voicemail with FreePBX, you will often get ERROR messages
complaining about not being able to find a mailbox. This is due to how FreePBX
handles voicemail mailboxes. Unfortunately, app_voicemail has to consider this
a configuration error, as in any other system it would be indicative of
someone misconfiguring their system.

Regardless, a misconfiguration is a WARNING, and not an ERROR. This patch
demotes the message so that system administrators can hopefully reduce some
of the noise in their log files.

Note that in the original patch this was made into a NOTICE, but that's a
too forgiving.

ASTERISK-24790 #close
Reported by: Graham Barnett
patches:
  app_voicemail.c.patch_noise uploaded by Graham Barnett (License 6685)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432098 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agohttp: Add missing html tag to 'httpstatus' functionality.
Joshua Colp [Sat, 21 Feb 2015 14:04:54 +0000 (14:04 +0000)] 
http: Add missing html tag to 'httpstatus' functionality.

ASTERISK-24724 #close
Reported by: Ashley Sanders

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432078 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoAllow shutdown to unload modules that register bucket scheme's or codec's.
Corey Farrell [Sat, 21 Feb 2015 02:55:26 +0000 (02:55 +0000)] 
Allow shutdown to unload modules that register bucket scheme's or codec's.

* Change __ast_module_shutdown_ref to be NULL safe (11+).
* Allow modules that call ast_bucket_scheme_register or ast_codec_register
  to be unloaded during graceful shutdown only (13+ only).

ASTERISK-24796 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4428/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432058 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoasterisk/lock.h: Fix syntax errors for non-gcc OSX with 64-bit integers.
Corey Farrell [Sat, 21 Feb 2015 02:45:17 +0000 (02:45 +0000)] 
asterisk/lock.h: Fix syntax errors for non-gcc OSX with 64-bit integers.

Add a couple of missing closing brackets / parenthesis.

ASTERISK-24814 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4436/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432054 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agochan_dahdi/sig_analog: Put log message strings on one line.
Richard Mudgett [Fri, 20 Feb 2015 17:43:52 +0000 (17:43 +0000)] 
chan_dahdi/sig_analog: Put log message strings on one line.

With the log messages on one line, you can search for the log message seen
in the log and expect to find it.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432032 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoapps/app_voicemail: Fix IMAP header compatibility issue with Microsoft Exchange
Matthew Jordan [Fri, 20 Feb 2015 15:45:35 +0000 (15:45 +0000)] 
apps/app_voicemail: Fix IMAP header compatibility issue with Microsoft Exchange

When interfacing with Microsoft Exchange, custom headers will be returned as
all lower case. Currently, the IMAP header code will fail to parse the returned
custom headers, as it will be performing a case sensitive comparison. This can
cause playback of messages to fail, as needed information - such as origtime -
will not be present.

This patch updates app_voicemail's header parsing code to perform a case
insensitive lookup for the requested custom headers. Since the headers are
specific to Asterisk, e.g., 'x-asterisk-vm-orig-time', and headers should be
unique in an IMAP message, this should cause no issues with other systems.

ASTERISK-24787 #close
Reported by: Graham Barnett
patches:
  app_voicemail.c.patch_MSExchange uploaded by Graham Barnett (License 6685)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432012 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agochan_dahdi: Remove some dead code.
Richard Mudgett [Thu, 19 Feb 2015 21:23:58 +0000 (21:23 +0000)] 
chan_dahdi: Remove some dead code.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431992 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agotcptls: Handle new OpenSSL compile time option to disable SSLv3
Matthew Jordan [Thu, 19 Feb 2015 15:21:06 +0000 (15:21 +0000)] 
tcptls: Handle new OpenSSL compile time option to disable SSLv3

Some distributions are going to disable SSLv3 at compile time. This option can
be checked using the directive OPENSSL_NO_SSL3_METHOD. This patch updates the
TCP/TLS handling in Asterisk to look for that directive before attempting to
use the SSLv3 specific methods.

ASTERISK-24799 #close
Reported by: Alexander Traud
patches:
  no-ssl3-method.patch uploaded by Alexander Traud (License 6520)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431936 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoCreate work around for scheduler leaks during shutdown.
Corey Farrell [Thu, 19 Feb 2015 01:59:05 +0000 (01:59 +0000)] 
Create work around for scheduler leaks during shutdown.

* Added ast_sched_clean_by_callback for cleanup of scheduled events
  that have not yet fired.
* Run all pending peercnt_remove_cb and replace_callno events in chan_iax2.
  Cleanup of replace_callno events is only run 11, since it no longer
  releases any references or allocations in 13+.

ASTERISK-24451 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4425/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431916 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoapps/app_mixmonitor: Move Test Event for MIXMONITOR_END to after it finishes
Matthew Jordan [Sun, 15 Feb 2015 00:31:55 +0000 (00:31 +0000)] 
apps/app_mixmonitor: Move Test Event for MIXMONITOR_END to after it finishes

The Test Event for MIXMONITOR_END - which signals that a MixMonitor has
completed - technically fired before the filestream was closed. If a test
used this to trigger a condition to verify that the file was written, it
could result in a race condition where the file size would not be what the
test expected.

Luckily, no tests were using this (although they should have been). Since the
test event needed to be moved after the point where the MixMonitor autochan has
been destroyed, the test event no longer emits the channel name. Luckily,
nothing needs it.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431788 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agochannels/chan_sip: Fix RealTime error during SIP unregistration with MariaDB
Matthew Jordan [Wed, 11 Feb 2015 17:11:41 +0000 (17:11 +0000)] 
channels/chan_sip: Fix RealTime error during SIP unregistration with MariaDB

When a SIP device that has its registration stored in RealTime unregisters,
the entry for that device is updated with blank values, i.e., "", indicating
that it is no longer registered. Unfortunately, one of those values that is
'blanked' is the device's port. If the column type for the port is not a
string datatype (the recommended type is integer), an ODBC or database error
will be thrown. MariaDB does not coerce empty strings to a valid integer value.

This patch updates the query run from chan_sip such that it replaces the port
value with a value of '0', as opposed to a blank value. This is the value that
other database backends coerce the empty string ("") to already, and the
handling of reading a RealTime registration value from a backend already
anticipates receiving a port of '0' from the backends.

ASTERISK-24772 #close
Reported by: Richard Miller
patches:
  chan_sip.diff uploaded by Richard Miller (License 5685)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431673 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agores_http_websocket: websocket write timeout fails to fully disconnect
Kevin Harwell [Wed, 11 Feb 2015 16:46:12 +0000 (16:46 +0000)] 
res_http_websocket: websocket write timeout fails to fully disconnect

When writing to a websocket if a timeout occurred the underlying socket did not
get closed/disconnected. This patch makes sure the websocket gets disconnected
on a write timeout.

ASTERISK-24701 #close
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/4412/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431669 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoEnable REF_DEBUG for ast_module_ref / ast_module_unref.
Corey Farrell [Wed, 11 Feb 2015 15:38:39 +0000 (15:38 +0000)] 
Enable REF_DEBUG for ast_module_ref / ast_module_unref.

Add ast_module_shutdown_ref for use by modules that can
only be unloaded during graceful shutdown.

When REF_DEBUG is enabled:
* Add an empty ao2 object to struct ast_module.
* Allocate ao2 object when the module is loaded.
* Perform an ao2_ref in each place where mod->usecount is manipulated.
* ao2_cleanup on module unload.

ASTERISK-24479 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4141/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431662 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agochannels/chan_sip: Ensure that a BYE is sent during INVITE w/Replaces transfer
Matthew Jordan [Mon, 9 Feb 2015 02:44:24 +0000 (02:44 +0000)] 
channels/chan_sip: Ensure that a BYE is sent during INVITE w/Replaces transfer

Consider a scenario where Alice and Bob have an established dialog with each
other external to Asterisk. Bob decides to perform an attended transfer of
Alice to Asterisk. In this case, Alice will send an INVITE with Replaces
to Asterisk, where the Replaces specifies Bob's dialog with Asterisk. In this
particular scenario, Asterisk will complete the transfer, but - since Bob's
channel has had Alice masqueraded into it and is now a Zombie - a BYE
request will not be sent.

This patch fixes that issue by adding a new flag to chan_sip that tracks
whether or not we have an INVITE with Replaces. If we do, the flag is used
on the sip_pvt to ensure that a BYE request is sent, even if the channel has
been masqueraded away.

Review: https://reviewboard.asterisk.org/r/4362/

ASTERISK-22436 #close
Reported by: Eelco Brolman
Tested by: Jeremiah Gowdy, Kristian Høgh
patches:
  asterisk-11-hangup-replaced-3.diff uploaded by Jeremiah Gowdy (License 6358)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431620 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agores/res_odbc: Remove unneeded queries when determining if a table exists
Matthew Jordan [Mon, 9 Feb 2015 02:34:17 +0000 (02:34 +0000)] 
res/res_odbc: Remove unneeded queries when determining if a table exists

This patch modifies the ast_odbc_find_table function such that it only performs
a lookup of the requested table if the table is not already known. Prior to
this patch, a queries would be executed against the database even if the table
was already known and cached.

Review: https://reviewboard.asterisk.org/r/4405/

ASTERISK-24742 #close
Reported by: ibercom
patches:
  patch.diff uploaded by ibercom (License 6599)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431617 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoconfig hooks: correct ref leaks
Scott Griepentrog [Fri, 6 Feb 2015 21:26:10 +0000 (21:26 +0000)] 
config hooks: correct ref leaks

This small patch fixes a ref leak when
adding a config hook and cleans up the
container on shutdown.

Review: https://reviewboard.asterisk.org/r/4407

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431582 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoBackport memory leak fix in pbx.c from branch 13 revision 431468
Mark Michelson [Fri, 30 Jan 2015 16:55:39 +0000 (16:55 +0000)] 
Backport memory leak fix in pbx.c from branch 13 revision 431468

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431472 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoUse SIPS URIs in Contact headers when appropriate.
Mark Michelson [Thu, 29 Jan 2015 20:40:04 +0000 (20:40 +0000)] 
Use SIPS URIs in Contact headers when appropriate.

RFC 3261 sections 8.1.1.8 and 12.1.1 dictate specific
scenarios when we are required to use SIPS URIs in Contact
headers. Asterisk's non-compliance with this could actually
cause calls to get dropped when communicating with clients
that are strict about checking the Contact header.

Both of the SIP stacks in Asterisk suffered from this issue.
This changeset corrects the behavior in chan_sip.

ASTERISK-24646 #close
Reported by Stephan Eisvogel

Review: https://reviewboard.asterisk.org/r/4346

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431423 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agores_rtp_asterisk: Fix DTLS when used with OpenSSL 1.0.1k
Joshua Colp [Thu, 29 Jan 2015 12:08:39 +0000 (12:08 +0000)] 
res_rtp_asterisk: Fix DTLS when used with OpenSSL 1.0.1k

A recent security fix for OpenSSL broke DTLS negotiation for many
applications. This was caused by read ahead not being enabled when it
should be. While a commit has gone into OpenSSL to force read ahead
on for DTLS it may take some time for a release to be made and the
change to be present in distributions (if at all). As enabling read
ahead is a simple one line change this commit does that and fixes
the issue.

ASTERISK-24711 #close
Reported by: Jared Biel

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431384 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoFix compilation error from previous patch.
Mark Michelson [Wed, 28 Jan 2015 17:12:49 +0000 (17:12 +0000)] 
Fix compilation error from previous patch.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431298 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoMitigate possible HTTP injection attacks using CURL() function in Asterisk.
Mark Michelson [Wed, 28 Jan 2015 17:05:26 +0000 (17:05 +0000)] 
Mitigate possible HTTP injection attacks using CURL() function in Asterisk.

CVE-2014-8150 disclosed a vulnerability in libcURL where HTTP request injection
can be performed given properly-crafted URLs.

Since Asterisk makes use of libcURL, and it is possible that users of Asterisk may
get cURL URLs from user input or remote sources, we have made a patch to Asterisk
to prevent such HTTP injection attacks from originating from Asterisk.

ASTERISK-24676 #close
Reported by Matt Jordan

Review: https://reviewboard.asterisk.org/r/4364

AST-2015-002

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431297 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agotcptls: Bad file descriptor error when reloading chan_sip
Kevin Harwell [Tue, 27 Jan 2015 22:53:57 +0000 (22:53 +0000)] 
tcptls: Bad file descriptor error when reloading chan_sip

While running through some scenarios using chan_sip and tcp a problem would
occur that resulted in a flood of bad file descriptor messages on the cli:

tcptls.c:712 ast_tcptls_server_root: Accept failed: Bad file descriptor

The message is received because the underlying socket has been closed, so is
valid. This is probably happening because unloading of chan_sip is not atomic.
That however is outside the scope of this patch. This patch simply stops the
logging of multiple occurrences of that message.

ASTERISK-24728 #close
Reported by: Thomas Thompson
Review: https://reviewboard.asterisk.org/r/4380/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431218 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agochan_sip: stale nonce causes failure
Kevin Harwell [Tue, 27 Jan 2015 19:19:25 +0000 (19:19 +0000)] 
chan_sip: stale nonce causes failure

When refreshing (with a small expiration) a registration that was sent to
chan_sip the nonce would be considered stale and reject the registration.
What was happening was that the initial registration's "dialog" still existed
in the dialogs container and upon refresh the dialog match algorithm would
choose that as the "dialog" instead of the newly created one. This occurred
because the algorithm did not check to see if the from tag matched if
authentication info was available after the 401. So, it ended up assuming
the original "dialog" was a match and stopped the search. The old "dialog"
of course had an old nonce, thus the stale nonce message.

This fix attempts to leave the original functionality alone except in the case
of a REGISTER. If a REGISTER is received if searches for an existing "dialog"
matching only on the callid. If the expires value is low enough it will reuse
dialog that is there, otherwise it will create a new one.

ASTERISK-24715 #close
Reported by: John Bigelow
Review: https://reviewboard.asterisk.org/r/4367/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431187 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoapp_confbridge: Repeatedly starting and stopping recording ref leaks the recording...
Richard Mudgett [Tue, 27 Jan 2015 17:11:59 +0000 (17:11 +0000)] 
app_confbridge: Repeatedly starting and stopping recording ref leaks the recording channel.

Starting and stopping conference recording more than once causes the
recording channels to be leaked.  For v13 the channels also show up in the
CLI "core show channels" output.

* Reworked and simplified the recording channel code to use
ast_bridge_impart() instead of managing the recording thread in the
ConfBridge code.  The recording channel's ref handling easily falls into
place and other off nominal code paths get handled better as a result.

ASTERISK-24719 #close
Reported by: John Bigelow

Review: https://reviewboard.asterisk.org/r/4368/
Review: https://reviewboard.asterisk.org/r/4369/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431135 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoapp_confbridge: Whitespace
Richard Mudgett [Fri, 23 Jan 2015 19:34:55 +0000 (19:34 +0000)] 
app_confbridge: Whitespace

Because there is sometimes no sence to any whitespace.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431049 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoTypo's (missed a spot in r430996).
Walter Doekes [Fri, 23 Jan 2015 14:55:47 +0000 (14:55 +0000)] 
Typo's (missed a spot in r430996).

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@430997 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoFix typo's (retrieve, specified, address).
Walter Doekes [Fri, 23 Jan 2015 14:51:03 +0000 (14:51 +0000)] 
Fix typo's (retrieve, specified, address).

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@430996 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agochan_sip: Case insensitive comparison of "defaultuser" parameter.
Walter Doekes [Fri, 23 Jan 2015 14:34:39 +0000 (14:34 +0000)] 
chan_sip: Case insensitive comparison of "defaultuser" parameter.

All the other configuration options are case insensitive, so this one
should be too.

ASTERISK-24355 #close
Reported by: HZMI8gkCvPpom0tM
patches:
  ast.patch uploaded by HZMI8gkCvPpom0tM (License 6658)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@430993 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoapps/app_voicemail: Trigger MWI notification with MixMonitor m() option
Matthew Jordan [Thu, 22 Jan 2015 14:22:02 +0000 (14:22 +0000)] 
apps/app_voicemail: Trigger MWI notification with MixMonitor m() option

The MixMonitor m() option allows a recording to be pushed to a specific
voicemail mailbox. If the message is delivered to the mailbox's INBOX, however,
no MWI notification is currently raised.

This patch corrects the issue by properly calling notify_new_state from the
msg_create_from_file function. This will cause MWI to be triggered if the
message was placed in the mailbox's INBOX.

ASTERISK-24709 #close
Reported by: Gareth Palmer
patches:
  app_voicemail-430919.patch uploaded by Gareth Palmer (License 5169)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@430920 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agocontrib/scripts/install_prereq: Don't install 32-bit packages on 64-bit hosts
Matthew Jordan [Tue, 20 Jan 2015 02:38:28 +0000 (02:38 +0000)] 
contrib/scripts/install_prereq: Don't install 32-bit packages on 64-bit hosts

On Debian based systems, the install_prereq tool uses a search command on
Debian that results in selecting both 64-bit and 32-bit packages. Besides the
waste of disk space, this can actually cause aptitude use 100% of memory on a
VM with 1GB of RAM as it tried to work out all of the 32-bit package
dependencies.

This patch filters out the 32-bit packages on a 64-bit machine, and leaves
32-bit machines alone.

ASTERISK-24048 #close
Reported by: Ben Klang
Tested by: Ben Klang, Matt Jordan
patches:
  install_prereq_64-bit_compat.patch uploaded by Ben Klang (License 5876)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@430798 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoapp_voicemail: Temp message left after review/hangup with ODBC/IMAP backend
Matthew Jordan [Tue, 20 Jan 2015 02:25:25 +0000 (02:25 +0000)] 
app_voicemail: Temp message left after review/hangup with ODBC/IMAP backend

When using ODBC or IMAP storage, temporary files created on the file system
must be disposed of using the DISPOSE macro. The DELETE macro will map to a
deletion function for the backend storage, but does not clean up any local
files created as a result of the operation.

When using voicemail with the operator and review options enabled, pressing
0 to enter the menu, followed by 1 to save the message, followed by any
other DTMF press to delete the message, will result in the temporary file
lingering on the file system.

This patch properly calls DISPOSE after the DELETE. This causes the local
file to be disposed of.

ASTERISK-24288 #close
Reported by: LEI FU
patches:
  voicemail_odbc_review_fix.diff uploaded by LEI FU (License 6640)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@430795 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agobuild_tools/mkpkgconfig: Fix Cflags concatenation error in asterisk.pc
Matthew Jordan [Wed, 14 Jan 2015 15:34:16 +0000 (15:34 +0000)] 
build_tools/mkpkgconfig: Fix Cflags concatenation error in asterisk.pc

The mkpkgconfig script incorrectly concatenates Cflags options together. As an
example, the following:
Cflags: -I/usr/include/libxml2 -g3

Is instead generated as:
Cflags: -I/usr/include/libxml2-g3

This patch corrects the generation of Cflags in mkpkgconfig such that the
Cflags options are output correctly.

Review: https://reviewboard.asterisk.org/r/3707/

ASTERISK-23991 #close
Reported by: Diederik de Groot
patches:
  fix_mkpkgconfig.diff uploaded by Diederik de Groot (License 6600)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@430589 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoapp_macro: Don't restore the calling location on a channel redirect.
Richard Mudgett [Tue, 13 Jan 2015 18:06:21 +0000 (18:06 +0000)] 
app_macro: Don't restore the calling location on a channel redirect.

v11: If a channel redirect to a macro exten of a macro that is active
happens, the redirect location doesn't get executed.  Instead the original
macro location is restored and gets reexecuted.

v13: An additional effect happens if a parked call times out to an
extension in the macro that parked the call then the macro is reexecuted
instead of the expected park return location.

* Made not restore the macro calling location on an
AST_SOFTHANGUP_ASYNCGOTO.

* Increased the locked channel range when setting up the macro execution
environment to cover things that should be done while the channel is
locked.

* Removed unnecessary NULL tests before calling ast_free() in
_macro_exec().

ASTERISK-23850 #close
Reported by: Andrew Nagy

Review: https://reviewboard.asterisk.org/r/4292/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@430564 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agomain/syslog: Allow dynamic logs, such as security events, to log to the syslog
Matthew Jordan [Mon, 12 Jan 2015 18:00:24 +0000 (18:00 +0000)] 
main/syslog: Allow dynamic logs, such as security events, to log to the syslog

The security event log uses a dynamic log level (SECURITY) that is registered
with the Asterisk logging core. Unfortunately, the syslog would ignore log
statements that had a dynamic log level associated with them. Because the
syslog cannot handle ad hoc dynamic log levels, this patch treats any dynamic
log entries sent to the syslog as logs with a level of NOTICE.

ASTERISK-20744 #close
Reported by: Michael Keuter
Tested by: Michael L. Young, Jacek Konieczny
patches:
  asterisk-20744-syslog-dynamic-logging_trunk.diff uploaded by Michael L. Young (license 5026)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@430506 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agofuncs/func_curl: Fix memory leak when CURLOPT channel datastore is destroyed
Matthew Jordan [Mon, 12 Jan 2015 15:11:08 +0000 (15:11 +0000)] 
funcs/func_curl: Fix memory leak when CURLOPT channel datastore is destroyed

When the channel datastore associated with the usage of CURLOPT on a specific
channel is freed, the underlying structure holding the list of options is not
disposed of. This patch properly frees the structure in the datastore .destroy
callback.

ASTERISK-24672 #close
Reported by: Kristian Hogh
patches:
  func_curl-memory-leak.diff uploaded by Kristian Hogh (License 6639)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@430487 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agores_fax: Add T.38 negotiation timeout option
Kinsey Moore [Fri, 9 Jan 2015 14:40:11 +0000 (14:40 +0000)] 
res_fax: Add T.38 negotiation timeout option

This change makes the T.38 negotiation timeout configurable via
't38timeout' in res_fax.conf or FAXOPT(t38timeout). It was previously
hard coded to be 5000 milliseconds.

This change also handles T.38 switch failures by aborting the fax since
in the case where this can happen, both sides have agreed to switch to
T.38 and Asterisk is unable to do so.

Review: https://reviewboard.asterisk.org/r/4320/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@430415 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoapp_queue: Update sample conf documenation
Kevin Harwell [Wed, 24 Dec 2014 21:18:29 +0000 (21:18 +0000)] 
app_queue: Update sample conf documenation

Updated the queues.conf.sample file to explicitly state which channel queue
variables are propagated to.

ASTERISK-24267
Reported by: Mitch Claborn

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@430126 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoqueue_log: Post QUEUESTART entry when Asterisk fully boots.
Richard Mudgett [Mon, 22 Dec 2014 19:38:58 +0000 (19:38 +0000)] 
queue_log: Post QUEUESTART entry when Asterisk fully boots.

The QUEUESTART log entry has historically acted like a fully booted event
for the queue_log file.  When the QUEUESTART entry was posted to the log
was broken by the change made by ASTERISK-15863.

* Made post the QUEUESTART queue_log entry when Asterisk fully boots.
This restores the intent of that log entry and happens after realtime has
had a chance to load.

AST-1444 #close
Reported by: Denis Martinez

Review: https://reviewboard.asterisk.org/r/4282/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@430009 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agochan_sip: Send CANCEL via original INVITE destination even after UPDATE request
Matthew Jordan [Mon, 22 Dec 2014 15:39:04 +0000 (15:39 +0000)] 
chan_sip: Send CANCEL via original INVITE destination even after UPDATE request

Given the following scenario:
* Three SIP phones (A, B, C), all communicating via a proxy with Asterisk
* A call is established between A and B. B performs a SIP attended transfer of
  A to C. B sets the call on hold (A is hearing MOH) and dials the extension of
  C. While phone C is ringing, B transfers the call (that is, what we typically
  call a 'blond transfer').
* When the transfer completes, A hears the ringing of phone C, while B is idle.

In the SIP messaging for the above scenario, a REFER request is sent to
transfer the call. When "sendrpid=yes" is set in sip.conf, Asterisk may send an
UPDATE request to phone C to update party information. This update is sent
directly to phone C, not through the intervening proxy. This has the unfortunate
side effect of providing route information, which is then set on the sip_pvt
structure for C. If someone (e.g. B) is trying to get the call back (through a
directed pickup), Asterisk will send a CANCEL request to C. However, since we
have now updated the route set, the CANCEL request will be sent directly to C
and not through the proxy. The phone ignores this CANCEL according to RFC3261
(Section 9.1).

This patch updates reqprep such that the route is not updated if an UPDATE
request is being sent while the INVITE state is INV_PROCEEDING or
INV_EARLY_MEDIA. This ensures that a subsequent CANCEL request is still sent
to the correct location.

Review: https://reviewboard.asterisk.org/r/4279

ASTERISK-24628 #close
Reported by: Karsten Wemheuer
patches:
  issue.patch uploaded by Karsten Wemheuer (License 5930)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@429982 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoacl: Fix reloading of configuration if configuration file does not exist at startup.
Joshua Colp [Sat, 20 Dec 2014 20:56:35 +0000 (20:56 +0000)] 
acl: Fix reloading of configuration if configuration file does not exist at startup.

The named ACL code incorrectly destroyed the config options information if loading
of the configuration file failed at startup. This would result in reloading
also failing even if a valid configuration file was put in place.

ASTERISK-23733 #close
Reported by: Richard Kenner

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@429893 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agores_http_websocket.c: Fix incorrect use of sizeof in ast_websocket_write().
Richard Mudgett [Fri, 19 Dec 2014 20:51:41 +0000 (20:51 +0000)] 
res_http_websocket.c: Fix incorrect use of sizeof in ast_websocket_write().

This won't fix the reported issue but it is an incorrect use of sizeof.

ASTERISK-24566
Reported by:  Badalian Vyacheslav

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@429867 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agochan_dahdi: Don't ignore setvar when using configuration section scheme.
Richard Mudgett [Fri, 19 Dec 2014 17:21:15 +0000 (17:21 +0000)] 
chan_dahdi: Don't ignore setvar when using configuration section scheme.

When the configuration section scheme of chan_dahdi.conf is used (keyword
dahdichan instead of channel) all setvar= options are completely ignored.
No variable defined this way appears in the created DAHDI channels.

* Move the clearing of setvar values to after the deferred processing of
dahdichan.

AST-1378 #close
Reported by: Guenther Kelleter
Patch by: Guenther Kelleter

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@429825 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agochan_dahdi.c, res_rtp_asterisk.c: Change some spammy debug messages to level 5.
Richard Mudgett [Thu, 18 Dec 2014 22:33:49 +0000 (22:33 +0000)] 
chan_dahdi.c, res_rtp_asterisk.c: Change some spammy debug messages to level 5.

ASTERISK-24337 #close
Reported by: Rusty Newton

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@429804 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agochan_dahdi: Populate CALLERID(ani2) for incoming calls in featdmf signaling mode.
Richard Mudgett [Thu, 18 Dec 2014 19:35:19 +0000 (19:35 +0000)] 
chan_dahdi: Populate CALLERID(ani2) for incoming calls in featdmf signaling mode.

For the featdmf signaling mode the incoming MF Caller-ID information is
formatted as follows: *${CALLERID(ani2)}${CALLERID(ani)}#*${EXTEN}#

Rather than discarding the ani2 digits, populate the CALLERID(ani2) value
with what is received instead.

AST-1368 #close
Reported by: Denis Martinez
Patches:
      extract_ani2_for_featdmf_v11.patch (license #5621) patch uploaded by Richard Mudgett

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@429783 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoFix printf problems with high ascii characters after r413586 (1.8).
Walter Doekes [Wed, 17 Dec 2014 09:24:50 +0000 (09:24 +0000)] 
Fix printf problems with high ascii characters after r413586 (1.8).

In r413586 (1.8) various casts were added to silence gcc 4.10 warnings.
Those fixes included things like:

    -out += sprintf(out, "%%%02X", (unsigned char) *ptr);
    +out += sprintf(out, "%%%02X", (unsigned) *ptr);

That works for low ascii characters, but for the high range that yields
e.g. FFFFFFC3 when C3 is expected.

This changeset:
- fixes those casts to use the 'hh' unsigned char modifier instead
- consistently uses %02x instead of %2.2x (or other non-standard usage)
- adds a few 'h' modifiers in various places
- fixes a 'replcaes' typo
- dev/urandon typo (in 13+ patch)

Review: https://reviewboard.asterisk.org/r/4263/

ASTERISK-24619 #close
Reported by: Stefan27 (on IRC)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@429673 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agochan_sip: Allow T.38 switch-over when SRTP is in use.
Joshua Colp [Tue, 16 Dec 2014 16:35:28 +0000 (16:35 +0000)] 
chan_sip: Allow T.38 switch-over when SRTP is in use.

Previously when SRTP was enabled on a channel it was not possible
to switch to T.38 as no crypto attributes would be present.

This change makes it so it is now possible. If a T.38 re-invite
comes in SRTP is terminated since in practice you can't encrypt
a UDPTL stream. Now... if we were doing T.38 over RTP (which
does exist) then we'd have a chance but almost nobody does that so
here we are.

ASTERISK-24449 #close
Reported by: Andreas Steinmetz
patches:
 udptl-ignore-srtp-v2.patch submitted by Andreas Steinmetz (license 6523)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@429632 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoDEBUG_THREADS: Fix regression and lock tracking initialization problems.
Richard Mudgett [Fri, 12 Dec 2014 23:31:38 +0000 (23:31 +0000)] 
DEBUG_THREADS: Fix regression and lock tracking initialization problems.

This patch started with David Lee's patch at
https://reviewboard.asterisk.org/r/2826/ and includes a regression fix
introduced by the ASTERISK-22455 patch.

The initialization of a mutex's lock tracking structure was not protected
in a critical section.  This is fine for any mutex that is explicitly
initialized, but a static mutex may have its lock tracking double
initialized if multiple threads attempt the first lock simultaneously.

* Added a global mutex to properly serialize initialization of the lock
tracking structure.  The painful global lock can be mitigated by adding a
double checked lock flag as discussed on the original review request.

* Defer lock tracking initialization until first use.

* Don't be "helpful" and initialize an uninitialized lock when
DEBUG_THREADS is enabled.  Debug code is not supposed to fix or change
normal code behavior.  We don't need a lock initialization race that would
force a re-setup of lock tracking.  Lock tracking already handles
initialization on first use.

* Properly handle allocation failures of the lock tracking structure.

* No need to initialize tracking data in __ast_pthread_mutex_destroy()
just to turn around and destroy it.

The regression introduced by ASTERISK-22455 is the result of manipulating
a pthread_mutex_t struct outside of the pthread library code.  The
pthread_mutex_t struct seems to have a global linked list pointer member
that can get changed by other threads.  Therefore, saving and restoring
the contents of a pthread_mutex_t struct is a bad thing.

Thanks to Thomas Airmont for finding this obscure regression.

* Don't overwrite the struct ast_lock_track.reentr_mutex member to restore
tracking data in __ast_cond_wait() and __ast_cond_timedwait().  The
pthread_mutex_t struct must be treated as a read-only opaque variable.

Miscellaneous other items fixed by this patch:

* Match ast_suspend_lock_info() with ast_restore_lock_info() in
__ast_cond_timedwait().

* Made some uninitialized lock sanity checks return EINVAL and try a
DO_THREAD_CRASH.

* Fix bad canlog initialization expressions.

ASTERISK-24614 #close
Reported by: Thomas Airmont

Review: https://reviewboard.asterisk.org/r/4247/
Review: https://reviewboard.asterisk.org/r/2826/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@429539 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agores/res_agi: Make Verbose message for 'stream file' match other playbacks
Matthew Jordan [Fri, 12 Dec 2014 22:42:35 +0000 (22:42 +0000)] 
res/res_agi: Make Verbose message for 'stream file' match other playbacks

The Verbose message displayed when a file is played back via 'stream file'
was formatted differently than other playbacks:
* It didn't include the channel name
* It didn't include the channel language
It does, however, include the playback offset as well as any escape digits.
That information was kept; however, this patch updates the formatting to more
closely match the Verbose messages displayed when a file is played back by
'control stream file', Playback, ControlPlayback, or any other file playback
operation.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@429517 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agores_http_websocket: Fix crash due to double freeing memory when receiving a payload...
Joshua Colp [Wed, 10 Dec 2014 13:30:22 +0000 (13:30 +0000)] 
res_http_websocket: Fix crash due to double freeing memory when receiving a payload length of zero.

Frames with a payload length of 0 were incorrectly handled in res_http_websocket.
Provided a frame with a payload had been received prior it was possible for a double
free to occur. The realloc operation would succeed (thus freeing the payload) but be
treated as an error. When the session was then torn down the payload would be
freed again causing a crash. The read function now takes this into account.

This change also fixes assumptions made by users of res_http_websocket. There is no
guarantee that a frame received from it will be NULL terminated.

ASTERISK-24472 #close
Reported by: Badalian Vyacheslav

Review: https://reviewboard.asterisk.org/r/4220/
Review: https://reviewboard.asterisk.org/r/4219/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@429270 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agores/res_monitor: Reset in/out sample counts on Monitor start
Matthew Jordan [Sat, 6 Dec 2014 18:15:20 +0000 (18:15 +0000)] 
res/res_monitor: Reset in/out sample counts on Monitor start

When repeatedly starting/stopping a Monitor on a channel, the accumulated
in/out sample counts are never reset to 0. This can cause inadvertent jumps
in the recordings, as the code in the channel core will determine incorrectly
that a jump in the recorded file position should occur. Setting the sample
counts to 0 simply reflects the initial state a Monitor should be in when it
is started, as this is the initial count that would be on the channels at that
time.

ASTERISK-24573 #close
Reported by: Nuno Borges
patches:
  24573.patch uploaded by Nuno Borges (License 6116)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@429031 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoapps/app_meetme: Apply default values on initial load with no config file
Matthew Jordan [Sat, 6 Dec 2014 17:19:39 +0000 (17:19 +0000)] 
apps/app_meetme: Apply default values on initial load with no config file

When the app_meetme module is loaded without its configuration file, the
module settings aren't initialized. In particular, this impacts the use
of logging realtime members. This patch guarantees that we always set the
default module settings on initial load.

Review: https://reviewboard.asterisk.org/r/4242/

ASTERISK-24572 #close
Reported by: Nuno Borges
patches:
  24572.patch uploaded by Nuno Borges (License 6116)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@429027 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoapps/app_voicemail: Fix crash with IMAP when streams are opened simultaneously
Matthew Jordan [Wed, 3 Dec 2014 16:43:47 +0000 (16:43 +0000)] 
apps/app_voicemail: Fix crash with IMAP when streams are opened simultaneously

The UW IMAP library is instrinsically not thread-safe, and relies upon higher
level applications to guarantee thread safety. For the most part, this is
provided by the vms object, which provides locking for individual streams.
Unfortunately, this is not sufficient for calls to mail_open which create the
IMAP stream. mail_open can, on some systems, call into a UW IMAP specific
function for determining the address of a system based on a hostname,
ip_nametoaddr.

In the ip6_unix implementation of this function, static variables are used
to hold parsing buffers. This can cause a crash if multiple threads attempt
to convert a hostname to an address at the same time. Locking on a single
mail stream is not sufficient to prevent simultaneous access to these static
variables.

In the IMAP library, this function can be called from the mail_open and
imap_status functions. As the imap_status function is not used by
app_voicemail, locking on access to mail_open is sufficient to prevent
any mangling of the buffers.

Review: https://reviewboard.asterisk.org/r/4188/

ASTERISK-24516 #close
Reported by: David Duncan Ross Palmer
Tested by: David Duncan Ross Palmer
patches:
  ASTERISK-24516.diff uploaded by David Duncan Ross Palmer (License 6660)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@428863 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agopbx/pbx_loopback: Speed up switches by avoiding unneeded lookups
Matthew Jordan [Tue, 2 Dec 2014 16:54:45 +0000 (16:54 +0000)] 
pbx/pbx_loopback: Speed up switches by avoiding unneeded lookups

This patch makes a small rearrangement to only do dialplan lookups during
loopback switches if the pattern matches. Prior to this patch, the dialplan
lookups were always performed, even when the result would be discarded.
Dialplan lookups can be very costly if remote switches - like DUNDi - are
present. In those cases extension matching is sped up considerably, making
the issue of lost digits more manageable.

As collateral damage, 6 trailing spaces were killed.

Review: https://reviewboard.asterisk.org/r/4211

ASTERISK-24577 #close
Reported by: Birger Harzenetter
patches:
  ast-loopback.patch uploaded by Birger Harzenetter (License 5870)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@428787 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoapp_record: Fix bug where using the 'k' option and hanging up would trim 1/4 of a...
Joshua Colp [Mon, 1 Dec 2014 13:39:15 +0000 (13:39 +0000)] 
app_record: Fix bug where using the 'k' option and hanging up would trim 1/4 of a second of the recording.

The Record dialplan function trims 1/4 of a second from the end of recordings in case
they are terminated because of DTMF. When hanging up, however, you don't want this to happen.
This change makes it so on hangup this does not occur.

ASTERISK-24530 #close
Reported by: Ben Smithurst
patches:
 app_record_v2.diff submitted by Ben Smithurst (license 6529)

Review: https://reviewboard.asterisk.org/r/4201/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@428653 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agomanager: Fix could not extend string messages.
Richard Mudgett [Fri, 21 Nov 2014 18:47:12 +0000 (18:47 +0000)] 
manager: Fix could not extend string messages.

When shutting down Asterisk that has an active AMI connection, you get
several "failed to extend from %d to %d" messages because use of the
EVENT_FLAG_SHUTDOWN attempts to add all AMI permission strings to the
event.

* Created MAX_AUTH_PERM_STRING to use when creating stack based struct
ast_str variables used with the authority_to_str() and
user_authority_to_str() functions instead of a variety of magic numbers
that could be too small.

* Added a special check for EVENT_FLAG_SHUTDOWN to authority_to_str() so
it will not attempt to add all permission level strings.

Review: https://reviewboard.asterisk.org/r/4200/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@428570 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoFix error with mixed address family ACLs.
Mark Michelson [Thu, 20 Nov 2014 16:35:18 +0000 (16:35 +0000)] 
Fix error with mixed address family ACLs.

Prior to this commit, the address family of the first item in an ACL
was used to compare all incoming traffic. This could lead to traffic
of other IP address families bypassing ACLs.

ASTERISK-24469 #close

Reported by Matt Jordan
Patches:
ASTERISK-24469-11.diff uploaded by Matt Jordan (License #6283)

AST-2014-012
........

Merged revisions 428402 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@428417 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoAST-2014-018 - func_db: DB Dialplan function permission escalation via AMI.
Kevin Harwell [Thu, 20 Nov 2014 16:22:50 +0000 (16:22 +0000)] 
AST-2014-018 - func_db: DB Dialplan function permission escalation via AMI.

The DB dialplan function when executed from an external protocol (for instance
AMI), could result in a privilege escalation.

Asterisk now inhibits the DB function from being executed from an external
interface if the live_dangerously option is set to no.

ASTERISK-24534
Reported by: Gareth Palmer
patches: submitted by Gareth Palmer (license 5169)
........

Merged revisions 428331 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@428363 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoAST-2014-017 - app_confbridge: permission escalation/ class authorization.
Kevin Harwell [Thu, 20 Nov 2014 15:42:01 +0000 (15:42 +0000)] 
AST-2014-017 - app_confbridge: permission escalation/ class authorization.

Confbridge dialplan function permission escalation via AMI and inappropriate
class authorization on the ConfbridgeStartRecord action. The CONFBRIDGE dialplan
function when executed from an external protocol (for instance AMI), could
result in a privilege escalation. Also, the AMI action “ConfbridgeStartRecord”
could also be used to execute arbitrary system commands without first checking
for system access.

Asterisk now inhibits the CONFBRIDGE function from being executed from an
external interface if the live_dangerously option is set to no.  Also, the
“ConfbridgeStartRecord” AMI action is now only allowed to execute under a
user with system level access.

ASTERISK-24490
Reported by: Gareth Palmer

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@428332 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoAST-2014-014: Fix race condition where channels may get stuck in ConfBridge under...
Joshua Colp [Thu, 20 Nov 2014 14:20:08 +0000 (14:20 +0000)] 
AST-2014-014: Fix race condition where channels may get stuck in ConfBridge under load.

Under load it was possible for the bridging API, and thus ConfBridge, to get
channels that may have hung up stuck in it. This is because handling of state
transitions for a bridged channel within a bridge was not protected and simply
set the new state without regard to the existing state. If the existing state
had been hung up this would get overwritten.

This change adds locking to protect changing of the state and also
takes into consideration the existing state.

ASTERISK-24440 #close
Reported by: Ben Klang

Review: https://reviewboard.asterisk.org/r/4173/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@428299 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoast_str: Fix improper member access to struct ast_str members.
Richard Mudgett [Wed, 19 Nov 2014 16:38:10 +0000 (16:38 +0000)] 
ast_str: Fix improper member access to struct ast_str members.

Accessing members of struct ast_str outside of the string manipulation API
routines is invalid since struct ast_str is supposed to be treated as
opaque.

Review: https://reviewboard.asterisk.org/r/4194/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@428244 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agochan_sip: Fix theoretical leak of p->refer.
Corey Farrell [Mon, 17 Nov 2014 15:56:11 +0000 (15:56 +0000)] 
chan_sip: Fix theoretical leak of p->refer.

If transmit_refer is called when p->refer is already allocated,
it leaks the previous allocation.  Updated code to always free
previous allocation during a new allocation.  Also instead of
checking if we have a previous allocation, always create a
clean record.

ASTERISK-15242 #close
Reported by: David Woolley
Review: https://reviewboard.asterisk.org/r/4160/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@428117 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoapps/app_confbridge: Ensure 'normal' users hear message when last marked leaves
Matthew Jordan [Mon, 17 Nov 2014 15:26:50 +0000 (15:26 +0000)] 
apps/app_confbridge: Ensure 'normal' users hear message when last marked leaves

When r428077 was made for ASTERISK-24522, it failed to take into account users
who are neither wait_marked nor end_marked. These users are *also* supposed to
hear the 'leader has left the conference' message. Granted, this behaviour is
a bit odd; however, that is how it used to work... and behaviour changes are
not good.

This patch ensures that if there are any 'normal' users present when the last
marked user leaves the conference, the message will still be played to them.

Note that this regression was caught by the Asterisk Test Suite's
confbridge_nominal test, which has a quirky combination of users.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@428113 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoapp_confbridge: Don't play leader leaving prompt if no one will hear it
Matthew Jordan [Mon, 17 Nov 2014 03:05:44 +0000 (03:05 +0000)] 
app_confbridge: Don't play leader leaving prompt if no one will hear it

Consider the following:
- A marked user in a conference
- One or more end_marked only users in the conference

When the marked users leaves, we will be in the conf_state_multi_marked state.
This currently will traverse the users, kicking out any who have the end_marked
flags. When they are kicked, a full ast_bridge_remove is immediately called on
the channels. At this time, we also unilaterally set the need_prompt flag.

When the need_prompt flag is set, we then playback a sound to the bridge
informing everyone that the leader has left; however, no one is left in the
bridge. This causes some odd behaviour for the end_marked users - they are
stuck waiting for the bridge to be unlocked. This results in them waiting for
5 or 6 seconds of dead air before hearing that they've been kicked.

Unfortunately, we do have to keep the bridge locked while we're playing back
the 'leader-has-left' prompt. If there are any wait_marked users in the
conference, this behaviour can't be easily changed - but we do make the case
of the end_marked users better with this patch.

Review: https://reviewboard.asterisk.org/r/4184/

ASTERISK-24522 #close
Reported by: Matt Jordan

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@428077 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agocel/cel_odbc: Provide microsecond precision in 'eventtime' column when possible
Matthew Jordan [Sat, 15 Nov 2014 16:51:51 +0000 (16:51 +0000)] 
cel/cel_odbc: Provide microsecond precision in 'eventtime' column when possible

This patch adds microsecond precision when inserting a CEL record into a table
with an "eventtime" column of type timestamp, instead of second precision. The
documentation (configs/cel_odbc.conf.sample) was already saying that the
eventtime column included microseconds precision, but that was not the case.

Also, without this patch, if you had a table with an "eventtime" column of
type varchar, you had millisecond precision. With this patch, you also get
microsecond precision in this case.

Review: https://reviewboard.asterisk.org/r/3980

ASTERISK-24283 #close
Reported by: Etienne Lessard
patches:
  cel_odbc_time_precision.patch uploaded by Etienne Lessard (License 6394)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@427952 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agostun: correct attribute string padding to match rfc
Scott Griepentrog [Fri, 14 Nov 2014 15:46:30 +0000 (15:46 +0000)] 
stun: correct attribute string padding to match rfc

When sending the USERNAME attribute in an RTP STUN
response, the implementation in append_attr_string
passed the actual length, instead of padding it up
to a multiple of four bytes as required by the RFC
3489.  This change adds separate variables for the
string and padded attributed lengths, and performs
padding correctly.

Reported by: Thomas Arimont
Review: https://reviewboard.asterisk.org/r/4139/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@427874 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoapp_confbridge: Play "leader has left" sound even when musiconhold is enabled.
Joshua Colp [Fri, 14 Nov 2014 14:54:50 +0000 (14:54 +0000)] 
app_confbridge: Play "leader has left" sound even when musiconhold is enabled.

Currently if the leader of a conference bridge leaves any participant
that has musiconhold enabled will not hear the "leader has left" sound.
This is because musiconhold is started and THEN the sound is played.

This change makes it so that the sound is played and THEN musiconhold
is started. This provides a better experience for users as they may not
have known previously why they went back to musiconhold.

Review: https://reviewboard.asterisk.org/r/4177/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@427844 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agopbx: Fix off-nominal case where a freed extension may still be used.
Joshua Colp [Wed, 12 Nov 2014 16:10:46 +0000 (16:10 +0000)] 
pbx: Fix off-nominal case where a freed extension may still be used.

If during the operation of adding an extension a priority is added but
fails it is possible for the extension to be freed but still exist in
the PBX core. If this occurs subsequent lookups may try to access the
extension and end up in freed memory.

This change removes the extension from the PBX core when the priority
addition fails and then frees the extension.

ASTERISK-24444 #close
Reported by: Leandro Dardini

Review: https://reviewboard.asterisk.org/r/4162/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@427709 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoFix compiler error when using ./configure --enable-dev-mode --enable-coverage
Corey Farrell [Wed, 12 Nov 2014 13:44:32 +0000 (13:44 +0000)] 
Fix compiler error when using ./configure --enable-dev-mode --enable-coverage

When DONT_OPTIMIZE is enabled with dev-mode, it causes a shadow compilation
to be done with output to /dev/null.  This can cause errors with coverage
when GCC attempts to write to /dev/null.gcno.  This change disables
coverage for the shadow compilation.

ASTERISK-24502 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4151/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@427682 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agomanager: Fix HTTP connection reference leaks.
Corey Farrell [Sun, 9 Nov 2014 07:56:41 +0000 (07:56 +0000)] 
manager: Fix HTTP connection reference leaks.

Fix reference leak that happens if (session && !blastaway).

ASTERISK-24505 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4153/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@427641 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agoconfigs/features.conf: Add documentation noting potential chan_agent conflict
Matthew Jordan [Sun, 9 Nov 2014 00:59:43 +0000 (00:59 +0000)] 
configs/features.conf: Add documentation noting potential chan_agent conflict

In chan_agent, a '*' is used by default to terminate a bridge with a caller.
This can lead to all sorts of problems if '*' is used by a feature in
features.conf, as the chan_agent disconnect '*' may be detected first.

This patch adds a documentation snippet to features.conf so that users who
attempt to use features with agents know of the potential conflict.

ASTERISK-20402 #close
Reported by: Matt Riddell
patches:
  features.conf.diff uploaded by Matt Riddell (License 5023)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@427617 65c4cc65-6c06-0410-ace0-fbb531ad65f3

10 years agochannels/chan_mgcp: Fix regression which causes gateways to be skipped
Matthew Jordan [Sun, 9 Nov 2014 00:36:31 +0000 (00:36 +0000)] 
channels/chan_mgcp: Fix regression which causes gateways to be skipped

In r227276, a while loop was turned into a for loop. Unfortunately, a portion
of the while loop was left in the code such that, when a static gateway is
encountered in the list of MGCP gateways, the next gateway would be skipped.
At best, we would simply flip past a gateway; at worst, this could lead to a
crash.

ASTERISK-24500 #close
Reported by: Xavier Hienne
patches:
  chan_mgcp.patch uploaded by Xavier Hienne (License 6657)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@427613 65c4cc65-6c06-0410-ace0-fbb531ad65f3