]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
5 years agoMerge "app_voicemail.c: Support multiple file formats for forwarded messages." into 13
Friendly Automation [Mon, 21 Oct 2019 12:19:41 +0000 (07:19 -0500)] 
Merge "app_voicemail.c: Support multiple file formats for forwarded messages." into 13

5 years agoMerge "Crash during "pjsip show channelstats" execution" into 13
Friendly Automation [Mon, 21 Oct 2019 12:18:16 +0000 (07:18 -0500)] 
Merge "Crash during "pjsip show channelstats" execution" into 13

5 years agoREADME-SERIOUSLY.bestpractices.md: Speling correetions.
Sean Bright [Wed, 16 Oct 2019 21:06:52 +0000 (17:06 -0400)] 
README-SERIOUSLY.bestpractices.md: Speling correetions.

ASTERISK-28586 #close

Change-Id: I43dc4e8bd9dc685b17695b215a5360314074734f

5 years agoCrash during "pjsip show channelstats" execution
Salah Ahmed [Thu, 10 Oct 2019 11:56:34 +0000 (13:56 +0200)] 
Crash during "pjsip show channelstats" execution

During execution "pjsip show channelstats" cli command by an
external module asterisk crashed. It seems this is a separate
thread running to fetch and print rtp stats. The crash happened on
the ao2_lock method, just before it going to read the rtp stats on
a rtp instance. According to gdb backtrace log, it seems the
session media was already cleaned up at that moment.

ASTERISK-28578

Change-Id: Ia918bfa3c8119060633e39b14852e8d983e0417e

5 years agoapp_voicemail.c: Support multiple file formats for forwarded messages.
cmaj [Fri, 27 Sep 2019 00:24:12 +0000 (18:24 -0600)] 
app_voicemail.c: Support multiple file formats for forwarded messages.

If you specify multiple formats in voicemail.conf, eg. "format = gsm|wav"
and are using realtime ODBC backend, only the first format gets stored
in the database. So when you forward a message later on, there is a bug
generating the email, related to the stored format (GSM) being different
than the desired email format (WAV) specified for the user. Sox can
handle this, but Asterisk needs to tell sox exactly what to do.

ASTERISK-22192

Change-Id: I7321e7f7e7c58adbf41dd4fd7191c887b9b2eafd

5 years agoMerge "res_pjsip_mwi: potential double unref, and potential unwanted double link...
Friendly Automation [Mon, 14 Oct 2019 15:18:23 +0000 (10:18 -0500)] 
Merge "res_pjsip_mwi: potential double unref, and potential unwanted double link" into 13

5 years agoMerge "pbx: deadlock when outgoing dialed channel hangs up too quickly" into 13
Friendly Automation [Mon, 14 Oct 2019 11:49:02 +0000 (06:49 -0500)] 
Merge "pbx: deadlock when outgoing dialed channel hangs up too quickly" into 13

5 years agoMerge "cdr_pgsql cel_pgsql res_config_pgsql: compatibility with PostgreSQL 12" into 13
Joshua Colp [Mon, 14 Oct 2019 11:28:41 +0000 (06:28 -0500)] 
Merge "cdr_pgsql cel_pgsql res_config_pgsql: compatibility with PostgreSQL 12" into 13

5 years agocdr_pgsql cel_pgsql res_config_pgsql: compatibility with PostgreSQL 12
Christoph Moench-Tegeder [Tue, 8 Oct 2019 18:40:30 +0000 (20:40 +0200)] 
cdr_pgsql cel_pgsql res_config_pgsql: compatibility with PostgreSQL 12

PostgreSQL 12 finally removed column adsrc from table pg_catalog.pg_attrdef
(column default values), which has been deprecated since version 8.0.
Since then, the official/correct/supported way to retrieve the column
default value from the catalog is function pg_catalog.pg_get_expr().

This change breaks compatibility with pre-8.0 PostgreSQL servers,
but has reached end-of-support more than a decade ago.
cdr_pgsql and res_config_pgsql still have support for pre-7.3
servers, but cleaning that up is perhaps a topic for a major release,
not this bugfix.

ASTERISK-28571

Change-Id: I834cb3addf1937e19e87ede140bdd16cea531ebe

5 years agoMerge "pjproject_bundled: Replace earlier reverts with official fixes." into 13
George Joseph [Fri, 11 Oct 2019 14:32:04 +0000 (09:32 -0500)] 
Merge "pjproject_bundled:  Replace earlier reverts with official fixes." into 13

5 years agotest_taskprocessor.c: Fix test failure on Ubuntu
csavinovich [Wed, 9 Oct 2019 21:00:31 +0000 (16:00 -0500)] 
test_taskprocessor.c: Fix test failure on Ubuntu

Fixes a failure in /main/taskprocesor unit test, only occurring in Ubuntu.
Newer versions of GCC require variable initialization.

Change-Id: I2994d8aab9307a8c2c7330584f287a27144a580c

5 years agores_pjsip_mwi: potential double unref, and potential unwanted double link
Kevin Harwell [Thu, 10 Oct 2019 20:30:06 +0000 (15:30 -0500)] 
res_pjsip_mwi: potential double unref, and potential unwanted double link

When creating an unsolicited MWI aggregate subscription it was possible for
the subscription object to be double unref'ed. This patch removes the explicit
unref as it is not needed since the RAII_VAR will handle it at function end.

Less concerning there was also a bug that could potentially allow the aggregate
subscription object to be added to the unsolicited container twice. This patch
ensures it is added only once.

ASTERISK-28575

Change-Id: I9ccfdb5ea788bc0c3618db183aae235e53c12763

5 years agoMerge "Revert "app_voicemail: Cleanup stale lock files on module load"" into 13
George Joseph [Thu, 10 Oct 2019 18:45:12 +0000 (13:45 -0500)] 
Merge "Revert "app_voicemail: Cleanup stale lock files on module load"" into 13

5 years agoMerge "res_pjsip_mwi: use an ao2_global object for mwi containers" into 13
George Joseph [Thu, 10 Oct 2019 14:12:09 +0000 (09:12 -0500)] 
Merge "res_pjsip_mwi: use an ao2_global object for mwi containers" into 13

5 years agoMerge "res_pjsip/res_pjsip_mwi: use centralized serializer pools" into 13
George Joseph [Thu, 10 Oct 2019 14:11:54 +0000 (09:11 -0500)] 
Merge "res_pjsip/res_pjsip_mwi: use centralized serializer pools" into 13

5 years agoMerge "serializer: move/add asterisk serializer pool functionality" into 13
George Joseph [Thu, 10 Oct 2019 14:11:25 +0000 (09:11 -0500)] 
Merge "serializer: move/add asterisk serializer pool functionality" into 13

5 years agopjproject_bundled: Replace earlier reverts with official fixes.
George Joseph [Wed, 9 Oct 2019 14:32:45 +0000 (08:32 -0600)] 
pjproject_bundled:  Replace earlier reverts with official fixes.

Issues in pjproject 2.9 caused us to revert some of their changes
as a work around.  This introduced another issue where pjproject
wouldn't build with older gcc versions such as that found on
CentOS 6.  This commit replaces the reverts with the official
fixes for the original issues and allows pjproject to be built
on CentOS 6 again.

ASTERISK-28574
Reported-by: Niklas Larsson
Change-Id: I06f8507bea553d1a01b0b8874197d35b9d47ec4c

5 years agopbx: deadlock when outgoing dialed channel hangs up too quickly
Kevin Harwell [Wed, 9 Oct 2019 20:17:59 +0000 (15:17 -0500)] 
pbx: deadlock when outgoing dialed channel hangs up too quickly

Here's the basic scenario that occurred when executing an AMI fast originate
while at the same time something else locks the channels container, and also
wants a lock on the dialed channel:

1. pbx_outgoing_attempt obtains a lock on a dialed channel
2. concurrently another thread obtains a lock on the channels container, and
   subsequently requests a lock on the dialed channel. It waits on #1. For
   instance, "core show channel <dialed channel"
3. the outgoing call does not fail, but ends before the pbx_outgoing_attempt
   function exits
4. pbx_outgoing_attempt function exits, the outgoing structure destructs, and
   attempts to hang up the dialed channel
5. hang up tries to obtain the channels container lock, but can't due to #2.
6. Asterisk is deadlocked.

The solution was to allow the pbx_outgoing_exec function to "steal" ownership
of the dialed channel, and handle hanging it up. The channel now is either hung
up prior to it being potentially locked by the initiating thread, or if locked
the hang up takes place in a different thread, thus alleviating the deadlock.

ASTERISK-28561
patches:
  iliketrains.diff submitted by Joshua Colp (license 5000)

Change-Id: I51b42b92dde8f2215b69bb509e28667ee3a3853a

5 years agochan_pjsip: Prevent segfault when running PlayDTMF on hungup channel
lvl [Tue, 1 Oct 2019 11:29:11 +0000 (13:29 +0200)] 
chan_pjsip: Prevent segfault when running PlayDTMF on hungup channel

ASTERISK-28086 #close

Change-Id: Ib3baadc89b9f0477a6f25a63861433812368c5ea

5 years agoMerge "cdr_mysql: Don't clean up on unload unless we can unregister from CDRs" into 13
George Joseph [Tue, 8 Oct 2019 13:24:15 +0000 (08:24 -0500)] 
Merge "cdr_mysql: Don't clean up on unload unless we can unregister from CDRs" into 13

5 years agoRevert "app_voicemail: Cleanup stale lock files on module load"
Sean Bright [Mon, 7 Oct 2019 19:02:39 +0000 (14:02 -0500)] 
Revert "app_voicemail: Cleanup stale lock files on module load"

This reverts commit fd2e8d0da7ba539470ed73d463d8bc641f7843af.

Reason for revert: Problematic for users who store their voicemail
on network storage devices, or share voicemail storage between
multiple Asterisk instances.

ASTERISK-28567 #close

Change-Id: I3ff4ca983d8e753fe2971f3439bd154705693c41

5 years agores_pjsip_mwi: use an ao2_global object for mwi containers
Kevin Harwell [Wed, 2 Oct 2019 16:08:05 +0000 (11:08 -0500)] 
res_pjsip_mwi: use an ao2_global object for mwi containers

On shutdown it's possible for the unsolicited mwi container to be freed before
other dependent threads are done using it. This patch ensures this can no
longer happen by wrapping the container in an ao2_global object. The solicited
container was also changed too.

ASTERISK-28552

Change-Id: I8f812286dc19a34916acacd71ce2ec26e1042047

5 years agores_pjsip/res_pjsip_mwi: use centralized serializer pools
Kevin Harwell [Tue, 1 Oct 2019 20:54:59 +0000 (15:54 -0500)] 
res_pjsip/res_pjsip_mwi: use centralized serializer pools

Both res_pjsip and res_pjsip_mwi made use of serializer pools. However, they
both implemented their own serializer pool functionality that was pretty much
identical in each of the source files. This patch removes the duplicated code,
and uses the new 'ast_serializer_pool' object instead.

Additionally res_pjsip_mwi enables a shutdown group on the pool since if the
timing was right the module could be unloaded while taskprocessor threads still
needed to execute, thus causing a crash.

Change-Id: I959b0805ad024585bbb6276593118be34fbf6e1d

5 years agoserializer: move/add asterisk serializer pool functionality
Kevin Harwell [Tue, 1 Oct 2019 20:43:47 +0000 (15:43 -0500)] 
serializer: move/add asterisk serializer pool functionality

Serializer pools have previously existed in Asterisk. However, for the most
part the code has been duplicated across modules. This patch abstracts the
code into an 'ast_serializer_pool' object. As well the code is now centralized
in serializer.c/h.

In addition serializer pools can now optionally be monitored by a shutdown
group. This will prevent the pool from being destroyed until all serializers
have completed.

Change-Id: Ib1e906144b90ffd4d5ed9826f0b719ca9c6d2971

5 years agoMerge "channel/chan_pjsip: add dialplan function for music on hold" into 13
Friendly Automation [Mon, 7 Oct 2019 12:53:35 +0000 (07:53 -0500)] 
Merge "channel/chan_pjsip: add dialplan function for music on hold" into 13

5 years agocdr_mysql: Don't clean up on unload unless we can unregister from CDRs
Sean Bright [Fri, 4 Oct 2019 20:31:22 +0000 (16:31 -0400)] 
cdr_mysql: Don't clean up on unload unless we can unregister from CDRs

ASTERISK-28566 #close

Change-Id: I6daa4e5128e9406d04d3aed670c3bae98d38d40c

5 years agoMerge "res_pjsip_transport_websocket: Don't put brackets around local_name if IPv6...
George Joseph [Tue, 1 Oct 2019 11:31:31 +0000 (06:31 -0500)] 
Merge "res_pjsip_transport_websocket: Don't put brackets around local_name if IPv6" into 13

5 years agochannel/chan_pjsip: add dialplan function for music on hold
Torrey Searle [Thu, 19 Sep 2019 08:56:26 +0000 (10:56 +0200)] 
channel/chan_pjsip: add dialplan function for music on hold

Add a new dialplan function PJSIP_MOH_PASSTHROUGH that allows
the on-hold behavior to be controlled on a per-call basis

ASTERISK-28542 #close

Change-Id: Iebe905b2ad6dbaa87ab330267147180b05a3c3a8

5 years agores_pjsip_pubsub: add endpoint to some warning
Alexei Gradinari [Tue, 24 Sep 2019 19:18:14 +0000 (15:18 -0400)] 
res_pjsip_pubsub: add endpoint to some warning

There are some warning messages which are not informative without endpoint:
"No registered subscribe handler for event presence.winfo"
"No registered publish handler for event presence"

This patch adds an endpoint name to these messages.

Change-Id: Ia2811ec226d8a12659b4f9d4d224b48289650827

5 years agores_pjsip_transport_websocket: Don't put brackets around local_name if IPv6
Sean Bright [Fri, 27 Sep 2019 14:54:53 +0000 (10:54 -0400)] 
res_pjsip_transport_websocket: Don't put brackets around local_name if IPv6

ASTERISK-28544 #close

Change-Id: I8e62c444d107674c298f472e3545661de8a80dce

5 years agoMerge "taskprocessor.c: Added "like" support to 'core show taskprocessors'" into 13
George Joseph [Fri, 27 Sep 2019 13:56:06 +0000 (08:56 -0500)] 
Merge "taskprocessor.c: Added "like" support to 'core show taskprocessors'" into 13

5 years agoMerge "pbx: Prevent Realtime switch crash on invalid priority" into 13
Friendly Automation [Fri, 27 Sep 2019 13:32:28 +0000 (08:32 -0500)] 
Merge "pbx: Prevent Realtime switch crash on invalid priority" into 13

5 years agoMerge "res_pjsip_registrar: Validate Contact URI before adding to responses" into 13
Friendly Automation [Thu, 26 Sep 2019 09:45:32 +0000 (04:45 -0500)] 
Merge "res_pjsip_registrar: Validate Contact URI before adding to responses" into 13

5 years agoMerge "chan_pjsip: Add support for passing hold and unhold requests through." into 13
Joshua Colp [Thu, 26 Sep 2019 09:24:07 +0000 (04:24 -0500)] 
Merge "chan_pjsip: Add support for passing hold and unhold requests through." into 13

5 years agotaskprocessor.c: Added "like" support to 'core show taskprocessors'
Ben Ford [Tue, 24 Sep 2019 20:44:14 +0000 (15:44 -0500)] 
taskprocessor.c: Added "like" support to 'core show taskprocessors'

Added "like" support for 'core show taskprocessors'. Now you
can specify a specific set of taskprocessors (or just one) by
adding the keyword "like" to the above command, followed by
your search criteria.

Change-Id: I021e740201e9ba487204b5451e46feb0e3222464

5 years agoUpdate CHANGES and UPGRADE.txt for 13.29.0-rc2
Asterisk Development Team [Wed, 25 Sep 2019 17:47:24 +0000 (12:47 -0500)] 
Update CHANGES and UPGRADE.txt for 13.29.0-rc2

5 years agopbx: Prevent Realtime switch crash on invalid priority
Sean Bright [Wed, 25 Sep 2019 16:01:33 +0000 (12:01 -0400)] 
pbx: Prevent Realtime switch crash on invalid priority

pbx_extension_helper takes two 'context' arguments. One (con) is a
pointer directly to a 'struct ast_context' and the other (context) is
the name of the context. In all cases, one of these arguments is NULL
and the other is non-NULL.

Functions that are ultimately called by pbx_extension_helper expect that
'context' will be non-NULL, so we set it unconditionally on entry into
this function.

ASTERISK-28534 #close

Change-Id: Ifbbc5e71440afd80efd441f7a9d72e8b10b6f47d

5 years agoMerge "core: Fix ABI mismatch of ao2_global_obj." into 13
Friendly Automation [Wed, 25 Sep 2019 12:27:32 +0000 (07:27 -0500)] 
Merge "core: Fix ABI mismatch of ao2_global_obj." into 13

5 years agoMerge "res_pjsip_pubsub: change warning to debug" into 13
George Joseph [Wed, 25 Sep 2019 12:04:04 +0000 (07:04 -0500)] 
Merge "res_pjsip_pubsub: change warning to debug" into 13

5 years agoMerge "taskprocessor.c: Add CLI commands to reset taskprocessor stats." into 13
George Joseph [Wed, 25 Sep 2019 11:26:39 +0000 (06:26 -0500)] 
Merge "taskprocessor.c: Add CLI commands to reset taskprocessor stats." into 13

5 years agores_pjsip_registrar: Validate Contact URI before adding to responses
Sean Bright [Tue, 24 Sep 2019 22:43:13 +0000 (18:43 -0400)] 
res_pjsip_registrar: Validate Contact URI before adding to responses

If a permanent contact URI associated with an AOR is invalid, we add a
Contact header to REGISTER responses with a NULL URI, causing a crash.

ASTERISK-28463 #close

Change-Id: Id2b643e58b975bc560aab1c111e6669d54db9102

5 years agochan_pjsip: Add support for passing hold and unhold requests through.
Joshua Colp [Mon, 3 Nov 2014 14:45:01 +0000 (14:45 +0000)] 
chan_pjsip: Add support for passing hold and unhold requests through.

This change adds an option, moh_passthrough, that when enabled will pass
hold and unhold requests through using a SIP re-invite. When placing on
hold a re-invite with sendonly will be sent and when taking off hold a
re-invite with sendrecv will be sent. This allows remote servers to handle
the musiconhold instead of the local Asterisk instance being responsible.

Review: https://reviewboard.asterisk.org/r/4103/

Change-Id: Ib6294e906e577e1a4245cb1f058d3976ff484c52

5 years agoMerge "pjproject_bundled: Revert pjproject 2.9 commits causing leaks" into 13
George Joseph [Tue, 24 Sep 2019 20:37:11 +0000 (15:37 -0500)] 
Merge "pjproject_bundled:  Revert pjproject 2.9 commits causing leaks" into 13

5 years agores_pjsip_pubsub: change warning to debug
Kevin Harwell [Tue, 24 Sep 2019 16:21:12 +0000 (11:21 -0500)] 
res_pjsip_pubsub: change warning to debug

The following message:

"Subscription request from endpoint <blah> rejected. Expiration of 0 is invalid"

Would sometimes spam the log with warnings if Asterisk restarted and a bunch
of clients sent unsubscribes. This patch changes it from a warning to a debug
message.

Change-Id: I841ec42f65559f3135e037df0e55f89b6447a467

5 years agocore: Fix ABI mismatch of ao2_global_obj.
Corey Farrell [Tue, 24 Sep 2019 16:24:15 +0000 (12:24 -0400)] 
core: Fix ABI mismatch of ao2_global_obj.

astobj2.c declares DEBUG_THREADS_LOOSE_ABI to avoid overhead of debug
threads tracking information in the internal structures of astobj2.
Unfortunately this means that ao2_global_obj contains the statically
allocated debug threads tracking fields which are used by initialization
and cleanup but main/astobj2.c believed those fields and associated
space did not exist.

Change-Id: Icef41ad97d88a8c1d1515e034ec8133cab3b1527

5 years agotaskprocessor.c: Add CLI commands to reset taskprocessor stats.
Ben Ford [Tue, 24 Sep 2019 14:40:35 +0000 (09:40 -0500)] 
taskprocessor.c: Add CLI commands to reset taskprocessor stats.

Added two new CLI commands to reset stats for taskprocessors. You can
reset stats for a single, specific taskprocessor ('core reset
taskprocessor <taskprocessor>'), or you can reset all taskprocessors
('core reset taskprocessors'). These commands will reset the counter for
the number of tasks processed as well as the max queue size.

Change-Id: Iaf17fc4ae29396ab0c6ac92408fc7bdc2f12362d

5 years agopjproject_bundled: Revert pjproject 2.9 commits causing leaks
George Joseph [Thu, 19 Sep 2019 14:50:07 +0000 (08:50 -0600)] 
pjproject_bundled:  Revert pjproject 2.9 commits causing leaks

We've found a connection re-use regression in pjproject 2.9
introduced by commit
"Close #1019: Support for multiple listeners."
https://trac.pjsip.org/repos/changeset/6002
https://trac.pjsip.org/repos/ticket/1019

Normally, multiple SSL requests should reuse the same connection
if one already exists to the remote server.  When a transport
error occurs, the next request should establish a new connection
and any following requests should use that same one.  With this
patch, when a transport error occurs, every new request creates
a new connection so you can wind up with thousands of open tcp
sockets, possibly exhausting file handles, and increasing memory
usage.

Reverting pjproject commit 6002 (and related 6021) restores the
expected behavior.

We also found a memory leak in SSL processing that was introduced by
commit
"Fixed #2204: Add OpenSSL remote certificate chain info"
https://trac.pjsip.org/repos/changeset/6014
https://trac.pjsip.org/repos/ticket/2204

Apparently the remote certificate chain is continually recreated
causing the leak.

Reverting pjproject commit 6014 (and related 6022) restores the
expected behavior.

Both of these issues have been acknowledged by Teluu.

ASTERISK-28521

Change-Id: I8ae7233c3ac4ec29a3b991f738e655dabcaba9f1

5 years agoMerge "res_sorcery_memory_cache: stale item update leak" into 13
Friendly Automation [Tue, 24 Sep 2019 13:08:44 +0000 (08:08 -0500)] 
Merge "res_sorcery_memory_cache: stale item update leak" into 13

5 years agoMerge "astmm.c: Display backtrace with memory show allocations" into 13
Friendly Automation [Tue, 24 Sep 2019 13:04:38 +0000 (08:04 -0500)] 
Merge "astmm.c:  Display backtrace with memory show allocations" into 13

5 years agoMerge "res_pjsip_mwi: Remove inappropriate topic unreference." into 13
Kevin Harwell [Mon, 23 Sep 2019 20:18:52 +0000 (15:18 -0500)] 
Merge "res_pjsip_mwi: Remove inappropriate topic unreference." into 13

5 years agores_sorcery_memory_cache: stale item update leak
Kevin Harwell [Mon, 23 Sep 2019 16:01:36 +0000 (11:01 -0500)] 
res_sorcery_memory_cache: stale item update leak

When a stale item was being updated the object was being retrieved, but its
reference was not being decremented after the update. This patch makes it so
the object is now appropriately de-referenced.

ASTERISK-28523

Change-Id: I9d8173d3a0416a242f4eba92fa0853279c500ec7

5 years agoastmm.c: Display backtrace with memory show allocations
George Joseph [Mon, 23 Sep 2019 12:09:29 +0000 (06:09 -0600)] 
astmm.c:  Display backtrace with memory show allocations

You can currently capture backtraces of memory allocations but they
only get displayed when you stop asterisk and the atexit hooks
are enabled.  Now, if memory backtrace is on and you issue a
"memory show allocations" CLI command for a specific file, then
a backtrace will show for each allocation that occurred after
you turned "memory backtrace on".  The backtrace display is shown
only when a specific file's allocations are displayed to prevent
a massive CLI dump of every file's allocations.

Change-Id: Ic657afc1fc6ec7205e16eb36a97a611d235a2b4f

5 years agores_pjsip_mwi: Remove inappropriate topic unreference.
Corey Farrell [Thu, 19 Sep 2019 16:06:07 +0000 (12:06 -0400)] 
res_pjsip_mwi: Remove inappropriate topic unreference.

ast_mwi_topic() returns a borrowed reference which should not be
unreferenced, doing so leads to a FRACK.  This was hidden by the fact
that stasis_cache.c leaked the result of cache_remove in
caching_topic_exec.

Change-Id: I51101bf7d07b8dc8ce8fc46b6cb31fbbd213fbc7

5 years agoapp_voicemail: Fix module unload leak.
Corey Farrell [Thu, 19 Sep 2019 15:53:19 +0000 (11:53 -0400)] 
app_voicemail: Fix module unload leak.

Change-Id: Ib9a06565b9a178822d3bbb67eccf51432e12d84a

5 years agoMerge "chan_pjsip: Relock correct channel during "fax" redirect." into 13
Joshua Colp [Wed, 18 Sep 2019 20:12:47 +0000 (15:12 -0500)] 
Merge "chan_pjsip: Relock correct channel during "fax" redirect." into 13

5 years agochan_pjsip: Relock correct channel during "fax" redirect.
Joshua Colp [Sun, 15 Sep 2019 19:35:45 +0000 (19:35 +0000)] 
chan_pjsip: Relock correct channel during "fax" redirect.

When fax detection occurs on an outbound PJSIP channel the
redirect operation will result in a masquerade occurring and
the underlying channel on the session changing. The code
incorrectly relocked the new channel instead of the old
channel when returning. This resulted in the new channel
being locked indefinitely. The code now always acts on the
expected channel.

ASTERISK-28538

Change-Id: I2b2e60d07e74383ae7e90d752c036c4b02d6b3a3

5 years agochan_dahdi: Fix build with clang/llvm
Guido Falsi [Sat, 14 Sep 2019 15:05:23 +0000 (17:05 +0200)] 
chan_dahdi: Fix build with clang/llvm

On FreeBSD using the clang/llvm compiler build fails to build due
to the switch statement argument being a non integer type expression.
Switch to an if/else if/else construct to sidestep the issue.

ASTERISK-28536 #close

Change-Id: Idf4a82cc1e94580a2d017fe9e351c226f23e20c8

5 years agoMerge "channels: Allow updating variable value" into 13
Friendly Automation [Fri, 13 Sep 2019 12:45:40 +0000 (07:45 -0500)] 
Merge "channels: Allow updating variable value" into 13

5 years agochannels: Allow updating variable value
Sean Bright [Wed, 11 Sep 2019 20:58:29 +0000 (16:58 -0400)] 
channels: Allow updating variable value

When modifying an already defined variable in some channel drivers they
add a new variable with the same name to the list, but that value is
never used, only the first one found.

Introduce ast_variable_list_replace() and use it where appropriate.

ASTERISK-23756 #close
Patches:
  setvar-multiplie.patch submitted by Michael Goryainov

Change-Id: Ie1897a96c82b8945e752733612ee963686f32839

5 years agoUpdate CHANGES and UPGRADE.txt for 13.29.0
Asterisk Development Team [Thu, 12 Sep 2019 20:20:14 +0000 (15:20 -0500)] 
Update CHANGES and UPGRADE.txt for 13.29.0

5 years agoUpdate CHANGES and UPGRADE.txt for 13.29.0
Asterisk Development Team [Thu, 12 Sep 2019 18:36:41 +0000 (13:36 -0500)] 
Update CHANGES and UPGRADE.txt for 13.29.0

5 years agoMerge "ChanIsAvail() generates a CDR when unanswered=yes in cdr.conf." into 13
Friendly Automation [Wed, 11 Sep 2019 14:02:11 +0000 (09:02 -0500)] 
Merge "ChanIsAvail() generates a CDR when unanswered=yes in cdr.conf." into 13

5 years agoMerge "res_musiconhold: Added unregister realtime moh class" into 13
George Joseph [Wed, 11 Sep 2019 14:02:08 +0000 (09:02 -0500)] 
Merge "res_musiconhold: Added unregister realtime moh class" into 13

5 years agoMerge "chan_dahdi: set CHANNEL(hangupsource) when a PRI channel hangs up" into 13
Joshua Colp [Wed, 11 Sep 2019 12:09:33 +0000 (07:09 -0500)] 
Merge "chan_dahdi: set CHANNEL(hangupsource) when a PRI channel hangs up" into 13

5 years agoMerge "codec_resample: Ensure OUTSIDE_SPEEX is defined when necessary" into 13
Joshua Colp [Wed, 11 Sep 2019 11:19:15 +0000 (06:19 -0500)] 
Merge "codec_resample: Ensure OUTSIDE_SPEEX is defined when necessary" into 13

5 years agores_musiconhold: Added unregister realtime moh class
sungtae kim [Tue, 27 Aug 2019 22:44:33 +0000 (00:44 +0200)] 
res_musiconhold: Added unregister realtime moh class

This fix allows a realtime moh class to be unregistered from the command
line. This is useful when the contents of a directory referenced by a
realtime moh class have changed.
The realtime moh class is then reloaded on the next request and uses the
new directory contents.

ASTERISK-17808

Change-Id: Ibc4c6834592257c4bb90601ee299682d15befbce

5 years agoChanIsAvail() generates a CDR when unanswered=yes in cdr.conf.
Frederic LE FOLL [Thu, 5 Sep 2019 16:09:28 +0000 (18:09 +0200)] 
ChanIsAvail() generates a CDR when unanswered=yes in cdr.conf.

ChanIsAvail() creates a temporary channel with ast_request() to test
resource availability. It should not generate a CDR when it hangs up
this temporary channel.

This patch disables CDR generation for the temporary channel with
ast_cdr_set_property().

ASTERISK-28527

Change-Id: I7b0555c6909c7d322e452dde97c9ea5b111552d1

5 years agochan_dahdi: set CHANNEL(hangupsource) when a PRI channel hangs up
Frederic LE FOLL [Thu, 5 Sep 2019 15:52:13 +0000 (17:52 +0200)] 
chan_dahdi: set CHANNEL(hangupsource) when a PRI channel hangs up

When the remote ISDN party ends an ISDN call on a PRI link
(DISCONNECT), CHANNEL(hangupsource) information is not available.

chan_dahdi already contains an ast_set_hangupsource() in
__dahdi_exception() function but it seems that ISDN message processing
does not use this part of code.

Two other channel modules associate ast_queue_hangup() and
ast_set_hangupsource() functions calls:
- chan_pjsip in chan_pjsip_session_end() function,
- chan_sip in sip_queue_hangup_cause() function.
chan_iax2 separates them, in iax2_queue_hangup()/iax2_destroy() and
set_hangup_source_and_cause().

Thus, I propose to add ast_set_hangupsource() beside
ast_queue_hangup() in sig_pri_queue_hangup(), like chan_pjsip and
chan_sip already do.

ASTERISK-28525

Change-Id: I0f588a4bcf15ccd0648fd69830d1b801c3f21b7c

5 years agoMerge "chan_unistim: Fix clang warning: variable sized type not at end of a struct...
George Joseph [Tue, 10 Sep 2019 13:41:28 +0000 (08:41 -0500)] 
Merge "chan_unistim: Fix clang warning: variable sized type not at end of a struct" into 13

5 years agocodec_resample: Ensure OUTSIDE_SPEEX is defined when necessary
Sean Bright [Sun, 8 Sep 2019 15:38:57 +0000 (11:38 -0400)] 
codec_resample: Ensure OUTSIDE_SPEEX is defined when necessary

ASTERISK-28511

Change-Id: If0d58598ce14aad3c786a1c0127b5f7b200b737d

5 years agoAST-2019-005 - translate: Don't assume all frames will have a src.
Joshua Colp [Mon, 26 Aug 2019 12:53:27 +0000 (09:53 -0300)] 
AST-2019-005 - translate: Don't assume all frames will have a src.

This change removes the assumption that a frame will always have
a src set on it. This assumption is incorrect.

Given a scenario where an RTP packet is received with no payload
the resulting audio frame will have no samples. If this frame goes
through a signed linear translation path an interpolated frame can
be created (if generic packet loss concealment is enabled) that has
minimal data on it, including no src. If this frame is given to a
translation path a crash will occur due to the lack of src.

ASTERISK-28499

Change-Id: I024d10dd98207eb8a6b35b59880bcdf1090538f8

5 years agochan_unistim: Fix clang warning: variable sized type not at end of a struct
Igor Goncharovsky [Tue, 27 Aug 2019 11:10:56 +0000 (17:10 +0600)] 
chan_unistim: Fix clang warning: variable sized type not at end of a struct

On reading information about initial client packet unistim use dirty
implementation of destination ip address retrieval. This fix uses
CMSG_*(..) to get ip address and make clang compile without warning.

ASTERISK-25592 #close
Reported-by: Alexander Traud
Change-Id: Ic1fd34c2c2bcc951da65bf62e3f7a8adff8351b1

5 years agoMerge "res_pjsip_mwi: add better handling of solicited vs unsolicited subscriptions...
George Joseph [Tue, 3 Sep 2019 10:34:04 +0000 (05:34 -0500)] 
Merge "res_pjsip_mwi: add better handling of solicited vs unsolicited subscriptions" into 13

5 years agoMerge "chan_unistim: Fix code, causing all incoming DTMF sent back to asterisk" into 13
Friendly Automation [Fri, 30 Aug 2019 14:50:42 +0000 (09:50 -0500)] 
Merge "chan_unistim: Fix code, causing all incoming DTMF sent back to asterisk" into 13

5 years agoMerge "codec_resample: Upgrade speex_resample to fix up-sampling bug" into 13
George Joseph [Fri, 30 Aug 2019 12:44:27 +0000 (07:44 -0500)] 
Merge "codec_resample: Upgrade speex_resample to fix up-sampling bug" into 13

5 years agores_pjsip_mwi: add better handling of solicited vs unsolicited subscriptions
Kevin Harwell [Fri, 23 Aug 2019 21:24:50 +0000 (16:24 -0500)] 
res_pjsip_mwi: add better handling of solicited vs unsolicited subscriptions

res_pjsip_mwi allows both solicited and unsolicited MWI subscription types.
While both can be set in the configuration for a given endpoint/aor, only
one is allowed. Precedence is given to unsolicited. Meaning if an endpoint/aor
is configured to allow both types then the solicited subscription is rejected
when it comes in. However, there is a configuration option to override that
behavior:

mwi_subscribe_replaces_unsolicited

When set to "yes" then when a solicited subscription comes in instead of
rejecting it Asterisk is suppose to replace the unsolicited one if it exists.
Prior to this patch there was a bug in Asterisk that allowed the solicted one
to be added, but did not remove the unsolicited. As a matter of fact a new
unsolicited subscription got added everytime a SIP register was received.
Over time this eventually could "flood" a phone with SIP notifies.

This patch fixes that behavior to now make it work as expected. If configured
to do so a solicited subscription now properly replaces the unsolicited one.
As well when an unsubscribe is received the unsolicited subscription is
restored. Logic was also put in to handle reloads, and any configuration changes
that might result from that. For instance, if a solicited subscription had
previously replaced an unsolicited one, but after reload it was configured to
not allow that then the solicited one needs to be shutdown, and the unsolicited
one added.

ASTERISK-28488

Change-Id: Iec2ec12d9431097e97ed5f37119963aee41af7b1

5 years agoMerge "chan_unistim: Fix RTP port byte order for big-endian arch" into 13
George Joseph [Wed, 28 Aug 2019 11:40:45 +0000 (06:40 -0500)] 
Merge "chan_unistim: Fix RTP port byte order for big-endian arch" into 13

5 years agochan_unistim: Fix code, causing all incoming DTMF sent back to asterisk
Igor Goncharovsky [Tue, 27 Aug 2019 05:49:46 +0000 (11:49 +0600)] 
chan_unistim: Fix code, causing all incoming DTMF sent back to asterisk

Current implementation of ast_channel_tech send_digit_begin hook uses
same function for tone playback as key press handler. This cause every
incoming dtmf send back to asterisk. In case of two unistim phones
connected to each other, it'll cause indefinite DTMF loop. Fix add
separate function for dtmf tone phone play.

Change-Id: I5795db468df552f0c89c7576b6b3858b26c4eab4

5 years agochan_unistim: Fix RTP port byte order for big-endian arch
Igor Goncharovsky [Fri, 16 Aug 2019 11:01:21 +0000 (15:01 +0400)] 
chan_unistim: Fix RTP port byte order for big-endian arch

This patch fixes one-way oudio that users expirienced on
big-endian architechtires. RTP port number bytes was stored
in improper order and phone sent RTP to wrong RTP port.

Reported-by: Andrey Ionov
Change-Id: I9a9ca7f26e31a67bbbceff12923baa10dfb8a3be

5 years agocodec_resample: Upgrade speex_resample to fix up-sampling bug
Sean Bright [Fri, 23 Aug 2019 20:14:36 +0000 (16:14 -0400)] 
codec_resample: Upgrade speex_resample to fix up-sampling bug

ASTERISK-28511 #close

Change-Id: Idd07bf341e89ac999c7f5701d9b72b8a9cb11e82

5 years agoMerge "Fix misname 'res_external_mwi' to 'res_mwi_external' in comments." into 13
Joshua Colp [Fri, 23 Aug 2019 12:48:56 +0000 (07:48 -0500)] 
Merge "Fix misname 'res_external_mwi' to 'res_mwi_external' in comments." into 13

5 years agoMerge "pjproject: Configurable setting for cnonce to include hyphens or not" into 13
Joshua Colp [Fri, 23 Aug 2019 11:55:34 +0000 (06:55 -0500)] 
Merge "pjproject: Configurable setting for cnonce to include hyphens or not" into 13

5 years agoFix misname 'res_external_mwi' to 'res_mwi_external' in comments.
Alexei Gradinari [Thu, 22 Aug 2019 18:19:51 +0000 (14:19 -0400)] 
Fix misname 'res_external_mwi' to 'res_mwi_external' in comments.

Change-Id: Ic784be8500e5cb75dcb34bae9f03cfd93b6b34fb

5 years agoMerge "res_pjsip: Channel variable SIPFROMDOMAIN" into 13
George Joseph [Wed, 21 Aug 2019 23:41:43 +0000 (18:41 -0500)] 
Merge "res_pjsip: Channel variable SIPFROMDOMAIN" into 13

5 years agopjproject: Configurable setting for cnonce to include hyphens or not
Dan Cropp [Wed, 21 Aug 2019 15:58:00 +0000 (10:58 -0500)] 
pjproject: Configurable setting for cnonce to include hyphens or not

NEC SIP Station interface with authenticated registration only supports cnonce
up to 32 characters.  In Linux, PJSIP would generate 36 character cnonce
which included hyphens.  Teluu developed this patch adding a compile time
setting to default to not include the hyphens.  They felt it best to still
generate the UUID and strip the hyphens.
They have indicated it will be part of PJSIP 2.10.

ASTERISK-28509
Reported-by: Dan Cropp
Change-Id: Ibdfcf845d4f8c0a14df09fd983b11f2d72c5f470

5 years agoMerge "res_ari.c: Prefer exact handler match over wildcard" into 13
Friendly Automation [Wed, 21 Aug 2019 12:46:19 +0000 (07:46 -0500)] 
Merge "res_ari.c:  Prefer exact handler match over wildcard" into 13

5 years agores_pjsip: Channel variable SIPFROMDOMAIN
Stas Kobzar [Tue, 30 Jul 2019 17:08:27 +0000 (13:08 -0400)] 
res_pjsip: Channel variable SIPFROMDOMAIN

In chan_sip, there was variable SIPFROMDOMAIN that allows to set
From header URI domain per channel. This patch introduces res_pjsip
variable SIPFROMDOMAIN for backward compatibility with chan_sip.

ASTERISK-28489

Change-Id: I715133e43172ce2a1e82093538dc39f9e99e5f2e

5 years agores_ari.c: Prefer exact handler match over wildcard
George Joseph [Tue, 20 Aug 2019 18:04:56 +0000 (12:04 -0600)] 
res_ari.c:  Prefer exact handler match over wildcard

Given the following request path and 2 handler paths...
Request: /channels/externalMedia
Handler: /channels/{channelId}      "wildcard"
Handler: /channels/externalmedia    "non-wildcard"

...if /channels/externalMedia was registered as a handler after
/channels/{channelId} as shown above, the request would automatically
match the wildcard handler and attempt to parse "externalMedia" into
the channelId variable which isn't what was intended.  It'd work
if the non-wildard entry was defined in rest-api/api-docs/channels.json
before the wildcard entry but that makes the json files
order-dependent which isn't a good thing.

To combat this issue, the search loop saves any wildcard match but
continues looking for exact matches at the same level.  If it finds
one, it's used.  If it hasn't found an exact match at the end of
the current level, the wildcard is used.  Regardless, after
searching the current level, the wildcard is cleared so it won't
accidentally match for a different object or a higher level.

BTW, it's currently not possible for more than 1 wildcard entry
to be defined for a level.  For instance, there couldn't be:
Handler: /channels/{channelId}
Handler: /channels/{channelName}
We wouldn't know which one to match.

Change-Id: I574aa3cbe4249c92c30f74b9b40e750e9002f925

5 years agoaudiohook.c: Substitute silence for unavailable audio frames
Sean Bright [Fri, 9 Aug 2019 20:53:03 +0000 (16:53 -0400)] 
audiohook.c: Substitute silence for unavailable audio frames

There are 4 scenarios to consider when capturing audio from a channel
with an audiohook:

 1. There is no rx and no tx audio, so return nothing.
 2. There is rx but no tx audio, so return rx.
 3. There is tx but no rx audio, so return tx.
 4. There is rx and tx audio, so mix them and return.

The file passed as the primary argument to MixMonitor will be written to
in scenarios 2, 3, and 4. However, if you pass the r() and t() options
to MixMonitor, a frame will only be written to the r() file if there was
rx audio and a frame will only be written to the t() file if there was
tx audio.

If you subsequently take the r() and t() files and try to mix them, the
sides of the conversation will 'drift' and be non-representative of the
user experience.

This patch adds a new 'S' option to MixMonitor that injects a frame of
silence on either the r() side or the t() side of the channel so that
when later mixed, there is no such drift.

Change-Id: Ibf5ed73a811087727bd561a89a59f4447b4ee20e

5 years agoapp_voicemail/IMAP: check mailstream not NULL in leave_voicemail
Alexei Gradinari [Wed, 14 Aug 2019 19:52:01 +0000 (15:52 -0400)] 
app_voicemail/IMAP: check mailstream not NULL in leave_voicemail

The function leave_voicemail checks if expungeonhangup is set,
but does not check if IMAP stream is closed,
so it could call imap function with NULL stream.
This leads to segfault.

ASTERISK-28505 #close

Change-Id: Ib66c57c1f1ba97774e447b36349198e2626a8d7c

5 years agomenuselect: Fix curses build on Gentoo Linux
Sean Bright [Fri, 9 Aug 2019 10:51:28 +0000 (06:51 -0400)] 
menuselect: Fix curses build on Gentoo Linux

Because keypad() is exported by libtinfo, it needs to be explicitly
added to the linker options.

ASTERISK-28487 #close

Change-Id: I6c2ad5b95f422c263d078b5c0e84c111807dffc6

5 years agoMerge "srtp: Fix possible race condition, and add NULL checks" into 13
George Joseph [Fri, 9 Aug 2019 12:51:10 +0000 (07:51 -0500)] 
Merge "srtp: Fix possible race condition, and add NULL checks" into 13

5 years agoMerge "cdr / cel: Use event time at event creation instead of processing." into 13
Friendly Automation [Thu, 8 Aug 2019 18:11:46 +0000 (13:11 -0500)] 
Merge "cdr / cel: Use event time at event creation instead of processing." into 13

5 years agoCI: Escape backslashes in printenv/sort/tr
George Joseph [Thu, 8 Aug 2019 17:10:11 +0000 (11:10 -0600)] 
CI: Escape backslashes in printenv/sort/tr

Change-Id: I52be64c8f6af2bbe15148a856d1f10cb113e1e94

5 years agosrtp: Fix possible race condition, and add NULL checks
Kevin Harwell [Wed, 7 Aug 2019 22:54:34 +0000 (17:54 -0500)] 
srtp: Fix possible race condition, and add NULL checks

Somehow it's possible for the srtp session object to be NULL even though the
Asterisk srtp object itself is valid. When this happened it would cause a
crash down in the srtp code when attempting to protect or unprotect data.

After looking at the code there is at least one spot that makes this situation
possible. If Asterisk fails to unprotect the data, and after several retries
it still can't then the srtp->session gets freed, and set to NULL while still
leaving the Asterisk srtp object around. However, according to the original
issue reporter this does not appear to be their situation since they found
no errors logged stating the above happened (which Asterisk does for that
situation).

An issue was found however, where a possible race condition could occur between
the pjsip incoming negotiation, and the receiving of RTP packets. Both places
could attempt to create/setup srtp for the same rtp instance at the same time.
This potentially could be the cause of the problem as well.

Given the above this patch adds locking around srtp setup for a given rtp, or
rtcp instance. NULL checks for the session have also been added within the
protect and unprotect functions as a precaution. These checks should at least
stop Asterisk from crashing if it gets in this situation again.

This patch also fixes one other issue noticed during investigation. When doing
a replace the old object was freed before creating the replacement. If the new
replacement object failed to create then the rtp/rtcp instance would now point
to freed srtp data which could potentially cause a crash as well when the next
attempt to reference it was made. This is now fixed so the old srtp object is
kept upon replacement failure.

Lastly, more logging has been added to help diagnose future issues.

ASTERISK-28472

Change-Id: I240e11cbb1e9ea8083d59d50db069891228fe5cc

5 years agoCI: Add "throttle" label and "skip_gate" capability
George Joseph [Thu, 8 Aug 2019 12:12:18 +0000 (06:12 -0600)] 
CI:  Add "throttle" label and "skip_gate" capability

To make throttling by label fully active, the "throttle" option
has to be specified with a specific label.

You can now specify "skip_gate" in the Gerrit comments when you
do a +2 code review to tell Jenkins not to actually run the
gate.  You'd do this if you plan to manually merge the change.

Also updated the "printenv" debug output to better sort multi-line
comments.

Change-Id: I4c0b1085acec4805f2ca207eebac50aad81f27e2

6 years agoMerge "CI: Make node labels job-specific" into 13
Friendly Automation [Wed, 7 Aug 2019 16:19:22 +0000 (11:19 -0500)] 
Merge "CI:  Make node labels job-specific" into 13

6 years agocdr / cel: Use event time at event creation instead of processing.
Joshua Colp [Mon, 5 Aug 2019 12:23:53 +0000 (09:23 -0300)] 
cdr / cel: Use event time at event creation instead of processing.

When updating times on CDR or CEL records using the time at which
it is done can result in times being incorrect if the system is
heavily loaded and stasis message processing is delayed.

This change instead makes it so CDR and CEL use the time at which
the stasis messages that drive the systems are created. This allows
them to be backed up while still producing correct records.

ASTERISK-28498

Change-Id: I6829227e67aefa318efe5e183a94d4a1b4e8500a

6 years agoMerge "various modules: json integer overflow" into 13
George Joseph [Tue, 6 Aug 2019 16:07:07 +0000 (11:07 -0500)] 
Merge "various modules: json integer overflow" into 13

6 years agoMerge "res_musiconhold: Use a vector instead of custom array allocation" into 13
George Joseph [Tue, 6 Aug 2019 16:05:19 +0000 (11:05 -0500)] 
Merge "res_musiconhold: Use a vector instead of custom array allocation" into 13