7 years agoMerge "Fix crash in codec_lpc10 when MALLOC_DEBUG is enabled."
Matt Jordan [Sat, 9 May 2015 04:33:36 +0000 (23:33 -0500)]
Merge "Fix crash in codec_lpc10 when MALLOC_DEBUG is enabled."

7 years agores_rtp_asterisk: Issue ERROR if res_srtp is not found.
Sean Bright [Fri, 8 May 2015 15:39:42 +0000 (15:39 +0000)]
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

Josh helpfully pointed out that 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

7 years agoMerge "sounds: Add Swedish sounds to Makefile and XML"
Matt Jordan [Fri, 8 May 2015 18:17:59 +0000 (13:17 -0500)]
Merge "sounds: Add Swedish sounds to Makefile and XML"

7 years agosounds: Add Swedish sounds to Makefile and XML
Rusty Newton [Thu, 7 May 2015 22:49:07 +0000 (17:49 -0500)]
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

7 years agoFix crash in codec_lpc10 when MALLOC_DEBUG is enabled.
Corey Farrell [Fri, 8 May 2015 15:30:24 +0000 (11:30 -0400)]
Fix crash in codec_lpc10 when MALLOC_DEBUG is enabled.

This switches codecs/lpc10/lpcini.c back to including "asterisk.h"
instead of <stdlib.h>.  lpcini.c allocates memory that is freed by
codec_lpc10.c, so it is important to use MALLOC_DEBUG allocator.
Added #define WRAP_LIBC_MALLOC to the start of the source to prevent
runtime symbol link error's.

Change-Id: I74f63fd09fdeb673ee7753122c3bb4722ab6e1ac

7 years agodoc: Make progdocs play nice with git
George Joseph [Thu, 7 May 2015 19:54:35 +0000 (13:54 -0600)]
doc: Make progdocs play nice with git

Moved contrib/asterisk-ng-doxygen to doc/

Changed /Makefile to copy 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

7 years agoMerge "res_pjsip_exten_state: Fix race condition between sending NOTIFY and termination"
Joshua Colp [Thu, 7 May 2015 20:10:50 +0000 (15:10 -0500)]
Merge "res_pjsip_exten_state: Fix race condition between sending NOTIFY and termination"

7 years agocontrib/editors: Fix vim syntax highlighting of comments in config files
Ivan Poddubny [Mon, 4 May 2015 19:43:20 +0000 (19:43 +0000)]
contrib/editors: Fix vim syntax highlighting of comments in config files

 * Added a lookbehind to one-line comment matcher to skip escaped
 * Added support for block comments.

Change-Id: Id17dfaeda8ed4be572e8107a0c010066584aaee7

7 years agoMerge "vector: Additional enhancements and fixes"
Matt Jordan [Thu, 7 May 2015 18:30:17 +0000 (13:30 -0500)]
Merge "vector:  Additional enhancements and fixes"

7 years agores_pjsip_exten_state: Fix race condition between sending NOTIFY and termination
Joshua Colp [Wed, 6 May 2015 18:24:29 +0000 (15:24 -0300)]
res_pjsip_exten_state: Fix race condition between sending NOTIFY and termination

The res_pjsip_exten_state module currently has a race condition between
processing the extension state callback from the PBX core and processing
the subscription shutdown callback from res_pjsip_pubsub. There is currently
no synchronization between the two. This can present a problem as while
the SIP subscription will remain valid the tree it points to may not.
This is in particular a problem as a task to send a NOTIFY may get queued
which will try to use the tree that may no longer be valid.

This change does the following to fix this problem:

1. All access to the subscription tree is done within the task that
sends the NOTIFY to ensure that no other thread is modifying or
destroying the tree. This task executes on the serializer for the

2. A reference to the subscription serializer is kept to ensure it
remains valid for the lifetime of the extension state subscription.

3. The NOTIFY task has been changed so it will no longer attempt
to send a NOTIFY if the subscription has already been terminated.

ASTERISK-25057 #close
Reported by: Matt Jordan

Change-Id: I0b3cd2fac5be8d9b3dc5e693aaa79846eeaf5643

7 years agoMerge "tcptls: Avoiding ERR_remove_state in OpenSSL."
Joshua Colp [Thu, 7 May 2015 12:07:08 +0000 (07:07 -0500)]
Merge "tcptls: Avoiding ERR_remove_state in OpenSSL."

7 years agoMerge "cdr/cdr_csv.c: Refactor, function to write content of csv file."
Matt Jordan [Thu, 7 May 2015 12:05:35 +0000 (07:05 -0500)]
Merge "cdr/cdr_csv.c: Refactor, function to write content of csv file."

7 years agoMerge topics 'ASTERISK-25049', 'ASTERISK-25056'
Matt Jordan [Thu, 7 May 2015 12:04:43 +0000 (07:04 -0500)]
Merge topics 'ASTERISK-25049', 'ASTERISK-25056'

* changes:
  CLI: Enable automatic references to modules.
  Modules: Make ast_module_info->self available to auxiliary sources.

7 years agoMerge "chan_dahdi: Improve force_restart_unavailable_chans option description."
Matt Jordan [Thu, 7 May 2015 12:02:49 +0000 (07:02 -0500)]
Merge "chan_dahdi: Improve force_restart_unavailable_chans option description."

7 years agoMerge "res_stasis_snoop: Spying on a single direction continually increases CPU"
Matt Jordan [Thu, 7 May 2015 11:39:26 +0000 (06:39 -0500)]
Merge "res_stasis_snoop: Spying on a single direction continually increases CPU"

7 years agoMerge "features: Fix crash when transferee hangs up during DTMF attended transfer."
Joshua Colp [Thu, 7 May 2015 11:27:39 +0000 (06:27 -0500)]
Merge "features: Fix crash when transferee hangs up during DTMF attended transfer."

7 years agovector: Additional enhancements and fixes
George Joseph [Wed, 6 May 2015 01:22:13 +0000 (19:22 -0600)]
vector:  Additional enhancements and fixes

After using the new vector stuff for real I found...

A bug in AST_VECTOR_INSERT_AT that could cause a seg fault.

The callbacks needed to be closer to ao2_callback in behavior
WRT to CMP_MATCH and CMP_STOP behavior and the ability to return
a vector of matched entries.

A pre-existing issue with APPEND and REPLACE was also fixed.

I also added a new macro to test.h that acts like ast_test_validate
but also accepts a return code variable and a cleanup label.  As well
as printing the error, it sets the rc variable to AST_TEST_FAIL and
does a goto to the specified label on error.  I had a local version
of this in test_vector so I just moved it.


Change-Id: I05e5e47fd02f61964be13b7e8942bab5d61b29cc

7 years agores_stasis_snoop: Spying on a single direction continually increases CPU
Kevin Harwell [Wed, 6 May 2015 22:37:51 +0000 (17:37 -0500)]
res_stasis_snoop: Spying on a single direction continually increases CPU

Creating a snoop channel in ARI and spying only on a single direction (in or
out) results in CPU utilization continually increasing until the CPU is fully
consumed. This occurs because frames are being put in the opposing direction's
slin factory queue, but not being removed.

Fixed the problem by always reading and disposing of frames from the opposite
queue of the direction selected.

ASTERISK-24938 #closes

Change-Id: I935bfd15f1db958f364d9d6b3b45582c0113dd60

7 years agochan_dahdi: Improve force_restart_unavailable_chans option description.
Richard Mudgett [Wed, 6 May 2015 21:00:40 +0000 (16:00 -0500)]
chan_dahdi: Improve force_restart_unavailable_chans option description.

Reported by: Richard Mudgett

Change-Id: I1ff8f02124d2f4abd632a050da52c64285bb7f30

7 years agoMerge "app_queue: Fix queue_log EXITWITHTIMEOUT containing only 1 parameter"
Joshua Colp [Wed, 6 May 2015 12:42:16 +0000 (07:42 -0500)]
Merge "app_queue: Fix queue_log EXITWITHTIMEOUT containing only 1 parameter"

7 years agoMerge "manager: Fix build due to missing variable usage."
Matt Jordan [Wed, 6 May 2015 12:06:11 +0000 (07:06 -0500)]
Merge "manager: Fix build due to missing variable usage."

7 years agoMerge "res_ari_bridges: Add missing dependencies."
Matt Jordan [Wed, 6 May 2015 11:13:44 +0000 (06:13 -0500)]
Merge "res_ari_bridges: Add missing dependencies."

7 years agomanager: Fix build due to missing variable usage.
Joshua Colp [Wed, 6 May 2015 09:32:54 +0000 (06:32 -0300)]
manager: Fix build due to missing variable usage.

Change-Id: I26d4d2cb9cee924632ff59ef0b30a7e6a1e2b00d

7 years agoMerge "pbx_config: Register manager actions with module version of macro."
Matt Jordan [Wed, 6 May 2015 02:05:16 +0000 (21:05 -0500)]
Merge "pbx_config: Register manager actions with module version of macro."

7 years agofeatures: Fix crash when transferee hangs up during DTMF attended transfer.
Richard Mudgett [Tue, 5 May 2015 23:17:54 +0000 (18:17 -0500)]
features: Fix crash when transferee hangs up during DTMF attended transfer.

A crash happens with this sequence of steps:
1) Party A is connected to party B.
2) Party B starts a DTMF attended transfer.
3) Party A hangs up while party B is dialing party C.

When party A hangs up the bridge that party A and party B are in is
dissolved and party B is kicked out of the bridge.  When party B finishes
dialing party C he attempts to move to the new bridge with party C.  Since
party B is no longer in a bridge the attempted move dereferences a NULL
bridge_channel pointer and crashes.

* Made the hold(), unhold(), ringing(), and the bridge_move() functions
tolerant of the channel not being in a bridge.  The assertion that party B
is always in a bridge is not true if the bridged peer of party B hangs up
and dissolves the bridge.  Being tolerant of not being in a bridge allows
the peer hangup stimulus to be processed by the FSM.

* Made the bridge_move() function return void since where the return value
for a failed move was checked generated a FSM coding ERROR message for a
normal off-nominal condition.

* Eliminated most uses of RAII_VAR in bridge_basic.c.

ASTERISK-25003 #close
Reported by: Artem Volodin

Change-Id: Ie2c1b14e5e647d4ea6de300bf56d69805d7bcada

7 years agoapp_queue: Fix queue_log EXITWITHTIMEOUT containing only 1 parameter
Ivan Poddubny [Tue, 5 May 2015 19:48:36 +0000 (19:48 +0000)]
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

7 years agochan_unistim: Fix build failure due to ACL changes.
Joshua Colp [Tue, 5 May 2015 18:34:43 +0000 (15:34 -0300)]
chan_unistim: Fix build failure due to ACL changes.

Change-Id: I57081045c72b9fcf12d5c84493278f9272c31b32

7 years agoMerge "stasis: Fix dial masquerade datastore lifetime"
Matt Jordan [Tue, 5 May 2015 18:13:01 +0000 (13:13 -0500)]
Merge "stasis: Fix dial masquerade datastore lifetime"

7 years agoMerge "vector: Traversal, retrieval, insert and locking enhancements"
Matt Jordan [Tue, 5 May 2015 17:45:41 +0000 (12:45 -0500)]
Merge "vector:  Traversal, retrieval, insert and locking enhancements"

7 years agotcptls: Avoiding ERR_remove_state in OpenSSL.
Alexander Traud [Tue, 5 May 2015 16:35:16 +0000 (18:35 +0200)]
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
  asterisk_with_BoringSSL.patch uploaded by Alexander Traud (License 6520)

Change-Id: If1c0871ece21a7e0763fafbd2fa023ae49d4d629

7 years agoMerge "Restrict functionality when ACLs are misconfigured."
Joshua Colp [Tue, 5 May 2015 15:13:23 +0000 (10:13 -0500)]
Merge "Restrict functionality when ACLs are misconfigured."

7 years agores_ari_bridges: Add missing dependencies.
Corey Farrell [Tue, 5 May 2015 14:47:43 +0000 (10:47 -0400)]
res_ari_bridges: Add missing dependencies.

Missed this module in the previous commit.  res_ari_bridges uses symbols
from res_stasis_playback and res_stasis_recording.

ASTERISK-25027 #close
Reported by: Corey Farrell

Change-Id: I90bf756abd25adfc4920d2869ebe7feb636b8c5f

7 years agopbx_config: Register manager actions with module version of macro.
Corey Farrell [Tue, 5 May 2015 14:27:15 +0000 (10:27 -0400)]
pbx_config: Register manager actions with module version of macro.

Switch manager actions in pbx_config to use the registration macro that
passes the module pointer, allowing pbx_config reference to be bumped
while the manager actions run.

ASTERISK-25061 #close
Reported by: Corey Farrell

Change-Id: I422c50dd74814616ac10c5e9c6598a0b1bc2c44e

7 years agostasis: Fix dial masquerade datastore lifetime
Joshua Colp [Mon, 4 May 2015 17:16:24 +0000 (14:16 -0300)]
stasis: Fix dial masquerade datastore lifetime

A recent change went into Asterisk which added reference counts to the
channels stored in a dial masquerade datastore. Unfortunately this
included a reference to the caller in a dialing operation. While all
of the dialed targets have the datastore removed from them upon dialing
completion this did not occur for the caller, causing it to have a
reference to itself that could go never go away (as it depended on
the destruction of the datastore which only happened when the channel
was destroyed). This resulted in the caller channel remaining on the
system despite it having hung up.

This change does the following to fix this issue:

1. The dial masquerade datastore is now removed from the caller upon
dialing completion, just like the dialed targets.
2. Upon destruction of the caller all the dialed targets are also
removed from the dial masquerade datastore (just in case).
3. The reference to the caller has been removed as it should not be
possible for the datastore to now be valid/useful after the lifetime
of the caller has ended.

ASTERISK-25025 #close

Change-Id: I1ef4ca5ca04980028604cc2af5d2992ac3431b3f

7 years agoCLI: Enable automatic references to modules.
Corey Farrell [Mon, 4 May 2015 21:41:08 +0000 (17:41 -0400)]
CLI: Enable automatic references to modules.

* Pass module to ast_cli_register and ast_cli_register_multiple.
* Add a module reference before executing any CLI callback, remove
  the reference when complete.

ASTERISK-25049 #close
Reported by: Corey Farrell

Change-Id: I7aafc7c9f2b912918f28fe51d51e9e8a755750e3

7 years agoModules: Make ast_module_info->self available to auxiliary sources.
Corey Farrell [Mon, 4 May 2015 19:26:37 +0000 (15:26 -0400)]
Modules: Make ast_module_info->self available to auxiliary sources.

ast_module_info->self is often needed to register items with the core.  Many
modules have ad-hoc code to make this pointer available to auxiliary sources.
This change updates the module build process to make the needed information
available to all sources in a module.

ASTERISK-25056 #close
Reported by: Corey Farrell

Change-Id: I18c8cd58fbcb1b708425f6757becaeca9fa91815

7 years agovector: Traversal, retrieval, insert and locking enhancements
George Joseph [Sat, 2 May 2015 00:25:17 +0000 (18:25 -0600)]
vector:  Traversal, retrieval, insert and locking enhancements

Renamed AST_VECTOR_INSERT to AST_VECTOR_REPLACE because it really
does replace not insert.  The few users of AST_VECTOR_INSERT were
refactored.  Because these are macros, there should be no ABI
compatibility issues.

Added AST_VECTOR_INSERT_AT that actually inserts an element into the
vector at a specific index pushing existing elements to the right.

Added AST_VECTOR_GET_CMP that can retrieve from the vector based
on a user-provided compare function.

Added AST_VECTOR_CALLBACK function that will execute a function
for each element in the vector.  Similar to ao2_callback and
ao2_callback_data functions although the vector callback can take
a variable number of arguments.  This should allow easy migration
to a vector where a container might be too heavy.

Added read/write locked vector and lock manipulation macros.

Added unit tests.

ASTERISK-25045 #close

Change-Id: I2e07ecc709d2f5f91bcab8904e5e9340609b00e0

7 years agomain/test.c: Add test to verify there were no registration errors.
Corey Farrell [Sun, 3 May 2015 18:55:56 +0000 (14:55 -0400)]
main/test.c: Add test to verify there were no registration errors.

This adds a test that will fail if any test failed to register. Also fail
if any test registration produced a warning about missing a leading or
trailing slash.

ASTERISK-25053 #close
Reported by: Corey Farrell

Change-Id: I93e50b8fcbcfa7f1f5b41b2c44a51685c09529c3

7 years agoMerge "contrib/ast-db-manage: Add Postgres ENUM type support in auto DTMF mode update"
Matt Jordan [Mon, 4 May 2015 14:26:17 +0000 (09:26 -0500)]
Merge "contrib/ast-db-manage: Add Postgres ENUM type support in auto DTMF mode update"

7 years agoMerge "Format Interfaces: Prevent unload except by shutdown."
Matt Jordan [Mon, 4 May 2015 14:25:42 +0000 (09:25 -0500)]
Merge "Format Interfaces: Prevent unload except by shutdown."

7 years agoMerge "res_odbc: Use negative connection cache for all connections"
Matt Jordan [Mon, 4 May 2015 12:46:12 +0000 (07:46 -0500)]
Merge "res_odbc: Use negative connection cache for all connections"

7 years agoMerge "main/presencestate.c: Add trailing slash to test category."
Matt Jordan [Mon, 4 May 2015 12:45:04 +0000 (07:45 -0500)]
Merge "main/presencestate.c: Add trailing slash to test category."

7 years agores_odbc: Use negative connection cache for all connections
Martin Tomec [Tue, 21 Apr 2015 16:52:22 +0000 (18:52 +0200)]
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

7 years agoMerge "Remove unneeded uses of optional_api providers."
Matt Jordan [Mon, 4 May 2015 09:04:04 +0000 (04:04 -0500)]
Merge "Remove unneeded uses of optional_api providers."

7 years agoMerge "Update for clang"
Matt Jordan [Mon, 4 May 2015 09:03:06 +0000 (04:03 -0500)]
Merge "Update for clang"

7 years agoFormat Interfaces: Prevent unload except by shutdown.
Corey Farrell [Mon, 4 May 2015 02:03:13 +0000 (22:03 -0400)]
Format Interfaces: Prevent unload except by shutdown.

Format interfaces cannot be unregistered, so the modules that provide them
need to be held open except by shutdown.

ASTERISK-25054 #close
Reported by: Corey Farrell

Change-Id: Iadbd9675bf0d30b8fded5a739b163db3ea2db8f3

7 years agocontrib/ast-db-manage: Add Postgres ENUM type support in auto DTMF mode update
Matt Jordan [Mon, 4 May 2015 01:28:52 +0000 (20:28 -0500)]
contrib/ast-db-manage: Add Postgres ENUM type support in auto DTMF mode update

The upgrade script for auto DTMF mode (31cd4f4891ec) added in 88b0fa7755
failed to add ENUM support for Postgres databases. This requires a
specific import from the sqlalchemy.dialects.postgresql package. This
patch corrects this error, which allows for Postgres update scripts to
be generated.


Change-Id: I4742ac8efa533cd6f18e0bdd907b339a9aedf015

7 years agomain/presencestate.c: Add trailing slash to test category.
Corey Farrell [Sun, 3 May 2015 18:36:01 +0000 (14:36 -0400)]
main/presencestate.c: Add trailing slash to test category.

Reported by: Corey Farrell

Change-Id: I8c0375dd0818747b2d2e1ceaea87bfbeb2daf8d4

7 years agoMerge "cdr/cdr_csv.c: Add a new option to enable columns added in Asterisk 1.8"
Joshua Colp [Sun, 3 May 2015 16:37:36 +0000 (11:37 -0500)]
Merge "cdr/cdr_csv.c: Add a new option to enable columns added in Asterisk 1.8"

7 years agoMerge "term: send proper reset sequence when black background is forced"
Matt Jordan [Sun, 3 May 2015 15:54:12 +0000 (10:54 -0500)]
Merge "term: send proper reset sequence when black background is forced"

7 years agoUpdate for clang
Diederik de Groot [Mon, 20 Apr 2015 18:03:56 +0000 (20:03 +0200)]
Update 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 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
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 ""
See also ""

Makefile.rules: If C_COMPILER_FAMILY=clang then add two warning
In an earlier review (reviewboard: 4550 and 4554), they were deemed a
nuisace and less than benefitial.
Added AST_CHECK_RAII() see earlier
Removed moved content

Change-Id: I12ea29d3bda2254ad3908e279b7effbbac6a97cb

7 years agocdr/cdr_csv.c: Add a new option to enable columns added in Asterisk 1.8
Rodrigo Ramírez Norambuena [Tue, 28 Apr 2015 09:49:18 +0000 (05:49 -0400)]
cdr/cdr_csv.c: Add a new option to enable columns added in Asterisk 1.8

This patch adds a new option to cdr.conf, 'newcdrcolumns', that will handle CDR
columns added in Asterisk 1.8. The columns are:
 * peeraccount
 * linkedid
 * sequence
When enabled, the columns in the database entry will be populated with the data
from the CDR.

ASTERISK-24976 #close

Change-Id: I51a57063f4ae5e194a9d933a8df45dc8a4534f0b

7 years agoMerge "res_pjsip_dlg_options: Fix MODULEINFO section."
Matt Jordan [Sun, 3 May 2015 14:19:16 +0000 (09:19 -0500)]
Merge "res_pjsip_dlg_options: Fix MODULEINFO section."

7 years agoRemove unneeded uses of optional_api providers.
Corey Farrell [Sat, 2 May 2015 23:58:40 +0000 (19:58 -0400)]
Remove unneeded uses of optional_api providers.

A few cases exist where headers of optional_api provders are included but
not needed.  This causes unneeded calls to ast_optional_api_use.

* Don't include optional_api.h from sip_api.h.
* Move 'struct ast_channel_monitor' to channel.h.
* Don't include monitor.h from chan_sip.c, channel.c or features.c.

The move of struct ast_channel_monitor is needed since channel.c depends on
it.  This has no effect on users of monitor.h since channel.h is included
from monitor.h.

ASTERISK-25051 #close
Reported by: Corey Farrell

Change-Id: I53ea65a9fc9693c89f8bcfd6120649bfcfbc3478

7 years agoMerge "include/asterisk/channel.h: Fix typo"
Matt Jordan [Sat, 2 May 2015 15:19:14 +0000 (10:19 -0500)]
Merge "include/asterisk/channel.h: Fix typo"

7 years agoMerge "Astobj2: Fix initialization order of refdebug and AO2_DEBUG."
Matt Jordan [Sat, 2 May 2015 15:17:31 +0000 (10:17 -0500)]
Merge "Astobj2: Fix initialization order of refdebug and AO2_DEBUG."

7 years agores_pjsip_dlg_options: Fix MODULEINFO section.
Corey Farrell [Sat, 2 May 2015 07:15:15 +0000 (03:15 -0400)]
res_pjsip_dlg_options: Fix MODULEINFO section.

Removed the extra space before "MODULEINFO" in res_pjsip_dlg_options.
This extra space prevented any of the dependencies from being seen by
menuselect, so building with default options would fail if PJSIP was
not installed.

This also makes the tool that extracts information for menuselect
tolerant of multiple spaces in the future.

ASTERISK-25033 #close
Reported by: Peter Whisker

Change-Id: Iccd54846f70c4a7a50cb5bf70b7bb5cb4bab3698

7 years agoterm: send proper reset sequence when black background is forced
D Tucny [Sat, 2 May 2015 00:50:22 +0000 (20:50 -0400)]
term: send proper reset sequence when black background is forced

When using the force black background command-line option or configuration
option an invalid reset sequence is sent following a coloured output item
in the CLI, the result is that the colour is not 'turned off' and continues
until the next non-default coloured text output.

A reset sequence is already defined in term.c, but the ast_term_reset
function doesn't use it, instead building it's own invalid sequence and
returning that.

This patch changes that behaviour, removing the building of a reset sequence
and instead using the pre-built constant 'enddata' which is a suitable reset
sequence for this purpose.

ASTERISK-24896 #close
Reported by: Dan Tucny

Change-Id: I56323899123ae3264900389cae1f5b252aa3bf43

7 years agoAstobj2: Fix initialization order of refdebug and AO2_DEBUG.
Corey Farrell [Fri, 1 May 2015 18:22:03 +0000 (14:22 -0400)]
Astobj2: Fix initialization order of refdebug and AO2_DEBUG.

This ensures that refdebug is initialized before AO2_DEBUG if
both are enabled, since AO2_DEBUG allocates a container.

This change also makes AO2_DEBUG initialization critical, a
failure will abort Asterisk startup.  This is needed since
the failure would be caused by reg_containers allocation
failure, and that would result in a segmentation fault by
ao2_container_register later in startup.

ASTERISK-25048 #close
Reported by: Corey Farrell

Change-Id: I9a243ea3fc5653b48b931ba6d61971cb2e530244

7 years agomain/pbx: Improve performance of dialplan reloads with a large number of hints
Matt Jordan [Wed, 29 Apr 2015 19:49:23 +0000 (14:49 -0500)]
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

7 years agoMerge "Prevent potential crash on blond transfer."
Matt Jordan [Fri, 1 May 2015 11:55:23 +0000 (06:55 -0500)]
Merge "Prevent potential crash on blond transfer."

7 years agoSample Configs: Fix syntax error in pjsip.conf
Corey Farrell [Thu, 30 Apr 2015 20:54:24 +0000 (16:54 -0400)]
Sample Configs: Fix syntax error in pjsip.conf

The sample pjsip.conf has a few comment lines that are missing the
semicolons at the start of the comment, causing the config to fail

Change-Id: I776a38c916a7df7ee3e072fd0b21dbf4cc457352

7 years agoMerge "Build System: Fix issue with addons moduleinfo."
Joshua Colp [Thu, 30 Apr 2015 20:21:38 +0000 (15:21 -0500)]
Merge "Build System: Fix issue with addons moduleinfo."

7 years agoPrevent potential crash on blond transfer.
Mark Michelson [Thu, 30 Apr 2015 20:20:43 +0000 (15:20 -0500)]
Prevent potential crash on blond transfer.

Alice calls Bob. Bob performs a blond transfer to Carol. Carol rejects
the incoming call (or some other immediate circumstance causes Carol not
to answer the call)

What occurs in this case is that when the bridge between Alice and Bob
breaks, Alice is told to masquerade into Bob's channel that had placed
the call to Carol. The actual masquerade goes down without a hitch.
However, a channel fixup callback that attempts to publish dial events
over Stasis has a crash. The reason for this crash is that the datastore
on Bob's channel that placed the outbound call to Carol only had a bare
pointer to Carol's channel. Since Carol rejected the incoming call,
Carol's channel has been hung up and freed, meaning accessing her
channel results in a crash.

The fix here is simple. The dial fixup code has been altered to hold
references to the involved channels and to drop those references when
freeing data.

ASTERISK-25025 #close
Reported by Chet Stevens

Change-Id: I54eedda207b8ec7a69263353b43abe5746aea197

7 years agoBuild System: Fix issue with addons moduleinfo.
Corey Farrell [Thu, 30 Apr 2015 19:40:48 +0000 (15:40 -0400)]
Build System: Fix issue with addons moduleinfo.

The build system now scans additional sources when generating
moduleinfo for menuselect.  Unfortunately the extra sources
for format_mp3 only exist if downloaded.

Use the Makefile macro 'wildcard' to allow moduleinfo generator
to ignore sources that do not exist.

Change-Id: I596604713b7345ce994f32197f8f6bfd9bcf4170

7 years agores_ari_device_states: Fix dependency on res_stasis_device_state.
Joshua Colp [Thu, 30 Apr 2015 18:42:15 +0000 (15:42 -0300)]
res_ari_device_states: Fix dependency on res_stasis_device_state.

The res_ari_device_states module depends on res_stasis_device_state,
not res_stasis_device_states.

Change-Id: I26e02ad37f9e36bcc859867e2fad1b90452ec3de

7 years agoMerge "chan_dahdi: Add the chan_dahdi.conf force_restart_unavailable_chans option."
Mark Michelson [Thu, 30 Apr 2015 16:11:19 +0000 (11:11 -0500)]
Merge "chan_dahdi: Add the chan_dahdi.conf force_restart_unavailable_chans option."

7 years agoRestrict functionality when ACLs are misconfigured.
Mark Michelson [Tue, 28 Apr 2015 22:00:37 +0000 (17:00 -0500)]
Restrict functionality when ACLs are misconfigured.

This patch has two main purposes:

1) Improve warning messages when ACLs are configured improperly.
2) Prevent misconfigured ACLs from allowing potentially unwanted

To acomplish point (2) in most cases, whatever configuration object that
the ACL belonged to was not allowed to load.

The one exception is res_pjsip_acl. In that case, ACLs are their own
configuration object. Furthermore, the module loading code has no
indication that a ACL configuration had a failure. So the tactic taken
here is to create an ACL that just blocks everything.

Reported by Corey Farrell

Change-Id: I2ebcb6959cefad03cea4d81401be946203fcacae

7 years agochan_dahdi: Add the chan_dahdi.conf force_restart_unavailable_chans option.
Richard Mudgett [Wed, 29 Apr 2015 19:29:10 +0000 (14:29 -0500)]
chan_dahdi: Add the chan_dahdi.conf force_restart_unavailable_chans option.

Some telco switches occasionally ignore ISDN RESTART requests.  The fix
for ASTERISK-19608 added an escape clause for B channels in the restarting
state if the telco ignores a RESTART request.  If the telco fails to
acknowledge the RESTART then Asterisk will assume the telco acknowledged
the RESTART on the second call attempt requesting the B channel by the
telco.  The escape clause is good for dealing with RESTART requests in
general but it does cause the next call for the restarting B channel to be
rejected if the telco insists the call must go on that B channel.

chan_dahdi doesn't really need to issue a RESTART request in response to
receiving a cause 44 (Requested channel not available) code.  Sending the
RESTART in such a situation is not required (nor prohibited) by the
standards.  I think chan_dahdi does this for historical reasons to deal
with buggy peers to get channels unstuck in a similar fashion as the
chan_dahdi.conf resetinterval option.

* Add the chan_dahdi.conf force_restart_unavailable_chans compatability
option that when disabled will prevent chan_dahdi from trying to RESTART
the channel in response to a cause 44 code.

ASTERISK-25034 #close
Reported by: Richard Mudgett

Change-Id: Ib8b17a438799920f4a2038826ff99a1884042f65

7 years agocdr/cdr_csv.c: Refactor, function to write content of csv file.
Rodrigo Ramírez Norambuena [Thu, 30 Apr 2015 02:54:16 +0000 (22:54 -0400)]
cdr/cdr_csv.c: Refactor, function to write content of csv file.

Create a function for write content of CDR on csv files. Before used same
code for write two distinct files (account and master cdr) instead use a
function for thats.

Reduced to one lock when files are written.

Change-Id: Idce707f4c108083252e0aeb948f421d924953e65

7 years agores_pjsip_outbound_registration: Fix double unref on error return.
Joshua Colp [Thu, 30 Apr 2015 11:04:34 +0000 (08:04 -0300)]
res_pjsip_outbound_registration: Fix double unref on error return.

When the PJSIP pjsip_regc_send function is invoked and an error
status returned the caller currently decrements the reference count
of the client state that it just incremented, assuming the
registration callback would not have been invoked. In practice
this is not correct. If the failure happens after the transaction
has been set up the callback will still be invoked. This will
cause the reference count to be incorrectly decremented twice, once
by the registration callback and second by the caller of

This change makes it so that whether the callback is invoked or
not is known by the caller of pjsip_regc_send. Depending on
this it can know whether it is responsible for decrementing the
reference count of the client state or not.

ASTERISK-25037 #close
Reported by: Joshua Colp

Change-Id: I749dc12f3a22115c49c5d7d95ff42a5fa45319de

7 years agoinclude/asterisk/channel.h: Fix typo
Rodrigo Ramírez Norambuena [Thu, 30 Apr 2015 07:07:06 +0000 (03:07 -0400)]
include/asterisk/channel.h: Fix typo

Change-Id: Ie584b85e16a94c255e60d0b1732ef9686464fef3

7 years agoMerge "ARI: Fix missing dependencies."
Matt Jordan [Wed, 29 Apr 2015 21:44:09 +0000 (16:44 -0500)]
Merge "ARI: Fix missing dependencies."

7 years agoMerge "res_fax: allow 2400 transmission rate according to v.27ter standard"
Matt Jordan [Wed, 29 Apr 2015 21:42:17 +0000 (16:42 -0500)]
Merge "res_fax: allow 2400 transmission rate according to v.27ter standard"

7 years agomain/rtp_engine: Fix DTLS double-free introduced by 0b6410c4f8
Matt Jordan [Wed, 29 Apr 2015 21:15:43 +0000 (16:15 -0500)]
main/rtp_engine: Fix DTLS double-free introduced by 0b6410c4f8

The patch in 0b6410c4f8 did correctly fix a memory leak of the DTLS
structures in the RTP engine. However, when a 'core reload' is issued, a
double free of the memory pointed to by the char *'s in the DTLS
configuration struct can occur, as ast_rtp_dtls_cfg_free does not set
the pointers to NULL when they are freed.

This patch sets those pointers to NULL, preventing a second call to
ast_rtp_dtls_cfg_free from corrupting memory.


Change-Id: I820471e6070a37e3c26f760118c86770e12f6115

7 years agoMerge "cdr/cdr_csv.c: Add missing space after comma."
Mark Michelson [Wed, 29 Apr 2015 21:11:27 +0000 (16:11 -0500)]
Merge "cdr/cdr_csv.c: Add missing space after comma."

7 years agores_fax: allow 2400 transmission rate according to v.27ter standard
Kevin Harwell [Wed, 29 Apr 2015 18:05:10 +0000 (13:05 -0500)]
res_fax: allow 2400 transmission rate according to v.27ter standard

A previous set of patches (see: ASTERISK-22790 & ASTERISK-23231) made it so
a v.27 modem was not allowed to have a minimum transmission rate of 2400 bits
per second. This reverts all or some of those patches since according to the
v.27ter standard a rate of 2400 bits per second is also supported.

One of the original patches also added 9600 bits per second support for v.27.
This patch also removes that since v.27ter only supports 2400/4800 bits per

Also, since Asterisk specifically supports v.27ter the enum was renamed to
better reflect this.

ASTERISK-24955 #close
Reported by: Matt Jordan

Change-Id: I4b9dfb6bf7eff08463ab47ee1a74224f27cae733

7 years agoMerge "Astobj2: Add ao2_weakproxy_ref_object function."
Matt Jordan [Wed, 29 Apr 2015 18:37:20 +0000 (13:37 -0500)]
Merge "Astobj2: Add ao2_weakproxy_ref_object function."

7 years agoMerge "res_pjsip_outbound_registration: Don't fail on delayed processing."
Joshua Colp [Wed, 29 Apr 2015 18:09:20 +0000 (13:09 -0500)]
Merge "res_pjsip_outbound_registration: Don't fail on delayed processing."

7 years agoAstobj2: Add ao2_weakproxy_ref_object function.
Corey Farrell [Wed, 29 Apr 2015 04:35:22 +0000 (00:35 -0400)]
Astobj2: Add ao2_weakproxy_ref_object function.

This function allows code to run ao2_ref against the real
object associated with a weakproxy.  It is useful when
all of the following conditions are true:
* You have a pointer to weakproxy.
* You do not have or need a pointer to the real object.
* You need to ensure the real object exists and is not
  destroyed during a process.

In this case it's wasteful to store a pointer to the real
object just for the sake of releasing it later.

Change-Id: I38a319b83314de75be74207a8771aab269bcca46

7 years agoMerge "Git Conversion: Switch Non-C files to ASTERISK_REGISTER_FILE."
Mark Michelson [Wed, 29 Apr 2015 17:28:24 +0000 (12:28 -0500)]
Merge "Git Conversion: Switch Non-C files to ASTERISK_REGISTER_FILE."

7 years agores_pjsip_outbound_registration: Don't fail on delayed processing.
Mark Michelson [Mon, 27 Apr 2015 21:13:22 +0000 (16:13 -0500)]
res_pjsip_outbound_registration: Don't fail on delayed processing.

Odd behaviors have been observed during outbound registrations. The most
common problem witnessed has been one where a request with
authentication credentials cannot be created after receiving a 401
response. Other behaviors include apparently processing an incorrect SIP

Inspecting the code led to an apparent issue with regards to how we
handle transactions in outbound registration code. When a response to a
REGISTER arrives, we save a pointer to the transaction and then push a
task onto the registration serializer. Between the time that we save the
pointer and push the task, it's possible for the transaction to be
destroyed due to a timeout. It's also possible for the address to be
reused by the transaction layer for a new transaction.

To allow for authentication of a REGISTER request to be authenticated
after the transaction has timed out, we now hold a reference to the
original REGISTER request instead of the transaction. The function for
creating a request with authentication has been altered to take the
original request instead of the transaction where the original request
was sent.

Reported by Mark Michelson

Change-Id: I756c19ab05ada5d0503175db9676acf87c686d0a

7 years agores_sorcery_config: Fix build issue due to syntax error.
Joshua Colp [Wed, 29 Apr 2015 15:46:21 +0000 (12:46 -0300)]
res_sorcery_config: Fix build issue due to syntax error.

Change-Id: Ic8322f04e37842848ad72cf2871bd0378f67c4ac

7 years agoMerge "chan_pjsip: Creating Channel Causes Asterisk to Crash When Duplicate AOR ...
Matt Jordan [Wed, 29 Apr 2015 15:13:03 +0000 (10:13 -0500)]
Merge "chan_pjsip: Creating Channel Causes Asterisk to Crash When Duplicate AOR             Sections Exist in pjsip.conf"

7 years agoMerge topic 'ASTERISK-25027'
Matt Jordan [Wed, 29 Apr 2015 14:49:43 +0000 (09:49 -0500)]
Merge topic 'ASTERISK-25027'

* changes:
  res_pjsip: Remove incorrect MODULEINFO from presence_xml.c.
  Git Migration: Create doc/rest-api when needed.

7 years agoMerge "Build System: Prevent unneeded changes to asterisk/buildopts.h."
Matt Jordan [Wed, 29 Apr 2015 14:47:58 +0000 (09:47 -0500)]
Merge "Build System: Prevent unneeded changes to asterisk/buildopts.h."

7 years agoARI: Fix missing dependencies.
Corey Farrell [Wed, 29 Apr 2015 11:46:44 +0000 (07:46 -0400)]
ARI: Fix missing dependencies.

ARI modules that are generated by 'make ari-stubs' are all dependent on
res_ari_model.  Additionally some of the same modules depend on one or more
res_stasis_* modules.

ASTERISK-25027 #close
Reported by: Corey Farrell

Change-Id: I8e07fe7e81fedacb87232f2b6f8b5f47927b4153

7 years agores_pjsip: Remove incorrect MODULEINFO from presence_xml.c.
Corey Farrell [Wed, 29 Apr 2015 11:26:13 +0000 (07:26 -0400)]
res_pjsip: Remove incorrect MODULEINFO from presence_xml.c.

Remove incorrect MODULEINFO block and unneeded header includes
from presence_xml.c.

Reported by: Corey Farrell

Change-Id: I977c609ab9d1fe05373027c4138900f6985990eb

7 years agoGit Migration: Create doc/rest-api when needed.
Corey Farrell [Wed, 29 Apr 2015 11:17:00 +0000 (07:17 -0400)]
Git Migration: Create doc/rest-api when needed.

Create the directory './doc/rest-api' at the start of 'make ari-stubs'
to prevent an error when documentation is generated.  The directory is
also added to git ignores.

Reported by: Corey Farrell

Change-Id: Iaccc7f0138501c23aa78feaca2f3cce9e68cbc1b

7 years agoMerge "chan_iax2: Ensure that IAX flags are 64 bits."
Joshua Colp [Wed, 29 Apr 2015 10:31:05 +0000 (05:31 -0500)]
Merge "chan_iax2: Ensure that IAX flags are 64 bits."

7 years agoBuild System: Prevent unneeded changes to asterisk/buildopts.h.
Corey Farrell [Wed, 29 Apr 2015 08:03:00 +0000 (04:03 -0400)]
Build System: Prevent unneeded changes to asterisk/buildopts.h.

* 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

7 years agoGit Conversion: Switch Non-C files to ASTERISK_REGISTER_FILE.
Corey Farrell [Wed, 29 Apr 2015 05:02:10 +0000 (01:02 -0400)]
Git Conversion: Switch Non-C files to ASTERISK_REGISTER_FILE.

This switches files used to generate other sources to use the new

ASTERISK-25026 #close
Reported by: Corey Farrell

Change-Id: Ieb2537b83421cad07c8955e5f90c405ccf079740

7 years agoMerge "res_pjsip_outbound_registration: Add debugging messages."
Joshua Colp [Wed, 29 Apr 2015 00:18:29 +0000 (19:18 -0500)]
Merge "res_pjsip_outbound_registration: Add debugging messages."

7 years agoMerge "CHANGES: Add missing spaces."
Mark Michelson [Tue, 28 Apr 2015 21:38:11 +0000 (16:38 -0500)]
Merge "CHANGES: Add missing spaces."

7 years agochan_iax2: Ensure that IAX flags are 64 bits.
Yousf Ateya [Tue, 28 Apr 2015 18:28:50 +0000 (20:28 +0200)]
chan_iax2: Ensure that IAX flags are 64 bits.

Flags are 64 bits.  Without LLU suffix the value of 1<<31 is negative.
Although it doesn't have an effect on the current implementation, it will
be problem if more flags are added.

Change-Id: Ic290c81cfbbbf062872392d99d3322932cc49487

7 years agochan_pjsip: Creating Channel Causes Asterisk to Crash When Duplicate AOR
Ashley Sanders [Tue, 28 Apr 2015 05:29:42 +0000 (00:29 -0500)]
chan_pjsip: Creating Channel Causes Asterisk to Crash When Duplicate AOR
            Sections Exist in pjsip.conf

This patch modifies the current loading strategy of the pjsip configuration. If
duplicate sections (e.g. sections containing the same [id/type]) are defined in
[pjsip.conf], the loader will consider the configuration for the given type as
invalid when the duplicate section is encountered. The entire configuration
(including what was previously loaded) for the duplicate [id/type] sections
will be rejected and destroyed, an error message is logged and the load
processing for the given stops.

Reported By: Ashley Sanders

Change-Id: I35090ca4cd40f1f34881dfe701a329145c347aef

7 years agochan_vpb: Fix compile error due to use of ASTERISK_FILE_VERSION.
Richard Mudgett [Tue, 28 Apr 2015 16:50:07 +0000 (11:50 -0500)]
chan_vpb: Fix compile error due to use of ASTERISK_FILE_VERSION.

Change-Id: I51179e2a83937423676da522b766f1126de4059e

7 years agores_pjsip_outbound_registration: Add debugging messages.
Mark Michelson [Mon, 27 Apr 2015 19:44:16 +0000 (14:44 -0500)]
res_pjsip_outbound_registration: Add debugging messages.

When problems occur regarding outbound registrations, it currently
is difficult to debug. Most off-nominal paths had warning messages,
but sometimes we want to know what's going on before hitting the
off-nominal path. This patch adds lots of debugging output that
should give a clearer picture of what is happening with regards
to outbound registrations.

Reported by Mark Michelson

Change-Id: I577bde7860be0a6c872b5bcb4d5047340bf45d45

7 years agoMerge "Example script for scan-build (the llvm static analyzer)"
Joshua Colp [Tue, 28 Apr 2015 12:15:47 +0000 (07:15 -0500)]
Merge "Example script for scan-build (the llvm static analyzer)"

7 years agores_rtp_asterisk: Resolve 2 discrete memory leaks in DTLS
Steve Davies [Tue, 28 Apr 2015 10:38:30 +0000 (11:38 +0100)]
res_rtp_asterisk: Resolve 2 discrete memory leaks in DTLS

ao2 ref leak in res_rtp_asterisk.c when a DTLS policy is created.
The resources are linked into a table, but the original alloc refs
are never released. ast_strdup leak in rtp_engine.c. If
ast_rtp_dtls_cfg_copy() is called twice on the same destination struct,
a pointer to an alloc'd string is overwritten before the string is free'd.

Reported by: one47

Change-Id: I62a8ceb8679709f6c3769136dc6aa9a68202ff9b