5 years agoapp_confbridge: Only use b_profile options from the conference.
Richard Mudgett [Mon, 25 Jan 2016 23:36:50 +0000 (17:36 -0600)]
app_confbridge: Only use b_profile options from the conference.

A user cannot set new bridge options after the conference is created by
the first user.  Attempting to do so is documented as undefined behavior.

This patch ensures that the bridge profile options used are from the
conference and not what a subsequent user may have tried to set.

Change-Id: I1b6383eba654679e5739d5a8de98199cf074a266

5 years agoMerge "pjsip/alembic: Add missing columns to system and registration"
Joshua Colp [Fri, 5 Feb 2016 17:50:35 +0000 (11:50 -0600)]
Merge "pjsip/alembic:  Add missing columns to system and registration"

5 years agoMerge "app_confbridge.c: Replace inlined code with existing function."
Joshua Colp [Fri, 5 Feb 2016 17:49:42 +0000 (11:49 -0600)]
Merge "app_confbridge.c: Replace inlined code with existing function."

5 years agoMerge topic 'ASTERISK-20987'
Joshua Colp [Fri, 5 Feb 2016 17:49:14 +0000 (11:49 -0600)]
Merge topic 'ASTERISK-20987'

* changes:
  app_confbridge: Add ability to get the muted conference state.
  app_confbridge.c: Update CONFBRIDGE and CONFBRIDGE_INFO documentation.
  app_confbridge: Make non-admin users join a muted conference muted.

5 years agoCheck for OpenSSL defines before trying to use them.
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

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

5 years agopjsip/alembic: Add missing columns to system and registration
George Joseph [Wed, 3 Feb 2016 20:25:23 +0000 (13:25 -0700)]
pjsip/alembic:  Add missing columns to system and registration

ps_systems needed disable_tcp_switch
ps_registrations needed line and endpoint

ASTERISK-25737 #close

Change-Id: Iaf9c2d69e62243d9fa53104c28c5339c47d4ac19

5 years agoMerge "logging: Remove/fix some message annoyances"
Mark Michelson [Thu, 4 Feb 2016 20:10:58 +0000 (14:10 -0600)]
Merge "logging: Remove/fix some message annoyances"

5 years agoMerge "res_stasis_device_state: Fix refcounting error."
Joshua Colp [Thu, 4 Feb 2016 18:35:37 +0000 (12:35 -0600)]
Merge "res_stasis_device_state: Fix refcounting error."

5 years agoMerge "app_queue: Add Lastpause field of queue member"
Joshua Colp [Thu, 4 Feb 2016 18:29:18 +0000 (12:29 -0600)]
Merge "app_queue: Add  Lastpause field of queue member"

5 years agoMerge "res_xmpp: Does not connect in component mode"
Joshua Colp [Thu, 4 Feb 2016 18:26:49 +0000 (12:26 -0600)]
Merge "res_xmpp: Does not connect in component mode"

5 years agores_stasis_device_state: Fix refcounting error.
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

5 years agores_rtp_asterisk: Allow ICE host candidates to be overriden
Sean Bright [Wed, 27 Jan 2016 16:44:10 +0000 (11:44 -0500)]
res_rtp_asterisk: Allow ICE host candidates to be overriden

During ICE negotiation the IPs of the local interfaces are sent to the remote
peer as host candidates. In many cases Asterisk is behind a static one-to-one
NAT, so these host addresses will be internal IP addresses.

To help in hiding the topology of the internal network, this patch adds the
ability to override the host candidates by matching them against a
user-defined list of replacements.

Change-Id: I1c9541af97b83a4c690c8150d19bf7202c8bff1f

5 years agoMerge "AST-2016-003 udptl.c: Fix uninitialized values."
Kevin Harwell [Wed, 3 Feb 2016 21:17:22 +0000 (15:17 -0600)]
Merge "AST-2016-003 udptl.c: Fix uninitialized values."

5 years agoMerge "AST-2016-002 chan_sip.c: Fix retransmission timeout integer overflow."
Kevin Harwell [Wed, 3 Feb 2016 21:14:53 +0000 (15:14 -0600)]
Merge "AST-2016-002 chan_sip.c: Fix retransmission timeout integer overflow."

5 years agoAST-2016-001 http: Provide greater control of TLS and set modern defaults.
Joshua Colp [Wed, 3 Feb 2016 18:05:20 +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: I0a10f2883f7559af5e48dee0901251dbf30d45b8

5 years agoAST-2016-003 udptl.c: Fix uninitialized values.
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

5 years agoAST-2016-002 chan_sip.c: Fix retransmission timeout integer overflow.
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

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

ASTERISK-25397 #close
Reported by: Alexander Traud

Change-Id: Ia7231f2f415af1cbf90b923e001b9219cff46290

5 years agologging: Remove/fix some message annoyances
George Joseph [Wed, 3 Feb 2016 20:07:07 +0000 (13:07 -0700)]
logging: Remove/fix some message annoyances

test_dlinklists doesn't need to NOTICE everyone that every macro worked.

res_phoneprov doesn't need to VERBOSE everyone that a phoneprov extension or
provider was registered.

res_odbc was missing a newline at the end of one message.

Change-Id: I6c06361518ef3711821795e535acd439782a995e

5 years agoMerge "res_sorcery_realtime: Fix regex regression."
Joshua Colp [Wed, 3 Feb 2016 16:14:45 +0000 (10:14 -0600)]
Merge "res_sorcery_realtime: Fix regex regression."

5 years agoMerge " REFACTOR Macro LENGTHEN_BUF"
Joshua Colp [Wed, 3 Feb 2016 12:20:18 +0000 (06:20 -0600)]

5 years agoMerge "app_queue: fix some tab format"
Joshua Colp [Wed, 3 Feb 2016 12:19:47 +0000 (06:19 -0600)]
Merge "app_queue: fix some tab format"

5 years agoMerge "README: Update year in copyright"
Joshua Colp [Wed, 3 Feb 2016 12:19:29 +0000 (06:19 -0600)]
Merge "README: Update year in copyright"

5 years agoMerge "app_queue: Fix preserved reason of pause when Asterisk is restared"
Joshua Colp [Wed, 3 Feb 2016 12:19:19 +0000 (06:19 -0600)]
Merge "app_queue: Fix preserved reason of pause when Asterisk is restared"

5 years agoMerge "app_queue.c: remove include for core_unreal.h not used in code."
Joshua Colp [Wed, 3 Feb 2016 12:18:58 +0000 (06:18 -0600)]
Merge "app_queue.c: remove include for core_unreal.h not used in code."

5 years agoMerge "chan_sip.c: AMI & CLI notify methods get different values of asterisk's own...
Mark Michelson [Tue, 2 Feb 2016 21:58:49 +0000 (15:58 -0600)]
Merge "chan_sip.c: AMI & CLI notify methods get different values of asterisk's own ip."

5 years agores_sorcery_realtime: Fix regex regression.
Mark Michelson [Tue, 2 Feb 2016 16:52:29 +0000 (10:52 -0600)]
res_sorcery_realtime: Fix regex regression.

A regression was introduced where searching for realtime PJSIP objects
by regex by starting the regex with a leading "^" would cause no items
to be returned.

This was due to a change which attempted to drop the requirement for a
leading "^" to be present due to how some CLI commands formulate their
regexes. However, the change, rather than simply eliminating the
requirement, caused any regexes that did begin with "^" to end up not
returning the expected results.

This change fixes the problem by inspecting the regex and formulating
the realtime query differently depending on if it begins with "^".

ASTERISK-25702 #close
Reported by Nic Colledge

    realtime_retrieve_regex.patch submitted by Alexei Gradinari License #5691

Change-Id: I055df608a6e6a10732044fa737a9fe8dca602693

5 years agores_xmpp: Does not connect in component mode
Karsten Wemheuer [Tue, 2 Feb 2016 10:05:15 +0000 (11:05 +0100)]
res_xmpp: Does not connect in component mode

The module res_xmpp does not accept usernames in the form used in component
mode (XEP-0114). In component mode there is no @something in the name.
In component mode the connection is now not dropped anymore.

If the xmpp server sends out a "stream" tag before handshake is finished,
the connection gets dropped in res_xmpp. Now this tag will be ignored and
the connection will be established.

After connecting there will be an exchange of presence states. This does
not work as expected in component mode. The responsible function
"xmpp_pak_presence" is left before the states get sent out. Sending
presence states in component mode is now moved to the top of the function.

ASTERISK-25735 #close

Change-Id: I70e036f931c3124ebb2ad1e56f93ed35cfdd9d5c

5 years agoMerge "res_odbc: Remove connection management"
Joshua Colp [Tue, 2 Feb 2016 12:46:41 +0000 (06:46 -0600)]
Merge "res_odbc: Remove connection management"

5 years agobuild_system: Fix some warnings highlighted by clang
George Joseph [Mon, 1 Feb 2016 19:04:06 +0000 (12:04 -0700)]
build_system:  Fix some warnings highlighted by clang

Fix some warnings found with clang.

Change-Id: I5195b6189b148c2ee3ed4a19d015a6d4ef3e77bd

5 years agopjsip/alembic: Fix definition of qualify_timeout
George Joseph [Mon, 1 Feb 2016 02:13:58 +0000 (19:13 -0700)]
pjsip/alembic: Fix definition of qualify_timeout

A recent commit set qualify_timeout to Decimal which isn't supported.
This path corrects it to Float.

Change-Id: I038f5274ba8cb60f8518a5845ce448d49306aadf

5 years agochan_sip.c: AMI & CLI notify methods get different values of asterisk's own ip.
StefanEng86 [Fri, 29 Jan 2016 13:39:06 +0000 (14:39 +0100)]
chan_sip.c: AMI & CLI notify methods get different values of asterisk's own ip.

When I ask asterisk to send a SIP NOTIFY message to a sip peer using either a)
AMI action: SIPnotify or b) cli command: sip notify <cmd> <peer>, I expect
asterisk to include the same value for its own ip in both cases a) and b),
but it seems a) produces a contact header like Contact:
<sip:asterisk@> whereas b) produces a contact header like
<sip:asterisk@>. is my udpbindaddr in sip.conf

My guess is that manager_sipnotify should call
ast_sip_ouraddrfor(&p->sa, &p->ourip, p) the same way sip_cli_notify does,
because after applying this patch, both cases a) and b) produce
the contact header that I expect: <sip:asterisk@>

Reported by: Stefan Engström
Tested by: Stefan Engström

Change-Id: I86af5e209db64aab82c25417de6c768fb645f476

5 years agoMerge "build_system: Prevent goals needing makeopts from running when it's missing"
Joshua Colp [Fri, 29 Jan 2016 14:06:22 +0000 (08:06 -0600)]
Merge "build_system: Prevent goals needing makeopts from running when it's missing"

5 years agoMerge "config: Allow options to register when documentation is unavailable."
Mark Michelson [Thu, 28 Jan 2016 21:56:30 +0000 (15:56 -0600)]
Merge "config: Allow options to register when documentation is unavailable."

5 years agoconfig_options.c: Fix warning message wording.
Richard Mudgett [Thu, 28 Jan 2016 18:44:43 +0000 (12:44 -0600)]
config_options.c: Fix warning message wording.

Change-Id: I915ea437936320393afde0e7552cf0a980a6b2e4

5 years agoapp_confbridge.c: Replace inlined code with existing function.
Richard Mudgett [Mon, 25 Jan 2016 23:34:20 +0000 (17:34 -0600)]
app_confbridge.c: Replace inlined code with existing function.

Change-Id: Ida5594e9f8d7c1fc18eeb733a11f8fb96326da51

5 years agoapp_confbridge: Add ability to get the muted conference state.
Richard Mudgett [Mon, 25 Jan 2016 22:05:09 +0000 (16:05 -0600)]
app_confbridge: Add ability to get the muted conference state.

* Added CONFBRIDGE_INFO(muted,) for querying the muted conference state.

* Added Muted header to AMI ConfbridgeListRooms action response list
events to indicate the muted conference state.

* Added Muted column to CLI "confbridge list" output to indicate the muted
conference state and made the locked column a yes/no value instead of a
locked/unlocked value.

Reported by: hristo

Change-Id: I4076bd8ea1c23a3afd4f5833e9291b49a0c448b1

5 years agoapp_confbridge.c: Update CONFBRIDGE and CONFBRIDGE_INFO documentation.
Richard Mudgett [Tue, 26 Jan 2016 23:59:28 +0000 (17:59 -0600)]
app_confbridge.c: Update CONFBRIDGE and CONFBRIDGE_INFO documentation.

Change-Id: Ic1f9e22ba1f2ff3b3f5cb017c5ddcd9bd48eccc7

5 years agoapp_confbridge: Make non-admin users join a muted conference muted.
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

5 years agores_pjsip: Add res_pjproject dependency to samples
George Joseph [Wed, 27 Jan 2016 19:08:29 +0000 (12:08 -0700)]
res_pjsip:  Add res_pjproject dependency to samples

Since res_pjsip now depends on res_pjproject, this has been added to
basic-pbx modules.conf.

Change-Id: I42826597d5e10f08e518208860c44c96e52f1b2d

5 years agobuild_system: Prevent goals needing makeopts from running when it's missing
George Joseph [Wed, 27 Jan 2016 16:29:13 +0000 (09:29 -0700)]
build_system: Prevent goals needing makeopts from running when it's missing

The Makefile only optionally includes makeopts so when goals like uninstall that
dont depend on anything else are run after a distclean, rules like
'rm -f "$(DESTDIR)$(ASTMODDIR)/"*' get run as 'rm -f ""/*' which attempts
to remove everything in the root directory.

Although there's a rule defined for makeopts which prints a message and does
an 'exit 1', since '-include makepopts' was specified (with the -), the exit
was ignored letting the rest of the rules run.

This patch makes makeopts required unless the goal has the string 'clean' in it.

ASTERISK-25730 #close
Reported-by: George Joseph

Change-Id: I1bce59a7ea4f48e7a468e22b2abbb13c63417ac7

5 years agoconfig: Allow options to register when documentation is unavailable.
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

5 years agoStasis: Use custom structure when setting variables.
Mark Michelson [Mon, 25 Jan 2016 16:23:18 +0000 (10:23 -0600)]
Stasis: Use custom structure when setting variables.

A recent change to queue channel variable setting to the Stasis control
queue caused a regression. When setting channel variables, it is
possible to give a NULL channel variable value in order to unset the
variable (i.e. remove it from the channel variable list). The change
introduced a call to ast_variable_new(), which is not tolerant of NULL
channel variable values.

This new change switches from using ast_variable to using a custom
channel variable struct that is lighter weight and NULL value-tolerant.

Change-Id: I784d7beaaa3c036ea936d103e7caf0bb1562162d

5 years agoMerge "res_pjsip_pubsub: Prevent crash from AMI command on freed subscription."
Matt Jordan [Tue, 26 Jan 2016 13:05:52 +0000 (07:05 -0600)]
Merge "res_pjsip_pubsub: Prevent crash from AMI command on freed subscription."

5 years agoMerge "sounds/Makefile: Incremented core and extra sounds versions to 1.5"
Matt Jordan [Tue, 26 Jan 2016 13:05:09 +0000 (07:05 -0600)]
Merge "sounds/Makefile: Incremented core and extra sounds versions to 1.5"

5 years agosounds/Makefile: Incremented core and extra sounds versions to 1.5
Rusty Newton [Mon, 25 Jan 2016 22:56:04 +0000 (16:56 -0600)]
sounds/Makefile: Incremented core and extra sounds versions to 1.5

Core and extra sounds 1.5 was recently released! The tarballs contain
change descriptions however I figure more people will see this one so
I'll try to be a bit detailed. Approximately 60 sounds were moved from Extra
to Core for en, en_GB, fr and added for languages that didn't already
have Extra sound sets (it,ja,ru).

In addition all of the English and Russian sounds have been completely

Sounds moved and added:

There were also a few random fixes here and there to file names for a few
of the languages.

ASTERISK-25068 #close

Change-Id: I2b594344ec585d7dfd922b40c1af43b1508828b3

5 years agores_pjsip_pubsub: Prevent crash from AMI command on freed subscription.
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

5 years agochan_sip: Fix buffer overrun in sip_sipredirect.
Corey Farrell [Mon, 25 Jan 2016 17:03:21 +0000 (12:03 -0500)]
chan_sip: Fix buffer overrun in sip_sipredirect.

sip_sipredirect uses sscanf to copy up to 256 characters to a stacked buffer
of 256 characters.  This patch reduces the copy to 255 characters to leave
room for the string null terminator.

ASTERISK-25722 #close

Change-Id: Id6c3a629a609e94153287512c59aa1923e8a03ab

5 years agoapp_queue: Add Lastpause field of queue member
Rodrigo Ramírez Norambuena [Sat, 23 Jan 2016 22:45:30 +0000 (19:45 -0300)]
app_queue: Add  Lastpause field of queue member

Add time when started a the last pause for a queue member for
QueueMemberStatus ami event.

Also show accumulate time in seconds when started a pause for a queue
member to CLI command 'queue show'.

ASTERISK-16394 #close

Change-Id: I4b12aa3b2efa8d02939db3e13712510b4879865c

5 years agoapp_queue: fix some tab format
Rodrigo Ramírez Norambuena [Sat, 23 Jan 2016 18:34:11 +0000 (15:34 -0300)]
app_queue: fix some tab format

Change-Id: I2734392b131f1fb0949515d538f83f30fbc15d8c

Rodrigo Ramírez Norambuena [Sat, 23 Jan 2016 17:41:38 +0000 (14:41 -0300)] REFACTOR Macro LENGTHEN_BUF

Remove repeated code on macro of assigned buffer to SQL vars.

Add table and connection name to log error message when is not possible
allocate memory.

Change-Id: I1fbf37d286a032d38fdda72a9f736356956c9ffe

5 years agoMerge "Stasis: Use control queue to prevent crash."
Joshua Colp [Sat, 23 Jan 2016 16:07:52 +0000 (10:07 -0600)]
Merge "Stasis: Use control queue to prevent crash."

5 years agoStasis: Fix potential memory leak of control data.
Mark Michelson [Fri, 22 Jan 2016 21:08:58 +0000 (15:08 -0600)]
Stasis: Fix potential memory leak of control data.

When queuing tasks onto the Stasis control queue, you can pass an
arbitrary data pointer and a function to free that data. All ARI
commands that use the Stasis control queue made the assumption that the
destructor function would be called in all paths, whether the task was
queued successfully or not. However, this was not correct. If a task was
queued onto a control structure that was already completed, the
allocated data would not be freed properly.

This patch corrects this by making sure that all return paths call the
data destructor.

Change-Id: Ibf06522094f8e5c4cce652537dc5d7222b1c4fcb

5 years agoStasis: Use control queue to prevent crash.
Mark Michelson [Thu, 21 Jan 2016 16:58:02 +0000 (10:58 -0600)]
Stasis: Use control queue to prevent crash.

A crash occurred when attempting to set a channel variable on a channel
that had already been hung up. This is because there is a small window
between when a control is grabbed and when the channel variable is set
that the channel can be hung up.

The fix here is to queue the setting of the channel variable onto the
control queue. This way, the manipulation of the channel happens in a
thread where it is safe to be done.

In this change, I also noticed that the setting of bridge roles on
channels was being done outside of the control queue, so I also changed
those operations to be done in the control queue.

ASTERISK-25709 #close
Reported by Mark Michelson

Change-Id: I2a0a4d51bce6fba6f1d9954e40935e42f366ea78

5 years agologger.c: Fix buffer overrun found by address sanitizer.
Richard Mudgett [Fri, 22 Jan 2016 17:48:24 +0000 (11:48 -0600)]
logger.c: Fix buffer overrun found by address sanitizer.

The null terminator of the tail struct member was not being allocated
when no logger.conf config file is installed.

ASTERISK-25714 #close
Reported by: Badalian Vyacheslav

Change-Id: I45770fdd08af39506a3bc33ba279c4f16e047a30

5 years agores_odbc: Remove connection management
Mark Michelson [Wed, 23 Dec 2015 21:07:05 +0000 (15:07 -0600)]
res_odbc: Remove connection management

Asterisk by default will create a single database connection and share
it among all threads that attempt to access the database. In previous
versions of Asterisk, this was tolerable, because the most used channel
driver, chan_sip, mostly accessed the database from a single thread.
With PJSIP, however, many threads may be attempting to perform database
operations, and there is the potential for many more database accesses,
meaning the concurrency is a horrible bottleneck if only one connection
is shared.

Asterisk has a connection pooling facility built into it, but the
implementation has flaws. For one, there is a strict limit on the number
of simultaneous connections that could be made to the database. Anything
beyond the maximum would result in a failed operation. Attempting to
predict what the maximum should be is nearly impossible even for someone
intimately familiar with Asterisk's threading model. In addition, use of
transactions in the dialplan can cause some severe bugs if connection
pooling is enabled.

This commit seeks to fix the concurrency problem by removing all
connection management code from Asterisk and leaving that to the
underlying unixODBC code instead. Now, Asterisk does not share a single
connection, nor does it try to maintain a connection pool. Instead, all
Asterisk ever does is request a connection from unixODBC and allow
unixODBC to either allocate those connections or retrieve them from a

Doing this has a bit of a ripple effect. For one, since connections are
not long-lived objects, several of the safeguards that previously
existed have been removed. We don't have to worry about trying to use a
connection that has gone stale. In every case, when we request a
connection, it has just been made and we don't need to perform any
sanity checks to be sure it's still active.

Another major player affected by this change is transactions.
Transactions and their respective connections were so tightly coupled
that it was almost pornographic. This code change moves
transaction-related code to its own file separate from the core ODBC
functionality. This way, the core of ODBC does not even have to know
that transactions exist.

In making this large change, I had to look at a lot of code and
understand it. When making this change, I discovered several places
where the behavior is definitely not ideal, but it seemed outside the
scope of this change to be fixing it. Instead, any place where I saw
some sort of room for improvement has had a XXX comment added explaining
what could be altered to improve it.

Change-Id: I37a84def5ea4ddf93868ce8105f39de078297fbf

5 years agoapp_queue.c: remove include for core_unreal.h not used in code.
Rodrigo Ramírez Norambuena [Fri, 22 Jan 2016 17:18:57 +0000 (14:18 -0300)]
app_queue.c: remove include for core_unreal.h not used in code.

Change-Id: Idc2ae8a6bd869a66544916906744a5678622262d

5 years agoMerge "Build System: Add support for checking alembic branches."
Matt Jordan [Fri, 22 Jan 2016 02:57:02 +0000 (20:57 -0600)]
Merge "Build System: Add support for checking alembic branches."

5 years agoMerge "res/res_pjsip/presence_xml.c: Add missing 2nd call presence state case."
Matt Jordan [Thu, 21 Jan 2016 23:25:26 +0000 (17:25 -0600)]
Merge "res/res_pjsip/presence_xml.c: Add missing 2nd call presence state case."

5 years agoMerge "main/asterisk.c: ast_el_read_char"
Matt Jordan [Thu, 21 Jan 2016 23:25:03 +0000 (17:25 -0600)]
Merge "main/asterisk.c: ast_el_read_char"

5 years agoBuild System: Add support for checking alembic branches.
Corey Farrell [Thu, 21 Jan 2016 22:40:47 +0000 (17:40 -0500)]
Build System: Add support for checking alembic branches.

* Add 'check-alembic' target to root Makefile.
* Create build_tools/make_check_alembic to do the actual checks.


Change-Id: Ibb3cae7d1202ac23dc70b0f3b5801571ad46b004

5 years agores/res_pjsip/presence_xml.c: Add missing 2nd call presence state case.
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

5 years agoMerge "chan_sip: option 'notifyringing' change and doc fix"
Mark Michelson [Thu, 21 Jan 2016 21:22:53 +0000 (15:22 -0600)]
Merge "chan_sip: option 'notifyringing' change and doc fix"

5 years agores_pjsip: Add CLI "pjsip dump endpt [details]"
Richard Mudgett [Wed, 13 Jan 2016 22:49:22 +0000 (16:49 -0600)]
res_pjsip: Add CLI "pjsip dump endpt [details]"

Dump the res_pjsip endpt internals.

In non-developer mode we will not document or make easily accessible the
"details" option even though it is still available.  The user has to know
it exists to use it.  Presumably they would also be aware of the potential
crash warning below.

Warning: PJPROJECT documents that the function used by this CLI command
may cause a crash when asking for details because it tries to access all
active memory pools.

Change-Id: If2d98a3641c9873364d1daaad971376311aef3cb

5 years agoMerge "taskprocessor.c: Increase CLI "core ping taskprocessor" timeout."
Mark Michelson [Wed, 20 Jan 2016 20:19:02 +0000 (14:19 -0600)]
Merge "taskprocessor.c: Increase CLI "core ping taskprocessor" timeout."

5 years agoMerge "taskprocessor.c: Fix some taskprocessor unrefs."
Mark Michelson [Wed, 20 Jan 2016 20:18:57 +0000 (14:18 -0600)]
Merge "taskprocessor.c: Fix some taskprocessor unrefs."

5 years agoMerge "res_pjproject: Add module providing pjproject logging and utils"
Joshua Colp [Wed, 20 Jan 2016 17:46:05 +0000 (11:46 -0600)]
Merge "res_pjproject:  Add module providing pjproject logging and utils"

5 years agomain/asterisk.c: ast_el_read_char
Diederik de Groot [Mon, 18 Jan 2016 09:49:48 +0000 (10:49 +0100)]
main/asterisk.c: ast_el_read_char

Make sure buf[res] is not accessed at res=-1 (buffer underrun).
Address Sanitizer will complain about this quite loudly.

ASTERISK-24801 #close

Change-Id: Ifcd7f691310815a31756b76067c56fba299d3ae9

5 years agores_pjproject: Add module providing pjproject logging and utils
George Joseph [Tue, 19 Jan 2016 01:27:57 +0000 (18:27 -0700)]
res_pjproject:  Add module providing pjproject logging and utils

res_pjsip_log_forwarder has been renamed to res_pjproject
and enhanced as follows:

As a follow-on to the recent 'Add CLI "pjsip show buildopts"' patch,
a new ast_pjproject_get_buildopt function has been added.  It
allows the caller to get the value of one of the buildopts.

The initial use case is retrieving the runtime value of
PJ_MAX_HOSTNAME to insure we don't send a hostname greater
than pjproject can handle.  Since it can differ between
the version of pjproject that Asterisk was compiled against
and the version of pjproject that Asterisk is running against,
we can't use the PJ_MAX_HOSTNAME macro directly in Asterisk
source code.

Change-Id: Iab6e82fec3d7cf00c1cf6185c42be3e7569dee1e

5 years agoMerge "funcs/func_cdr: Correctly report high precision values for duration and billsec"
Joshua Colp [Wed, 20 Jan 2016 16:33:27 +0000 (10:33 -0600)]
Merge "funcs/func_cdr: Correctly report high precision values for duration and billsec"

5 years agoMerge "pjsip_loging_refactor: Rename res_pjsip_log_forwarder to res_pjproject"
Joshua Colp [Wed, 20 Jan 2016 16:32:47 +0000 (10:32 -0600)]
Merge "pjsip_loging_refactor: Rename res_pjsip_log_forwarder to res_pjproject"

5 years agofuncs/func_cdr: Correctly report high precision values for duration and billsec
Matt Jordan [Mon, 18 Jan 2016 23:16:24 +0000 (17:16 -0600)]
funcs/func_cdr: Correctly report high precision values for duration and billsec

When CDRs were refactored, func_cdr's ability to report high precision values
for duration and billsec (the 'f' option) was broken. This was due to func_cdr
incorrectly interpreting the duration/billsec values provided by the CDR engine
in milliseconds, as opposed to seconds. Since the CDR engine only provides
duration and billsec in seconds, and does not expose either attribute with
sufficient precision to merely pass back the underlying value, this patch fixes
the bug by re-calculating duration and billsec with microsecond precision based
on the start/answer/end times on the CDR.

ASTERISK-25179 #close

Change-Id: I8bc63822b496537a5bf80baf6102c06206bee841

5 years agoREADME: Update year in copyright
Rodrigo Ramírez Norambuena [Wed, 20 Jan 2016 13:52:45 +0000 (10:52 -0300)]
README: Update year in copyright

Change-Id: I56240f537fb3205672cdb2a74f0591ae7bb73dbc

5 years agotest_threadpool: Wait for each task to complete and fix memory leak.
Joshua Colp [Tue, 19 Jan 2016 23:15:50 +0000 (19:15 -0400)]
test_threadpool: Wait for each task to complete and fix memory leak.

This change makes the thread_timeout_thrash unit test wait for
each task to complete. This fixes the problem where the test would
prematurely end when all threads were gone and a new one had to be
started to handle the last task. It also increases the thrasing as
it is now more likely for each task to encounter the above scenario.

This also fixes a memory leak where the data for each task was not
being freed.

ASTERISK-25611 #close

Change-Id: I5017d621a4dc911f509074c16229b86bff2fb3c6

5 years agoMerge "Refactor init_logger_chain locking."
Mark Michelson [Tue, 19 Jan 2016 23:07:27 +0000 (17:07 -0600)]
Merge "Refactor init_logger_chain locking."

5 years agotaskprocessor.c: Increase CLI "core ping taskprocessor" timeout.
Richard Mudgett [Tue, 19 Jan 2016 01:44:24 +0000 (19:44 -0600)]
taskprocessor.c: Increase CLI "core ping taskprocessor" timeout.

Change-Id: I4892d6acbb580d6c207d006341eaf5e0f8f2a029

5 years agotaskprocessor.c: Fix some taskprocessor unrefs.
Richard Mudgett [Tue, 19 Jan 2016 01:43:41 +0000 (19:43 -0600)]
taskprocessor.c: Fix some taskprocessor unrefs.

You have to call ast_taskprocessor_unref() outside of the taskprocessor
implementation code.  Taskprocessor use since v12 has become more
transient than just the singleton uses in earlier versions.

Change-Id: If7675299924c0cc65f2a43a85254e6f06f2d61bb

5 years agoFix alembic branches on master.
Richard Mudgett [Tue, 19 Jan 2016 20:16:17 +0000 (14:16 -0600)]
Fix alembic branches on master.

Change-Id: I64ed21fec50eb833641ca49d92184f6aaabd86e8

5 years agoRefactor init_logger_chain locking.
Corey Farrell [Tue, 5 Jan 2016 23:12:54 +0000 (18:12 -0500)]
Refactor init_logger_chain locking.

This removes logchannels locking from init_logger_chain, puts the
responsibility on the caller.  Adds locking around the one call that was
missing it.


Change-Id: I6cc42117338bf9575650a67bcb78ab1a33d7bad8

5 years agoapp_queue: Fix preserved reason of pause when Asterisk is restared
Rodrigo Ramírez Norambuena [Tue, 19 Jan 2016 04:10:06 +0000 (01:10 -0300)]
app_queue: Fix preserved reason of pause when Asterisk is restared

When the Asterisk is restared is not preseved reason paused of members.
This patch fixed this cases, retain data on astdb and set when Asterisk
is started.

ASTERISK-25732 #close

Report by: Rodrigo Ramírez Norambuena

Change-Id: Id3fb744c579e006d27cda4a02334ac0e4bed9eb5

5 years agoMerge "Remove *.gcna / *.gcno files from added module sources."
Joshua Colp [Tue, 19 Jan 2016 01:24:28 +0000 (19:24 -0600)]
Merge "Remove *.gcna / *.gcno files from added module sources."

5 years agopjsip_loging_refactor: Rename res_pjsip_log_forwarder to res_pjproject
George Joseph [Tue, 19 Jan 2016 01:01:36 +0000 (18:01 -0700)]
pjsip_loging_refactor: Rename res_pjsip_log_forwarder to res_pjproject

Change-Id: I5387821f29e5caa0cba0b7d62b0fc0d341e7e20b

5 years agoMerge "Update version number in features.conf.sample"
Mark Michelson [Mon, 18 Jan 2016 23:31:40 +0000 (17:31 -0600)]
Merge "Update version number in features.conf.sample"

5 years agoMerge "pjsip/alembic: Fix qualify_timeout column definition"
Joshua Colp [Mon, 18 Jan 2016 11:49:45 +0000 (05:49 -0600)]
Merge "pjsip/alembic:  Fix qualify_timeout column definition"

5 years agoMerge "func_channel: Add help text for undocumented CHANNEL function arguments"
Joshua Colp [Sun, 17 Jan 2016 19:48:32 +0000 (13:48 -0600)]
Merge "func_channel: Add help text for undocumented CHANNEL function arguments"

5 years agoMerge "main/config: Clean config maps on shutdown."
Joshua Colp [Sun, 17 Jan 2016 17:44:38 +0000 (11:44 -0600)]
Merge "main/config: Clean config maps on shutdown."

5 years agoUpdate version number in features.conf.sample
Daniel Journo [Sat, 16 Jan 2016 19:18:19 +0000 (19:18 +0000)]
Update version number in features.conf.sample

Update the version number in the comments from Asterisk 12 to Asterisk 12+

Change-Id: Ie692ac8cda3c993c3bf10f27f51a1cca3317ec7b

5 years agopjsip/alembic: Fix qualify_timeout column definition
Daniel Journo [Wed, 13 Jan 2016 21:58:22 +0000 (21:58 +0000)]
pjsip/alembic:  Fix qualify_timeout column definition

Corrects the qualify_timeout column type from Integer to Decimal

ASTERISK-25686 #close
Reported-by: Marcelo Terres

Change-Id: I757d0e3c011ee9be6cd5abd48bc92441a405d3c8

5 years agoMerge "bridge_basic: don't play an attended transfer fail sound after target hangs up"
Joshua Colp [Sat, 16 Jan 2016 14:29:58 +0000 (08:29 -0600)]
Merge "bridge_basic: don't play an attended transfer fail sound after target hangs up"

5 years agoMerge "bridge_basic: don't cache xferfailsound during an attended transfer"
Joshua Colp [Sat, 16 Jan 2016 14:29:17 +0000 (08:29 -0600)]
Merge "bridge_basic: don't cache xferfailsound during an attended transfer"

5 years agoMerge "taskprocessor.c: Simplify ast_taskprocessor_get() return code."
Joshua Colp [Sat, 16 Jan 2016 14:28:16 +0000 (08:28 -0600)]
Merge "taskprocessor.c: Simplify ast_taskprocessor_get() return code."

5 years agomain/config: Clean config maps on shutdown.
Corey Farrell [Sat, 16 Jan 2016 01:52:26 +0000 (20:52 -0500)]
main/config: Clean config maps on shutdown.

ASTERISK-25700 #close

Change-Id: I096da84f9c62c6095f68bcf98eac4b7c7868e808

5 years agobridge_basic: don't cache xferfailsound during an attended transfer
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

5 years agotaskprocessor.c: Simplify ast_taskprocessor_get() return code.
Richard Mudgett [Fri, 10 Jul 2015 15:37:35 +0000 (10:37 -0500)]
taskprocessor.c: Simplify ast_taskprocessor_get() return code.

Change-Id: Id5bd18ef1f60ef8be453e677e98478298358a9d1

5 years agoastmm.c: Add more stats to CLI "memory show" commands.
Richard Mudgett [Thu, 14 Jan 2016 00:20:57 +0000 (18:20 -0600)]
astmm.c: Add more stats to CLI "memory show" commands.

* Add freed regions totals to allocations and summary.

* Add totals for all allocations and not just the selected allocations.

Change-Id: I61d5a5112617b0733097f2545a3006a344b4032a

5 years agobridge_basic: don't play an attended transfer fail sound after target hangs up
Kevin Harwell [Thu, 14 Jan 2016 22:00:50 +0000 (16:00 -0600)]
bridge_basic: don't play an attended transfer fail sound after target hangs up

If the attended transfer destination answers (picks call up or goes to
voicemail) and then hangs up on the transferer then transferer hears the
fail sound.

This patch makes it so the fail sound is not played when the transfer
destination/target hangs up after answering.

ASTERISK-25697 #close

Change-Id: I97f142fe4fc2805d1a24b7c16143069dc03d9ded

5 years agoRemove *.gcna / *.gcno files from added module sources.
Corey Farrell [Thu, 14 Jan 2016 20:36:10 +0000 (15:36 -0500)]
Remove *.gcna / *.gcno files from added module sources.

Asterisk uses a Makefile macro to associate additional sources with a
module.  This macro is responsible for creating clean targets but
previously left behind *.gcna and *.gcno files.

ASTERISK-25683 #close
Reported by yaron nahum

Change-Id: Idc0823fe80a25c42cefae901fde875e9fc38d8ea

5 years agofunc_channel: Add help text for undocumented CHANNEL function arguments
Rusty Newton [Thu, 14 Jan 2016 15:26:15 +0000 (09:26 -0600)]
func_channel: Add help text for undocumented CHANNEL function arguments

Adding help text documentation for:
* hangupsource
* appname
* appdata
* exten
* context
* channame
* uniqueid
* linkedid

ASTERISK-24097 #close
Reported by: Steven T. Wheeler
Tested by: Rusty Newton

Change-Id: Ib94b00568b0433987df87d5b67ea529b5905754d

5 years agoMerge "pjsip: Add option global/regcontext"
Joshua Colp [Thu, 14 Jan 2016 12:32:12 +0000 (06:32 -0600)]
Merge "pjsip:  Add option global/regcontext"

5 years agopjsip: Add option global/regcontext
Daniel Journo [Sun, 10 Jan 2016 22:22:12 +0000 (22:22 +0000)]
pjsip:  Add option global/regcontext

Added new global option (regcontext) to pjsip. When set, Asterisk will
dynamically create and destroy a NoOp priority 1 extension
for a given endpoint who registers or unregisters with us.

ASTERISK-25670 #close
Reported-by: Daniel Journo

Change-Id: Ib1530c5b45340625805c057f8ff1fb240a43ea62

5 years agoapp: Queue hangup if channel is hung up during sub or macro execution.
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