]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
9 years agobridge.c: Fixed race condition during attended transfer 68/2668/1
Kevin Harwell [Wed, 8 Jul 2015 19:56:10 +0000 (14:56 -0500)] 
bridge.c: Fixed race condition during attended transfer

During an attended transfer a thread is started that handles imparting the
bridge channel. From the start of the thread to when the bridge channel is
ready exists a gap that can potentially cause problems (for instance, the
channel being swapped is hung up before the replacement channel enters the
bridge thus stopping the transfer). This patch adds a condition that waits
for the impart thread to get to a point of acceptable readiness before
allowing the initiating thread to continue.

ASTERISK-24782
Reported by: John Bigelow

This patch is a remedial cherry-pick from v13.

Change-Id: I08fe33a2560da924e676df55b181e46fca604577

9 years agobridge.c: Hangup attended transfer target if bridged 67/2667/1
Kevin Harwell [Mon, 22 Jun 2015 20:11:18 +0000 (15:11 -0500)] 
bridge.c: Hangup attended transfer target if bridged

After completing an attended transfer the transfer target channel was not being
hung up after leaving the bridge. Added an explicit softhangup to hangup said
channel, but only if it was previously bridged.

ASTERISK-24782 #close
Reported by: John Bigelow

This patch is a remedial cherry-pick from v13.

Change-Id: Idde9543d56842369384a5e8c00d72a22bbc39ada

9 years agobridge.c: Hangup attended transfer target after it has been swapped out 66/2666/1
Kevin Harwell [Tue, 7 Apr 2015 16:40:44 +0000 (16:40 +0000)] 
bridge.c: Hangup attended transfer target after it has been swapped out

After completing an attended transfer the transfer target channel (the one that
gets swapped out) was not being hung up after leaving the bridge. This resulted
in a channel possibly being left around. Added an explicit softhangup for the
channel in question after the transfer is successfully completed in order to
make sure the channel is hung up.

ASTERISK-24782 #close
Reported by: John Bigelow
Review: https://reviewboard.asterisk.org/r/4575/

This patch is a remedial cherry-pick from v13.

Change-Id: I26cc0c207acf74ade93e6567febf7b9776452058

9 years agostasis transfer: fix stasis bridge push race part two 65/2665/1
Scott Griepentrog [Thu, 29 Jan 2015 23:02:41 +0000 (23:02 +0000)] 
stasis transfer: fix stasis bridge push race part two

When swapping a Local channel in place of one already
in a bridge (to complete a bridge attended transfer),
the channel that was swapped out can actually be hung
up before the stasis bridge push callback executes on
the independant transfer thread.  This results in the
stasis app loop dropping out and removing the control
that has the the app name which the local replacement
channel needs so it can re-enter stasis.

To avoid this race condition a new push_peek callback
has been added, and called from the ast_bridge_impart
thread before it launches the independant thread that
will complete the transfer.  Now the stasis push_peek
callback can copy the stasis app name before the swap
channel can hang up.

ASTERISK-24649
Review: https://reviewboard.asterisk.org/r/4382/

This patch is a remedial cherry-pick from v13.

Change-Id: I307c3b506af5af80ec506f73e8b78a91d79999e0

9 years agostasis transfer: fix a race condition on stasis bridge push 64/2664/1
Scott Griepentrog [Thu, 22 Jan 2015 18:09:35 +0000 (18:09 +0000)] 
stasis transfer: fix a race condition on stasis bridge push

After a bridge transfer completes where a local replacement
channel is used, a stasis transfer message with the details
of the transfer is sent.  This is processed by stasis which
then sets the stasis app name and replaced channel snapshot
on the replacement channel.

However, since a separate thread was already started to run
stasis on the new replacement channel, a race was on to see
if the message processing would be completed before the app
name was needed, otherwise the channel would be hung up.

This change moves the calls used to set the stasis app name
and the replace snapshot to the bridge_stasis_push function
callback from the bridge transfer logic, allowing the steps
to be completed earlier and more deterministically, and the
race elimianted.

NOTE: the swap channel parameter to bridge_stasis_push (and
thus all bridge push callbacks) must always be present when
performing a swap with another channel.

ASTERISK-24649 #close
Reported by: John Bigelow
Review: https://reviewboard.asterisk.org/r/4341/

This patch is a remedial cherry-pick from v13.

Change-Id: I35c98989786f74cdd7940677002a1a88d34bd2dd

9 years agoBridge core: Pass a ref with the swap channel when joining a bridge. 63/2663/1
Richard Mudgett [Thu, 22 Jan 2015 19:24:28 +0000 (19:24 +0000)] 
Bridge core: Pass a ref with the swap channel when joining a bridge.

When code imparts a channel into a bridge to swap with another channel, a
ref needs to be held on the swap channel to ensure that it cannot
dissapear before finding it in the bridge.

* The ast_bridge_join() swap channel parameter now always steals a ref for
the swap channel.  This is the only change to the bridge framework's
public API semantics.

* bridge_channel_internal_join() now requires the bridge_channel->swap
channel to pass in a ref.

ASTERISK-24649
Reported by: John Bigelow

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

This patch is a remedial cherry-pick from v13.

Change-Id: I73fdf13a3a1042566281c7d06d6e83e2ef87c120

9 years agoChangeLog: Updated for certified/13.1-cert6 certified/13.1-cert6
Joshua Colp [Wed, 20 Apr 2016 10:48:28 +0000 (05:48 -0500)] 
ChangeLog: Updated for certified/13.1-cert6

9 years agoRelease summaries: Add summaries for certified/13.1-cert6
Joshua Colp [Wed, 20 Apr 2016 10:48:27 +0000 (05:48 -0500)] 
Release summaries: Add summaries for certified/13.1-cert6

9 years agoRelease summaries: Remove previous versions
Joshua Colp [Wed, 20 Apr 2016 10:48:12 +0000 (05:48 -0500)] 
Release summaries: Remove previous versions

9 years ago.version: Update for certified/13.1-cert6
Joshua Colp [Wed, 20 Apr 2016 10:48:12 +0000 (05:48 -0500)] 
.version: Update for certified/13.1-cert6

9 years ago.lastclean: Update for certified/13.1-cert6
Joshua Colp [Wed, 20 Apr 2016 10:48:12 +0000 (05:48 -0500)] 
.lastclean: Update for certified/13.1-cert6

9 years agorealtime: Add database scripts for certified/13.1-cert6
Joshua Colp [Wed, 20 Apr 2016 10:48:12 +0000 (05:48 -0500)] 
realtime: Add database scripts for certified/13.1-cert6

9 years agoPJSIP: Remove PJSIP parsing functions from uri length validation. 45/2645/3
Mark Michelson [Mon, 18 Apr 2016 17:12:37 +0000 (12:12 -0500)] 
PJSIP: Remove PJSIP parsing functions from uri length validation.

The PJSIP parsing functions provide a nice concise way to check the
length of a hostname in a SIP URI. The problem is that in order to use
those parsing functions, it's required to use them from a thread that
has registered with PJLib.

On startup, when parsing AOR configuration, the permanent URI handler
may not be run from a PJLib-registered thread. Specifically, this could
happen when Asterisk was started in daemon mode rather than
console-mode. If PJProject were compiled with assertions enabled, then
this would cause Asterisk to crash on startup.

The solution presented here is to do our own parsing of the contact URI
in order to ensure that the hostname in the URI is not too long. The
parsing does not attempt to perform a full SIP URI parse/validation,
since the hostname in the URI is what is important.

ASTERISK-25928 #close
Reported by Joshua Colp

Change-Id: Ic3d6c20ff3502507c17244a8b7e2ca761dc7fb60

9 years agoMerge "res_pjsip_transport_management: Allow unload to occur." into certified/13.1
Joshua Colp [Tue, 19 Apr 2016 14:40:53 +0000 (09:40 -0500)] 
Merge "res_pjsip_transport_management: Allow unload to occur." into certified/13.1

9 years agores_pjsip_registrar: Fix bad memory-ness with user_agent. 42/2642/2
Mark Michelson [Mon, 18 Apr 2016 22:00:42 +0000 (17:00 -0500)] 
res_pjsip_registrar: Fix bad memory-ness with user_agent.

Recent changes to the PJSIP registrar resulted in tests failing due to
missing AOR_CONTACT_ADDED test events. The reason for this was that the
user_agent string had junk values in it, resulting in being unable to
generate the event.

I'm going to be honest here, I have no idea why this was happening. Here
are the steps needed for the user_agent variable to get messed up:
* REGISTER is received
* First contact in the REGISTER results in a contact being removed
* Second contact in the REGISTER results in a contact being added
* The contact, AOR, expiration, and user agent all have to be passed as
  format parameters to the creation of a string. Any subset of those
  parameters would not be enough to cause the problem.

Looking into what was happening, the thing that struck me as odd was
that the user_agent variable was meant to be set to the value of the
User-Agent SIP header in the incoming REGISTER. However, when removing a
contact, the user_agent variable would be set (via ast_strdupa inside a
loop) to the stored contact's user_agent. This means that the
user_agent's value would be incorrect when attempting to process further
contacts in the incoming REGISTER.

The fix here is to use a different variable for the stored user agent
when removing a contact. Correcting the behavior to be correct also
means the memory usage is less weird, and the issue no longer occurs.

ASTERISK-25929 #close
Reported by Joshua Colp

Change-Id: I7cd24c86a38dec69ebcc94150614bc25f46b8c08

9 years agores_pjsip_transport_management: Allow unload to occur. 47/2647/1
Joshua Colp [Mon, 18 Apr 2016 18:41:34 +0000 (15:41 -0300)] 
res_pjsip_transport_management: Allow unload to occur.

At shutdown it is possible for modules to be unloaded that wouldn't
normally be unloaded. This allows the environment to be cleaned up.

The res_pjsip_transport_management module did not have the unload
logic in it to clean itself up causing the res_pjsip module to not
get unloaded. As a result the res_pjsip monitor thread kept going
processing traffic and timers when it shouldn't.

Change-Id: Ic8cadee131e3b2c436a81d3ae8bb5775999ae00a

9 years agoChangeLog: Updated for certified/13.1-cert5 certified/13.1-cert5
Kevin Harwell [Thu, 14 Apr 2016 20:22:30 +0000 (15:22 -0500)] 
ChangeLog: Updated for certified/13.1-cert5

9 years agoRelease summaries: Add summaries for certified/13.1-cert5
Kevin Harwell [Thu, 14 Apr 2016 20:22:26 +0000 (15:22 -0500)] 
Release summaries: Add summaries for certified/13.1-cert5

9 years agoRelease summaries: Remove previous versions
Kevin Harwell [Thu, 14 Apr 2016 20:22:04 +0000 (15:22 -0500)] 
Release summaries: Remove previous versions

9 years ago.version: Update for certified/13.1-cert5
Kevin Harwell [Thu, 14 Apr 2016 20:22:04 +0000 (15:22 -0500)] 
.version: Update for certified/13.1-cert5

9 years ago.lastclean: Update for certified/13.1-cert5
Kevin Harwell [Thu, 14 Apr 2016 20:22:04 +0000 (15:22 -0500)] 
.lastclean: Update for certified/13.1-cert5

9 years agorealtime: Add database scripts for certified/13.1-cert5
Kevin Harwell [Thu, 14 Apr 2016 20:22:04 +0000 (15:22 -0500)] 
realtime: Add database scripts for certified/13.1-cert5

9 years agotransport management: Register thread with PJProject. 15/2615/3
Mark Michelson [Thu, 14 Apr 2016 18:49:35 +0000 (13:49 -0500)] 
transport management: Register thread with PJProject.

The scheduler thread that kills idle TCP connections was not registering
with PJProject properly and causing assertions if PJProject was built in
debug mode.

This change registers the thread with PJProject the first time that the
scheduler callback executes.

AST-2016-005

Change-Id: I5f7a37e2c80726a99afe9dc2a4a69bdedf661283

9 years agoMerge "res_pjsip_transport_management: Kill idle TCP connections." into certified...
Joshua Colp [Thu, 14 Apr 2016 18:03:01 +0000 (13:03 -0500)] 
Merge "res_pjsip_transport_management: Kill idle TCP connections." into certified/13.1

9 years agoMerge "Rename res_pjsip_keepalive res_pjsip_transport_management" into certified...
Joshua Colp [Thu, 14 Apr 2016 18:00:54 +0000 (13:00 -0500)] 
Merge "Rename res_pjsip_keepalive res_pjsip_transport_management" into certified/13.1

9 years agores_pjsip_transport_management: Kill idle TCP connections. 01/2601/1
Mark Michelson [Tue, 8 Mar 2016 18:12:16 +0000 (12:12 -0600)] 
res_pjsip_transport_management: Kill idle TCP connections.

"Idle" here means that someone connects to us and does not send a SIP
request. PJProject will not automatically time out such connections, so
it's up to Asterisk to do it instead.

When we receive an incoming TCP connection, we will start a timer
(equivalent to transaction timer D) waiting to receive an incoming
request. If we do not receive a request in that timeframe, then we will
shut down the TCP connection.

ASTERISK-25796 #close
Reported by George Joseph

AST-2016-005

Change-Id: I7b0d303e5d140d0ccaf2f7af562071e3d1130ac6

9 years agoRename res_pjsip_keepalive res_pjsip_transport_management 00/2600/1
Mark Michelson [Tue, 8 Mar 2016 16:52:19 +0000 (10:52 -0600)] 
Rename res_pjsip_keepalive res_pjsip_transport_management

ASTERISK-25796
Reported by George Joseph

AST-2016-005

Change-Id: Id322a05f927392293570599730050bc677d99433

9 years agoAST-2016-004: Fix crash on REGISTER with long URI. 96/2596/1
Mark Michelson [Thu, 14 Apr 2016 12:20:46 +0000 (07:20 -0500)] 
AST-2016-004: Fix crash on REGISTER with long URI.

Due to some ignored return values, Asterisk could crash if processing an
incoming REGISTER whose contact URI was above a certain length.

ASTERISK-25707 #close
Reported by George Joseph

Patches:
    0001-res_pjsip-Validate-that-URIs-don-t-exceed-pjproject-.patch

AST-2016-004

Change-Id: Ic4f5e49f1a83fef4951ffeeef8f443a7f6ac15eb

9 years agores_pjsip: Handle deferred SDP hold/unhold properly. 35/2535/2
Mark Michelson [Tue, 5 Apr 2016 19:23:35 +0000 (14:23 -0500)] 
res_pjsip: Handle deferred SDP hold/unhold properly.

Some SIP devices indicate hold/unhold using deferred SDP reinvites. In
other words, they provide no SDP in the reinvite.

A typical transaction that starts hold might look something like this:

* Device sends reinvite with no SDP
* Asterisk sends 200 OK with SDP indicating sendrecv on streams.
* Device sends ACK with SDP indicating sendonly on streams.

At this point, PJMedia's SDP negotiator saves Asterisk's local state as
being recvonly.

Now, when the device attempts to unhold, it again uses a deferred SDP
reinvite, so we end up doing the following:

* Device sends reinvite with no SDP
* Asterisk sends 200 OK with SDP indicating recvonly on streams
* Device sends ACK with SDP indicating sendonly on streams

The problem here is that Asterisk offered recvonly, and by RFC 3264's
rules, if an offer is recvonly, the answer has to be sendonly. The
result is that the device is not taken off hold.

What is supposed to happen is that Asterisk should indicate sendrecv in
the 200 OK that it sends. This way, the device has the freedom to
indicate sendrecv if it wants the stream taken off hold, or it can
continue to respond with sendonly if the purpose of the reinvite was
something else (like a session timer refresher).

The fix here is to alter the SDP negotiator's state when we receive a
reinvite with no SDP. If the negotiator's state is currently in the
recvonly or inactive state, then we alter our local state to be
sendrecv. This way, we allow the device to indicate the stream state as
desired.

ASTERISK-25854 #close
Reported by Robert McGilvray

Change-Id: I7615737276165eef3a593038413d936247dcc6ed

9 years agores_stasis: Fix crash on a hanging up channel. 15/2515/1
Richard Mudgett [Mon, 28 Mar 2016 23:10:40 +0000 (18:10 -0500)] 
res_stasis: Fix crash on a hanging up channel.

* Give the struct stasis_app_control ao2 object a ref to the channel held
in the object.  Now the channel will still be around if a thread needs to
post a stasis message instead of crash because the topic was destroyed.

* Moved stopping any lingering silence generator out of the struct
stasis_app_control destructor and made it a part of exiting the Stasis
application.  Who knows which thread the destructor will be called under
so it cannot affect the channel's silence generator.  Not only was the
channel unprotected when the silence generator was stopped, stasis may no
longer even control the channel.

ASTERISK-25882

Change-Id: I21728161b5fe638cef7976fa36a605043a7497e4

9 years agores_pjsip_send_to_voicemail.c: Allow either quoted or not send_to_vm reason. 39/2339/1
Richard Mudgett [Sat, 27 Feb 2016 00:54:53 +0000 (18:54 -0600)] 
res_pjsip_send_to_voicemail.c: Allow either quoted or not send_to_vm reason.

Change-Id: Id6350b3c7d4ec8df7ec89863566645e2b0f441fd

9 years agores_pjsip_pubsub: Move where the subscription is stored to after initialized. 95/2295/1
Joshua Colp [Mon, 15 Feb 2016 18:52:22 +0000 (14:52 -0400)] 
res_pjsip_pubsub: Move where the subscription is stored to after initialized.

A problem arose when testing the AMI subscription listing actions where it
was possible for a subscription that had not been fully initialized to be
listed. This was problematic as the underlying listing code would crash.

This change makes it so the subscription tree is fully set up before it is
added to the list of subscriptions. This ensures that when the listing actions
get the subscription it is valid.

ASTERISK-25738 #close

Change-Id: Iace2b13641c31bbcc0d43a39f99aba1f340c0f48
(cherry picked from commit 1c4f2a920db173412b38aab785ba22c2cc489f89)

9 years agoChangeLog: Updated for certified/13.1-cert4 certified/13.1-cert4
kharwell [Thu, 11 Feb 2016 18:31:44 +0000 (13:31 -0500)] 
ChangeLog: Updated for certified/13.1-cert4

9 years agoRelease summaries: Add summaries for certified/13.1-cert4
kharwell [Thu, 11 Feb 2016 18:31:44 +0000 (13:31 -0500)] 
Release summaries: Add summaries for certified/13.1-cert4

9 years agoRelease summaries: Remove previous versions
Kevin Harwell [Thu, 11 Feb 2016 18:31:35 +0000 (12:31 -0600)] 
Release summaries: Remove previous versions

9 years ago.version: Update for certified/13.1-cert4
kharwell [Thu, 11 Feb 2016 18:31:34 +0000 (13:31 -0500)] 
.version: Update for certified/13.1-cert4

9 years ago.lastclean: Update for certified/13.1-cert4
kharwell [Thu, 11 Feb 2016 18:31:34 +0000 (13:31 -0500)] 
.lastclean: Update for certified/13.1-cert4

9 years agorealtime: Add database scripts for certified/13.1-cert4
kharwell [Thu, 11 Feb 2016 18:31:34 +0000 (13:31 -0500)] 
realtime: Add database scripts for certified/13.1-cert4

9 years agoMerge "app_confbridge: Make non-admin users join a muted conference muted." into...
Joshua Colp [Fri, 5 Feb 2016 17:49:18 +0000 (11:49 -0600)] 
Merge "app_confbridge: Make non-admin users join a muted conference muted." into certified/13.1

9 years agoCheck for OpenSSL defines before trying to use them. 05/2205/1
Mark Michelson [Thu, 4 Feb 2016 22:17:55 +0000 (16:17 -0600)] 
Check for OpenSSL defines before trying to use them.

The SSL_OP_NO_TLSv1_1 and SSL_OP_NO_TLSv1_2 defines did not exist prior
to OpenSSL version 1.0.1. A recent commit attempts to, by default, set
these options, which can cause problems on systems with older OpenSSL
installations.

This commit adds a configure script check for those defines and will not
attempt to make use of those if they do not exist. We will print a
warning urging the user to upgrade their OpenSSL installation if those
defines are not present.

Change-Id: I6a2eb9a43fd0738b404d8f6f2cf4b5c22d9d752d

9 years agores_stasis_device_state: Fix refcounting error. 97/2197/3
Mark Michelson [Thu, 4 Feb 2016 17:39:10 +0000 (11:39 -0600)] 
res_stasis_device_state: Fix refcounting error.

Device state subscription lifetimes were governed by when the
subscription was established and unsubscribed from. However, it is
possible that at the time of unsubscription, there could be device state
events still in flight. When those device state events occur, the device
state callback could attempt to dereference a freed pointer. Crash.

This change ensures that the lifetime of the device state subscription
does not end until the underlying stasis subscription has confirmed that
its final message has been sent.

Change-Id: I25a0f1472894c1a562252fb7129671478e25e9b2

9 years agoChangeLog: Updated for certified/13.1-cert3 certified/13.1-cert3
kharwell [Wed, 3 Feb 2016 22:14:42 +0000 (17:14 -0500)] 
ChangeLog: Updated for certified/13.1-cert3

9 years agoRelease summaries: Add summaries for certified/13.1-cert3
kharwell [Wed, 3 Feb 2016 22:14:41 +0000 (17:14 -0500)] 
Release summaries: Add summaries for certified/13.1-cert3

9 years ago.version: Update for certified/13.1-cert3
kharwell [Wed, 3 Feb 2016 22:05:00 +0000 (17:05 -0500)] 
.version: Update for certified/13.1-cert3

9 years ago.lastclean: Update for certified/13.1-cert3
kharwell [Wed, 3 Feb 2016 22:04:59 +0000 (17:04 -0500)] 
.lastclean: Update for certified/13.1-cert3

9 years agorealtime: Add database scripts for certified/13.1-cert3
kharwell [Wed, 3 Feb 2016 22:04:59 +0000 (17:04 -0500)] 
realtime: Add database scripts for certified/13.1-cert3

9 years agoMerge "AST-2016-003 udptl.c: Fix uninitialized values." into certified/13.1
Kevin Harwell [Wed, 3 Feb 2016 21:18:00 +0000 (15:18 -0600)] 
Merge "AST-2016-003 udptl.c: Fix uninitialized values." into certified/13.1

9 years agoMerge "AST-2016-002 chan_sip.c: Fix retransmission timeout integer overflow." into...
Kevin Harwell [Wed, 3 Feb 2016 21:15:24 +0000 (15:15 -0600)] 
Merge "AST-2016-002 chan_sip.c: Fix retransmission timeout integer overflow." into certified/13.1

9 years agoAST-2016-001 http: Provide greater control of TLS and set modern defaults. 64/2164/3
Joshua Colp [Wed, 3 Feb 2016 18:05:52 +0000 (14:05 -0400)] 
AST-2016-001 http: Provide greater control of TLS and set modern defaults.

This change exposes the configuration of various aspects of the TLS
support and sets the default to the modern standards.

The TLS cipher is now set to the best values according to the
Mozilla OpSec team, different TLS versions can now be disabled, and
the cipher order can be forced to be that of the server instead of
the client.

ASTERISK-24972 #close

Change-Id: I8635470e722ce6d47951a5045ae9ef348271d395

9 years agoAST-2016-003 udptl.c: Fix uninitialized values. 79/2179/2
Richard Mudgett [Mon, 7 Dec 2015 18:46:53 +0000 (12:46 -0600)] 
AST-2016-003 udptl.c: Fix uninitialized values.

Sending UDPTL packets to Asterisk with the right amount of missing
sequence numbers and enough redundant 0-length IFP packets, can make
Asterisk crash.

ASTERISK-25603 #close
Reported by: Walter Doekes

ASTERISK-25742 #close
Reported by: Torrey Searle

Change-Id: I97df8375041be986f3f266ac1946a538023a5255

9 years agoAST-2016-002 chan_sip.c: Fix retransmission timeout integer overflow. 71/2171/2
Richard Mudgett [Mon, 28 Sep 2015 22:07:42 +0000 (17:07 -0500)] 
AST-2016-002 chan_sip.c: Fix retransmission timeout integer overflow.

Setting the sip.conf timert1 value to a value higher than 1245 can cause
an integer overflow and result in large retransmit timeout times.  These
large timeout times hold system file descriptors hostage and can cause the
system to run out of file descriptors.

NOTE: The default sip.conf timert1 value is 500 which does not expose the
vulnerability.

* The overflow is now detected and the previous timeout time is
calculated.

ASTERISK-25397 #close
Reported by: Alexander Traud

Change-Id: Ia7231f2f415af1cbf90b923e001b9219cff46290

9 years agoconfig: Allow options to register when documentation is unavailable. 37/2137/1
Joshua Colp [Mon, 25 Jan 2016 15:35:21 +0000 (11:35 -0400)] 
config: Allow options to register when documentation is unavailable.

The config options framework is strict in that configuration options must
be documented unless XML documentation support is not available. In
practice this is useful as it ensures documentation exists however in
off-nominal cases this can cause strange problems.

If it is expected that a config option has a non-zero or non-empty
default value but the config option documentation is unavailable
this reasonable expectation will not be met. This can cause obscure
crashes and weirdness depending on how the code handles it.

This change tweaks the behavior to ensure that the config option
is still allowed to register, apply default values, and be set when
devmode is not enabled. If devmode is enabled then the option can
NOT be set.

This also does not remove the initial documentation error message that
is output on load when registering the configuration option.

ASTERISK-25725 #close

Change-Id: Iec42fca6b35f31326c33fcdc25473f6fd7bc8af8
(cherry picked from commit f22074e5d9ed1882be976299311b8e093d25e1da)

9 years agoapp_confbridge: Make non-admin users join a muted conference muted. 17/2117/1
Richard Mudgett [Mon, 25 Jan 2016 21:48:04 +0000 (15:48 -0600)] 
app_confbridge: Make non-admin users join a muted conference muted.

ASTERISK-20987 #close
Reported by: hristo

Change-Id: Ic61a2b524ab3a4cfadf227fc6b3506527bc03f38

9 years agores_pjsip_pubsub: Prevent crash from AMI command on freed subscription. 96/2096/1
Mark Michelson [Mon, 25 Jan 2016 22:51:25 +0000 (16:51 -0600)] 
res_pjsip_pubsub: Prevent crash from AMI command on freed subscription.

A test recently uncovered that running an ill-timed AMI command to show
inbound subscriptions could cause a crash since Asterisk will try to
operate on a freed subscription.

The fix for this is to remove the subscription tree from the list of
subscriptions at the time that we are sending our final NOTIFY request
out. This way, as the subscription is in the process of dying, it is
inaccessible from AMI.

Change-Id: Ic0239003d8d73e04c47c12dd2a7e23867e5b5b23
(cherry picked from commit b073244c511f9634de57ea401ab9dbebcf2390e8)

9 years agores/res_pjsip/presence_xml.c: Add missing 2nd call presence state case. 63/2063/1
Richard Mudgett [Wed, 20 Jan 2016 00:20:59 +0000 (18:20 -0600)] 
res/res_pjsip/presence_xml.c: Add missing 2nd call presence state case.

ASTERISK-25712 #close
Reported by: Richard Mudgett

Change-Id: I70634df24f8c6c3a2c66c45af61d021e4999253f

9 years agobridge_basic: don't cache xferfailsound during an attended transfer 16/2016/2
Kevin Harwell [Thu, 14 Jan 2016 20:42:57 +0000 (14:42 -0600)] 
bridge_basic: don't cache xferfailsound during an attended transfer

The xferfailsound was read from the channel at the beginning of the transfer,
and that value is "cached" for the duration of the transfer. Therefore, changing
the xferfailsound on the channel using the FEATURE() dialplan function does
nothing once the transfer is under way.

This makes it so the transfer code instead gets the xferfailsound configuration
options from the channel when it is actually going to be used.

This patch also fixes a potential memory leak of the props object as well as
making sure the condition variable gets initialized before being destroyed.

ASTERISK-25696 #close

Change-Id: Ic726b0f54ef588bd9c9c67f4b0e4d787934f85e4

9 years agotest_time: Provide a timeout when waiting. 06/2006/1
Joshua Colp [Mon, 28 Dec 2015 20:02:19 +0000 (16:02 -0400)] 
test_time: Provide a timeout when waiting.

The test_timezone_watch unit test is written to expect a
condition to be signaled when the inotify daemon thread runs.
There exists a small window where the test_timezone_watch
thread can signal the inotify daemon thread while it is not
reading on the underlying file descriptor. If this occurs
the test_timezone_watch thread will wait indefinitely for a
signal that will never arrive.

This change adds a timeout to the condition so it will return
regardless after a period of time.

Change-Id: Ifed981879df6de3d93acd3ee0a70f92546517390
(cherry picked from commit c8499b8d5adc805efadb91b483d9d987f62891ff)

9 years agoapp: Queue hangup if channel is hung up during sub or macro execution. 98/1998/2
Joshua Colp [Tue, 12 Jan 2016 17:14:29 +0000 (13:14 -0400)] 
app: Queue hangup if channel is hung up during sub or macro execution.

This issue was exposed when executing a connected line subroutine.
When connected or redirected subroutines or macros are executed it is
expected that the underlying applications and logic invoked are fast
and do not consume frames. In practice this constraint is not enforced
and if not adhered to will cause channels to continue when they shouldn't.
This is because each caller of the connected or redirected logic does not
check whether the channel has been hung up on return. As a result the
the hung up channel continues.

This change makes it so when the API to execute a subroutine or
macro is invoked the channel is checked to determine if it has hung up.
If it has then a hangup is queued again so the caller will see it
and stop.

ASTERISK-25690 #close

Change-Id: I1f9a8ceb1487df0389f0d346ce0f6dcbcaf476ea

9 years agopbx: Deadlock between contexts container and context_merge locks 63/1963/2
Kevin Harwell [Fri, 8 Jan 2016 21:22:05 +0000 (15:22 -0600)] 
pbx: Deadlock between contexts container and context_merge locks

Recent changes (ASTERISK-25394 commit 2bd27d12223fe33b58c453965ed5c6ed3af7c4f5)
introduced the possibility of a deadlock. Due to the mentioned modifications
ast_change_hints now needs to keep both merge/delete and state callbacks from
occurring while it executes. Unfortunately, sometimes ast_change_hints can be
called with the contexts container locked. When this happens it's possible for
another thread to grab the context_merge_lock before the thread calling into
ast_change_hints does and then try to obtain the contexts container lock. This
of course causes a deadlock between the two threads. The thread calling into
ast_change_hints waits for the other thread to release context_merge_lock and
the other thread is waiting on that one to release the contexts container lock.

Unfortunately, there is not a great way to fix this problem. When hints change,
the subsequent state callbacks cannot run at the same time as a merge/delete,
nor when the usual state callbacks do. This patch alleviates the problem by
having those particular callbacks (the ones run after a hint change) occur in a
serialized task. By moving the context_merge_lock to a task it can now safely be
attempted or held without a deadlock occurring.

ASTERISK-25640 #close
Reported by: Krzysztof Trempala

Change-Id: If2210ea241afd1585dc2594c16faff84579bf302

9 years agoPJSIP: Prevent deadlock due to dialog/transaction lock inversion. 31/1931/3
Mark Michelson [Thu, 7 Jan 2016 21:37:36 +0000 (15:37 -0600)] 
PJSIP: Prevent deadlock due to dialog/transaction lock inversion.

A deadlock was observed where the monitor thread was stuck, therefore
resulting in no incoming SIP traffic being processed.

The problem occurred when two 200 OK responses arrived in response to a
terminating NOTIFY request sent from Asterisk. The first 200 OK was
dispatched to a threadpool worker, who locked the corresponding
transaction. The second 200 OK arrived, resulting in the monitor thread
locking the dialog. At this point, the two threads are at odds, because
the monitor thread attempts to lock the transaction, and the threadpool
thread loops attempting to try to lock the dialog.

In this case, the fix is to not have the monitor thread attempt to hold
both the dialog and transaction locks at the same time. Instead, we
release the dialog lock before attempting to lock the transaction.

There have also been some debug messages added to the process in an
attempt to make it more clear what is going on in the process.

ASTERISK-25668 #close
Reported by Mark Michelson

Change-Id: I4db0705f1403737b4360e33a8e6276805d086d4a

9 years agochan_sip: Add TCP/TLS keepalive to TCP/TLS server 01/1801/2
Jonathan Rose [Thu, 10 Dec 2015 17:44:03 +0000 (11:44 -0600)] 
chan_sip: Add TCP/TLS keepalive to TCP/TLS server

Adds the TCP Keep Alive option to TCP and TLS server sockets. Previously
this option was only being set on session sockets.
http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/
According to the link above, the SO_KEEPALIVE option is useful for knowing
when a TCP connected endpoint has severed communication without indicating
it or has become unreachable for some reason. Without this patch, keep
alive is not set on the socket listening for incoming TCP sessions and
in Komatsu's report this resulted in the thread listening for TCP becoming
stuck in a waiting state.

ASTERISK-25364 #close
Reported by: Hiroaki Komatsu

Change-Id: I7ed7bcfa982b367dc64b4b73fbd962da49b9af36

9 years agoPJSIP FAX: Fix T.38 automatic reject timer NULL channel pointer dereferences. 74/1774/1
Richard Mudgett [Fri, 26 Jun 2015 15:36:19 +0000 (10:36 -0500)] 
PJSIP FAX: Fix T.38 automatic reject timer NULL channel pointer dereferences.

When a caller calls a FAX number and then hangs up right after the call is
answered then the T.38 re-INVITE automatic reject timer may still be
running after the channel goes away.

* Added session NULL channel checks on the code paths that get executed by
t38_automatic_reject() to prevent a crash when the T.38 re-INVITE
automatic reject timer expires.

ASTERISK-25168
Reported by: Carl Fortin

Change-Id: I07b6cd23815aedce5044f8f32543779e2f7a2403
(cherry picked from commit 8ea214aed782424a884b9a2f67d6dca270854e83)

9 years agoMerge "sched.c: Make not return a sched id of 0." into certified/13.1
Joshua Colp [Thu, 3 Dec 2015 11:50:55 +0000 (05:50 -0600)] 
Merge "sched.c: Make not return a sched id of 0." into certified/13.1

9 years agoMerge topic 'ASTERISK-25476' into certified/13.1
Joshua Colp [Thu, 3 Dec 2015 11:50:24 +0000 (05:50 -0600)] 
Merge topic 'ASTERISK-25476' into certified/13.1

* changes:
  Audit improper usage of scheduler exposed by 5c713fdf18f. (v13 additions)
  Audit improper usage of scheduler exposed by 5c713fdf18f.

9 years agoUnset BRIDGEPEER when leaving a bridge 53/1753/1
Jonathan Rose [Tue, 1 Dec 2015 22:11:07 +0000 (16:11 -0600)] 
Unset BRIDGEPEER when leaving a bridge

Currently if a channel is transferred out of a bridge, the BRIDGEPEER
variable (also BRIDGEPVTCALLID) remain set even once the channel is
out of the bridge. This patch removes these variables when leaving
the bridge.

ASTERISK-25600 #close
Reported by: Mark Michelson

Change-Id: I753ead2fffbfc65427ed4e9244c7066610e546da

9 years agosched.c: Make not return a sched id of 0. 40/1740/2
Richard Mudgett [Mon, 30 Nov 2015 22:42:47 +0000 (16:42 -0600)] 
sched.c: Make not return a sched id of 0.

According to the API doxygen a sched ID of 0 is valid.  Unfortunately, 0
was never returned historically and several users incorrectly coded usage
of the returned sched ID assuming that 0 was invalid.

ASTERISK-25476

Change-Id: Ib19c7ebb44ec9fd393ef6646dea806d4f34e3a20

9 years agoAudit improper usage of scheduler exposed by 5c713fdf18f. (v13 additions) 39/1739/2
Richard Mudgett [Wed, 25 Nov 2015 18:23:47 +0000 (12:23 -0600)] 
Audit improper usage of scheduler exposed by 5c713fdf18f. (v13 additions)

chan_sip.c:
* Initialize mwi subscription scheduler ids earlier because of ASTOBJ to
ao2 conversion.

* Initialize register scheduler ids earlier because of ASTOBJ to ao2
conversion.

chan_skinny.c:
* Fix more scheduler usage for the valid 0 id value.

ASTERISK-25476

Change-Id: If9f0e5d99638b2f9d102d1ebc9c5a14b2d706e95

9 years agoAudit improper usage of scheduler exposed by 5c713fdf18f. 38/1738/2
Richard Mudgett [Tue, 24 Nov 2015 18:44:53 +0000 (12:44 -0600)] 
Audit improper usage of scheduler exposed by 5c713fdf18f.

channels/chan_iax2.c:
* Initialize struct chan_iax2_pvt scheduler ids earlier because of
iax2_destroy_helper().

channels/chan_sip.c:
channels/sip/config_parser.c:
* Fix initialization of scheduler id struct members.  Some off nominal
paths had 0 as a scheduler id to be destroyed when it was never started.

chan_skinny.c:
* Fix some scheduler id comparisons that excluded the valid 0 id.

channel.c:
* Fix channel initialization of the video stream scheduler id.

pbx_dundi.c:
* Fix channel initialization of the packet retransmission scheduler id.

ASTERISK-25476

Change-Id: I07a3449f728f671d326a22fcbd071f150ba2e8c8

9 years agores_sorcery_realtime.c: Fix crash from NULL sorcery object type. 01/1701/1
Richard Mudgett [Mon, 23 Nov 2015 20:27:27 +0000 (14:27 -0600)] 
res_sorcery_realtime.c: Fix crash from NULL sorcery object type.

If the sorcery object type is not found a NULL is returned.
Unfortunately, sorcery_realtime_filter_objectset() will crash after
complaining about not finding the object type and saying to expect errors.

* Use ao2_cleanup() instead of ao2_ref() to prevent the crash.

ASTERISK-25165
Reported by Corey Farrell

Change-Id: Ic3b64453ea3058cb68d5c26d97d4fe7b8eea2e97

9 years agofeatures: Fix crash when transferee hangs up during DTMF attended transfer. 50/1650/1
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
(cherry picked from commit be1260a35f88faea4fa029d59343b124d250a8a6)

9 years agoMerge "Confbridge: Add a user timeout option" into certified/13.1
Joshua Colp [Tue, 17 Nov 2015 14:12:21 +0000 (08:12 -0600)] 
Merge "Confbridge: Add a user timeout option" into certified/13.1

9 years agoapp_queue: (try_calling): mutex 'qe->chan' freed more times than we've locked! 41/1641/1
Alec Davis [Mon, 16 Nov 2015 10:29:25 +0000 (23:29 +1300)] 
app_queue: (try_calling): mutex 'qe->chan' freed more times than we've locked!

commit aae45acbd (Mark Michelson 2015-04-15 10:38:02 -0500 6525)
refer ASTERISK-24958

above commit removed ast_channel_lock(qe->chan);
but failed to remove corresponding ast_channel_unlock(qe->chan);

ASTERISK-25561 #close
Reported Alec Davis

Change-Id: Ie05f4e2d08912606178bf1fded57cc022c7a2e1a

9 years agoConfbridge: Add a user timeout option 30/1630/3
Mark Michelson [Fri, 13 Nov 2015 20:03:35 +0000 (14:03 -0600)] 
Confbridge: Add a user timeout option

This option adds the ability to specify a timeout, in seconds, for a
participant in a ConfBridge. When the user's timeout has been reached,
the user is ejected from the conference with the CONFBRIDGE_RESULT
channel variable set to "TIMEOUT".

The rationale for this change is that there have been times where we
have seen channels get "stuck" in ConfBridge because a network issue
results in a SIP BYE not being received by Asterisk. While these
channels can be hung up manually via CLI/AMI/ARI, adding some sort of
automatic cleanup of the channels is a nice feature to have.

ASTERISK-25549 #close
Reported by Mark Michelson

Change-Id: I2996b6c5e16a3dda27595f8352abad0bda9c2d98

9 years agoTaskprocessors: Increase high-water mark 24/1624/1
Mark Michelson [Fri, 13 Nov 2015 20:19:35 +0000 (14:19 -0600)] 
Taskprocessors: Increase high-water mark

In practical tests, we have seen certain taskprocessors, specifically
Stasis subscription taskprocessors, cross the recently-added high-water
mark and emit a warning. This high-water mark warning is only intended
to be emitted when things have tanked on the system and things are
heading south quickly. In the practical tests, the Stasis taskprocessors
sometimes had a max depth of 180 tasks in them, and Asterisk wasn't in
any danger at all.

As such, this ups the high-water mark to 500 tasks instead. It also
redefines the SIP threadpool request denial number to be a multiple of
the taskprocessor high-water mark.

Change-Id: Ic8d3e9497452fecd768ac427bb6f58aa616eebce

9 years agores_pjsip distributor: Don't send 503 response to responses. 18/1618/1
Mark Michelson [Thu, 12 Nov 2015 17:17:51 +0000 (11:17 -0600)] 
res_pjsip distributor: Don't send 503 response to responses.

When the SIP threadpool is backed up with tasks, we send 503 responses
to ensure that we don't try to overload ourselves. The problem is that
we were not insuring that we were not trying to send a 503 to an
incoming SIP response.

This change makes it so that we only send the 503 on incoming requests.

Change-Id: Ie2b418d89c0e453cc6c2b5c7d543651c981e1404

9 years agoMerge "Further fixes to improper usage of scheduler" into certified/13.1
Matt Jordan [Thu, 12 Nov 2015 17:16:58 +0000 (11:16 -0600)] 
Merge "Further fixes to improper usage of scheduler" into certified/13.1

9 years agoFurther fixes to improper usage of scheduler 15/1615/1
Steve Davies [Wed, 11 Nov 2015 10:16:22 +0000 (10:16 +0000)] 
Further fixes to improper usage of scheduler

When ASTERISK-25449 was closed, a number of scheduler issues mentioned in
the comments were missed. These have since beed raised in ASTERISK-25476
and elsewhere.

This patch attempts to collect all of the scheduler issues discovered so
far and address them sensibly.

ASTERISK-25476 #close

Change-Id: I87a77d581e2e0d91d33b4b2fbff80f64a566d05b
(cherry picked from commit 07583c288828a496cd7730b55112128fea31eaef)

9 years agores_pjsip: Deny requests when threadpool queue is backed up. 08/1608/2
Mark Michelson [Wed, 11 Nov 2015 23:11:53 +0000 (17:11 -0600)] 
res_pjsip: Deny requests when threadpool queue is backed up.

We have observed situations where the SIP threadpool may become
deadlocked. However, because incoming traffic is still arriving, the SIP
threadpool's queue can continue to grow, eventually running the system
out of memory.

This change makes it so that incoming traffic gets rejected with a 503
response if the queue is backed up too much.

Change-Id: I4e736d48a2ba79fd1f8056c0dcd330e38e6a3816

9 years agothreadpool: Handle worker thread transitioning to dead when going active. 04/1604/1
Joshua Colp [Wed, 11 Nov 2015 17:04:08 +0000 (13:04 -0400)] 
threadpool: Handle worker thread transitioning to dead when going active.

This change adds handling of dead worker threads when moving them
to be active. When this happens the worker thread is removed from
both the active and idle threads container. If no threads are able
to be moved to active then the pool grows as configured.

A unit test has also been added which thrashes the idle timeout
and thread activation to exploit any race conditions between the
two.

ASTERISK-25546 #close

Change-Id: I6c455f9a40de60d9e86458d447b548fb52ba1143

9 years agotaskprocessor: Add high water mark warnings 73/1573/1
Jonathan Rose [Tue, 3 Nov 2015 22:19:43 +0000 (16:19 -0600)] 
taskprocessor: Add high water mark warnings

If a taskprocessor's queue grows large, this can indicate that there
may be a problem with tasks not leaving the processor or else that
the number of available task processors for a given type of task is
too low. This patch makes it so that if a taskprocessor's task queue
grows above 100 queued tasks that it will emit a warning message.
Warning messages are emitted only once per task processor.

ASTERISK-25518 #close
Reported by: Jonathan Rose

Change-Id: Ib1607c35d18c1d6a0575b3f0e3ff5d932fd6600c

9 years agoapp_dial: Hold reference to calling channel formats when dialing outbound. 69/1569/1
Joshua Colp [Tue, 23 Jun 2015 16:21:41 +0000 (13:21 -0300)] 
app_dial: Hold reference to calling channel formats when dialing outbound.

Currently when requesting a channel the native formats of the
calling channel are provided to the core for usage when dialing
the outbound channel. This occurs without holding the channel lock
or keeping a reference to the formats. This is problematic as
the channel driver may end up changing the formats during this time.
In the case of chan_sip this happens when an SDP negotiation
completes.

This change makes it so app_dial keeps a reference to the native
formats of the calling channel which guarantees that they will
remain valid for the period of time needed.

ASTERISK-25172 #close

Change-Id: I2f0a67bd0d5d14c3bdbaae552b4b1613a283f0db
(cherry picked from commit 3b2b004d699b8cc7b808f62536bb2bc4db8b4e0e)

9 years agomain/dial: Protect access to the format_cap structure of the requesting channel 67/1567/1
Matt Jordan [Wed, 4 Nov 2015 20:31:28 +0000 (14:31 -0600)] 
main/dial: Protect access to the format_cap structure of the requesting channel

When a dial attempt is made that involves a requesting channel, we previously
were not:
a) Protecting access to the native format capabilities structure on the
   requesting channel. That is inherently unsafe.
b) Reference bumping the lifetime of the format capabilities structure.

In both cases, something else could sneak in, blow away the format
capabilities, and we'd be holding onto an invalid format_cap structure. When
the newly created channel attempts to construct its format capabilities, things
go poorly.

This patch:
a) Ensures that we get a reference to the native format capabilities while
   the requesting channel is locked
b) Holds a reference to the native format capabilities during the creation
   of the new channel.

ASTERISK-25522 #close

Change-Id: I0bfb7ba8b9711f4158cbeaae96edf9626e88a54f

9 years agores_pjsip: Set threadpool max size default to 50. 51/1551/1
Mark Michelson [Mon, 2 Nov 2015 23:19:21 +0000 (17:19 -0600)] 
res_pjsip: Set threadpool max size default to 50.

During a stress test of subscriptions, a huge blast of
subscription-related traffic resulted in the threadpool expanding to a
ridiculous number of threads. The balooning of threads resulted in an
increase of memory, which led to a crash due to being out of memory.

An easy fix for the particular test was to limit the size of the
threadpool, thus reining in the amount of memory that would be used. It
was decided that there really is no downside to having a non-infinite
default value for the maximum size of the threadpool, so this change
introduces 50 threads as the maximum threadpool size for the SIP
threadpool.

ASTERISK-25513 #close
Reported by John Bigelow

Change-Id: If0b9514f1d9b172540ce1a6e2f2ffa1f2b6119be

9 years agoMerge "res_pjsip_pubsub: Prevent sending NOTIFY on destroyed dialog." into certified...
Matt Jordan [Sun, 25 Oct 2015 15:14:50 +0000 (10:14 -0500)] 
Merge "res_pjsip_pubsub: Prevent sending NOTIFY on destroyed dialog." into certified/13.1

9 years agoMerge "res_pjsip_pubsub: Ensure dialog lock balance." into certified/13.1
Matt Jordan [Sun, 25 Oct 2015 15:13:19 +0000 (10:13 -0500)] 
Merge "res_pjsip_pubsub: Ensure dialog lock balance." into certified/13.1

9 years agoMerge "res_pjsip_pubsub: Prevent crashes on final NOTIFY." into certified/13.1
Matt Jordan [Sun, 25 Oct 2015 15:12:52 +0000 (10:12 -0500)] 
Merge "res_pjsip_pubsub: Prevent crashes on final NOTIFY." into certified/13.1

9 years agoMerge "res_pjsip_pubsub: Remove serializer when sending final NOTIFY." into certified...
Matt Jordan [Sun, 25 Oct 2015 15:12:31 +0000 (10:12 -0500)] 
Merge "res_pjsip_pubsub: Remove serializer when sending final NOTIFY." into certified/13.1

9 years agoMerge "res_pjsip_pubsub: Fix crash on destruction of empty subscription tree." into...
Matt Jordan [Sun, 25 Oct 2015 15:12:16 +0000 (10:12 -0500)] 
Merge "res_pjsip_pubsub: Fix crash on destruction of empty subscription tree." into certified/13.1

9 years agoMerge "res_pjsip_pubsub: Solidify lifetime and ownership of objects." into certified...
Matt Jordan [Sun, 25 Oct 2015 15:11:21 +0000 (10:11 -0500)] 
Merge "res_pjsip_pubsub: Solidify lifetime and ownership of objects." into certified/13.1

9 years agoMerge "res_pjsip_pubsub: Set the endpoint on SUBSCRIBE dialogs." into certified/13.1
Matt Jordan [Sun, 25 Oct 2015 15:11:18 +0000 (10:11 -0500)] 
Merge "res_pjsip_pubsub: Set the endpoint on SUBSCRIBE dialogs." into certified/13.1

9 years agoalembic: Bad down revision in add_default_from_user script 17/1517/1
Kevin Harwell [Fri, 23 Oct 2015 21:53:51 +0000 (16:53 -0500)] 
alembic: Bad down revision in add_default_from_user script

The down revision wasn't set correct in the add_default_from_user script.
This patch points it to the correct revision.

Change-Id: Ied45786db265a1d4fb350ef0dd33b4d043c9a74d

9 years agoMerge "res_pjsip_outbound_registration: registration stops due to fatal 4xx response...
Joshua Colp [Fri, 23 Oct 2015 20:35:25 +0000 (15:35 -0500)] 
Merge "res_pjsip_outbound_registration: registration stops due to fatal 4xx response" into certified/13.1

9 years agores_pjsip_outbound_registration: registration stops due to fatal 4xx response 74/1474/5
Kevin Harwell [Wed, 21 Oct 2015 17:35:08 +0000 (12:35 -0500)] 
res_pjsip_outbound_registration: registration stops due to fatal 4xx response

During outbound registration it is possible to receive a fatal (any permanent/
non-temporary 4xx, 5xx, 6xx) response from the registrar that is simply due
to a problem with the registrar itself. Upon receiving the failure response
Asterisk terminates outbound registration for the given endpoint.

This patch adds an option, 'fatal_retry_interval', that when set continues
outbound registration at the given interval up to 'max_retries' upon receiving
a fatal response.

ASTERISK-25485 #close

Change-Id: Ibc2c7b47164ac89cc803433c0bbe7063bfa143a2

9 years agoMerge "Add missing failure checks to ast_str_set_va() callers." into certified/13.1
Joshua Colp [Fri, 23 Oct 2015 11:51:24 +0000 (06:51 -0500)] 
Merge "Add missing failure checks to ast_str_set_va() callers." into certified/13.1

9 years agoMerge "res_pjsip: Need to use the same serializer for a pjproject SIP transaction...
Joshua Colp [Fri, 23 Oct 2015 11:50:39 +0000 (06:50 -0500)] 
Merge "res_pjsip: Need to use the same serializer for a pjproject SIP transaction." into certified/13.1

9 years agoMerge "Fix issue with AST_THREADSTORAGE_RAW when DEBUG_THREADLOCALS is enabled."...
Joshua Colp [Fri, 23 Oct 2015 11:50:29 +0000 (06:50 -0500)] 
Merge "Fix issue with AST_THREADSTORAGE_RAW when DEBUG_THREADLOCALS is enabled." into certified/13.1

9 years agoMerge "Replace most uses of ast_register_atexit with ast_register_cleanup." into...
Joshua Colp [Fri, 23 Oct 2015 11:49:04 +0000 (06:49 -0500)] 
Merge "Replace most uses of ast_register_atexit with ast_register_cleanup." into certified/13.1

9 years agoMerge "res_pjsip: Move URI validation to use time." into certified/13.1
Joshua Colp [Fri, 23 Oct 2015 11:48:55 +0000 (06:48 -0500)] 
Merge "res_pjsip: Move URI validation to use time." into certified/13.1

9 years agoformat_cap: Detect vector allocation failures. 14/1514/1
Mark Michelson [Thu, 22 Oct 2015 22:07:55 +0000 (17:07 -0500)] 
format_cap: Detect vector allocation failures.

A crash was seen on a system that ran out of memory due to Asterisk not
checking for vector allocation failures in format_cap.c. With this
change, if either of the AST_VECTOR_INIT calls fail, we will return a
value indicating failure.

Change-Id: Ieb9c59f39dfde6d11797a92b45e0cf8ac5722bc8

9 years agores_pjsip_pubsub: Prevent sending NOTIFY on destroyed dialog. 12/1512/1
Mark Michelson [Fri, 2 Oct 2015 20:32:09 +0000 (15:32 -0500)] 
res_pjsip_pubsub: Prevent sending NOTIFY on destroyed dialog.

A certain situation can result in our attempting to send a NOTIFY on a
destroyed dialog. Say we attempt to send a NOTIFY to a subscriber, but
that subscriber has dropped off the network. We end up retransmitting
that NOTIFY until the appropriate SIP timer says to destroy the NOTIFY
transaction. When the pjsip evsub code is told that the transaction has
been terminated, it responds in kind by alerting us that the
subscription has been terminated, destroying the subscription, and then
removing its reference to the dialog, thus destroying the dialog.

The problem is that when we get told that the subscription is being
terminated, we detect that we have not sent a terminating NOTIFY
request, so we queue up such a NOTIFY to be sent out. By the time that
queued NOTIFY gets sent, the dialog has been destroyed, so attempting to
send that NOTIFY can result in a crash.

The fix being introduced here is actually a reintroduction of something
the pubsub code used to employ. We hold a reference to the dialog and
wait to decrement our reference to the dialog until our subscription
tree object is destroyed. This way, we can send messages on the dialog
even if the PJSIP evsub code wants to terminate earlier than we would
like.

In doing this, some NULL checks for subscription tree dialogs have been
removed since NULL dialogs are no longer actually possible.

Change-Id: I013f43cddd9408bb2a31b77f5db87a7972bfe1e5