asterisk/asterisk.git
2 years agotest_astobj2_thrash: Fix multithreaded issues
George Joseph [Tue, 25 Oct 2016 16:20:16 +0000 (10:20 -0600)]
test_astobj2_thrash:  Fix multithreaded issues

The test uses 4 threads to grow, count, lookup and shrink 15K objects
in a container.  If there's only 1 execution engine available, the test
will complete in <50ms.  If each threads gets its own execution engine,
the test may timeout after 60 seconds because the count thread does a
locked ao2_callback on the whole container in a tight loop with only
a sched_yield to give up time.  The lock contention makes the test
execution times wildly variable and mostly timeout.  2 execution
engines are OK, 3 results in about 33% failure rate and >=4 causes
a 80% failure rate.

To fix, the sched_yield was changed to a usleep(500).

Also, the number of buckets specified for the container was an even
number so that was changed to the next prime number greater than
(MAX_HASH_ENTRIES / 100).  That's 151 currently.

Change-Id: I50cd2344161ea61bfe4b96d2a29a6ccf88385c77

2 years agoMerge "pjsip: Support dual stack automatically."
Joshua Colp [Tue, 25 Oct 2016 10:29:45 +0000 (05:29 -0500)]
Merge "pjsip: Support dual stack automatically."

2 years agoMerge "pjproject_bundled: Fixed various build issues"
Joshua Colp [Tue, 25 Oct 2016 10:28:48 +0000 (05:28 -0500)]
Merge "pjproject_bundled:  Fixed various build issues"

2 years agoMerge "ARI: Add duplicate channel ID checking for channel creation."
Joshua Colp [Tue, 25 Oct 2016 01:01:47 +0000 (20:01 -0500)]
Merge "ARI: Add duplicate channel ID checking for channel creation."

2 years agoMerge "ARI: Detect duplicate channel IDs"
Joshua Colp [Tue, 25 Oct 2016 01:01:43 +0000 (20:01 -0500)]
Merge "ARI: Detect duplicate channel IDs"

2 years agopjproject_bundled: Fixed various build issues
George Joseph [Mon, 24 Oct 2016 15:55:23 +0000 (09:55 -0600)]
pjproject_bundled:  Fixed various build issues

* CFLAGS is now properly set when using older gcc.
* All third-party pjproject targets have been removed.  This fixes
  an issue with older libsrtp in some distros.
* Manually removing the source directory now causes a rebuild.
* EXTERNALS_CACHE_DIR is now properly checked.
* Whitespace fixes.

Change-Id: I98fec6847efc5602a9f41cb95096fd660a49fa60

2 years agotypo: s/paranthesis/parenthesis/ in a comment
Pascal Cadotte Michaud [Mon, 24 Oct 2016 19:13:43 +0000 (15:13 -0400)]
typo: s/paranthesis/parenthesis/ in a comment

Change-Id: I7c1f4eb051177ee22cbe97e063d4a3effe29be30

2 years agopjsip: Support dual stack automatically.
Joshua Colp [Mon, 19 Sep 2016 11:13:21 +0000 (11:13 +0000)]
pjsip: Support dual stack automatically.

This change adds support for dual stack automatically. No
configuration is required and the IP address and version
in the SIP messages and SDP will be automatically changed
based on the transport over which the message is being
sent. RTP usage has also been changed to listen on both
IPv4 and IPv6 simultaneously to allow media to flow, and
to allow ICE support on both simultaneously. This also
allows failover between IPv6 and IPv4 to work as expected.

ASTERISK-26309 #close

Change-Id: I235a421d8f9a326606d861b449fa6fe3a030572d

2 years agoARI: Add duplicate channel ID checking for channel creation.
Mark Michelson [Wed, 19 Oct 2016 17:05:28 +0000 (12:05 -0500)]
ARI: Add duplicate channel ID checking for channel creation.

This is similar to what is done for origination, but for the 14 and up
channel creation method. When attempting to create a channel, if a
channel ID is specified and a channel already exists with that ID, then
a 409 is returned.

Change-Id: I77f9253278c6947939c418073b6b31065489187c

2 years agoARI: Detect duplicate channel IDs
Mark Michelson [Mon, 17 Oct 2016 19:18:57 +0000 (14:18 -0500)]
ARI: Detect duplicate channel IDs

ARI and AMI allow for an explicit channel ID to be specified
when originating channels. Unfortunately, there is nothing in
place to prevent someone from using the same ID for multiple
channels. Further complicating things, adding ID validation to channel
allocation makes it impossible for ARI to discern why channel allocation
failed, resulting in a vague error code being returned.

The fix for this is to institute a new method for channel errors to be
discerned. The method mirrors errno, in that when an error occurs, the
caller can consult the channel errno value to determine what the error
was. This initial iteration of the feature only introduces "unknown" and
"channel ID exists" errors. However, it's possible to add more errors as
needed.

ARI uses this feature to determine why channel allocation failed and can
return a 409 error during origination to show that a channel with the
given ID already exists.

ASTERISK-26421

Change-Id: Ibba7ae68842dab6df0c2e9c45559208bc89d3d06

2 years agoFix issue with CLI not returning to prompt after running "features show"
snuffy [Wed, 19 Oct 2016 22:53:24 +0000 (09:53 +1100)]
Fix issue with CLI not returning to prompt after running "features show"

ASTERISK-26444 #close

Change-Id: I91d645b7e6e5dba35f8c410df2be77a8c0e3acb8

2 years agoMerge "utils.c: Fix ast_set_default_eid for multiple platforms"
zuul [Wed, 19 Oct 2016 22:35:52 +0000 (17:35 -0500)]
Merge "utils.c:  Fix ast_set_default_eid for multiple platforms"

2 years agoMerge "res_rtp_asterisk: Add ice_blacklist option"
zuul [Wed, 19 Oct 2016 19:58:23 +0000 (14:58 -0500)]
Merge "res_rtp_asterisk: Add ice_blacklist option"

2 years agoMerge "chan_sip: Support nat=auto_comedia or nat=force_rport,auto_comedia."
Joshua Colp [Wed, 19 Oct 2016 16:06:41 +0000 (11:06 -0500)]
Merge "chan_sip: Support nat=auto_comedia or nat=force_rport,auto_comedia."

2 years agores_rtp_asterisk: Add ice_blacklist option
Michael Walton [Tue, 4 Oct 2016 23:24:54 +0000 (12:24 +1300)]
res_rtp_asterisk: Add ice_blacklist option

Introduces ice_blacklist configuration in rtp.conf. Subnets listed in the
form ice_blacklist = <subnet spec>, e.g. ice_blacklist =
192.168.1.0/255.255.255.0, are excluded from ICE host, srflx and relay
discovery. This is useful for optimizing the ICE process where a system
has multiple host address ranges and/or physical interfaces and certain
of them are not expected to be used for RTP. Multiple ice_blacklist
configuration lines may be used. If left unconfigured, all discovered
host addresses are used, as per previous behavior.

Documention in rtp.conf.sample.

ASTERISK-26418 #close

Change-Id: Ibee88f80d7693874fda1cceaef94a03bd86012c9

2 years agoCDR: Alter destruction pattern for CDR chains.
Mark Michelson [Tue, 18 Oct 2016 21:30:17 +0000 (16:30 -0500)]
CDR: Alter destruction pattern for CDR chains.

CDRs form chains. When the root of the chain is destroyed, it then
unreferences the next CDR in the chain. That CDR is destroyed, and it
then unreferences the next CDR in the chain. This repeats until the end
of the chain is reached. While this typically does not cause any sort of
problems, it is possible in strange scenarios for the CDR chain to grow
way longer than expected. In such a scenario, the destruction pattern
can result in a stack overflow.

This patch fixes the problem by switching from a recursive pattern to an
iterative pattern for destruction. When the root CDR is destroyed, it is
responsible for iterating over the rest of the CDRs and unreferencing
each one. Other CDRs in the chain, since they are not the root, will
simply destroy themselves and be done. This causes the stack depth not
to increase.

ASTERISK-26421 #close
Reported by Andrew Nagy

Change-Id: I3ca90c2b8051f3b7ead2e0e43f60d2c18fb204b8

2 years agoMerge "menuselect: invalid test for GTK2"
zuul [Tue, 18 Oct 2016 19:57:08 +0000 (14:57 -0500)]
Merge "menuselect: invalid test for GTK2"

2 years agoMerge "cli: Auto-complete File not Module for core set debug."
Joshua Colp [Tue, 18 Oct 2016 18:22:02 +0000 (13:22 -0500)]
Merge "cli: Auto-complete File not Module for core set debug."

2 years agoari: Update model validator based on addition of asterisk_id.
Joshua Colp [Tue, 18 Oct 2016 16:51:20 +0000 (16:51 +0000)]
ari: Update model validator based on addition of asterisk_id.

ASTERISK-26470

Change-Id: I9c386f7a1c7d969161b28f189eb6298bbc5b7541

2 years agoMerge "Binaural synthesis (confbridge): On/off setting for binaural synthesis."
Joshua Colp [Tue, 18 Oct 2016 16:38:59 +0000 (11:38 -0500)]
Merge "Binaural synthesis (confbridge): On/off setting for binaural synthesis."

2 years agoMerge "chan_rtp: Set a sane default rtp engine for unicast."
Joshua Colp [Tue, 18 Oct 2016 16:38:13 +0000 (11:38 -0500)]
Merge "chan_rtp: Set a sane default rtp engine for unicast."

2 years agomenuselect: invalid test for GTK2
Tzafrir Cohen [Sun, 11 Sep 2016 15:13:00 +0000 (10:13 -0500)]
menuselect: invalid test for GTK2

configuire.ac was only checking for the existence of pkg-config
and not the gtk2 package itself.  Now it calls AST_PKG_CONFIG_CHECK
for gtk+-2.0.

ASTERISK-26356 #close

Change-Id: I93e9d0166341f0e7f84b52955bb6f81da42f2ef6

2 years agoMerge "res/ari: Add the Asterisk EID field to outgoing events"
Joshua Colp [Tue, 18 Oct 2016 10:38:46 +0000 (05:38 -0500)]
Merge "res/ari: Add the Asterisk EID field to outgoing events"

2 years agocli: Auto-complete File not Module for core set debug.
Alexander Traud [Tue, 18 Oct 2016 08:01:47 +0000 (10:01 +0200)]
cli: Auto-complete File not Module for core set debug.

Since Asterisk 1.8, the command "core set debug" on the command-line interface
asks not for a file (.c) but a module name. This change shows modules (.so) on
the auto-completion via a tabulator or the question mark. Now, when you
partially type a module name, TAB or ?, you get the correct candidiates.

ASTERISK-26480

Change-Id: I1213f1dd409bd4ff8de08ad80cb0c73cafb1bae0

2 years agoMerge "app_queue: Added initialization for "context" parameter"
zuul [Mon, 17 Oct 2016 20:08:58 +0000 (15:08 -0500)]
Merge "app_queue: Added initialization for "context" parameter"

2 years agoBinaural synthesis (confbridge): On/off setting for binaural synthesis.
frahaase [Fri, 12 Aug 2016 16:22:58 +0000 (18:22 +0200)]
Binaural synthesis (confbridge): On/off setting for binaural synthesis.

Adds setting to confbridge.conf (binaural_active) that determines if binaural
synthesis can be available in bridge_softmix.

ASTERISK-26292

Change-Id: I59dfcb8e55fe1df4ef32045882fea5bb58fc71db

2 years agopjproject_bundled: Add patch to address SSL crash
George Joseph [Mon, 17 Oct 2016 16:39:10 +0000 (10:39 -0600)]
pjproject_bundled:  Add patch to address SSL crash

Addresses crashes when an attempt is made to operate on an SSL socket
after the socket has been closed.

ASTERISK-26477 #close

Change-Id: I421305b357558b4f9e690210dc0f4831ef4b3002

2 years agoapp_queue: Added initialization for "context" parameter
Leandro Dardini [Thu, 13 Oct 2016 19:09:18 +0000 (21:09 +0200)]
app_queue: Added initialization for "context" parameter

When using Asterisk Realtime Architecture, empty fields are skipped and the
default values are used. If the "context" parameter in queue was set and then
cleared from the database, the old value remains in memory and it continues
to be used. This change initialize the "context" parameter with an empty value,
allowing clearing the parameter.

ASTERISK-26462 #close

Change-Id: I64be73d5044ce38dd02408bd0e53de965ef65905

2 years agores/ari: Add the Asterisk EID field to outgoing events
Matt Jordan [Sun, 16 Oct 2016 01:05:05 +0000 (20:05 -0500)]
res/ari: Add the Asterisk EID field to outgoing events

This patch adds the Asterisk EID field to all outgoing ARI events.
Because this field should be added to all events as they are
transmitted, it is appended to the JSON message just prior to it being
handed off to the application message handler. This makes it somewhat
resilient to both new events being added to ARI, as well as other
potential event transport mechanisms.

ASTERISK-26470 #close

Change-Id: Ieff0ecc24464e83f3f44e9c3e7bd9a5d70b87a1d

2 years agochan_rtp: Set a sane default rtp engine for unicast.
Moises Silva [Thu, 13 Oct 2016 07:06:56 +0000 (03:06 -0400)]
chan_rtp: Set a sane default rtp engine for unicast.

ASTERISK-26439

Change-Id: I7f5ee2eeba8906e9ecb3293dbe3a747770bb5011

2 years agoutils.c: Fix ast_set_default_eid for multiple platforms
George Joseph [Sun, 16 Oct 2016 22:25:35 +0000 (16:25 -0600)]
utils.c:  Fix ast_set_default_eid for multiple platforms

ast_set_default_eid was searching for ethX, emX, enoX, ensX and even
pciD#U interface names.  While this was a good attempt, it wasn't
inclusive enough to capture interfaces like enp6s0 or ens6d1, etc.

Rather than relying on interface names, we now simply find the first
interface returned by the OS that has a hardware address and that
address isn't all 0x00 or all 0xff.  The code IS different for BSD,
Solaris and Linux based on what method is available for enumerating
interfaces.

Tested on:
FreeBSD9
CentOS6
Ubuntu14
Fedora24

I was unable to test on Solaris at this time but the code for Solaris
is used elsewhere at Digium.

Change-Id: Iaa6db87ca78a9a375e47d70e043ae08c1448cb72

2 years agochan_sip: Only send video on outgoing channel if incoming channel supports it
Michael Kuron [Sat, 15 Oct 2016 09:58:05 +0000 (11:58 +0200)]
chan_sip: Only send video on outgoing channel if incoming channel supports it

Previously, the settings videosupport=always and videosupport=yes behaved
identically and unconditionally caused a video offer to be sent in the SDP on
an outgoing call. This was a regression introduced with commit
5a1d90e1fbfc4b48927aad55311f3b38efbf1f54 in Asterisk 1.6.1.

This commit restores correct behavior: videosupport=always causes a video offer
to be sent unconditionally, while videosupport=yes will only offer video on an
outbound channel if the incoming channel it is bridged to also supports video.
That way, the device receiving the outgoing call can display the correct user
interface elements for audio or video and will not unnecessarily show a blank
video window on an audio-only call.

ASTERISK-17470 #close

Change-Id: I782f4409d436114dbc97061c3570c0cd24f7c3ae

2 years agoMerge "Fix issues with bundled pjproject cached download."
zuul [Fri, 14 Oct 2016 23:48:58 +0000 (18:48 -0500)]
Merge "Fix issues with bundled pjproject cached download."

2 years agoMerge "Audit ast_json_pack() calls for needed UTF-8 checks."
zuul [Fri, 14 Oct 2016 22:17:14 +0000 (17:17 -0500)]
Merge "Audit ast_json_pack() calls for needed UTF-8 checks."

2 years agoMerge "json: Check party id name, number, subaddresses for UTF-8."
zuul [Fri, 14 Oct 2016 21:32:18 +0000 (16:32 -0500)]
Merge "json: Check party id name, number, subaddresses for UTF-8."

2 years agoMerge "json: Add UTF-8 check call."
zuul [Fri, 14 Oct 2016 19:40:34 +0000 (14:40 -0500)]
Merge "json: Add UTF-8 check call."

2 years agoMerge "res_config_mysql: Fix several issues related to recent table changes"
zuul [Fri, 14 Oct 2016 16:49:14 +0000 (11:49 -0500)]
Merge "res_config_mysql:  Fix several issues related to recent table changes"

2 years agoMerge "aoc.c: Whitespace cleanup"
zuul [Fri, 14 Oct 2016 16:13:50 +0000 (11:13 -0500)]
Merge "aoc.c: Whitespace cleanup"

2 years agoMerge "app_queue.c: Fix clearing of pause reason string."
zuul [Fri, 14 Oct 2016 15:08:23 +0000 (10:08 -0500)]
Merge "app_queue.c: Fix clearing of pause reason string."

2 years agoFix issues with bundled pjproject cached download.
Corey Farrell [Fri, 14 Oct 2016 05:18:50 +0000 (01:18 -0400)]
Fix issues with bundled pjproject cached download.

Previously when testing I had a preexisting makeopts in ASTTOPDIR.  The
ordering of configure.ac causes --with-externals-cache to be processed
after third-party configure.  In cases where the Asterisk clone is
cleaned it would cause pjproject to be downloaded to /tmp.  This
moves processing of the externals cache and sounds cache to happen
before third-party configure.

This also addresses a possible issue with the third-party Makefile.  If
TMPDIR is set by the environment it would override the path given to
--with-externals-cache.

ASTERISK-26416

Change-Id: Ifab7f35bfcd5a31a31a3a4353cc26a68c8c6592d

3 years agoAudit ast_json_pack() calls for needed UTF-8 checks.
Richard Mudgett [Wed, 12 Oct 2016 21:24:14 +0000 (16:24 -0500)]
Audit ast_json_pack() calls for needed UTF-8 checks.

Added needed UTF-8 checks before constructing json objects in various
files for strings obtained outside the system.  In this case string values
from a channel driver's peer and not from the user setting channel
variables.

* aoc.c: Fixed type mismatch in s_to_json() for time and granularity json
object construction.

ASTERISK-26466
Reported by: Richard Mudgett

Change-Id: Iac2d867fa598daba5c5dbc619b5464625a7f2096

3 years agojson: Check party id name, number, subaddresses for UTF-8.
Richard Mudgett [Wed, 12 Oct 2016 21:20:00 +0000 (16:20 -0500)]
json: Check party id name, number, subaddresses for UTF-8.

* Updated unit test as ast_json_name_number() is now NULL tolerant.

ASTERISK-26466 #close
Reported by: Richard Mudgett

Change-Id: I7d4e14194f8f81f24a1dc34d1b8602c0950265a6

3 years agojson: Add UTF-8 check call.
Richard Mudgett [Tue, 11 Oct 2016 23:14:39 +0000 (18:14 -0500)]
json: Add UTF-8 check call.

Since the json library does not make the check function public we
recreate/copy the function in our interface module.

ASTERISK-26466
Reported by: Richard Mudgett

Change-Id: I36d3d750b6f5f1a110bc69ea92b435ecdeeb2a99

3 years agoaoc.c: Whitespace cleanup
Richard Mudgett [Wed, 12 Oct 2016 22:42:11 +0000 (17:42 -0500)]
aoc.c: Whitespace cleanup

* In s_to_json() removed unnecessary ast_json_ref() to ast_json_null()
when creating the type json object.  The ref is a noop.

Change-Id: I2be8b836876fc2e34a27c161f8b1c53b58a3889a

3 years agoapp_minivm.c: Fix malformed ast_json_pack() call.
Richard Mudgett [Wed, 12 Oct 2016 21:22:34 +0000 (16:22 -0500)]
app_minivm.c: Fix malformed ast_json_pack() call.

Change-Id: I082b239022fac462666e52a14a44304748908dc0

3 years agoapp_queue.c: Fix clearing of pause reason string.
Richard Mudgett [Wed, 12 Oct 2016 22:27:06 +0000 (17:27 -0500)]
app_queue.c: Fix clearing of pause reason string.

The pause reason is not always cleared when it should be cleared.

* Made set_queue_member_pause() always clear pause reason if not pausing
with a reason string.

Change-Id: I993dad19626ec017478a230e980989438b778c53

3 years agores_config_mysql: Fix several issues related to recent table changes
George Joseph [Wed, 12 Oct 2016 21:30:40 +0000 (15:30 -0600)]
res_config_mysql:  Fix several issues related to recent table changes

Unlike any of the other database drivers, res_config_mysql checks that
the table definition matches the requirements for every insert and
update statement.  Since all requirements are forced to 'char', any
column that isn't a char, like ps_contacts' expiration_time,
qualify_timeout, etc., will throw a warning.  It's kinda harmless but
very misleading.  Since no other driver does those checks on insert
or update, they've been removed from res_config_mysql.  Also, all
the logic that actually attempted to ALTER the table to fix the issue
has been removed.  With the move to alembic, the auto-alter
functionality is not only unnecessary, it's also dangerous.

The other issue is that res_config_mysql calls the mysql_insert_id
function inside store_mysql.  Presumably the intention was to return
the number of rows inserted DESPITE A NOTE IN THE CODE THAT THE VALUE
IS NON_PORTABLE AND MAY CHANGE.  That value is then returned to
config realtime as the number of rows inserted.  Guess what?  The value
changed.  It now only returns the number of rows inserted if there's an
auto increment column on the table, which ps_contacts doesn't have.
Otherwise it returns 0.  So now, the insert worked but we tell config
realtime and sorcery that no rows were inserted.  That call to
mysql_insert_id was removed and we now always return 1 if the insert
succeeded.  We're only inserting 1 row at a time anyway.  If the insert
fails, we still return -1.

ASTERISK-26362 #close
Reported-by: Carlos Chavez

Change-Id: I83ce633efdb477b03c8399946994ee16fefceaf4

3 years agoBinaural synthesis (confbridge): Adds libfftw3 as dependency.
frahaase [Fri, 12 Aug 2016 16:22:40 +0000 (18:22 +0200)]
Binaural synthesis (confbridge): Adds libfftw3 as dependency.

Adds libfftw3 to the build chain that is is going to be used for binaural
synthesis by bridge_softmix.

ASTERISK-26292

Change-Id: Iedc2f174e4ccb39ae5d9e698e339c6a17155867b

3 years agoMerge "Binaural synthesis (confbridge): interleaved two-channel audio."
zuul [Wed, 12 Oct 2016 16:36:06 +0000 (11:36 -0500)]
Merge "Binaural synthesis (confbridge): interleaved two-channel audio."

3 years agoMerge "bundled_pjproject: Add tests for programs used by the Makefile, et al."
zuul [Wed, 12 Oct 2016 16:04:53 +0000 (11:04 -0500)]
Merge "bundled_pjproject:  Add tests for programs used by the Makefile, et al."

3 years agores_fax: Fix a tight race condition causing fax to crash in audio fallback
Torrey Searle [Thu, 29 Sep 2016 18:08:07 +0000 (20:08 +0200)]
res_fax: Fix a tight race condition causing fax to crash in audio fallback

When T.38 gets rejected and G711 failback occurs there is a period of
time where neither AST_FAX_TECH_T38 nor AST_FAX_TECH_AUDIO is set,
leading to a crash.

Change-Id: Icc3f457b2292d48a9d7843dac0028347420cc982

3 years agoMerge "Add text of cdr directory into README.md for ast-db-manage"
zuul [Wed, 12 Oct 2016 00:45:14 +0000 (19:45 -0500)]
Merge "Add text of cdr directory into README.md for ast-db-manage"

3 years agoMerge "res_calendar: Add support for fetching calendars when reloading"
zuul [Wed, 12 Oct 2016 00:22:24 +0000 (19:22 -0500)]
Merge "res_calendar: Add support for fetching calendars when reloading"

3 years agoMerge "audiohooks: Remove redundant codec translations when using audiohooks"
zuul [Tue, 11 Oct 2016 22:45:56 +0000 (17:45 -0500)]
Merge "audiohooks: Remove redundant codec translations when using audiohooks"

3 years agoMerge "vector: After remove element recheck index"
zuul [Tue, 11 Oct 2016 21:41:33 +0000 (16:41 -0500)]
Merge "vector: After remove element recheck index"

3 years agoMerge "app_dial: Add the "Q" option to set the cause on unanswered channels"
zuul [Tue, 11 Oct 2016 20:15:56 +0000 (15:15 -0500)]
Merge "app_dial:  Add the "Q" option to set the cause on unanswered channels"

3 years agoMerge "logger: Prevent output of verbose messages initiated from rasterisk."
zuul [Tue, 11 Oct 2016 18:57:56 +0000 (13:57 -0500)]
Merge "logger: Prevent output of verbose messages initiated from rasterisk."

3 years agoapp_dial: Add the "Q" option to set the cause on unanswered channels
George Joseph [Thu, 6 Oct 2016 14:58:26 +0000 (08:58 -0600)]
app_dial:  Add the "Q" option to set the cause on unanswered channels

The "Q" option will set the cause on the unanswered channels when
another channel answers.  It overrides the default of
ANSWERED_ELSEWHERE.

NOTE:  chan_sip does not support setting the cause on a CANCEL to
anything other than ANSWERED_ELSEWHERE.

ASTERISK-26446 #close

Change-Id: I71742e0919aaa16784c30a2b2e73fbeed7672e47

3 years agoMerge "res_rtp_asterisk: Fix infinite DTMF issue when switching to P2P bridge"
Joshua Colp [Tue, 11 Oct 2016 13:52:45 +0000 (08:52 -0500)]
Merge "res_rtp_asterisk: Fix infinite DTMF issue when switching to P2P bridge"

3 years agochan_sip: Support nat=auto_comedia or nat=force_rport,auto_comedia.
Alexander Traud [Tue, 11 Oct 2016 11:55:13 +0000 (13:55 +0200)]
chan_sip: Support nat=auto_comedia or nat=force_rport,auto_comedia.

In the SIP channel driver chan_sip, auto_comedia was expected to be used in
tandem with auto_force_rport. Or stated differently: Only when auto_force_rport
was chosen (the default), auto_comedia worked. This change allows auto_comedia
to be set independently of the state of (auto_)force_rport. For example,
nat=force_rport,auto_comedia is useful for IPv4/IPv6 Dual Stack deployments
when IPv6 clients are behind a Firewall.

ASTERISK-26457 #close

Change-Id: Ib29d66c6dbb61648e371e01fc36c6978ddae5bc2

3 years agovector: After remove element recheck index
Badalyan Vyacheslav [Mon, 10 Oct 2016 21:59:58 +0000 (17:59 -0400)]
vector: After remove element recheck index

Small fix. It is necessary to double-check
the index that we just removed because there
is a new element.

ASTERISK-26453 #close

Change-Id: Ib947fa94dc91dcd9341f357f1084782c64434eb7

3 years agoMerge "cel_odbc: Fix memory leak on module unload"
Joshua Colp [Tue, 11 Oct 2016 00:26:37 +0000 (19:26 -0500)]
Merge "cel_odbc: Fix memory leak on module unload"

3 years agoMerge "pjproject_bundled: Add MALLOC_DEBUG capability"
Joshua Colp [Mon, 10 Oct 2016 23:06:30 +0000 (18:06 -0500)]
Merge "pjproject_bundled:  Add MALLOC_DEBUG capability"

3 years agores_rtp_asterisk: Fix infinite DTMF issue when switching to P2P bridge
Torrey Searle [Thu, 29 Sep 2016 17:52:45 +0000 (19:52 +0200)]
res_rtp_asterisk: Fix infinite DTMF issue when switching to P2P bridge

If a bridge switched to P2P when a DTMF was in progress it
was possible for the DTMF to continue being sent indefinitely.

Change-Id: I7e2a3efe0d59d4b214ed50cd0b5d0317e2d92e29

3 years agologger: Prevent output of verbose messages initiated from rasterisk.
Corey Farrell [Mon, 10 Oct 2016 02:28:52 +0000 (22:28 -0400)]
logger: Prevent output of verbose messages initiated from rasterisk.

Remote asterisk consoles should only display verbose log messages
created by the daemon.  The first patch for ASTERISK-26410 caused
a couple verbose messages to be printed when the rasterisk process
ended.

ASTERISK-26410

Change-Id: Ie2a1bb3753ad2724c0349ec1a336f52f7117b52a

3 years agoaudiohooks: Remove redundant codec translations when using audiohooks
Michael Walton [Wed, 5 Oct 2016 01:46:17 +0000 (14:46 +1300)]
audiohooks: Remove redundant codec translations when using audiohooks

The main frame read and write handlers in main/channel.c don't use the
optimum placement in the processing flow for calling audiohooks
callbacks, as far as codec translation is concerned. This change places
the audiohooks callback code:
 * After the channel read translation if the frame is not linear before
the translation, thereby increasing the chance that the frame is linear
as required by audiohooks
 * Before the channel write translation if the frame is linear at this
point
This prevents the audiohooks code from instantiating additional
translation paths to/from linear where a linear frame format is already
available, saving valuable CPU cycles

ASTERISK-26419

Change-Id: I6edd5771f0740e758e7eb42558b953f046c01f8f

3 years agores_pjsip_config_wizard: Memory leak in module_unload
Badalyan Vyacheslav [Mon, 10 Oct 2016 15:59:38 +0000 (11:59 -0400)]
res_pjsip_config_wizard: Memory leak in module_unload

Fixed a memory leak. It removes only the first element.
Added a useful feature in vector.h to remove all items
under the CMP through a callback function / macro.

ASTERISK-26453 #close

Change-Id: I84508353463456d2495678f125738e20052da950

3 years agores_calendar: Add support for fetching calendars when reloading
Ludovic Gasc (GMLudo) [Thu, 29 Sep 2016 17:45:39 +0000 (19:45 +0200)]
res_calendar: Add support for fetching calendars when reloading

We use a lot res_calendar, we are very happy with that, especially
because you use libical, the almost alone opensource library that
supports really ical format with all types of recurrency.

Nevertheless, some features are missed for our business use cases.

This first patch adds a new option in calendar.conf:
fetch_again_at_reload. Be my guest for a better name.

If it's true, when you'll launch "module reload res_calendar.so",
Asterisk will download again the calendar.

The business use case is that we have a WebUI with a scheduler planner,
we know when the calendars are modified.

For now, we need to define 1 minute of timeout to have a chance that
our user doesn't wait too long between the modification and the real
test.  But it generates a lot of useless HTTP traffic.

ASTERISK-26422 #close

Change-Id: I384b02ebfa42b142bbbd5b7221458c7f4dee7077

3 years agoMerge "Revert "Packet-Loss Concealment (PLC) for supporting codecs.""
Joshua Colp [Mon, 10 Oct 2016 11:01:07 +0000 (06:01 -0500)]
Merge "Revert "Packet-Loss Concealment (PLC) for supporting codecs.""

3 years agocel_odbc: Fix memory leak on module unload
Badalyan Vyacheslav [Mon, 10 Oct 2016 02:53:07 +0000 (22:53 -0400)]
cel_odbc: Fix memory leak on module unload

Change-Id: Ic7a1236eba2408090fdabb5f717b5fa455ead715

3 years agobundled_pjproject: Add tests for programs used by the Makefile, et al.
George Joseph [Mon, 3 Oct 2016 16:30:43 +0000 (10:30 -0600)]
bundled_pjproject:  Add tests for programs used by the Makefile, et al.

Added tests for bzip2, tar, patch, sed and nm to configure.ac.

Set DOWNLOAD_TO_STDOUT to a working command line regardless of
whether the download program is wget, curl or fetch.

Added a 'configure.m4' file to the third-party directory which takes
care of calling any third-party project setup.  Had to move some
pjproject_bundled stuff up in configure.ac so it was called before
the third-party configure macro.

The pjproject tarball is now downloaded to the externals_cache_dir if
it was specified on the ./configure command line

Removed regeneration of the pjproject aconfigure file.  It was only
needed for an old patch that no longer applies.

Converted the tests for symbols to explicit tests since we know that
they're now available in the bundled version.  Saves a little time
during configure.

ASTERISK-26416 #close
Reported-by: Corey Farrell

Change-Id: Id1d94251c0155f8dd41b7de7067f35cfbaafbb9b
(cherry picked from commit e6b0053d7561032b7adbf6f3afaecf30f5046605)
(cherry picked from commit a0d02f38322c2c4d7743504003fd376d32a133db)

3 years agoRevert "Packet-Loss Concealment (PLC) for supporting codecs."
Joshua Colp [Sun, 9 Oct 2016 23:54:53 +0000 (23:54 +0000)]
Revert "Packet-Loss Concealment (PLC) for supporting codecs."

This change introduced some fax test failures
that have not yet been addressed. So this is
not forgotten I'm submitting a change which
reverts it.

This reverts:
d56fc3b36b7bb59b5506129b9895b6c3341350c9.

ASTERISK-25629

Change-Id: Ibc2f23c38643f5a2c89cf8915ae2d805b81bc3d5

3 years agopjproject_bundled: Add MALLOC_DEBUG capability
George Joseph [Wed, 5 Oct 2016 19:53:10 +0000 (13:53 -0600)]
pjproject_bundled:  Add MALLOC_DEBUG capability

pjproject_bundled will now use the asterisk memory debugging APIs
if MALLOC_DEBUG is turned on in menuselect.

Because this required stubs for the executable programs and the python
bindings, some Makefile reorganization was needed to properly handle
the dependencies.  As a result, the makefile now individually makes
each of the pjproject libraries separately instead of making them all
in 1 shot.  The only visible change is that there are separate status
lines printed for each library instead oif 1 for all libs.  Also, the
making of the pjproject dependency files was eliminated.  They're not
needed for building unless you're actively modifying pjproject source
files and it makes the build process faster.  Finally, any issues with
parallel builds should be resolved again making the build faster.

Change-Id: Icc5e3d658fbfb00e0a46b44c66dcc2522d5171b0

3 years agoalembic: Allow cdr, config and voicemail to exist in the same schema
George Joseph [Tue, 4 Oct 2016 21:59:54 +0000 (15:59 -0600)]
alembic:  Allow cdr, config and voicemail to exist in the same schema

cdr, config and voicemail are all separate alembic trees.  Because
alembic's default is to use a table named 'alembic_version' to store
the current tree revision, the 3 trees can't exist in the same schema
without stepping on each other.

Now each tree uses 'alembic_version_<tree_name>' as the version table.
Each tree's env.py script now first checks for 'alembic_version'.  If
it finds it AND its revision is in the tree's history, the script
renames it to 'alembic_version_<tree_name>'.  Regardless, the script
then continues with the migration using 'alembic_version_<tree_name>'
and creates that table if it's not found.  The result is that if an
existing 'alembic_version' table was found but it didn't belong to this
tree, it's left alone and 'alembic_version_<tree_name>' is used or
created.

WARNING:  If multiple trees are using the same schema, they MUST NOT
CRU or D any objects with names that might exist in the other trees.
An example would be 'yesno_values' type.  If two trees perform
operations on it, one tree could pull it out from under the other.
Thankfully we currently don't share any names among cdr, config and
voicemail.

NOTE:  Since the env.py scripts in each tree were identical, a common
env.py has been placed in the ast-db-manage directory and a symlink
to it has been placed in each tree directory.

ASTERISK-24311 #close
Reported-by: Dafi Ni

Change-Id: I4d593f000350deb5d21a14fa1e9bc3896844d898

3 years agoMerge "chan_sip: Honor support of Symmetric Response (rport) for SIP requests."
Joshua Colp [Fri, 7 Oct 2016 10:58:56 +0000 (05:58 -0500)]
Merge "chan_sip: Honor support of Symmetric Response (rport) for SIP requests."

3 years agochan_sip: Honor support of Symmetric Response (rport) for SIP requests.
Alexander Traud [Wed, 5 Oct 2016 09:25:11 +0000 (11:25 +0200)]
chan_sip: Honor support of Symmetric Response (rport) for SIP requests.

In the SIP channel driver chan_sip, the default is "auto_force_rport". When no
NAT was detected, for example in case of IPv6, Asterisk uses the IP address
from the headers within the SIP-REGISTER for subsequent SIP signaling. When
the remote party specifies support for Symmetric Response (RFC 3581) via the
parameter "rport", Asterisk should not extract the port from the SIP headers
but reuse the port of the transport. This did not happen because of a typo.

ASTERISK-26438 #close

Change-Id: If6e7891848aaf96666dee5305695f7c6667cd5a6

3 years agoMerge "app_queue: Update dynamic members ringinuse on reload."
Joshua Colp [Tue, 4 Oct 2016 17:45:54 +0000 (12:45 -0500)]
Merge "app_queue: Update dynamic members ringinuse on reload."

3 years agoBinaural synthesis (confbridge): interleaved two-channel audio.
frahaase [Fri, 12 Aug 2016 16:22:02 +0000 (18:22 +0200)]
Binaural synthesis (confbridge): interleaved two-channel audio.

Asterisk only supports mono audio at the moment.
This patch adds interleaved two-channel audio to Asterisk's channels.

ASTERISK-26292

Change-Id: I7a547cea0fd3c6d1e502709d9e7e39605035757a

3 years agoastobj2: Add backtrace to log_bad_ao2.
Corey Farrell [Fri, 16 Sep 2016 23:54:07 +0000 (19:54 -0400)]
astobj2: Add backtrace to log_bad_ao2.

* Compile __ast_assert_failed unconditionally.
* Use __ast_assert_failed to log messages from log_bad_ao2
* Remove calls to ast_assert(0) that happen after log_bad_ao2 was run.

Change-Id: I48f1af44b2718ad74a421ff75cb6397b924a9751

3 years agoAdd text of cdr directory into README.md for ast-db-manage
Rodrigo Ramírez Norambuena [Fri, 30 Sep 2016 21:29:37 +0000 (18:29 -0300)]
Add text of cdr directory into README.md for ast-db-manage

Change-Id: I68321c4bea50730c39fdb486e5f23aeadd1ad636

3 years agoapp_queue: Update dynamic members ringinuse on reload.
Etienne Lessard [Fri, 9 Sep 2016 17:38:39 +0000 (13:38 -0400)]
app_queue: Update dynamic members ringinuse on reload.

Previously, when reloading the members of a queue, the members added statically
(i.e. defined in queues.conf) would see their "ringinuse" value updated but not
the members added dynamically.

This change makes dynamic members ringuse value to be updated on reload.

Note that it's impossible to add a dynamic member with a specific ringinuse
value. For both static and dynamic members, the ringinuse value can always be
changed later on with command like "queue set ringinuse" or with the AMI action
"QueueMemberRingInUse". So it's possible this commit could break a user workflow
if he was changing the ringinuse value of dynamic members via such commands and
was also relying on the fact that a queue reload would not update the dynamic
members ringinuse value.

ASTERISK-26330

Change-Id: I3745cc9a06ba7e02c399636f1ee9e58c04081f3f

3 years agoMerge "core: Remove ABI effects of LOW_MEMORY."
Joshua Colp [Fri, 30 Sep 2016 11:49:33 +0000 (06:49 -0500)]
Merge "core: Remove ABI effects of LOW_MEMORY."

3 years agoMerge "Remove "format_ogg_opus: New format""
Joshua Colp [Thu, 29 Sep 2016 21:14:28 +0000 (16:14 -0500)]
Merge "Remove "format_ogg_opus: New format""

3 years agoMerge "download_externals: Fix issue with re-install"
Joshua Colp [Thu, 29 Sep 2016 21:03:27 +0000 (16:03 -0500)]
Merge "download_externals: Fix issue with re-install"

3 years agoRemove "format_ogg_opus: New format"
Kevin Harwell [Thu, 29 Sep 2016 19:02:37 +0000 (14:02 -0500)]
Remove "format_ogg_opus: New format"

This reverts commit 40aa28131bc30b4516da2b20eb1a1e043920169c.

ASTERISK-26426 #close

Change-Id: I81e55c3c512f1dd6f49896f0c6b97a07d74fd8f5

3 years agocore: Remove ABI effects of LOW_MEMORY.
Corey Farrell [Mon, 19 Sep 2016 09:46:27 +0000 (05:46 -0400)]
core: Remove ABI effects of LOW_MEMORY.

This allows asterisk to compiled with LOW_MEMORY to load modules built
without LOW_MEMORY.

ASTERISK-26398 #close

Change-Id: I24b78ac9493ab933b11087a8b6794f3c96d4872d

3 years agodownload_externals: Fix issue with re-install
George Joseph [Tue, 27 Sep 2016 21:10:37 +0000 (15:10 -0600)]
download_externals: Fix issue with re-install

Needed to ignore an xmlstarlet return code for optional element.

Change-Id: I6a96f709b4b38c9a3f3dda4e8b07903787e16873
Reported-by: Dan Jenkins

3 years agologger: Output early verbose messages to console.
Corey Farrell [Tue, 27 Sep 2016 20:35:38 +0000 (16:35 -0400)]
logger: Output early verbose messages to console.

Verbose messages should be printed to the console if the sublevel is
less than option_verbose.  This fix ensures the welcome message with
copyright and license are printed at daemon and interactive rasterisk
startup.

ASTERISK-26410 #close

Change-Id: Ia44235e30ec328aba92ea2c8a837b094e65c9a03

3 years agoMerge "chan_sip: Resolve externhost not to IPv6; instead go for IPv4."
zuul [Tue, 27 Sep 2016 19:30:46 +0000 (14:30 -0500)]
Merge "chan_sip: Resolve externhost not to IPv6; instead go for IPv4."

3 years agoMerge "codec_opus: Add download ability to menuselect"
George Joseph [Tue, 27 Sep 2016 19:13:04 +0000 (14:13 -0500)]
Merge "codec_opus: Add download ability to menuselect"

3 years agoMerge "codec_opus: Replace res_format_attr_opus with the one from codec_opus"
George Joseph [Tue, 27 Sep 2016 19:12:52 +0000 (14:12 -0500)]
Merge "codec_opus: Replace res_format_attr_opus with the one from codec_opus"

3 years agoMerge "format_ogg_opus: New format"
George Joseph [Tue, 27 Sep 2016 19:12:42 +0000 (14:12 -0500)]
Merge "format_ogg_opus: New format"

3 years agocodec_opus: Add download ability to menuselect
George Joseph [Thu, 22 Sep 2016 14:49:50 +0000 (08:49 -0600)]
codec_opus: Add download ability to menuselect

Updated codecs/codecs.xml to add codec_opus to the external
download list.

ASTERISK-26409

Change-Id: Ia07b36539f30e852125fb2b94147dc9774df31a4
(cherry picked from commit 2cdab0e36eec4997ca3bd85aa09efc477038e31c)
(cherry picked from commit e9684f3acd0e8def0df582c1505dd39dd3fd1610)

3 years agocodec_opus: Replace res_format_attr_opus with the one from codec_opus
George Joseph [Sat, 23 Jul 2016 19:50:37 +0000 (13:50 -0600)]
codec_opus: Replace res_format_attr_opus with the one from codec_opus

Preparation

ASTERISK-26409

Change-Id: I9f20e7cce00c32464d9a180e81283d49d199d0a3
(cherry picked from commit 59f7662a93bf9c07204fb50e1020a0f5bfbbd5c9)

3 years agoformat_ogg_opus: New format
George Joseph [Sat, 23 Jul 2016 20:56:43 +0000 (14:56 -0600)]
format_ogg_opus: New format

Add Ogg/Opus playback support.

This uses libopusfile in order to be able to read .opus files and play
them back.

Writing/recording support is not present at this time.

ASTERISK-26409

Change-Id: I8815d23345108d8ca7c0bd640f6a1ce6b4f56955
(cherry picked from commit daee8bbd5209b4158bc1785eede845a26e6cbeaa)

3 years agobuild_tools: Add ability to download variants to download_externals
George Joseph [Sun, 25 Sep 2016 00:05:02 +0000 (18:05 -0600)]
build_tools:  Add ability to download variants to download_externals

Some external packages have multiple variants that apply to different
builds of asterisk.  The DPMA for instance has a "bundled" variant that
needs to be downloaded if asterisk was configured with
--with-pjproject-bundled.

There are 2 ways to specify variants:

If you need the user to make the decision about which variant to
download, simply create multiple menuselect "member" entries like so...

<member name="res_digium_phone" displayname="..snipped..">
  <support_level>external</support_level>
  <depend>xmlstarlet</depend>
  <depend>bash</depend>
  <defaultenabled>no</defaultenabled>
</member>

<member name="res_digium_phone-bundled" displayname="..snipped..">
  <support_level>external</support_level>
  <depend>xmlstarlet</depend>
  <depend>bash</depend>
  <defaultenabled>no</defaultenabled>
</member>

Note that the second entry has "-<variant>" appended to the name.
You can then use the existing menuselect facilities to restrict which
members to enable or disable.  Youy probably don't want the user to
enable multiple at the same time.

If you want to hide the details of the variants, the better way to
do it is to create 1 member with "variant" elements.

<member name="res_digium_phone" displayname="..snipped..">
  <support_level>external</support_level>
  <depend>xmlstarlet</depend>
  <depend>bash</depend>
  <defaultenabled>no</defaultenabled>
  <member_data>
    <downloader>
      <variants>
        <variant tag="bundled"
          condition='[[ "$PJPROJECT_BUNDLED" = "yes" ]]'/>
      </variants>
    </downloader>
  </member_data>
</member>

The condition must be a bash expression suitable for use with an "if"
statement.  Any environment variable can be used plus those available
in makeopts.

In this case, if asterisk was configured with --with-pjproject-bundled
the bundled variant will be automatically downloaded.  Otherwise the
normal version will be downloaded.

Change-Id: I4de23e06d4492b0a65e105c8369966547d0faa3e

3 years agoMerge "chan_sip: Address runaway when realtime peers subscribe to mailboxes"
zuul [Fri, 23 Sep 2016 21:59:59 +0000 (16:59 -0500)]
Merge "chan_sip:  Address runaway when realtime peers subscribe to mailboxes"

3 years agoMerge "channels/chan_pjsip: fix HANGUPCAUSE function bug."
zuul [Fri, 23 Sep 2016 20:38:53 +0000 (15:38 -0500)]
Merge "channels/chan_pjsip: fix HANGUPCAUSE function bug."

3 years agochan_sip: Resolve externhost not to IPv6; instead go for IPv4.
Alexander Traud [Fri, 23 Sep 2016 14:54:28 +0000 (16:54 +0200)]
chan_sip: Resolve externhost not to IPv6; instead go for IPv4.

For the channel driver chan_sip, you specify externhost=example.com in sip.conf
when your Asterisk is behind a NAT and your IP address is assigned dynamically.
Or stated differently: You do not have a static IP address to use "externaddr"
directly. This NAT support is quite handy but just about IPv4. Previously,
Asterisk resolved "externhost" to any IP version. When the first DNS answer
resolved to an IPv6, Asterisk sent an IPv6 in SIP/SDP for origin (o=) and
connection (c=). This happened in outgoing SIP-REGISTER and while answering
SIP-INVITE. If the remote peer is IPv4-only, it might not handle o=/c= with an
IPv6. This change makes sure, no IPv6 is resolved anymore for "externhost".

ASTERISK-18232 #close
Reported by: Jacek Kowalski
Tested by: Alexander Traud
patches:
 changes.patch submitted by Alessandro Crespi

Change-Id: If68eedbeff65bd1c1d8a9ed921c02ba464b32dac

3 years agochan_sip: Address runaway when realtime peers subscribe to mailboxes
George Joseph [Tue, 20 Sep 2016 14:42:15 +0000 (08:42 -0600)]
chan_sip:  Address runaway when realtime peers subscribe to mailboxes

Users upgrading from asterisk 13.5 to a later version and who use
realtime with peers that have mailboxes were experiencing runaway
situations that manifested as a continuous stream of taskprocessor
congestion errors, memory leaks and an unresponsive chan_sip.

A related issue was that setting rtcachefriends=no NEVER worked in
asterisk 13 (since the move to stasis).  In 13.5 and earlier, when a
peer tried to register, all of the stasis threads would block and
chan_sip would again become unresponsive.  After 13.5, the runaway
would happen.

There were a number of causes...
* mwi_event_cb was (indirectly) calling build_peer even though calls to
  mwi_event_cb are often caused by build_peer.
* In an effort to prevent chan_sip from being unloaded while messages
  were still in flight, destroy_mailboxes was calling
  stasis_unsubscribe_and_join but in some cases waited forever for the
  final message.
* add_peer_mailboxes wasn't properly marking the existing mailboxes
  on a peer as "keep" so build_peer would always delete them all.
* add_peer_mwi_subs was unsubscribing existing mailbox subscriptions
  then just creating them again.

All of this was causing a flood of subscribes and unsubscribes on
multiple threads all for the same peer and mailbox.

Fixes...
* add_peer_mailboxes now marks mailboxes correctly and build_peer only
  deletes the ones that really are no longer needed by the peer.
* add_peer_mwi_subs now only adds subscriptions marked as "new" instead
  of unsubscribing and resubscribing everything.  It also adds the peer
  object's address to the mailbox instead of its name to the subscription
  userdata so mwi_event_cb doesn't have to call build_peer.

With these changes, with rtcachefriends=yes (the most common setting),
there are no leaks, locks, loops or crashes at shutdown.

rtcachefriends=no still causes leaks but at least it doesn't lock, loop
or crash.  Since making rtcachefriends=no work wasnt in scope for this
issue, further work will have to be deferred to a separate patch.

Side fixes...
 * The ast_lock_track structure had a member named "thread" which gdb
   doesn't like since it conflicts with it's "thread" command.  That
   member was renamed to "thread_id".

ASTERISK-25468 #close

Change-Id: I07519ef7f092629e1e844f855abd279d6475cdd0