Richard Mudgett [Fri, 20 Mar 2015 18:27:22 +0000 (18:27 +0000)]
res_pjsip_sdp_rtp,sorcery: Fix invalid access and memory leak respectively.
Valgrind found a memory leak and invalid access.
* Fix invalid access by sscanf() being fed a non-nul terminated string of
digits in res/res_pjsip_sdp_rtp.c:get_codecs().
* Fix memory leak in main/sorcery.c:sorcery_object_field_destructor().
* Fix potential NULL pointer dereference in
main/xmldoc.c:xmldoc_get_syntax_config_option().
Review: https://reviewboard.asterisk.org/r/4513/
........
Merged revisions 433199 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433200
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Thu, 19 Mar 2015 19:20:21 +0000 (19:20 +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
........
Merged revisions 433173 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 433174 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433175
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Kevin Harwell [Thu, 19 Mar 2015 15:27:56 +0000 (15:27 +0000)]
alemebic scripts: endpoint identifier order option
The script was added in 13, but when committed to trunk it caused a branch to
occur due to some trunk only alemebic changes. This fixes it so that the new
'add_pjsip_endpoint_identifier_order script points to the correct down revision.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433152
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Corey Farrell [Thu, 19 Mar 2015 10:21:42 +0000 (10:21 +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/
........
Merged revisions 433122 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 433126 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433130
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Corey Farrell [Thu, 19 Mar 2015 09:57:59 +0000 (09:57 +0000)]
chan_sip: Simplify dialog/peer references, improve REF_DEBUG output.
* Replace functions for ref/undef of dialogs and peers with macro's
to call ao2_t_bump/ao2_t_cleanup.
* Enable passthough of REF_DEBUG caller information to sip_alloc and
find_call.
ASTERISK-24882 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4189/
........
Merged revisions 433115 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433116
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Corey Farrell [Thu, 19 Mar 2015 09:46:06 +0000 (09:46 +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/
........
Merged revisions 433112 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 433113 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433114
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Wed, 18 Mar 2015 02:42:16 +0000 (02:42 +0000)]
res_pjsip_session: Fix off-nominal extra unref of session.
........
Merged revisions 433088 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433089
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Scott Griepentrog [Tue, 17 Mar 2015 22:15:42 +0000 (22:15 +0000)]
Various: 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.
Review: https://reviewboard.asterisk.org/r/4468/
........
Merged revisions 433064 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433065
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Scott Griepentrog [Tue, 17 Mar 2015 22:03:37 +0000 (22:03 +0000)]
core: Introduce chaos into memory allocations
Locate potential crashes by exercising seldom
used code paths. This patch introduces a new
define DEBUG_CHAOS, and mechanism to randomly
return an error condition from functions that
will seldom do so. Functions that handle the
allocation of memory get the first treatment.
Review: https://reviewboard.asterisk.org/r/4463/
........
Merged revisions 433060 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433063
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Scott Griepentrog [Tue, 17 Mar 2015 22:03:01 +0000 (22:03 +0000)]
Reverting accidental ci of wrong change in r433061
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433062
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Scott Griepentrog [Tue, 17 Mar 2015 22:00:05 +0000 (22:00 +0000)]
various: cleanup issues found during leak hunt
In this collection of small patches to prevent
Valgrind errors are: fixes for reference leaks
in config hooks, evaluating a parameter beyond
bounds, and accessing a structure after a lock
where it could have been already free'd.
Review: https://reviewboard.asterisk.org/r/4407/
........
Merged revisions 431583 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433061
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Tue, 17 Mar 2015 21:52:47 +0000 (21:52 +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().
* Made functions that call ast_sockaddr_resolve() with RAII_VAR()
controlling the addrs variable use ast_free instead of ast_free_ptr to
provide better MALLOC_DEBUG information.
Review: https://reviewboard.asterisk.org/r/4509/
........
Merged revisions 433056 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 433057 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433058
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Kevin Harwell [Tue, 17 Mar 2015 18:35:07 +0000 (18:35 +0000)]
res_pjsip: Allow configuration of endpoint identifier query order
Updated some documentation stating that endpoint identifiers registered without
a name are place at the front of the lookup list. Also renamed register method
'ast_sip_register_endpoint_identifier_by_name' to
'ast_sip_register_endpoint_identifier_with_name'
ASTERISK-24840
Reported by: Mark Michelson
........
Merged revisions 433031 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433032
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Kevin Harwell [Tue, 17 Mar 2015 18:22:20 +0000 (18:22 +0000)]
res_pjsip: Allow configuration of endpoint identifier query order
This patch fixes previously reverted code that caused binary incompatibility
problems with some modules. And like the original patch it makes sure that
no matter what order the endpoint identifier modules were loaded, priority is
given based on the ones specified in the new global 'endpoint_identifier_order'
option.
ASTERISK-24840
Reported by: Mark Michelson
Review: https://reviewboard.asterisk.org/r/4489/
........
Merged revisions 433028 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433029
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Tue, 17 Mar 2015 16:11:36 +0000 (16:11 +0000)]
res_pjsip: Add reason comment.
........
Merged revisions 433005 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433006
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Sat, 14 Mar 2015 02:29:29 +0000 (02:29 +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
........
Merged revisions 432970 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432971 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432972
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Joshua Colp [Sat, 14 Mar 2015 02:01:12 +0000 (02:01 +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
........
Merged revisions 432948 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432949 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432950
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Sat, 14 Mar 2015 01:53:13 +0000 (01:53 +0000)]
apps/app_sms: Add an option to prevent SMS content from being logged
In some countries, privacy laws specify that SMS content cannot be saved by a
provider. This patch adds a new option to the SMS application, 'n', which
prevents the SMS content from being written to the SMS log.
ASTERISK-22591 #close
Reported by: Jan Juergens
patches:
DisableSmsContentLoggingByParam.patch uploaded by Jan Juergens (License 6538)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432947
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Joshua Colp [Sat, 14 Mar 2015 01:37:24 +0000 (01:37 +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
........
Merged revisions 432944 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432945 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432946
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Sat, 14 Mar 2015 01:22:01 +0000 (01:22 +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)
........
Merged revisions 432935 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432938 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432940
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Sat, 14 Mar 2015 00:24:52 +0000 (00:24 +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
........
Merged revisions 432918 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432920 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432921
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Fri, 13 Mar 2015 17:06:39 +0000 (17:06 +0000)]
chan_pjsip: AMI action PJSIPShowEndpoint closes AMI connection on error.
Also fixed similar problem with AMI action PJSIPShowEndpoints.
ASTERISK-24872 #close
Reported by: Dmitriy Serov
Review: https://reviewboard.asterisk.org/r/4487/
........
Merged revisions 432894 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432895
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Fri, 13 Mar 2015 16:37:17 +0000 (16:37 +0000)]
chan_pjsip/res_pjsip_callerid: Make Party ID handling simpler and consistent.
The res_pjsip modules were manually checking both name and number
presentation values when there is a function that determines the combined
presentation for a party ID struct. The function takes into account if
the name or number components are valid while the manual code rarely
checked if the data was even valid.
* Made use ast_party_id_presentation() rather than manually checking party
ID presentation values.
* Ensure that set_id_from_pai() and set_id_from_rpid() will not return
presentation values other than what is pulled out of the SIP headers. It
is best if the code doesn't assume that AST_PRES_ALLOWED and
AST_PRES_USER_NUMBER_UNSCREENED are zero.
* Fixed copy paste error in add_privacy_params() dealing with RPID
privacy.
* Pulled the id->number.valid test from add_privacy_header() and
add_privacy_params() up into the parent function add_id_headers() to skip
adding PAI/RPID headers earlier.
* Made update_connected_line_information() not send out connected line
updates if the connected line number is invalid. Lower level code would
not add the party ID information and thus the sent message would be
unnecessary.
* Eliminated RAII_VAR usage in send_direct_media_request().
Review: https://reviewboard.asterisk.org/r/4472/
........
Merged revisions 432892 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432893
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Kevin Harwell [Fri, 13 Mar 2015 14:55:44 +0000 (14:55 +0000)]
Revert - res_pjsip: Allow configuration of endpoint identifier query order
Due to a break in binary compatibility with some other modules these changes
are being reverted until the issue can be resolved.
ASTERISK-24840
Reported by: Mark Michelson
........
Merged revisions 432868 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432869
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Corey Farrell [Fri, 13 Mar 2015 02:10:17 +0000 (02:10 +0000)]
Logger: Fix MALLOC_DEBUG build error.
Revision 432834 introduced a build error when MALLOC_DEBUG
is used. Switch callid threadstorage to simple
AST_THREADSTORAGE since we no longer need custom cleanup.
Reported by: Corey Farrell
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432851
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Corey Farrell [Fri, 13 Mar 2015 01:12:35 +0000 (01:12 +0000)]
Logger: Convert 'struct ast_callid' to unsigned int.
Switch logger callid's from AO2 objects to simple integers.
This helps in two ways. Copying integers is faster than
referencing AO2 objects, so this will result in a small
reduction in logger overhead. This also erases the possibility
of an infinate loop caused by an invalid callid in
threadstorage.
ASTERISK-24833 #comment Committed callid conversion to trunk.
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4466/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432834
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Thu, 12 Mar 2015 12:58:41 +0000 (12:58 +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/
........
Merged revisions 432810 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432811 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432812
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Thu, 12 Mar 2015 12:40:23 +0000 (12:40 +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)
........
Merged revisions 432807 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432808 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432809
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Wed, 11 Mar 2015 16:39:29 +0000 (16:39 +0000)]
res_pjsip: Move internal init/destroy prototypes to private header file.
Done as a separate commit from a finding in
https://reviewboard.asterisk.org/r/4467/
........
Merged revisions 432787 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432788
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Wed, 11 Mar 2015 15:26:32 +0000 (15:26 +0000)]
res_pjsip: Fix pjsip.conf type=global object default value handling.
When a type=global section is not defined in pjsip.conf the global
defaults are not applied. As a result the mandatory Max-Forwards header
is not added to SIP messages for res_pjsip/chan_pjsip.
The handling of pjsip.conf type=global objects has several problems:
1) If the global object is missing the defaults are not applied.
2) If the global object is missing the default_outbound_endpoint's default
value is not returned by ast_sip_global_default_outbound_endpoint().
3) Defines are needed so default values only need to be changed in one
place.
* Added a sorcery instance observer callback to check if there were any
type=global sections loaded. If there were more than one then issue an
error message. If there were none then apply the global defaults.
* Fixed ast_sip_global_default_outbound_endpoint() to return the
documented default when no type=global object is defined.
* Made defines for the global default values.
* Increased the default_useragent[] size because SVN version strings can
get lengthy and 128 characters may not be enough.
* Fixed an off-nominal code path ref leak in global_alloc() if the string
fields fail to initialize.
* Eliminated RAII_VAR in get_global_cfg() and
ast_sip_global_default_outbound_endpoint().
ASTERISK-24807 #close
Reported by: Anatoli
Review: https://reviewboard.asterisk.org/r/4467/
........
Merged revisions 432766 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432767
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Wed, 11 Mar 2015 15:22:01 +0000 (15:22 +0000)]
res_pjsip: Fixed invalid empty Server and User-Agent SIP headers.
Setting pjsip.conf useragent to an empty string results in an empty SIP
header being sent.
* Made not add an empty SIP header item to the global SIP headers list.
Review: https://reviewboard.asterisk.org/r/4467/
........
Merged revisions 432764 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432765
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Joshua Colp [Tue, 10 Mar 2015 23:09:49 +0000 (23:09 +0000)]
core: Don't create snapshots with locks.
Snapshots are immutable and are never changed. Allocating them
with a lock is wasteful.
Review: https://reviewboard.asterisk.org/r/4469/
........
Merged revisions 432742 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432743
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Tue, 10 Mar 2015 21:33:55 +0000 (21:33 +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)
........
Merged revisions 432720 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432721 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432722
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Tue, 10 Mar 2015 18:13:27 +0000 (18:13 +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)
........
Merged revisions 432695 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432696 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432697
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Tue, 10 Mar 2015 18:05:37 +0000 (18:05 +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)
........
Merged revisions 432691 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432693 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432694
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Tue, 10 Mar 2015 16:08:40 +0000 (16:08 +0000)]
res_pjsip_refer: Fix occasional unexpected BYE sent after receiving a REFER.
A race condition happened between initiating a transfer and requesting
that a dialog termination be delayed. Occasionally, the transferrer
channels would exit the bridge and hangup before the dialog termination
delay was requested.
* Made request dialog termination delay before initiating the transfer
action. If the transfer fails then cancel the delayed dialog termination
request.
ASTERISK-24755 #close
Reported by: John Bigelow
Review: https://reviewboard.asterisk.org/r/4460/
........
Merged revisions 432668 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432669
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Kevin Harwell [Mon, 9 Mar 2015 16:13:40 +0000 (16:13 +0000)]
res_pjsip: allow configuration of endpoint identifier query order
It's possible to have a scenario that will create a conflict between endpoint
identifiers. For instance an incoming call could be identified by two different
endpoint identifiers and the one chosen depended upon which identifier module
loaded first. This of course causes problems when, for example, the incoming
call is expected to be identified by username, but instead is identified by ip.
This patch adds a new 'global' option to res_pjsip called
'endpoint_identifier_order'. It is a comma separated list of endpoint
identifier names that specifies the order by which identifiers are processed
and checked.
ASTERISK-24840 #close
Reported by: Mark Michelson
Review: https://reviewboard.asterisk.org/r/4455/
........
Merged revisions 432638 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432639
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Joshua Colp [Sun, 8 Mar 2015 01:47:03 +0000 (01:47 +0000)]
res_rtp_asterisk: Fix wrongful use of USE_PJPROJECT define.
As pjproject is now used as a shared library a different define,
HAVE_PJPROJECT, is used to specify if pjproject is present.
ASTERISK-24830 #close
Reported by: Stefan Engström
........
Merged revisions 432614 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432615
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Fri, 6 Mar 2015 22:59:29 +0000 (22:59 +0000)]
res_pjsip_refer: Make safely get the context for a blind transfer.
Made safely get the TRANSFER_CONTEXT channel value while the channel is
locked in refer_incoming_attended_request() and
refer_incoming_blind_request(). The pointer returned by
pbx_builtin_getvar_helper() is only valid while the channel is locked.
........
Merged revisions 432594 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432595
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Fri, 6 Mar 2015 22:18:28 +0000 (22:18 +0000)]
res_pjsip_refer: Made refer_attended_alloc() not create the ao2 object with a lock.
The lock is unused.
........
Merged revisions 432574 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432579
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Jonathan Rose [Fri, 6 Mar 2015 21:38:36 +0000 (21:38 +0000)]
app: Add functions to swap voicemail function table for testing purposes
........
Merged revisions 432556 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432573
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Fri, 6 Mar 2015 20:24:58 +0000 (20:24 +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/
........
Merged revisions 432530 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432534 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432551
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Fri, 6 Mar 2015 19:34:35 +0000 (19:34 +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/
........
Merged revisions 432526 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432528 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432529
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
George Joseph [Thu, 5 Mar 2015 16:40:27 +0000 (16:40 +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/
........
Merged revisions 432484 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432485 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432486
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Wed, 4 Mar 2015 18:55:08 +0000 (18:55 +0000)]
translate: Prevent invalid memory accesses on fast shutdown
When a 'core restart now' or 'core stop now' is executed and a channel is
currently in a media operation, the translator matrix can be destroyed while a
channel is currently blocked on getting the best translation choice
(see ast_translator_best_choice). When the channel gets the mutex, the
translation matrix now has invalid memory, and Asterisk crashes.
This patch does two things:
(1) We now only clean up the translation matrix on a graceful shutdown. In that
case, there are no channels, and so there is no risk of this occurring.
(2) We also now set the __matrix and __indextable to NULL. In some initial
backtraces when this occurred, it looked as if there was a memory corruption
occurring, and it wasn't until we determined that something had restarted
Asterisk that the issue became clear. By setting these to NULL on shutdown,
it becomes a bit easier to determine why a crash is occurring.
Note that we could litter the code with NULL checks on the __matrix, but the
act of making the translation matrix cleaned up on shutdown should preclude
this issue from occurring in the first place, and this part of the code needs
to be as fast as possible.
Review: https://reviewboard.asterisk.org/r/4457/
........
Merged revisions 432453 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432455
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Mon, 2 Mar 2015 19:15:58 +0000 (19:15 +0000)]
res/res_pjsip_sdp_rtp: Revert portion of r432195
Unfortunately, while initial testing with ConfBridge did not reproduce the
audio problem alluded to in the comment in res_pjsip_sdp_rtp, further testing
did show that bridge_softmix and/or ConfBridge has a severe problem bridging
two or more participants at different sampling rates. Sometimes, it even picks
odd sampling rates that cause hideous audio problems.
This patch backs out the offending portion of the code until the issues in
the affected bridging modules can be more properly analyzed.
ASTERISK-24841
........
Merged revisions 432423 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432425
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Fri, 27 Feb 2015 18:31:31 +0000 (18:31 +0000)]
ARI: Fix crash if integer values used in JSON payload 'variables' object.
Sending the following ARI commands caused Asterisk to crash if the JSON
body 'variables' object passes values of types other than strings.
POST /ari/channels
POST /ari/channels/{channelid}
PUT /ari/endpoints/sendMessage
PUT /ari/endpoints/{tech}/{resource}/sendMessage
* Eliminated RAII_VAR usage in ast_ari_channels_originate_with_id(),
ast_ari_channels_originate(), ast_ari_endpoints_send_message(), and
ast_ari_endpoints_send_message_to_endpoint().
ASTERISK-24751 #close
Reported by: jeffrey putnam
Review: https://reviewboard.asterisk.org/r/4447/
........
Merged revisions 432404 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432405
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Scott Griepentrog [Thu, 26 Feb 2015 18:53:36 +0000 (18:53 +0000)]
Dial API: add self destruct option when complete
This patch adds a self-destruction option to the
dial api. The usefulness of this is mostly when
using async mode to spawn a separate thread used
to handle the new call, while the calling thread
is allowed to go on about other business.
The only alternative to this option would be the
calling thread spawning a new thread, or hanging
around itself waiting to destroy the dial struct
after completion.
Example of use (minus error checking):
struct ast_dial *dial = ast_dial_create();
ast_dial_append(dial, "PJSIP", "200", NULL);
ast_dial_option_global_enable(dial, AST_DIAL_OPTION_ANSWER_EXEC, "Echo");
ast_dial_option_global_enable(dial, AST_DIAL_OPTION_SELF_DESTROY, NULL);
ast_dial_run(dial, NULL, 1);
The dial_run call will return almost immediately
after spawning the new thread to run and monitor
the dial. If the call is answered, it is placed
into the echo app. When completed, it will call
ast_dial_destroy() on the dial structure.
Note that any allocations made to pass values to
ast_dial_set_user_data() or dial options must be
free'd in a state callback function on any of:
AST_DIAL_RESULT_UNASWERED,
AST_DIAL_RESULT_ANSWERED,
AST_DIAL_RESULT_HANGUP, or
AST_DIAL_RESULT_TIMEOUT.
Review: https://reviewboard.asterisk.org/r/4443/
........
Merged revisions 432385 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432386
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Kevin Harwell [Thu, 26 Feb 2015 17:12:12 +0000 (17:12 +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/
........
Merged revisions 432362 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432363 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432364
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Thu, 26 Feb 2015 04:58:38 +0000 (04:58 +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
........
Merged revisions 432341 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432342 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432343
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Thu, 26 Feb 2015 03:03:39 +0000 (03:03 +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)
........
Merged revisions 432320 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432321 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432322
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Rusty Newton [Wed, 25 Feb 2015 23:49:21 +0000 (23:49 +0000)]
configs/basic-pbx - Super Awesome Company example configs Phase 1, Patch 1
Example configuration files for a "basic PBX" deployment for the fictitious
Super Awesome Company. Details at https://reviewboard.asterisk.org/r/4379/
and https://wiki.asterisk.org/wiki/display/AST/Super+Awesome+Company
Reported by: Malcolm Davenport
Tested by: Rusty Newton
Review: https://reviewboard.asterisk.org/r/4379/
........
Merged revisions 432301 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432302
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Wed, 25 Feb 2015 23:09:51 +0000 (23:09 +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.
........
Merged revisions 432280 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432281 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432282
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Wed, 25 Feb 2015 23:05:40 +0000 (23:05 +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
........
Merged revisions 432277 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432278 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432279
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Wed, 25 Feb 2015 21:42:39 +0000 (21:42 +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
........
Merged revisions 432239 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432258 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432259
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
David M. Lee [Wed, 25 Feb 2015 20:47:39 +0000 (20:47 +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/
........
Merged revisions 432236 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432237 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432238
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Tue, 24 Feb 2015 23:00:24 +0000 (23:00 +0000)]
config.h: Use real parameter names for ast_variable_new() define.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432220
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Tue, 24 Feb 2015 22:14:44 +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
........
Merged revisions 432198 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432199 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432200
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Tue, 24 Feb 2015 22:00:51 +0000 (22:00 +0000)]
ARI/PJSIP: Apply requesting channel's format cap to created channels
This patch addresses the following problems:
* ari/resource_channels: In ARI, we currently create a format capability
structure of SLIN and apply it to the new channel being created. This was
originally done when the PBX core was used to create the channel, as there
was a condition where a newly created channel could be created without any
formats. Unfortunately, now that the Dial API is being used, this has two
drawbacks:
(a) SLIN, while it will ensure audio will flows, can cause a lot of
needless transcodings to occur, particularly when a Local channel is
created to the dialplan. When no format capabilities are available, the
Dial API handles this better by handing all audio formats to the requsted
channels. As such, we defer to that API to provide the format
capabilities.
(b) If a channel (requester) is causing this channel to be created, we
currently don't use its format capabilities as we are passing in our own.
However, the Dial API will use the requester channel's formats if none
are passed into it, and the requester channel exists and has format
capabilities. This is the "best" scenario, as it is the most likely to
create a media path that minimizes transcoding.
Fixing this simply entails removing the providing of the format capabilities
structure to the Dial API.
* chan_pjsip: Rather than blindly picking the first format in the format
capability structure - which actually *can* be a video or text format - we
select an audio format, and only pick the first format if that fails. That
minimizes the weird scenario where we attempt to transcode between video/audio.
* res_pjsip_sdp_rtp: Applied the joint capapbilites to the format structure.
Since ast_request already limits us down to one format capability once the
format capabilities are passed along, there's no reason to squelch it here.
* channel: Fixed a comment. The reason we have to minimize our requested
format capabilities down to a single format is due to Asterisk's inability
to convey the format to be used back "up" a channel chain. Consider the
following:
PJSIP/A => L;1 <=> L;2 => PJSIP/B
g,u,a g,u,a g,u,a u
That is, we have PJSIP/A dialing a Local channel, where the Local;2 dials
PJSIP/B. PJSIP/A has native format capabilities g722,ulaw,alaw; the Local
channel has inherited those format capabilities down the line; PJSIP/B
supports only ulaw. According to these format capabilities, ulaw is
acceptable and should be selected across all the channels, and no
transcoding should occur. However, there is no way to convey this: when L;2
and PJSIP/B are put into a bridge, we will select ulaw, but that is not
conveyed to PJSIP/A and L;1. Thus, we end up with:
PJSIP/A <=> L;1 <=> L;2 <=> PJSIP/B
g g X u u
Which causes g722 to be written to PJSIP/B.
Even if we can convey the 'ulaw' choice back up the chain (which through
some severe hacking in Local channels was accomplished), such that the chain
looks like:
PJSIP/A <=> L;1 <=> L;2 <=> PJSIP/B
u u u u
We have no way to tell PJSIP/A's *channel driver* to Answer in the SDP back
with only 'ulaw'. This results in all the channel structures being set up
correctly, but PJSIP/A *still* sending g722 and causing the chain to fall
apart.
There's a lot of difficulty just in setting this up, as there are numerous
race conditions in the act of bridging, and no clean mechanism to pass the
selected format backwards down an established channel chain. As such, the
best that can be done at this point in time is clarifying the comment.
Review: https://reviewboard.asterisk.org/r/4434/
ASTERISK-24812 #close
Reported by: Matt Jordan
........
Merged revisions 432195 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432196
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Kevin Harwell [Tue, 24 Feb 2015 18:38:03 +0000 (18:38 +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/
........
Merged revisions 432174 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432175 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432176
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Joshua Colp [Sat, 21 Feb 2015 20:48:17 +0000 (20:48 +0000)]
res_ari_channels: Return a 404 response when a requested channel variable does not exist.
This change makes it so that if a channel variable is requested and it does not exist
a 404 response will be returned instead of an allocation failed response. This makes
it easier to debug and figure out what is going on for a user.
ASTERISK-24677 #close
Reported by: Joshua Colp
........
Merged revisions 432154 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432155
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Joshua Colp [Sat, 21 Feb 2015 19:28:09 +0000 (19:28 +0000)]
res_pjsip_registrar: Add Expires header to 200 OK if present in REGISTER.
Some implementations don't pay attention to the expires for individual contacts.
In this case they may consider the lack of an Expires header in the 200 OK as
unregistered. This change makes it so if an Expires header is present in the REGISTER
we will add one in the 200 OK.
ASTERISK-24785 #close
Reported by: Ross Beer
........
Merged revisions 432136 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432137
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Joshua Colp [Sat, 21 Feb 2015 18:53:34 +0000 (18:53 +0000)]
res_pjsip: Add a log message when creating a UAC dialog to a target URI that is invalid.
ASTERISK-24499 #close
Reported by: Rusty Newton
........
Merged revisions 432118 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432119
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Sat, 21 Feb 2015 17:36:39 +0000 (17:36 +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)
........
Merged revisions 432098 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432099 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432100
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Joshua Colp [Sat, 21 Feb 2015 14:06:20 +0000 (14:06 +0000)]
http: Add missing html tag to 'httpstatus' functionality.
ASTERISK-24724 #close
Reported by: Ashley Sanders
........
Merged revisions 432078 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432079 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432080
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Corey Farrell [Sat, 21 Feb 2015 02:58:19 +0000 (02:58 +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/
........
Merged revisions 432058 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432059 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432060
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Corey Farrell [Sat, 21 Feb 2015 02:51:35 +0000 (02:51 +0000)]
main/asterisk.c: Reverse #if statement in listener() to fix code folding.
listener() opens the same code block in two places (#if and #else). This
confuses some folding editors causing it to think that an extra code block
was opened. Folding in 'geany' causes all code after listener() to be
folded as if it were part of that procedure.
ASTERISK-24813 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4435/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432057
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Corey Farrell [Sat, 21 Feb 2015 02:47:44 +0000 (02:47 +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/
........
Merged revisions 432054 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432055 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432056
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Fri, 20 Feb 2015 17:55:41 +0000 (17:55 +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.
........
Merged revisions 432032 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432034 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432036
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
George Joseph [Fri, 20 Feb 2015 17:53:33 +0000 (17:53 +0000)]
ASTERISK-24811: Add ast_sorcery_apply_config() to res_pjsip_publish_asterisk.
Matt Hoskins reported that res_pjsip_publish_asterisk wouldn't pull config from
realtime. Turns out it was just missing a call ast_sorcery_apply_config().
res_pjsip_acl was missing it as well, so I added it. The other pjsip modules
looked OK.
ASTERISK-24811 #close
Reported-by: Matt Hoskins
Tested-by: George Joseph
Tested-by: Matt Hoskins
patches:
res_pjsip_publish_asterisk.c.patch submitted by Matt Hoskins (license 6688)
Review: https://reviewboard.asterisk.org/r/4433/
........
Merged revisions 432033 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432035
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Fri, 20 Feb 2015 15:47:46 +0000 (15:47 +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)
........
Merged revisions 432012 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432013 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432014
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Thu, 19 Feb 2015 21:26:55 +0000 (21:26 +0000)]
chan_dahdi: Remove some dead code.
........
Merged revisions 431992 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 431993 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431994
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Thu, 19 Feb 2015 18:26:49 +0000 (18:26 +0000)]
ISDN AOC: Fix crash from an AOC-E message that doesn't have a channel association.
Processing an AOC-E event that does not or no longer has a channel
association causes a crash.
The problem with posting AOC events to the channel topic is that AOC-E
events don't always have a channel association and posting the event to
the all channels topic is just wrong. AOC-E events do however have their
own charging association method to refer to the agreement with the
charging entity.
* Changed the AOC events to post to the AMI manager topic instead of the
channel topics. If a channel is associated with the event then channel
snapshot information is supplied with the AMI event.
* Eliminated RAII_VAR() usage in aoc_to_ami() and ast_aoc_manager_event().
This patch supercedes the patch on Review: https://reviewboard.asterisk.org/r/4427/
ASTERISK-22670 #close
Reported by: klaus3000
ASTERISK-24689 #close
Reported by: Marcel Manz
ASTERISK-24740 #close
Reported by: Panos Gkikakis
Review: https://reviewboard.asterisk.org/r/4430/
........
Merged revisions 431974 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431975
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Thu, 19 Feb 2015 17:37:00 +0000 (17:37 +0000)]
res_pjsip_refer: Handle INVITE with Replaces failure after answer.
* Fixed hangup handling of the session->channel after answer if the
ast_channel_move() or ast_bridge_impart() fails. We are still the thread
controlling the session->channel so we need to call ast_hangup() to kill
the channel.
* Fixed debug messages in refer_incoming_invite_request() referencing
incorrect channnels on success. Code comments now say why the
session->channel cannot be used.
Review: https://reviewboard.asterisk.org/r/4422/
........
Merged revisions 431956 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431957
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Thu, 19 Feb 2015 15:28:56 +0000 (15:28 +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)
........
Merged revisions 431936 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 431937 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431938
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Corey Farrell [Thu, 19 Feb 2015 02:03:01 +0000 (02:03 +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/
........
Merged revisions 431916 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 431917 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431918
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Tue, 17 Feb 2015 15:34:10 +0000 (15:34 +0000)]
res_pjsip_refer: Fix crash from a REFER and BYE collision.
Analyzing a one-off crash on a busy system showed that processing a REFER
request had a NULL session channel pointer. The only way I can think of
that could cause this is if an outgoing BYE transaction overlapped the
incoming REFER transaction in a collision. Asterisk sends a BYE while the
phone sends a REFER to complete an attended transfer.
* Made check the session channel pointer before processing an incoming
REFER request in res_pjsip_refer.
* Fixed similar crash potential for res_pjsip supplement incoming request
processing for res_pjsip_sdp_rtp INFO, res_pjsip_caller_id INVITE/UPDATE,
res_pjsip_messaging MESSAGE, and res_pjsip_send_to_voicemail REFER
messages.
* Made res_pjsip_messaging respond to a message body too large with a 413
instead of ignoring it.
ASTERISK-24700 #close
Reported by: Zane Conkle
Review: https://reviewboard.asterisk.org/r/4417/
........
Merged revisions 431898 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431899
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Mon, 16 Feb 2015 21:29:39 +0000 (21:29 +0000)]
res/res_rtp_asterisk: Fix crash in debug from RTCP reports without report block
When RTCP debugging was enabled, an RTCP report without a report block would
cause a crash. This was due to the verbose output not checking to see if the
report_block pointer was NULl before dereferencing it.
This patch adds the necessary check to prevent printing any verbose output
if the far side hasn't provided us the information they should have.
ASTERISK-24791 #close
Reported by: JoshE
Tested by: JoshE
........
Merged revisions 431879 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431880
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Joshua Colp [Sun, 15 Feb 2015 19:01:44 +0000 (19:01 +0000)]
pjsip: Remove "contact" type from pjsip.conf.sample
The "contact" object is not meant to be configured from the pjsip.conf
configuration file. It is meant to be created as a result of a registration
and stored elsewhere.
ASTERISK-24085 #close
Reported by: Rusty Newton
........
Merged revisions 431860 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431861
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Joshua Colp [Sun, 15 Feb 2015 18:00:18 +0000 (18:00 +0000)]
install_prereq: Tweak flags when configuring pjproject.
This change does two things:
1. Disables debugging so assertions which can return an error do,
instead of asserting.
2. Enables IPv6 support.
ASTERISK-24632 #close
Reported by: Rusty Newton
........
Merged revisions 431843 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431844
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Joshua Colp [Sun, 15 Feb 2015 17:43:21 +0000 (17:43 +0000)]
res_sorcery_config: Improve object lookup times.
The res_sorcery_config module currently uses a fixed bucket
size of 53. This means that depending on the number of objects
you either end up with excess buckets or a lot of collisions.
Due to the way that res_sorcery_config is implemented it's actually
possible to make the bucket size dynamic based on the number of
objects. This is due to the fact that each loading of the config file
produces a new container and does not modify the existing one.
This change uses the number of expected objects and finds a prime
number near it. In practice depending on the number of objects this
can speed up lookups anywhere from 2X to 15X. This change also removes
the lock from the container as it is not needed.
Review: https://reviewboard.asterisk.org/r/4423/
........
Merged revisions 431841 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431842
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Joshua Colp [Sun, 15 Feb 2015 16:01:09 +0000 (16:01 +0000)]
res_pjsip: Add "pjsip show version" CLI command.
When debugging things it can be useful to know absolutely what
version of pjproject res_pjsip is running against. This change
adds a "pjsip show version" CLI command which can be used to
query for this.
ASTERISK-24685 #close
Reported by: Joshua Colp
Review: https://reviewboard.asterisk.org/r/4424/
........
Merged revisions 431824 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431825
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Joshua Colp [Sun, 15 Feb 2015 12:41:06 +0000 (12:41 +0000)]
res_timing_pthread: Fix leaky pipes.
During some refactoring the way private information for timers
was stored was changed. As a result of this the action which normally
removed the timer upon closure in res_timing_pthread was also removed
causing the timer to remain after it should using up resources.
This change ensures that the timer is removed upon closure.
ASTERISK-24768 #close
Reported by: Matthias Urlichs
patches:
timer.patch submitted by Matthias Urlichs (license 5508)
........
Merged revisions 431807 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431808
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Sun, 15 Feb 2015 00:33:22 +0000 (00:33 +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.
........
Merged revisions 431788 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 431789 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431790
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Joshua Colp [Sat, 14 Feb 2015 19:46:09 +0000 (19:46 +0000)]
sorcery: Output an error message if a wizard is specified for an object type and it isn't found.
ASTERISK-24612 #close
Reported by: Joshua Colp
........
Merged revisions 431771 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431772
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Joshua Colp [Sat, 14 Feb 2015 18:31:15 +0000 (18:31 +0000)]
res_pjsip_exten_state: Improve log message when a subscription is attempted to a non-existent extension.
ASTERISK-24716 #close
Reported by: Rusty Newton
........
Merged revisions 431754 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431755
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Joshua Colp [Sat, 14 Feb 2015 18:21:02 +0000 (18:21 +0000)]
Multiple revisions 431751-431752
........
r431751 | file | 2015-02-14 14:19:07 -0400 (Sat, 14 Feb 2015) | 5 lines
chan_pjsip: Fix crash when CHANNEL dialplan function is invoked with pjsip argument and no type.
ASTERISK-24771 #close
Reported by: Niklas Larsson
........
r431752 | file | 2015-02-14 14:20:27 -0400 (Sat, 14 Feb 2015) | 2 lines
'information' ends with an 'n'.
........
Merged revisions 431751-431752 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431753
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Fri, 13 Feb 2015 17:24:08 +0000 (17:24 +0000)]
res_pjsip_session: Fix double re-INVITE collision crash.
A multi-asterisk box setup with direct media enabled would occasionally
crash when two re-INVITE collisions on a call leg happen in a row.
The re-INVITE logic only had one timer struct to defer the re-INVITE.
When the second collision happens the timer struct is overwritten and put
into the timer heap again. Resources for the first timer are leaked and
the heap has two positions occupied by the same timer struct. Now the
heap ordering is potentially corrupted, the timer will fire twice, and any
resources allocated for the second timer will be released twice.
* The solution is to put the collided re-INVITE into the delayed requests
queue with all the other delayed requests and cherry pick the next request
that can come off the queue when an event happens.
* Changed to put delayed BYE requests at the head of the delayed queue.
There is no sense in processing delayed UPDATEs and re-INVITEs when a BYE
has been requested.
* Made the start of a BYE request flush the delayed requests queue to
prevent a delayed request from overlapping the BYE transaction. I saw a
few cases where a delayed re-INVITE got started after the BYE transaction
started.
* Changed the delayed_request struct to use an enum instead of a string
for the request method. Cherry picking the queue is easier with an enum
than string comparisons and the compiler can warn if a switch statement
does not cover all defined enum values.
* Improved the debug output to give more information. It helps to know
which channel is involved with an endpoint. Trunks can have many channels
associated with the endpoint at the same time.
ASTERISK-24727 #close
Reported by: Mark Michelson
Review: https://reviewboard.asterisk.org/r/4414/
........
Merged revisions 431734 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431735
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Thu, 12 Feb 2015 20:34:37 +0000 (20:34 +0000)]
ARI/PJSIP: Add the ability to redirect (transfer) a channel in a Stasis app
This patch adds a new feature to ARI to redirect a channel to another server,
and fixes a few bugs in PJSIP's handling of the Transfer dialplan
application/ARI redirect capability.
*New Feature*
A new operation has been added to the ARI channels resource, redirect. With
this, a channel in a Stasis application can be redirected to another endpoint
of the same underlying channel technology.
*Bug fixes*
In the process of writing this new feature, two bugs were fixed in the PJSIP
stack:
(1) The existing .transfer channel callback had the limitation that it could
only transfer channels to a SIP URI, i.e., you had to pass
'PJSIP/sip:foo@my_provider.com' to the dialplan application. While this is
still supported, it is somewhat unintuitive - particularly in a world full
of endpoints. As such, we now also support specifying the PJSIP endpoint to
transfer to.
(2) res_pjsip_multihomed was, unfortunately, trying to 'help' a 302 redirect by
updating its Contact header. Alas, that resulted in the forwarding
destination set by the dialplan application/ARI resource/whatever being
rewritten with very incorrect information. Hence, we now don't bother
updating an outgoing response if it is a 302. Since this took a looong time
to find, some additional debug statements have been added to those modules
that update the Contact headers.
Review: https://reviewboard.asterisk.org/r/4316/
ASTERISK-24015 #close
Reported by: Private Name
ASTERISK-24703 #close
Reported by: Matt Jordan
........
Merged revisions 431717 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431718
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Kevin Harwell [Wed, 11 Feb 2015 18:03:01 +0000 (18:03 +0000)]
res_pjsip: dtls_handler causes Asterisk to crash
There have been a couple of times where a crash occurred in the dtls_handler
section of the code for res_pjsip. Unfortunately, in working this issue the
problem was unable to be reproduced. After looking at the backtraces and
through the code the current best guess as to why this happened might be due
to a reentrance problem and the strtok function. So, the current fix is to
convert the strtok function into the reentrant version of the function,
strtok_r.
ASTERISK-24741 #close
Reported by: Zane Conkle
Review: https://reviewboard.asterisk.org/r/4409/
........
Merged revisions 431698 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431699
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Kevin Harwell [Wed, 11 Feb 2015 17:45:00 +0000 (17:45 +0000)]
ari_websockets: removed extra check on websocket session read
When merging the websocket timeout issue (ASTERISK-24701) an extra, almost
duplicate, check was left in the code that should not have been. This removes
it.
ASTERISK-24701 #close
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/4412/
........
Merged revisions 431693 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431695
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Richard Mudgett [Wed, 11 Feb 2015 17:39:13 +0000 (17:39 +0000)]
HTTP: Stop accepting requests on final system shutdown.
There are three CLI commands to stop and restart Asterisk each.
1) core stop/restart now - Hangup all calls and stop or restart Asterisk.
New channels are prevented while the shutdown request is pending.
2) core stop/restart gracefully - Stop or restart Asterisk when there are
no calls remaining in the system. New channels are prevented while the
shutdown request is pending.
3) core stop/restart when convenient - Stop or restart Asterisk when there
are no calls in the system. New calls are not prevented while the
shutdown request is pending.
ARI has made stopping/restarting Asterisk more problematic. While a
shutdown request is pending it is desirable to continue to process ARI
HTTP requests for current calls. To handle the current calls while a
shutdown request is pending, a new committed to shutdown phase is needed
so ARI applications can deal with the calls until the system is fully
committed to shutdown.
* Added a new shutdown committed phase so ARI applications can deal with
calls until the final committed to shutdown phase is reached.
* Made refuse new HTTP requests when the system has reached the final
system shutdown phase. Starting anything while the system is actively
releasing resources and unloading modules is not a good thing.
* Split the bridging framework shutdown to not cleanup the global bridging
containers when shutting down in a hurry. This is similar to how other
modules prevent crashes on rapid system shutdown.
* Moved ast_begin_shutdown(), ast_cancel_shutdown(), and
ast_shutting_down(). You should not have to include channel.h just to
access these system functions.
ASTERISK-24752 #close
Reported by: Matthew Jordan
Review: https://reviewboard.asterisk.org/r/4399/
........
Merged revisions 431692 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431694
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Wed, 11 Feb 2015 17:13:28 +0000 (17:13 +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)
........
Merged revisions 431673 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 431674 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431675
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Corey Farrell [Wed, 11 Feb 2015 17:03:04 +0000 (17:03 +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/
........
Merged revisions 431662 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 431663 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431672
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Kevin Harwell [Wed, 11 Feb 2015 16:52:55 +0000 (16:52 +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. Also a notice is logged stating that the websocket was
disconnected.
ASTERISK-24701 #close
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/4412/
........
Merged revisions 431669 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 431670 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431671
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
George Joseph [Tue, 10 Feb 2015 23:17:17 +0000 (23:17 +0000)]
res_pjsip_config_wizard: Add ability to auto-create hints.
Looking at the Super Awesome Company sample reminded me that creating hints is
just plain gruntwork. So you can now have the pjsip conifg wizard auto-create
them for you.
Specifying 'hint_exten' in the wizard will create
'exten => <hint_exten>,hint/PJSIP/<wizard_id>'
in whatever is specified for 'hint_context'.
Specifying 'hint_application' in the wizard will create
'exten => <hint_exten>,1,<hint_application>'
in whatever is specified for 'hint_context'.
The default for 'hint_context' is the endpoint's context.
There's no default for 'hint_application'. If not specified, no app is added.
There's no default for 'hint_exten'. If not specified, neither the hint itself
nor the application will be created.
Some may think this is the slippery slope to users.conf but hints are a basic
necessity for phones unlike voicemail, manager, etc that users.conf creates.
Tested-by: George Joseph
Review: https://reviewboard.asterisk.org/r/4383/
........
Merged revisions 431643 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431644
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Mon, 9 Feb 2015 03:12:16 +0000 (03:12 +0000)]
res/ari/resource_channels: Add missing 'no_answer' reason to DELETE /channels
One of the canonical reasons for hanging up a channel is because the far end
failed to answer - or because someone else answered, and we want to get rid of
this channel. This patch adds the missing value to the 'reason' query parameter
for the DELETE /channels operation.
Review: https://reviewboard.asterisk.org/r/4400
ASTERISK-24745 #close
Reported by: Ben Merrills
patches:
add_no_answer_ari_hangup_cause.diff uploaded by Ben Merrills (License 6678)
........
Merged revisions 431622 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431623
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Mon, 9 Feb 2015 02:35:31 +0000 (02:35 +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)
........
Merged revisions 431617 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 431618 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431619
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Matthew Jordan [Sun, 8 Feb 2015 17:24:22 +0000 (17:24 +0000)]
res/res_pjsip_sdp_rtp: Fix leak of local ICE candidates when applying to SDP
When an SDP is created for an outgoing request/response, the ICE candidates
obtained from the RTP instance are currently leaked. This causes the ao2
container that holds the candidates to never properly be reclaimed when the
RTP instance is destroyed.
This patch properly decrements the ICE candidates' container if it is
successfully obtained.
ASTERISK-24769 #close
Reported by: Matt Jordan
........
Merged revisions 431600 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431601
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
Scott Griepentrog [Fri, 6 Feb 2015 21:26:46 +0000 (21:26 +0000)]
various: cleanup issues found during leak hunt
In this collection of small patches to prevent
Valgrind errors are: fixes for reference leaks
in config hooks, evaluating a parameter beyond
bounds, and accessing a structure after a lock
where it could have been already free'd.
Review: https://reviewboard.asterisk.org/r/4407/
........
Merged revisions 431583 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431584
65c4cc65-6c06-0410-ace0-
fbb531ad65f3