Commit graph

24118 commits

Author SHA1 Message Date
Matt Jordan
96bbcf495a main/pbx: Resolve case sensitivity regression in PBX hints
When 8297136f was merged for ASTERISK-25040, a regression was introduced
surrounding the case sensitivity of device names within hints.
Previously, device names - such as 'sip/foo' - were compared in a case
insensitive fashion. Thus, 'sip/foo' was equivalent to 'SIP/foo'. After
that patch, only the case sensitive name would match, i.e., 'SIP/foo'.
As a result, some dialplan hints stopped working.

This patch re-introduces case insensitive matching for device names in
hints.

ASTERISK-25040

ASTERISK-25202 #close

Change-Id: If5046a7d14097e1e3c12b63092b9584bb1e9cb4c
2015-06-26 20:38:58 -05:00
Matt Jordan
353dd68cd0 Merge "chan_sip: Prevent deadlock when performing BYE with Also transfer." into 11 2015-06-16 09:59:32 -05:00
Damian Ivereigh
8b60998d29 chan_sip.c: Update dialog fromtag after request with auth
If a client sends and INVITE which is 401 rejected, then subsequently
sends a new INVITE with the auth info and uses a different fromtag
from the first INVITE, Asterisk will accept the new INVITE as part of
the original dialog - match_req_to_dialog() specifically ignores the
fromtag. However it does not update the stored dialog with the new
fromtag.

This results in Asterisk being unable to match future packets that are
part of this dialog (such as the ACK to the OK or the OK to the BYE),
and the call is dropped.

This problem was originally found when using an NEC-i SV8100-GE (NEC SIP
Card).

* After a successful match of a packet to the dialog, if the packet is
  not a SIP_RESPONSE, authentication is present and the fromtags are
  different, the stored fromtag is updated with the one from the recent
  INVITE.

ASTERISK-25154 #close
Reported by: Damian Ivereigh
Tested by: Damian Ivereigh

Change-Id: I5c16cf3b409e5ef9f2b2fe974b6bd2a45a6aa17e
2015-06-12 09:02:16 -05:00
Mark Michelson
d821f56b02 chan_sip: Prevent deadlock when performing BYE with Also transfer.
When a BYE with an Also header is successfully processed, and the sender
of the BYE is bridged with another channel, chan_sip will unlock the
owner of the dialog on which the BYE was received, call ast_async_goto()
on the bridged channel, and then re-lock the owner. The reason for this
locking behavior is that ast_async_goto() can result in a masquerade,
which requires that the involved channels are unlocked.

The problem here is that this causes a locking inversion since the
dialog's lock is held when re-locking the owner channel after the async
goto. The lock order is supposed to be channel and then sip_pvt.

The fix proposed is simple. In addition to unlocking the owner channel
before the ast_async_goto() call, also unlock the sip_pvt. Then relock
both after ast_async_goto() returns, being sure to lock the channel and
then the sip_pvt.

ASTERISK-25139 #close
Reported by Gregory Massel

Change-Id: I72c4fc295ec8573bee599e8e9213c5350a3cd224
2015-06-11 17:04:36 -05:00
Joshua Colp
c164bd2613 Merge "weakref attribute detection broken with gcc 4.6 and higher" into 11 2015-06-10 12:13:17 -05:00
Corey Farrell
53658a14cc Fix unsafe uses of ast_context pointers.
Although ast_context_find, ast_context_find_or_create and
ast_context_destroy perform locking of the contexts table,
any context pointer can become invalid at any time that the
contexts table is unlocked. This change adds locking around
all complete operations involving these functions.

Places where ast_context_find was followed by ast_context_destroy
have been replaced with calls ast_context_destroy_by_name.

ASTERISK-25094 #close
Reported by: Corey Farrell

Change-Id: I1866b6787730c9c4f3f836b6133ffe9c820734fa
2015-06-08 11:23:38 -04:00
ibercom
eed9b1ce52 CLI: Cosmetic issue - core show uptime
Show uptime information ends with an unnecessary space.

Now NEEDCOMMA is better defined.

Change-Id: I11b360504a0703309ff51772ff8f672287f3c5a1
2015-06-04 20:07:26 +02:00
ibercom
f98c458c92 weakref attribute detection broken with gcc 4.6 and higher
GCC 4.7 Manual:
http://gcc.gnu.org/onlinedocs/gcc-4.7.4/gcc/Function-Attributes.html

weakref ("target")

A weak reference is an alias that does not by itself require a definition
to be given for the target symbol.

ASTERISK-22559 #close
Reported by: Ibercom

Change-Id: I36a136cae947b65187a697533416f9ff9a0b8cdf
2015-06-04 13:34:30 +02:00
Ivan Poddubny
99c54fe42d Fix buffer overflow in slin sample frames generation.
The length of frames retured by sample functions was twice as large as
real, what caused global buffer overflow caught by AddressSanitizer.

ASTERISK-24717 #close
Reported by: Badalian Vyacheslav

Change-Id: Iec2fe682aef13e556684912f906bedf7c18229c6
2015-05-31 12:30:16 -05:00
Ivan Poddubny
f9877139df Astobj2: Correctly treat hash_fn returning INT_MIN
The code in astobj2_hash.c wrongly assumed that abs(int) is always > 0.
However, abs(INT_MIN) = INT_MIN and is still negative, as well as
abs(INT_MIN) % num_buckets, and as a result this led to a crash.

One way to trigger the bug is using host=::80 or 0.0.0.128 in peer
configuration section in chan_sip or chan_iax.

This patch takes the remainder before applying abs, so that bucket
number is always in range.

ASTERISK-25100 #close
Reported by: Mark Petersen

Change-Id: Id6981400ad526f47e10bcf7b847b62bd2785e899
2015-05-25 10:12:59 +03:00
Matt Jordan
8f431d679f Merge "audiohook.c: Difference in read/write rates caused continuous buffer resets" into 11 2015-05-21 07:22:07 -05:00
Matt Jordan
5c047d4b0d Merge "Logger: Reset defaults before processing config." into 11 2015-05-21 07:21:50 -05:00
Corey Farrell
58de286467 Logger: Reset defaults before processing config.
Reset options to default values before reloading config.  This ensures
that if a setting is removed or commented out of the configuration file
it is unset on reload.

ASTERISK-25112 #close
Reported by: Corey Farrell

Change-Id: Id24bb1fb0885c2c14cf8bd6f69a0c2ee7cd6c5bd
2015-05-20 21:53:46 -04:00
Corey Edwards
2d297c7b9a chan_sip/sdp_crypto.c: allow SDP crypto tag to be up to 9 digits
ASTERISK-24887 #close
Reported by: Makoto Dei
Tested by: tensai

Change-Id: I6a96f572adb17f76b3acafe503a01c48eb5dd9bf
2015-05-20 17:03:22 -05:00
Kevin Harwell
58970f1475 audiohook.c: Difference in read/write rates caused continuous buffer resets
Currently, everytime a sample rate change occurs (on read or write) the
associated factory buffers are reset. If the requested sample rate on a
read differed from that of a write then the buffers are continually reset
on every read and write. This has the side effect of emptying the buffer,
thus there being no data to read and then write to a file in the case of
call recording.

This patch fixes it so that an audiohook_list's rate always maintains the
maximum sample rate among hooks and formats. Audiohook sample rates are
only overwritten by this value when slin native compatibility is turned on.
Also, the audiohook sample rate can only overwrite the list's sample rate
when its rate is greater than that of the list or if compatibility is
turned off. This keeps the rate from constantly switching/resetting.

ASTERISK-24944 #close
Reported by: Ronald Raikes

Change-Id: Idab4dfef068a7922c09cc631dda27bc920a6c76f
2015-05-20 16:07:51 -05:00
Jonathan Rose
cf1190cc6b Message.c: Clear message channel frames on cleanup
The message channel is a special channel that doesn't actually process frames.
However, certain actions can cause frames to be placed in the channel's read
queue including the Hangup application which is called on the channel after
each message is processed. Since the channel will continually be reused for
many messages, it's necessary to flush these frames at some point.

ASTERISK-25083 #close
Reported by: Jonathan Rose

Change-Id: Idf18df73ccd8c220be38743335b5c79c2a4c0d0f
2015-05-14 11:24:17 -05:00
Joshua Colp
81b0789906 Merge "main/manager.c: Bugfix sort action_manager by alphabetically" into 11 2015-05-14 05:03:16 -05:00
Joshua Colp
3bc8c96443 Merge "General: Fix recent menuselect-related cross compile regression" into 11 2015-05-13 14:21:51 -05:00
Joshua Colp
ffb60909a3 Merge "chan_dahdi/sig_pri: Fix crash on ISDN call hangup collision." into 11 2015-05-13 12:55:09 -05:00
Joshua Colp
63d9ae01ee Merge "res_config_mysql: Fix broken column type checking" into 11 2015-05-13 12:26:19 -05:00
Rodrigo Ramírez Norambuena
be7255b563 main/manager.c: Bugfix sort action_manager by alphabetically
Fix the alphabetic order added on ast_manager_register_struct. The order
for struct manager_action added is not working, this change fixes the
problem.

Change-Id: I149da0cd06c3c4445d7516cc303358e9f26f8b4b
2015-05-13 10:46:13 -05:00
Alexandre Fournier
9370db107a res_config_mysql: Fix broken column type checking
MySQL configuration engine contains a bug in require_mysql(). This
function is used for column type checking in tables. This bug only
affects DATETIME, DATE and FLOAT types.

It came from mixing the first condition (switch-case-like
if/then/else), to check the expected column type, with the second
condition, to check the actual column type against the expected column
type. Both conditions must be checked separately in order to avoid the
execution of the wrong block.

ASTERISK-18252 #comment This patch might fix the issue
Reported by: Gareth Blades

ASTERISK-25041 #close
Reported by: Alexandre Fournier
Tested by: Alexandre Fournier

Change-Id: I0b8bf7e68ab938be8e6525a249260cb648cb0bfa
2015-05-13 06:40:48 -05:00
Yousf Ateya
e3129b84b1 res_rtp_asterisk: Correction for the limit which detects that a packet is DTLS.
First byte of DTLS packet shall be in range 20-63, not 20-64. Refer to RFC
https://tools.ietf.org/html/rfc5764#section-5.1.2 for correct values.

Change-Id: Iae6fa0d72b37c36a27fe40686e0ae6fba3afec31
2015-05-13 04:52:57 -05:00
Joshua Colp
735d337d88 Merge "cdr_pgsql: Use PQescapeStringConn for escaping names." into 11 2015-05-13 04:36:34 -05:00
Richard Mudgett
bedc7bf825 chan_dahdi/sig_pri: Fix crash on ISDN call hangup collision.
If an ISDN call is hungup by both sides at the same time a crash could
happen.

* Added missing NULL checks for the owner channel after calling
pri_queue_pvt_cause_data() in two places.  Code after those calls need to
check the owner channel pointer for NULL before use because
pri_queue_pvt_cause_data() needs to do deadlock avoidance to lock the
owner and the owner may get hung up.

ASTERISK-21893 #close
Reported by:  Alexandr Gordeev

Change-Id: Ica3e266ebc7a894b41d762326f08653e1904bb9a
2015-05-12 17:34:45 -05:00
Sebastian Kemper
53326e7ab0 General: Fix recent menuselect-related cross compile regression
MAKE_MENUSELECT currently sets CC to CC, which is the compiler for the
target platform. But menuselect is to be run on the build system, so
BUILD_CC needs to be used instead - like it was in the past, before the
recent changes (https://reviewboard.asterisk.org/r/4370/). This is the
patch for ASTERISK-25074.

ASTERISK-25074 #close
Reported by: Sebastian Kemper
Tested by: Sebastian Kemper

Change-Id: I8a2b1fc5deb6ad2b80f49baca35b1b13d468ebf8
2015-05-12 14:09:56 -05:00
Joshua Colp
cd3e851a35 Merge "Fix processing of asterisk.conf debug=yes." into 11 2015-05-12 11:57:01 -05:00
Corey Farrell
57144feed4 Fix processing of asterisk.conf debug=yes.
The code which reads asterisk.conf supports processing the debug
option with ast_true, but ast_true returns -1.  This causes debug
to still be off, convert to 1 so debug will be on as requested.

ASTERISK-25042
Reported by: Corey Farrell

Change-Id: I3c898b7d082d914b057e111b9357fde46bad9ed6
2015-05-12 10:34:01 -04:00
Rodrigo Ramírez Norambuena
4c0eb9d4fb cdr_pgsql: Use PQescapeStringConn for escaping names.
Use function PQescapeStringConn for escaping the name
of the table and schema instead of doing it manually.

Change-Id: I6709165e2d00463e9c813d24f17830ad4910b599
2015-05-12 08:16:15 -05:00
Ivan Poddubny
cc39cfa213 pbx/pbx_spool: Fix issue when call files were executed too early
pbx_spool used to delete/move the call file upon successful outgoing
call completion, but did not delete it from in-memory list of files
(dirlist, used only when compiled with inotify/kqueue support).
That resulted in an extra attempt to process that filename after
retrytime seconds.
Then, if a new file with the same name appears that is scheduled
in future further than the completed one plus its retrytime,
then it gets executed earlier than expected.

This patch fixes remove_from_queue function to also remove the entry
from the dirlist.

ASTERISK-17069 #close
Reported by: Jeremy Kister

ASTERISK-24442 #close
Reported by: tootai

Change-Id: If9ec9b88073661ce485d6b008fd0b2612e49a28b
2015-05-11 20:28:52 +00:00
Matt Jordan
fb27395f75 Merge "tcptls: Avoiding ERR_remove_state in OpenSSL." into 11 2015-05-08 15:55:38 -05:00
Matt Jordan
767d96cf7e Merge "res_rtp_asterisk: Issue ERROR if res_srtp is not found." into 11 2015-05-08 15:54:53 -05:00
Sean Bright
151c3316d5 res_rtp_asterisk: Issue ERROR if res_srtp is not found.
While trying to get WebRTC working with chan_pjsip, I was running
into the following error:

    Attempted to set an invalid DTLS-SRTP configuration on RTP
    instance...

Josh helpfully pointed out that res_srtp.so might not be loaded, and
sure enough, it wasn't. This patch adds a ERROR indiciating as much
to hopefully help others having a similar problem.

Change-Id: I13aa477b47b299876728a21b130998a0ea6cd19f
2015-05-08 18:27:37 +00:00
Rusty Newton
a2f96d3c1a sounds: Add Swedish sounds to Makefile and XML
Added the necessary lines to the Makefile and sounds.xml so we'll have the
Swedish sounds in all available formats in menuselect.

See also: Swedish sounds were added into the core sounds release 1.4.27.

ASTERISK-24744 #close

Reported by: Tove Hjelm
Tested by: Rusty Newton

Change-Id: Ib6f4fd177afd1667b2402735034001d4d055a908
2015-05-08 12:54:28 -05:00
Alexander Traud
5cca9a66bc tcptls: Avoiding ERR_remove_state in OpenSSL.
ERR_remove_state was deprecated with OpenSSL 1.0.0 and was replaced by 
ERR_remove_thread_state. ERR_load_SSL_strings and ERR_load_BIO_strings were 
called by SSL_load_error_strings already and got removed. These changes allow 
OpenSSL forks like BoringSSL to be used with Asterisk.

ASTERISK-25043 #close
Reported by: Alexander Traud
patches:
  asterisk_with_BoringSSL.patch uploaded by Alexander Traud (License 6520)

Change-Id: If1c0871ece21a7e0763fafbd2fa023ae49d4d629
(cherry picked from commit 247fef6653)
2015-05-08 08:34:44 -05:00
George Joseph
7de043e43d doc: Make progdocs play nice with git
Moved contrib/asterisk-ng-doxygen to doc/asterisk-ng-doxygen.in

Changed /Makefile to copy asterisk-ng-doxygen.in to
asterisk-ng-doxygen then modify it with version instead of
modifying asterisk-ng-doxygen directly.  Updated clean
targets as well.

Updated /.gitignore and doc/.gitignore.

Change-Id: I38712d3e334fa4baec19d30d05de8c6f28137622
2015-05-07 22:23:19 -06:00
Ivan Poddubny
97101bd481 contrib/editors: Fix vim syntax highlighting of comments in config files
* Added a lookbehind to one-line comment matcher to skip escaped
   semicolons.
 * Added support for block comments.

Change-Id: Id17dfaeda8ed4be572e8107a0c010066584aaee7
2015-05-07 14:40:55 -05:00
Richard Mudgett
d5db203024 chan_dahdi: Improve force_restart_unavailable_chans option description.
ASTERISK-25034
Reported by: Richard Mudgett

Change-Id: I1ff8f02124d2f4abd632a050da52c64285bb7f30
2015-05-06 16:00:40 -05:00
Ivan Poddubny
8d927fad0d app_queue: Fix queue_log EXITWITHTIMEOUT containing only 1 parameter
This patch fixes EXITWITHTIMEOUT queue_log entry to always come with 3
parameters: position, original position and waiting time.

ASTERISK-25038 #close
Reported by: Etienne Lessard

Change-Id: I0c62045922e26bee2125e93aee1dee17eee79618
2015-05-05 20:11:14 +00:00
Matt Jordan
e823fc9f9b Merge "cdr/cdr_csv.c: Add a new option to enable columns added in Asterisk 1.8" into 11 2015-05-04 09:25:55 -05:00
Matt Jordan
2ed57f3ab1 Merge "res_odbc: Use negative connection cache for all connections" into 11 2015-05-04 07:46:00 -05:00
Martin Tomec
7c32cb27b7 res_odbc: Use negative connection cache for all connections
Apply the negative connection cache setting to all connections,
even those that are not pooled. This ensures that the connection
will not be re-established before the negative connection cache
time is met.

ASTERISK-22708 #close

Change-Id: I431cc2e8584ab0b6908b3523d0a0e18c9a527271
2015-05-04 06:46:59 -05:00
Matt Jordan
8fed642764 Merge "Update configure.ac/Makefile for clang" into 11 2015-05-04 04:03:14 -05:00
Diederik de Groot
f70f2c6252 Update configure.ac/Makefile for clang
Created autoconf/ast_check_raii.m4: contains AST_CHECK_RAII which
checks compiler requirements for RAII:
gcc: -fnested-functions support
clang: -fblocks (and if required -lBlocksRuntime)
The original check was implemented in configure.ac and now has it's
own file. This function also sets C_COMPILER_FAMILY to either gcc or
clang for use by makefile

Created autoconf/ast_check_strsep_array_bounds.m4 (contains
AST_CHECK_STRSEP_ARRAY_BOUNDS):
which checks if clang is able to handle the optimized strsep & strcmp
functions (linux). If not, the standard libc implementation should be
used instead. Clang + the optimized macro's work with:
strsep(char *, char []), but not with strsepo(char *, char *).
Instead of replacing all the occurences throughout the source code,
not using the optimized macro version seemed easier

See 'define __strcmp_gc(s1, s2, l2) in bits/string2.h':
llvm-comment: Normally, this array-bounds warning are suppressed for
macros, so that unused paths like the one that accesses __s1[3] are
not warned about.  But if you preprocess manually, and feed the
result to another instance of clang, it will warn about all the
possible forks of this particular if statement. Instead of switching
of this optimization, another solution would be to run the preproces-
sing step with -frewrite-includes, which should preserve enough
information so that clang should still be able to suppress the diag-
nostic at the compile step later on.

See also "https://llvm.org/bugs/show_bug.cgi?id=20144"
See also "https://llvm.org/bugs/show_bug.cgi?id=11536"

Makefile.rules: If C_COMPILER_FAMILY=clang then add two warning
suppressions:
-Wno-unused-value
-Wno-parentheses-equality
In an earlier review (reviewboard: 4550 and 4554), they were deemed a
nuisace and less than benefitial.

configure.ac:
Added AST_CHECK_RAII() see earlier
Added AST_CHECK_STRSEP_ARRAY_BOUNDS() see earlier
Removed moved content

ASTERISK-24917
Change-Id: I12ea29d3bda2254ad3908e279b7effbbac6a97cb
(cherry picked from commit 9c3ed42875)
2015-05-03 10:03:08 -05:00
Matt Jordan
9764918afb Merge "Build System: Prevent unneeded changes to asterisk/buildopts.h." into 11 2015-05-03 09:20:08 -05:00
Matt Jordan
5e986ddea0 Merge "v11: More files to ignore." into 11 2015-05-02 10:20:16 -05:00
Matt Jordan
494c7a98eb Merge "main/pbx: Improve performance of dialplan reloads with a large number of hints" into 11 2015-05-02 10:16:36 -05:00
Corey Farrell
ce86340403 Build System: Prevent unneeded changes to asterisk/buildopts.h.
* Add AST_DEVMODE to BUILDOPTS
* Remove CFLAGS that do not effect ABI from BUILDOPTS.
* Use BUILDOPTS to generate AST_BUILDOPT_SUM.
* Remove loop that defined AST_MODULE_*

These changes ensure that only ABI effecting options are considered for
AST_BUILDOPT_SUM.  This also reduces unneeded full system rebuilds caused
by enabling or disabling one module that another is dependent on.

ASTERISK-25028 #close
Reported by: Corey Farrell

Change-Id: I2c516d93df9f6aaa09ae079a8168c887a6ff93a2
2015-05-01 16:51:06 -04:00
Richard Mudgett
f3bc0cc70f v11: More files to ignore.
Change-Id: If5eef47d03399ff93e3f2f490780144971f6b64a
2015-05-01 12:23:53 -05:00
Matt Jordan
8297136fdf main/pbx: Improve performance of dialplan reloads with a large number of hints
The PBX core maintains two hash tables for hints: a container of the
actual hints (hints), along with a container of devices that are watching that
hint (hintdevices). When a dialplan reload occurs, each hint in the hints
container is destroyed; this requires a lookup in the container of devices to
find the device => hint mapping object. In the current code, this performs an
ao2_callback, iterating over each of the device to hint objects in the
hintdevices container. For a large number of hints, this is extremely
expensive: dialplan reloads with 20000 hints could take several minutes
in just this phase.

This patch improves the performance of this step in the dialplan reloads
by caching which devices are watching a hint on the hint object itself.
Since we don't want to create a circular reference, we just cache the
name of the device. This allows us to perform a smarter ao2_callback on
the hintdevices container during hint removal, hashing on the name of the
device and returning an iterator to the matching names. The overall
performance improvement is rather large, taking this step down to a number of
seconds as opposed to minutes.

In addition, this patch also registers the hint containers in the PBX
core with the astobj2 library. This allows for reasonable debugging to
hash collisions in those containers.

ASTERISK-25040 #close
Reported by: Matt Jordan

Change-Id: Iedfc97a69d21070c50fca42275d7b3e714e59360
(cherry picked from commit 80c0756f73)
2015-05-01 08:44:25 -05:00