asterisk/asterisk.git
5 years agores_sorcery_memory_cache: Add support for maximum_objects.
Mark Michelson [Wed, 20 May 2015 20:19:27 +0000 (15:19 -0500)]
res_sorcery_memory_cache: Add support for maximum_objects.

This makes the "maximum_objects" option operational.

A heap has been added alongside the hash table in the cache. When
objects are added to the cache, they are also added to the heap.
Similarly, when objects are removed from the cache, they are removed
from the heap.

The heap's use comes into play when an item is to be added to a "full"
cache. When the cache is full, the oldest item is removed from the
cache, using the heap to determine the oldest item.

A unit test has been added that verifies that the maximum_objects option
works as expected and that the oldest object is removed from the cache
when an object beyond the maximum is added.

ASTERISK-25067 #close
Reported by Matt Jordan

Change-Id: I490658830e9c4cbf0b3051e4cdc4913cf9f1b73a

5 years agores_sorcery_memory_cache: Add basic module implementation.
Joshua Colp [Sat, 16 May 2015 22:02:50 +0000 (19:02 -0300)]
res_sorcery_memory_cache: Add basic module implementation.

This change adds a basic res_sorcery_memory_cache module which implements
configuration option parsing, configuration file parsing for threading,
sorcery interface implementation, and unit tests.

Objects can be added, updated, deleted, and retrieved from the memory
cache. Automatic expiration and stale handling will be added in the
future.

Note that unit tests exist within the module itself in case the
threading done as a result of expiration results in asynchronous
actions (which it likely will). Providing access and a notification
mechanism for an external test module would be complicated and
not worth it.

ASTERISK-25067 #close
Reported by: Matt Jordan

Change-Id: Id8a6a357ef5a83d466f81eee56a67d13eeb118b9

5 years agoMerge "cel, cdr: Assigned separator for column name and values."
Joshua Colp [Fri, 22 May 2015 10:16:30 +0000 (05:16 -0500)]
Merge "cel, cdr: Assigned separator for column name and values."

5 years agores_mwi_external_ami: Use module version of AMI registration.
Corey Farrell [Thu, 21 May 2015 22:51:18 +0000 (18:51 -0400)]
res_mwi_external_ami: Use module version of AMI registration.

Use ast_manager_register_xml for res_mwi_external_ami manager
actions.  This ensures the module is held open while any of
the actions are being run.

ASTERISK-25117 #close
Reported by: Corey Farrell

Change-Id: Iececfdc2da498b2c32b9e09042f5f12292007ac7

5 years agoARI: Update version to 1.7.0
Matt Jordan [Thu, 21 May 2015 18:05:08 +0000 (13:05 -0500)]
ARI: Update version to 1.7.0

This patch updates the version of ARI to 1.7.0 to reflect the backwards
compatible changes that will be introduced in 13.4.0.

Change-Id: I6c36e6144da426412f25828a868e4df916bff60a
(cherry picked from commit 9d8a462356a938eea82e8424242d89a682495b57)

5 years agoMerge "audiohook.c: Difference in read/write rates caused continuous buffer resets"
Matt Jordan [Thu, 21 May 2015 12:22:21 +0000 (07:22 -0500)]
Merge "audiohook.c: Difference in read/write rates caused continuous buffer resets"

5 years agoMerge "Logger: Reset defaults before processing config."
Matt Jordan [Thu, 21 May 2015 12:21:36 +0000 (07:21 -0500)]
Merge "Logger: Reset defaults before processing config."

5 years agoMerge "res/res_http_websocket: Add a pre-session established callback"
Matt Jordan [Thu, 21 May 2015 12:21:04 +0000 (07:21 -0500)]
Merge "res/res_http_websocket: Add a pre-session established callback"

5 years agoMerge "main/sdp_srtp.c: allow SDP crypto tag to be up to 9 digits"
Joshua Colp [Thu, 21 May 2015 10:15:41 +0000 (05:15 -0500)]
Merge "main/sdp_srtp.c: allow SDP crypto tag to be up to 9 digits"

5 years agoLogger: Reset defaults before processing config.
Corey Farrell [Thu, 21 May 2015 01:53:46 +0000 (21:53 -0400)]
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

5 years agoapp_playback: Suppress warnings on playback if channel hung up
George Joseph [Thu, 21 May 2015 00:05:20 +0000 (18:05 -0600)]
app_playback: Suppress warnings on playback if channel hung up

If a channel hangs up while an audio file is playing, there's
no need to clutter up the logs with a warning so suppress it
if ast_check_hangup returns true.

Also, change warning to debug/2 in file.c if writing a frame
fails.  Same reasoning.

Change-Id: I2e66191af3c5b6e951c98e8f1c3fe3cf2cf7ed89
Reported-by: George Joseph <george.joseph@fairview5.com>
Tested-by: George Joseph <george.joseph@fairview5.com>

5 years agoaudiohook.c: Difference in read/write rates caused continuous buffer resets
Kevin Harwell [Thu, 14 May 2015 20:21:30 +0000 (15:21 -0500)]
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

5 years agoMerge "Fix potential crash after unload of func_periodic_hook or test_message."
Matt Jordan [Wed, 20 May 2015 20:23:04 +0000 (15:23 -0500)]
Merge "Fix potential crash after unload of func_periodic_hook or test_message."

5 years agores/res_http_websocket: Add a pre-session established callback
Matt Jordan [Wed, 13 May 2015 14:55:58 +0000 (09:55 -0500)]
res/res_http_websocket: Add a pre-session established callback

This patch updates http_websocket and its corresponding implementation
with a pre-session established callback. This callback allows for
WebSocket server consumers to be notified when a WebSocket connection is
attempted, but before we accept it. Consumers can choose to reject the
connection, if their application specific logic allows for it.

As a result, this patch pulls out the previously private
websocket_protocol struct and makes it public, as
ast_websocket_protocol. In order to preserve backwards compatibility
with existing modules, the existing APIs were left as-is, and new APIs
were added for the creation of the ast_websocket_protocol as well as for
adding a sub-protocol to a WebSocket server.

In particular, the following new API calls were added:
* ast_websocket_add_protocol2 - add a protocol to the core WebSocket
  server
* ast_websocket_server_add_protocol2 - add a protocol to a specific
  WebSocket server
* ast_websocket_sub_protocol_alloc - allocate a sub-protocol object.
  Consumers can populate this with whatever callbacks they wish to
  support, then add it to the core server or a specified server.

ASTERISK-24988
Reported by: Joshua Colp

Change-Id: Ibe0bbb30c17eec6b578071bdbd197c911b620ab2

5 years agores/res_resolver_unbound.c: Add missing include of signal.h
John Bigelow [Wed, 20 May 2015 17:55:40 +0000 (12:55 -0500)]
res/res_resolver_unbound.c: Add missing include of signal.h

ASTERISK-25110 #close
Reported by: John Bigelow

Change-Id: I99a9d93f066f265357b647b8e99a75e45da5a39f

5 years agocel, cdr: Assigned separator for column name and values.
Rodrigo Ramírez Norambuena [Thu, 7 May 2015 02:18:28 +0000 (22:18 -0400)]
cel, cdr: Assigned separator for column name and values.

Use a separator string between column names and values for SQL sentences
instead of evaluating the separator to use each time.

This change adds a space after the comma in constructing SQL sentences.
Before the SQL was created like "INSERT INTO cdr(calldate,clid,dst"
without spaces between column name and values.

The files applied this change are cdr/cdr_adaptive_odbc.c, cdr/cdr_pgsql.c,
cel/cel_odbc.c

ASTERISK-25109 #close
Reported By: Rodrigo Ramírez Norambuena <decipher.hk@gmail.com>

Change-Id: Ia5a1a161f5e26e1643703b30f8cc9cf0860cc7ea

5 years agodoxygen: Fix doxygen errors
Matt Jordan [Sun, 17 May 2015 12:15:15 +0000 (07:15 -0500)]
doxygen: Fix doxygen errors

This patch fixes a number of errors and warning messages in the doxygen
log. Specifically, it addresses:
* A number of files incorrectly places a '\brief' tag immediately after
  a '\file' tag. Doing so emits a warning, as '\file' takes an optional
  argument specifying which file the doxygen comment is for. As '\brief'
  is not a file, doxygen was unamused.
* A grouping of Stasis Topics and Messages in rtp_engine.h was
  incorrectly terminated. We now correctly terminate the grouping, which
  prevents members of rtp_engine.h from showing up in the wrong group.
* Group indicators which are not part of the Stasis Topics and Messages
  group were removed. Group indicators without an \addtogroup or
  \ingroup have no meaning.

Change-Id: Ia1415ffec6767e27233ae1cae5ed5970de5656d4

5 years agomain/sdp_srtp.c: allow SDP crypto tag to be up to 9 digits
Corey Edwards [Tue, 19 May 2015 18:01:36 +0000 (12:01 -0600)]
main/sdp_srtp.c: allow SDP crypto tag to be up to 9 digits

ASTERISK-24887 #close
Reported by: Makoto Dei
Tested by: tensai

Change-Id: I6a96f572adb17f76b3acafe503a01c48eb5dd9bf

5 years agoMerge "chan_pjsip: Fix crash during off-nominal when no endpoint specified."
Matt Jordan [Mon, 18 May 2015 12:34:01 +0000 (07:34 -0500)]
Merge "chan_pjsip: Fix crash during off-nominal when no endpoint specified."

5 years agochan_pjsip: Fix crash during off-nominal when no endpoint specified.
snuffy [Fri, 15 May 2015 03:05:52 +0000 (13:05 +1000)]
chan_pjsip: Fix crash during off-nominal when no endpoint specified.

Add missing return -1 when no endpoint name is specified.

ASTERISK-25086 #close
Reported by: snuffy

Change-Id: I9de76c2935a1f4e3f0cffe97a670106f5605e89e

5 years agores_pjsip_config_wizard/config: Fix template processing
George Joseph [Thu, 14 May 2015 23:01:56 +0000 (17:01 -0600)]
res_pjsip_config_wizard/config: Fix template processing

The config wizard was always pulling the first occurrence of
a variable from an ast_variable list but this gets the template
value from the list instead of any overridden value.  This patch
creates ast_variable_find_last_in_list() in config.c and updates
res_pjsip_config_wizard to use it instead of
ast_variable_find_in_list.  Now the overridden values, where they
exist, are used instead of template variables.

Updated test_config to test the new API.

ASTERISK-25089 #close

Reported-by: George Joseph <george.joseph@fairview5.com>
Tested-by: George Joseph <george.joseph@fairview5.com>
Change-Id: Ifa7ddefc956a463923ee6839dd1ebe021c299de4

5 years agoMerge "Add X.509 subject alternative name support to TLS certificate verification."
Joshua Colp [Fri, 15 May 2015 15:37:58 +0000 (10:37 -0500)]
Merge "Add X.509 subject alternative name support to TLS certificate verification."

5 years agoMerge "cdr: Fix 'core show channel' CDR variable truncation."
Joshua Colp [Fri, 15 May 2015 15:20:51 +0000 (10:20 -0500)]
Merge "cdr: Fix 'core show channel' CDR variable truncation."

5 years agocdr: Fix 'core show channel' CDR variable truncation.
snuffy [Fri, 15 May 2015 06:54:26 +0000 (16:54 +1000)]
cdr: Fix 'core show channel' CDR variable truncation.

When the new Bridging API was implemented, the workspace variable
changed to a malloc'd string, causing sizeof() to always be 8 (char).

Revert back to stored on stack string for workspace.

ASTERISK-25090 #close

Change-Id: I51e610ae87371df771ce7693a955510efb90f8f7

5 years agoMerge "tcptls: Enable multiple TLS certificate chains (RSA+ECC+DSA) for server socket."
Joshua Colp [Fri, 15 May 2015 14:38:56 +0000 (09:38 -0500)]
Merge "tcptls: Enable multiple TLS certificate chains (RSA+ECC+DSA) for server socket."

5 years agotcptls: Enable multiple TLS certificate chains (RSA+ECC+DSA) for server socket.
Alexander Traud [Sun, 10 May 2015 14:55:24 +0000 (16:55 +0200)]
tcptls: Enable multiple TLS certificate chains (RSA+ECC+DSA) for server socket.

When a client connects to a server via SSL/TLS, the server commonly utilizes an
RSA key-pair. However, other such algorithms exist (i.e. DSA and ECDSA), and if
the server socket is configured with a certificate for either one of those, it
would lose its compatibility with RSA-only clients.

Now, the server socket can be configured with up to one RSA, ECDSA and DSA key
each. For example, if a client is not compatible with SHA-2 hashed certificates
like Nokia mobile phones, the server socket still can use RSA/SHA-1 for legacy
clients and ECDSA/SHA-2 for everyone else.

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

Change-Id: Iada5e00d326db5ef86e0af7069b4dfa1b979da9a

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

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

Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name>

ASTERISK-25063 #close

Change-Id: I13302c80490a0b44c43f1b45376c9bd7b15a538f

5 years agoMerge "sorcery: Add API to insert/remove a wizard to/from an object type's list"
Joshua Colp [Thu, 14 May 2015 20:20:32 +0000 (15:20 -0500)]
Merge "sorcery: Add API to insert/remove a wizard to/from an object type's list"

5 years agoMessage.c: Clear message channel frames on cleanup
Jonathan Rose [Wed, 13 May 2015 20:41:07 +0000 (15:41 -0500)]
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

5 years agoMerge "MALLOC_DEBUG: Replace WRAP_LIBC_MALLOC with ASTMM_LIBC."
Joshua Colp [Thu, 14 May 2015 15:57:04 +0000 (10:57 -0500)]
Merge "MALLOC_DEBUG: Replace WRAP_LIBC_MALLOC with ASTMM_LIBC."

5 years agoFix potential crash after unload of func_periodic_hook or test_message.
Corey Farrell [Thu, 14 May 2015 05:06:53 +0000 (01:06 -0400)]
Fix potential crash after unload of func_periodic_hook or test_message.

These modules save a pointer to the context they create on load, and
use that pointer to destroy the context at unload.  It is not safe
to save this pointer, it is replaced during load of pbx_config,
pbx_lua or pbx_ael.

This change causes the modules to pass NULL to ast_context_destroy,
a safer way to perform the unregistration since it does not use
a pointer that could become invalid.

ASTERISK-25085 #close
Reported by: Corey Farrell

Change-Id: I6a00ec8e38046058f97dc703e1adcde9bf517835

5 years agoMerge "cdr_adaptive_odbc: Add ability to set character for quoted identifiers."
Joshua Colp [Thu, 14 May 2015 10:28:16 +0000 (05:28 -0500)]
Merge "cdr_adaptive_odbc: Add ability to set character for quoted identifiers."

5 years agoMerge "AST_MODULE_INFO: Format corrections to the usages of AST_MODULE_INFO macro."
Joshua Colp [Thu, 14 May 2015 10:03:43 +0000 (05:03 -0500)]
Merge "AST_MODULE_INFO: Format corrections to the usages of AST_MODULE_INFO macro."

5 years agoMerge "main/manager.c: Bugfix sort action_manager by alphabetically"
Joshua Colp [Thu, 14 May 2015 10:03:07 +0000 (05:03 -0500)]
Merge "main/manager.c: Bugfix sort action_manager by alphabetically"

5 years agoMerge "cel/cel_pgsql.c: Use the 'SEP' macro when appending a column name"
Joshua Colp [Thu, 14 May 2015 10:02:13 +0000 (05:02 -0500)]
Merge "cel/cel_pgsql.c: Use the 'SEP' macro when appending a column name"

5 years agoMALLOC_DEBUG: Replace WRAP_LIBC_MALLOC with ASTMM_LIBC.
Corey Farrell [Tue, 12 May 2015 13:58:52 +0000 (09:58 -0400)]
MALLOC_DEBUG: Replace WRAP_LIBC_MALLOC with ASTMM_LIBC.

There are 3 ways that calls directly to standard allocator functions can
be dealt with:
1. Block their use, cause them to generate an error.  This is the default.
2. Replace them with the Asterisk equivalent function calls.
3. Leave them alone.

This change allows one of these 3 options to be selected by any source.
The source just needs to define ASTMM_LIBC to ASTMM_BLOCK, ASTMM_REDIRECT,
or ASTMM_IGNORE to use option 1, 2 or 3 respectively.  Normally ASTMM_BLOCK
is the correct option, so it is default when ASTMM_LIBC is not defined.
In some cases when building 3rd party code it is desirable to have it use
Asterisk functions, without changing the whole source - ASTMM_REDIRECT
accomplishes this.  When using 3rd party libraries sometimes a static
inline function will make use of malloc or free.  In these cases it may
be unsafe to replace the allocator in the header, as it's possible the
memory could be freed by the library using standard allocators.  For
those cases ASTMM_IGNORE is needed.

Change-Id: I8afef4bc7f3b93914263ae27d3a5858b69663fc7

5 years agoAST_MODULE_INFO: Format corrections to the usages of AST_MODULE_INFO macro.
Rodrigo Ramírez Norambuena [Wed, 6 May 2015 00:49:04 +0000 (20:49 -0400)]
AST_MODULE_INFO: Format corrections to the usages of AST_MODULE_INFO macro.

Change-Id: Icf88f9f861c6b2a16e5f626ff25795218a6f2723

5 years agocel/cel_pgsql.c: Use the 'SEP' macro when appending a column name
Rodrigo Ramírez Norambuena [Wed, 6 May 2015 10:28:28 +0000 (06:28 -0400)]
cel/cel_pgsql.c: Use the 'SEP' macro when appending a column name

When appending a column name to the sql buffer, the predicate, "if first is
non-null, use empty string; else, use comma", is identical to the 'SEP' macro
definition. Since they are the same, this patch replaces the redundant
predicate statement with the 'SEP' macro.

Change-Id: Ib8b6138b06a48381723108a05ab8752cb8700509

5 years agoMerge "app_voicemail: fix moving when old messages full"
Joshua Colp [Wed, 13 May 2015 20:44:30 +0000 (15:44 -0500)]
Merge "app_voicemail: fix moving when old messages full"

5 years agoapp_voicemail: fix moving when old messages full
Jonathan Rose [Tue, 12 May 2015 22:45:09 +0000 (17:45 -0500)]
app_voicemail: fix moving when old messages full

When completing voicemail playback of a message in the 'INBOX', the
message gets moved to the 'Old' messages folder. Without this patch, if
the 'Old' folder is already at its set limit, then the 'INBOX' message will
simply be deleted. With this patch, the flag to delete the message will be
removed if the save_to_folder function indicates that the message could
not be moved due to a full folder.

ASTERISK-25082 #close
Reported by: Jonathan Rose
Review: https://gerrit.asterisk.org/#/c/448/

Change-Id: I2be440a09f42e2d06d50975c40d1ad7f836ecb3f

5 years agoMerge "cdr_pgsql, cel_pgsql: Store maximum buffer size to prevent reallocation"
Joshua Colp [Wed, 13 May 2015 20:17:48 +0000 (15:17 -0500)]
Merge "cdr_pgsql, cel_pgsql: Store maximum buffer size to prevent reallocation"

5 years agoMerge "cel_pgsql: Add support for setting schema"
Joshua Colp [Wed, 13 May 2015 20:17:18 +0000 (15:17 -0500)]
Merge "cel_pgsql: Add support for setting schema"

5 years agoMerge "General: Fix recent menuselect-related cross compile regression"
Joshua Colp [Wed, 13 May 2015 19:20:35 +0000 (14:20 -0500)]
Merge "General: Fix recent menuselect-related cross compile regression"

5 years agoMerge "res_config_mysql: Fix broken column type checking"
Joshua Colp [Wed, 13 May 2015 17:25:58 +0000 (12:25 -0500)]
Merge "res_config_mysql: Fix broken column type checking"

5 years agoMerge "chan_dahdi/sig_pri: Fix crash on ISDN call hangup collision."
Joshua Colp [Wed, 13 May 2015 17:24:44 +0000 (12:24 -0500)]
Merge "chan_dahdi/sig_pri: Fix crash on ISDN call hangup collision."

5 years agoMerge "res_rtp_asterisk: Correction for the limit which detects that a packet is...
Joshua Colp [Wed, 13 May 2015 15:38:23 +0000 (10:38 -0500)]
Merge "res_rtp_asterisk: Correction for the limit which detects that a packet is DTLS."

5 years agoMerge "cdr_pgsql: Use PQescapeStringConn for escaping names."
Joshua Colp [Wed, 13 May 2015 09:35:55 +0000 (04:35 -0500)]
Merge "cdr_pgsql: Use PQescapeStringConn for escaping names."

5 years agochan_dahdi/sig_pri: Fix crash on ISDN call hangup collision.
Richard Mudgett [Tue, 12 May 2015 22:34:45 +0000 (17:34 -0500)]
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

5 years agoMerge "Allow command-line options to override asterisk.conf."
Joshua Colp [Tue, 12 May 2015 16:59:04 +0000 (11:59 -0500)]
Merge "Allow command-line options to override asterisk.conf."

5 years agoMerge "cdr: standardizes tab for options of AST_MODULE_INFO"
Joshua Colp [Tue, 12 May 2015 16:58:30 +0000 (11:58 -0500)]
Merge "cdr: standardizes tab for options of AST_MODULE_INFO"

5 years agoAllow command-line options to override asterisk.conf.
Corey Farrell [Wed, 6 May 2015 13:31:33 +0000 (09:31 -0400)]
Allow command-line options to override asterisk.conf.

Previous versions of Asterisk processed command-line options before
processing asterisk.conf.  This meant that if an option was set in
asterisk.conf, it could not be overridden with the equivelent command
line option.  This change causes Asterisk to process the command-line
twice.  First it processes options that are needed to load asterisk.conf,
then it processes the remaining options after the config is read.

This changes the function of -X slightly.  Previously using -X without
disabling execincludes in asterisk.conf caused #exec to be usable in any
config.  Now -X only enables #exec for the load of asterisk.conf, if it
is wanted in the rest of the system it must be enabled with execincludes
in asterisk.conf.  Updated 'asterisk -h' and 'man asterisk' to reflect
the limited function of -X.

ASTERISK-25042 #close
Reported by: Corey Farrell

Change-Id: I1450d45c15b4467274b871914d893ed4f6564cd7

5 years agosorcery: Add API to insert/remove a wizard to/from an object type's list
George Joseph [Tue, 5 May 2015 20:32:08 +0000 (14:32 -0600)]
sorcery: Add API to insert/remove a wizard to/from an object type's list

Currently you can 'apply' a wizard to an object type but the wizard
always goes at the end of the object type's wizard list.  This patch
adds a new ast_sorcery_insert_wizard_mapping function that allows
you to insert a wizard anyplace in the list.  I.E.  You could
add a caching wizard to an object type and place it before all
wizards.

ast_sorcery_get_wizard_mapping_count and
ast_sorcery_get_wizard_mapping were added to allow examination
of the mapping list.

ast_sorcery_remove_mapping was added to remove a mapping by name.

As part of this patch, the object type's wizard list was converted
from an ao2_container to an AST_VECTOR_RW.

A new test was added to test_sorcery for this capability.

ASTERISK-25044 #close

Change-Id: I9d2469a9296b2698082c0989e25e6848dc403b57

5 years agoFix processing of asterisk.conf debug=yes.
Corey Farrell [Tue, 12 May 2015 06:31:58 +0000 (02:31 -0400)]
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

5 years agoGeneral: Fix recent menuselect-related cross compile regression
Sebastian Kemper [Sun, 10 May 2015 07:26:30 +0000 (09:26 +0200)]
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

5 years agoMerge "vector: Add REMOVE, ADD_SORTED and RESET macros"
Joshua Colp [Tue, 12 May 2015 10:39:08 +0000 (05:39 -0500)]
Merge "vector:  Add REMOVE, ADD_SORTED and RESET macros"

5 years agocdr_pgsql, cel_pgsql: Store maximum buffer size to prevent reallocation
Rodrigo Ramírez Norambuena [Fri, 1 May 2015 17:22:17 +0000 (13:22 -0400)]
cdr_pgsql, cel_pgsql: Store maximum buffer size to prevent reallocation

The code previously used a fixed size of 512 for the SQL
queries. Depending on the size this may require it to grow.

This change makes it so if the buffer size does grow the size
is stored and next time the buffer will be large enough.

Change-Id: I55385899f1c06dee47e4274c2d21538037b2d895

5 years agoMerge "pbx/pbx_spool: Fix issue when call files were executed too early"
Joshua Colp [Tue, 12 May 2015 10:06:23 +0000 (05:06 -0500)]
Merge "pbx/pbx_spool: Fix issue when call files were executed too early"

5 years agoMerge "dns_srv: Fix SRV sorting when records with priority zero exist with non-zero."
Joshua Colp [Tue, 12 May 2015 09:59:18 +0000 (04:59 -0500)]
Merge "dns_srv: Fix SRV sorting when records with priority zero exist with non-zero."

5 years agovector: Add REMOVE, ADD_SORTED and RESET macros
George Joseph [Sat, 9 May 2015 21:58:46 +0000 (15:58 -0600)]
vector:  Add REMOVE, ADD_SORTED and RESET macros

Based on feedback from Corey Farrell and Y Ateya, a few new
macros have been added...

AST_VECTOR_REMOVE which takes a parameter to indicate if
order should be preserved.

AST_VECTOR_ADD_SORTED which adds an element to
a sorted vector.

AST_VECTOR_RESET which cleans all elements from the vector
leaving the storage intact.

Change-Id: I41d32dbdf7137e0557134efeff9f9f1064b58d14

5 years agopbx/pbx_spool: Fix issue when call files were executed too early
Ivan Poddubny [Mon, 11 May 2015 12:07:31 +0000 (12:07 +0000)]
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

5 years agoMerge "main/asterisk.c: Update Asterisk copyright year"
Joshua Colp [Mon, 11 May 2015 19:44:52 +0000 (14:44 -0500)]
Merge "main/asterisk.c: Update Asterisk copyright year"

5 years agoMerge "utils: Remove trailing whitespace"
Joshua Colp [Mon, 11 May 2015 19:43:01 +0000 (14:43 -0500)]
Merge "utils: Remove trailing whitespace"

5 years agocdr_pgsql: Use PQescapeStringConn for escaping names.
Rodrigo Ramírez Norambuena [Sat, 2 May 2015 04:43:22 +0000 (00:43 -0400)]
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

5 years agoMerge "Fix error's produced by astmm.h when standard allocators are used."
Joshua Colp [Mon, 11 May 2015 10:34:05 +0000 (05:34 -0500)]
Merge "Fix error's produced by astmm.h when standard allocators are used."

5 years agores_rtp_asterisk: Correction for the limit which detects that a packet is DTLS.
Yousf Ateya [Sun, 10 May 2015 12:37:54 +0000 (14:37 +0200)]
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

5 years agodns_srv: Fix SRV sorting when records with priority zero exist with non-zero.
Joshua Colp [Sun, 10 May 2015 13:36:51 +0000 (10:36 -0300)]
dns_srv: Fix SRV sorting when records with priority zero exist with non-zero.

The DNS SRV sorting code currently has an issue when records with a priority
of zero exist with records of a non-zero priority. This occurs because the
sorting code considers zero to mean unset when in reality is a valid
value. If the current priority is zero it will get replaced with any remaining
record that has a priority of non-zero, until no records of those exist after
which the records of priority zero are handled.

This change makes it so that the priority of the first remaining record is
the current starting priority. There is also a small optimization to prevent
iterating records when the starting priority is already zero.

Change-Id: I103511f35b50428f770bd4db3ffef70fb6f82d35

5 years agoMerge "configs/basic-pbx: Modified main IVR to play new Allison prompt."
Joshua Colp [Sun, 10 May 2015 13:15:29 +0000 (08:15 -0500)]
Merge "configs/basic-pbx: Modified main IVR to play new Allison prompt."

5 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."

5 years agores_config_mysql: Fix broken column type checking
Alexandre Fournier [Fri, 8 May 2015 23:01:26 +0000 (01:01 +0200)]
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

5 years agoconfigs/basic-pbx: Modified main IVR to play new Allison prompt.
Rusty Newton [Fri, 8 May 2015 19:47:51 +0000 (14:47 -0500)]
configs/basic-pbx: Modified main IVR to play new Allison prompt.

The main IVR was playing demo-congrats. I've switched it over to the
basic-pbx-ivr-main file that we added in core sounds 1.4.27. This prompt
has Allison prompting the user with the actual IVR menu.

ASTERISK-24892 #close

Change-Id: Ifb749616ff8e156a1031ddaddfcc9244767a095d

5 years agoFix error's produced by astmm.h when standard allocators are used.
Corey Farrell [Fri, 8 May 2015 17:30:26 +0000 (13:30 -0400)]
Fix error's produced by astmm.h when standard allocators are used.

astmm.h includes defines that are meant to cause error's when standard
allocators (malloc, calloc, free, etc) are used.  It actually only
causes a warning, which is not always caught on certain sources.  In
modules this unknown symbol is not detected until runtime, where the
module fails to load.  This modifies the define's so that using one
of the blocked functions will cause a compile error regardless of
CFLAGS.

Moved spandsp header includes to before asterisk.h so the static inline
functions can continue using malloc and free.  Although these functions
are never called and optimized away, the updated replacement macro's
would still cause a failure.

Change-Id: I532640aca0913ba9da3b18c04a0f010ca1715af5

5 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
    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

5 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"

5 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

5 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

5 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/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

5 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"

5 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
   semicolons.
 * Added support for block comments.

Change-Id: Id17dfaeda8ed4be572e8107a0c010066584aaee7

5 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"

5 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
subscriptions.

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

5 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."

5 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."

5 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.

5 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."

5 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"

5 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."

5 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.

ASTERISK-25045

Change-Id: I05e5e47fd02f61964be13b7e8942bab5d61b29cc

5 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

5 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.

ASTERISK-25034
Reported by: Richard Mudgett

Change-Id: I1ff8f02124d2f4abd632a050da52c64285bb7f30

5 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"

5 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."

5 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."

5 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

5 years agomain/manager.c: Bugfix sort action_manager by alphabetically
Rodrigo Ramírez Norambuena [Tue, 5 May 2015 01:11:56 +0000 (21:11 -0400)]
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

5 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."

5 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

5 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

5 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

5 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"

5 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"