]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
10 years agores_ari_bridges: Add missing dependencies. 62/362/1
Corey Farrell [Tue, 5 May 2015 14:47:43 +0000 (10:47 -0400)] 
res_ari_bridges: Add missing dependencies.

Missed this module in the previous commit.  res_ari_bridges uses symbols
from res_stasis_playback and res_stasis_recording.

ASTERISK-25027 #close
Reported by: Corey Farrell

Change-Id: I90bf756abd25adfc4920d2869ebe7feb636b8c5f

10 years agomain/test.c: Add test to verify there were no registration errors. 53/353/3
Corey Farrell [Sun, 3 May 2015 18:55:56 +0000 (14:55 -0400)] 
main/test.c: Add test to verify there were no registration errors.

This adds a test that will fail if any test failed to register. Also fail
if any test registration produced a warning about missing a leading or
trailing slash.

ASTERISK-25053 #close
Reported by: Corey Farrell

Change-Id: I93e50b8fcbcfa7f1f5b41b2c44a51685c09529c3

10 years agoMerge "contrib/ast-db-manage: Add Postgres ENUM type support in auto DTMF mode update...
Matt Jordan [Mon, 4 May 2015 14:26:10 +0000 (09:26 -0500)] 
Merge "contrib/ast-db-manage: Add Postgres ENUM type support in auto DTMF mode update" into 13

10 years agoMerge "cdr/cdr_csv.c: Add a new option to enable columns added in Asterisk 1.8" into 13
Matt Jordan [Mon, 4 May 2015 14:26:01 +0000 (09:26 -0500)] 
Merge "cdr/cdr_csv.c: Add a new option to enable columns added in Asterisk 1.8" into 13

10 years agoMerge "Format Interfaces: Prevent unload except by shutdown." into 13
Matt Jordan [Mon, 4 May 2015 14:25:35 +0000 (09:25 -0500)] 
Merge "Format Interfaces: Prevent unload except by shutdown." into 13

10 years agoMerge "res_odbc: Use negative connection cache for all connections" into 13
Matt Jordan [Mon, 4 May 2015 12:46:06 +0000 (07:46 -0500)] 
Merge "res_odbc: Use negative connection cache for all connections" into 13

10 years agores_odbc: Use negative connection cache for all connections 84/184/6
Martin Tomec [Tue, 21 Apr 2015 16:52:22 +0000 (18:52 +0200)] 
res_odbc: Use negative connection cache for all connections

Apply the negative connection cache setting to all connections,
even those that are not pooled. This ensures that the connection
will not be re-established before the negative connection cache
time is met.

ASTERISK-22708 #close

Change-Id: I431cc2e8584ab0b6908b3523d0a0e18c9a527271

10 years agoMerge "Remove unneeded uses of optional_api providers." into 13
Matt Jordan [Mon, 4 May 2015 09:03:50 +0000 (04:03 -0500)] 
Merge "Remove unneeded uses of optional_api providers." into 13

10 years agoMerge "Update configure.ac/Makefile for clang" into 13
Matt Jordan [Mon, 4 May 2015 09:03:10 +0000 (04:03 -0500)] 
Merge "Update configure.ac/Makefile for clang" into 13

10 years agoFormat Interfaces: Prevent unload except by shutdown. 51/351/1
Corey Farrell [Mon, 4 May 2015 02:03:13 +0000 (22:03 -0400)] 
Format Interfaces: Prevent unload except by shutdown.

Format interfaces cannot be unregistered, so the modules that provide them
need to be held open except by shutdown.

ASTERISK-25054 #close
Reported by: Corey Farrell

Change-Id: Iadbd9675bf0d30b8fded5a739b163db3ea2db8f3

10 years agocontrib/ast-db-manage: Add Postgres ENUM type support in auto DTMF mode update 49/349/1
Matt Jordan [Mon, 4 May 2015 01:28:52 +0000 (20:28 -0500)] 
contrib/ast-db-manage: Add Postgres ENUM type support in auto DTMF mode update

The upgrade script for auto DTMF mode (31cd4f4891ec) added in 88b0fa7755
failed to add ENUM support for Postgres databases. This requires a
specific import from the sqlalchemy.dialects.postgresql package. This
patch corrects this error, which allows for Postgres update scripts to
be generated.

ASTERISK-24706

Change-Id: I4742ac8efa533cd6f18e0bdd907b339a9aedf015

10 years agoterm: send proper reset sequence when black background is forced 42/342/1
D Tucny [Sat, 2 May 2015 00:50:22 +0000 (20:50 -0400)] 
term: send proper reset sequence when black background is forced

When using the force black background command-line option or configuration
option an invalid reset sequence is sent following a coloured output item
in the CLI, the result is that the colour is not 'turned off' and continues
until the next non-default coloured text output.

A reset sequence is already defined in term.c, but the ast_term_reset
function doesn't use it, instead building it's own invalid sequence and
returning that.

This patch changes that behaviour, removing the building of a reset sequence
and instead using the pre-built constant 'enddata' which is a suitable reset
sequence for this purpose.

ASTERISK-24896 #close
Reported by: Dan Tucny

Change-Id: I56323899123ae3264900389cae1f5b252aa3bf43

10 years agoMerge "Build System: Prevent unneeded changes to asterisk/buildopts.h." into 13
Matt Jordan [Sun, 3 May 2015 14:20:15 +0000 (09:20 -0500)] 
Merge "Build System: Prevent unneeded changes to asterisk/buildopts.h." into 13

10 years agoMerge "res_pjsip_dlg_options: Fix MODULEINFO section." into 13
Matt Jordan [Sun, 3 May 2015 14:19:05 +0000 (09:19 -0500)] 
Merge "res_pjsip_dlg_options: Fix MODULEINFO section." into 13

10 years agoRemove unneeded uses of optional_api providers. 40/340/1
Corey Farrell [Sat, 2 May 2015 23:58:40 +0000 (19:58 -0400)] 
Remove unneeded uses of optional_api providers.

A few cases exist where headers of optional_api provders are included but
not needed.  This causes unneeded calls to ast_optional_api_use.

* Don't include optional_api.h from sip_api.h.
* Move 'struct ast_channel_monitor' to channel.h.
* Don't include monitor.h from chan_sip.c, channel.c or features.c.

The move of struct ast_channel_monitor is needed since channel.c depends on
it.  This has no effect on users of monitor.h since channel.h is included
from monitor.h.

ASTERISK-25051 #close
Reported by: Corey Farrell

Change-Id: I53ea65a9fc9693c89f8bcfd6120649bfcfbc3478

10 years agoMerge "include/asterisk/channel.h: Fix typo" into 13
Matt Jordan [Sat, 2 May 2015 15:19:08 +0000 (10:19 -0500)] 
Merge "include/asterisk/channel.h: Fix typo" into 13

10 years agoMerge "Astobj2: Fix initialization order of refdebug and AO2_DEBUG." into 13
Matt Jordan [Sat, 2 May 2015 15:17:26 +0000 (10:17 -0500)] 
Merge "Astobj2: Fix initialization order of refdebug and AO2_DEBUG." into 13

10 years agoinclude/asterisk/channel.h: Fix typo 36/336/1
Rodrigo Ramírez Norambuena [Thu, 30 Apr 2015 07:07:06 +0000 (03:07 -0400)] 
include/asterisk/channel.h: Fix typo

Change-Id: Ie584b85e16a94c255e60d0b1732ef9686464fef3

10 years agores_pjsip_dlg_options: Fix MODULEINFO section. 34/334/1
Corey Farrell [Sat, 2 May 2015 07:15:15 +0000 (03:15 -0400)] 
res_pjsip_dlg_options: Fix MODULEINFO section.

Removed the extra space before "MODULEINFO" in res_pjsip_dlg_options.
This extra space prevented any of the dependencies from being seen by
menuselect, so building with default options would fail if PJSIP was
not installed.

This also makes the tool that extracts information for menuselect
tolerant of multiple spaces in the future.

ASTERISK-25033 #close
Reported by: Peter Whisker

Change-Id: Iccd54846f70c4a7a50cb5bf70b7bb5cb4bab3698

10 years agoBuild System: Prevent unneeded changes to asterisk/buildopts.h. 31/331/1
Corey Farrell [Wed, 29 Apr 2015 08:03:00 +0000 (04:03 -0400)] 
Build System: Prevent unneeded changes to asterisk/buildopts.h.

* Add AST_DEVMODE to BUILDOPTS
* Remove CFLAGS that do not effect ABI from BUILDOPTS.
* Use BUILDOPTS to generate AST_BUILDOPT_SUM.
* Remove loop that defined AST_MODULE_*

These changes ensure that only ABI effecting options are considered for
AST_BUILDOPT_SUM.  This also reduces unneeded full system rebuilds caused
by enabling or disabling one module that another is dependent on.

ASTERISK-25028
Reported by: Corey Farrell

Change-Id: I2c516d93df9f6aaa09ae079a8168c887a6ff93a2

10 years agoAstobj2: Fix initialization order of refdebug and AO2_DEBUG. 28/328/3
Corey Farrell [Fri, 1 May 2015 18:22:03 +0000 (14:22 -0400)] 
Astobj2: Fix initialization order of refdebug and AO2_DEBUG.

This ensures that refdebug is initialized before AO2_DEBUG if
both are enabled, since AO2_DEBUG allocates a container.

This change also makes AO2_DEBUG initialization critical, a
failure will abort Asterisk startup.  This is needed since
the failure would be caused by reg_containers allocation
failure, and that would result in a segmentation fault by
ao2_container_register later in startup.

ASTERISK-25048 #close
Reported by: Corey Farrell

Change-Id: I9a243ea3fc5653b48b931ba6d61971cb2e530244

10 years agomain/pbx: Improve performance of dialplan reloads with a large number of hints 12/312/6
Matt Jordan [Wed, 29 Apr 2015 19:49:23 +0000 (14:49 -0500)] 
main/pbx: Improve performance of dialplan reloads with a large number of hints

The PBX core maintains two hash tables for hints: a container of the
actual hints (hints), along with a container of devices that are watching that
hint (hintdevices). When a dialplan reload occurs, each hint in the hints
container is destroyed; this requires a lookup in the container of devices to
find the device => hint mapping object. In the current code, this performs an
ao2_callback, iterating over each of the device to hint objects in the
hintdevices container. For a large number of hints, this is extremely
expensive: dialplan reloads with 20000 hints could take several minutes
in just this phase.

This patch improves the performance of this step in the dialplan reloads
by caching which devices are watching a hint on the hint object itself.
Since we don't want to create a circular reference, we just cache the
name of the device. This allows us to perform a smarter ao2_callback on
the hintdevices container during hint removal, hashing on the name of the
device and returning an iterator to the matching names. The overall
performance improvement is rather large, taking this step down to a number of
seconds as opposed to minutes.

In addition, this patch also registers the hint containers in the PBX
core with the astobj2 library. This allows for reasonable debugging to
hash collisions in those containers.

ASTERISK-25040 #close
Reported by: Matt Jordan

Change-Id: Iedfc97a69d21070c50fca42275d7b3e714e59360

10 years agoMerge "res_pjsip_outbound_authenticator_digest: Add missing outbound authenticator...
Matt Jordan [Fri, 1 May 2015 11:55:49 +0000 (06:55 -0500)] 
Merge "res_pjsip_outbound_authenticator_digest: Add missing outbound authenticator callback." into 13

10 years agoMerge "Prevent potential crash on blond transfer." into 13
Matt Jordan [Fri, 1 May 2015 11:55:15 +0000 (06:55 -0500)] 
Merge "Prevent potential crash on blond transfer." into 13

10 years agoSample Configs: Fix syntax error in pjsip.conf 24/324/1
Corey Farrell [Thu, 30 Apr 2015 20:54:24 +0000 (16:54 -0400)] 
Sample Configs: Fix syntax error in pjsip.conf

The sample pjsip.conf has a few comment lines that are missing the
semicolons at the start of the comment, causing the config to fail
load.

Change-Id: I776a38c916a7df7ee3e072fd0b21dbf4cc457352

10 years agoPrevent potential crash on blond transfer. 22/322/1
Mark Michelson [Thu, 30 Apr 2015 20:20:43 +0000 (15:20 -0500)] 
Prevent potential crash on blond transfer.

Scenario:
Alice calls Bob. Bob performs a blond transfer to Carol. Carol rejects
the incoming call (or some other immediate circumstance causes Carol not
to answer the call)

What occurs in this case is that when the bridge between Alice and Bob
breaks, Alice is told to masquerade into Bob's channel that had placed
the call to Carol. The actual masquerade goes down without a hitch.
However, a channel fixup callback that attempts to publish dial events
over Stasis has a crash. The reason for this crash is that the datastore
on Bob's channel that placed the outbound call to Carol only had a bare
pointer to Carol's channel. Since Carol rejected the incoming call,
Carol's channel has been hung up and freed, meaning accessing her
channel results in a crash.

The fix here is simple. The dial fixup code has been altered to hold
references to the involved channels and to drop those references when
freeing data.

ASTERISK-25025 #close
Reported by Chet Stevens

Change-Id: I54eedda207b8ec7a69263353b43abe5746aea197

10 years agores_pjsip_outbound_authenticator_digest: Add missing outbound authenticator callback. 17/317/2
Mark Michelson [Thu, 30 Apr 2015 19:09:32 +0000 (14:09 -0500)] 
res_pjsip_outbound_authenticator_digest: Add missing outbound authenticator callback.

The Asterisk 13 version of the fix for outbound registration was missing
a key component that set the outbound authenticator's callback that
creates an authenticated request based on an old request. This was
picked up by some outbound registration tests failing in the testsuite.

Change-Id: I5ca9379698c606da36bc38eaffccedaf64211ce3

10 years agores_ari_device_states: Fix dependency on res_stasis_device_state. 15/315/1
Joshua Colp [Thu, 30 Apr 2015 18:42:15 +0000 (15:42 -0300)] 
res_ari_device_states: Fix dependency on res_stasis_device_state.

The res_ari_device_states module depends on res_stasis_device_state,
not res_stasis_device_states.

Change-Id: I26e02ad37f9e36bcc859867e2fad1b90452ec3de

10 years agoMerge "chan_dahdi: Add the chan_dahdi.conf force_restart_unavailable_chans option...
Mark Michelson [Thu, 30 Apr 2015 16:11:11 +0000 (11:11 -0500)] 
Merge "chan_dahdi: Add the chan_dahdi.conf force_restart_unavailable_chans option." into 13

10 years agoMerge "res_pjsip_outbound_registration: Add virtual line support." into 13
Matt Jordan [Thu, 30 Apr 2015 15:53:36 +0000 (10:53 -0500)] 
Merge "res_pjsip_outbound_registration: Add virtual line support." into 13

10 years agochan_dahdi: Add the chan_dahdi.conf force_restart_unavailable_chans option. 04/304/2
Richard Mudgett [Wed, 29 Apr 2015 19:29:10 +0000 (14:29 -0500)] 
chan_dahdi: Add the chan_dahdi.conf force_restart_unavailable_chans option.

Some telco switches occasionally ignore ISDN RESTART requests.  The fix
for ASTERISK-19608 added an escape clause for B channels in the restarting
state if the telco ignores a RESTART request.  If the telco fails to
acknowledge the RESTART then Asterisk will assume the telco acknowledged
the RESTART on the second call attempt requesting the B channel by the
telco.  The escape clause is good for dealing with RESTART requests in
general but it does cause the next call for the restarting B channel to be
rejected if the telco insists the call must go on that B channel.

chan_dahdi doesn't really need to issue a RESTART request in response to
receiving a cause 44 (Requested channel not available) code.  Sending the
RESTART in such a situation is not required (nor prohibited) by the
standards.  I think chan_dahdi does this for historical reasons to deal
with buggy peers to get channels unstuck in a similar fashion as the
chan_dahdi.conf resetinterval option.

* Add the chan_dahdi.conf force_restart_unavailable_chans compatability
option that when disabled will prevent chan_dahdi from trying to RESTART
the channel in response to a cause 44 code.

ASTERISK-25034 #close
Reported by: Richard Mudgett

Change-Id: Ib8b17a438799920f4a2038826ff99a1884042f65

10 years agocdr/cdr_csv.c: Add a new option to enable columns added in Asterisk 1.8 46/346/1
Rodrigo Ramírez Norambuena [Thu, 30 Apr 2015 11:38:11 +0000 (07:38 -0400)] 
cdr/cdr_csv.c: Add a new option to enable columns added in Asterisk 1.8

This patch adds a new option to cdr.conf, 'newcdrcolumns', that will handle CDR
columns added in Asterisk 1.8. The columns are:
 * peeraccount
 * linkedid
 * sequence
When enabled, the columns in the database entry will be populated with the data
from the CDR.

ASTERISK-24976 #close

Change-Id: I51a57063f4ae5e194a9d933a8df45dc8a4534f0b

10 years agores_pjsip_outbound_registration: Fix double unref on error return. 06/306/1
Joshua Colp [Thu, 30 Apr 2015 11:04:34 +0000 (08:04 -0300)] 
res_pjsip_outbound_registration: Fix double unref on error return.

When the PJSIP pjsip_regc_send function is invoked and an error
status returned the caller currently decrements the reference count
of the client state that it just incremented, assuming the
registration callback would not have been invoked. In practice
this is not correct. If the failure happens after the transaction
has been set up the callback will still be invoked. This will
cause the reference count to be incorrectly decremented twice, once
by the registration callback and second by the caller of
pjsip_regc_send.

This change makes it so that whether the callback is invoked or
not is known by the caller of pjsip_regc_send. Depending on
this it can know whether it is responsible for decrementing the
reference count of the client state or not.

ASTERISK-25037 #close
Reported by: Joshua Colp

Change-Id: I749dc12f3a22115c49c5d7d95ff42a5fa45319de

10 years agoUpdate configure.ac/Makefile for clang 57/157/13
Diederik de Groot [Mon, 20 Apr 2015 18:03:56 +0000 (20:03 +0200)] 
Update configure.ac/Makefile for clang

Created autoconf/ast_check_raii.m4: contains AST_CHECK_RAII which
checks compiler requirements for RAII:
gcc: -fnested-functions support
clang: -fblocks (and if required -lBlocksRuntime)
The original check was implemented in configure.ac and now has it's
own file. This function also sets C_COMPILER_FAMILY to either gcc or
clang for use by makefile

Created autoconf/ast_check_strsep_array_bounds.m4 (contains
AST_CHECK_STRSEP_ARRAY_BOUNDS):
which checks if clang is able to handle the optimized strsep & strcmp
functions (linux). If not, the standard libc implementation should be
used instead. Clang + the optimized macro's work with:
strsep(char *, char []), but not with strsepo(char *, char *).
Instead of replacing all the occurences throughout the source code,
not using the optimized macro version seemed easier

See 'define __strcmp_gc(s1, s2, l2) in bits/string2.h':
llvm-comment: Normally, this array-bounds warning are suppressed for
macros, so that unused paths like the one that accesses __s1[3] are
not warned about.  But if you preprocess manually, and feed the
result to another instance of clang, it will warn about all the
possible forks of this particular if statement. Instead of switching
of this optimization, another solution would be to run the preproces-
sing step with -frewrite-includes, which should preserve enough
information so that clang should still be able to suppress the diag-
nostic at the compile step later on.

See also "https://llvm.org/bugs/show_bug.cgi?id=20144"
See also "https://llvm.org/bugs/show_bug.cgi?id=11536"

Makefile.rules: If C_COMPILER_FAMILY=clang then add two warning
suppressions:
-Wno-unused-value
-Wno-parentheses-equality
In an earlier review (reviewboard: 4550 and 4554), they were deemed a
nuisace and less than benefitial.

configure.ac:
Added AST_CHECK_RAII() see earlier
Added AST_CHECK_STRSEP_ARRAY_BOUNDS() see earlier
Removed moved content

ASTERISK-24917
Change-Id: I12ea29d3bda2254ad3908e279b7effbbac6a97cb

10 years agoMerge "ARI: Fix missing dependencies." into 13
Matt Jordan [Wed, 29 Apr 2015 21:43:59 +0000 (16:43 -0500)] 
Merge "ARI: Fix missing dependencies." into 13

10 years agoMerge "res_fax: allow 2400 transmission rate according to v.27ter standard" into 13
Matt Jordan [Wed, 29 Apr 2015 21:42:25 +0000 (16:42 -0500)] 
Merge "res_fax: allow 2400 transmission rate according to v.27ter standard" into 13

10 years agomain/rtp_engine: Fix DTLS double-free introduced by 0b6410c4f8 00/300/1
Matt Jordan [Wed, 29 Apr 2015 21:15:43 +0000 (16:15 -0500)] 
main/rtp_engine: Fix DTLS double-free introduced by 0b6410c4f8

The patch in 0b6410c4f8 did correctly fix a memory leak of the DTLS
structures in the RTP engine. However, when a 'core reload' is issued, a
double free of the memory pointed to by the char *'s in the DTLS
configuration struct can occur, as ast_rtp_dtls_cfg_free does not set
the pointers to NULL when they are freed.

This patch sets those pointers to NULL, preventing a second call to
ast_rtp_dtls_cfg_free from corrupting memory.

ASTERISK-25022

Change-Id: I820471e6070a37e3c26f760118c86770e12f6115

10 years agores_fax: allow 2400 transmission rate according to v.27ter standard 95/295/2
Kevin Harwell [Wed, 29 Apr 2015 18:05:10 +0000 (13:05 -0500)] 
res_fax: allow 2400 transmission rate according to v.27ter standard

A previous set of patches (see: ASTERISK-22790 & ASTERISK-23231) made it so
a v.27 modem was not allowed to have a minimum transmission rate of 2400 bits
per second. This reverts all or some of those patches since according to the
v.27ter standard a rate of 2400 bits per second is also supported.

One of the original patches also added 9600 bits per second support for v.27.
This patch also removes that since v.27ter only supports 2400/4800 bits per
second.

Also, since Asterisk specifically supports v.27ter the enum was renamed to
better reflect this.

ASTERISK-24955 #close
Reported by: Matt Jordan

Change-Id: I4b9dfb6bf7eff08463ab47ee1a74224f27cae733

10 years agores_sorcery_config: Fix build issue due to syntax error. 89/289/1
Joshua Colp [Wed, 29 Apr 2015 15:46:21 +0000 (12:46 -0300)] 
res_sorcery_config: Fix build issue due to syntax error.

Change-Id: Ic8322f04e37842848ad72cf2871bd0378f67c4ac

10 years agochan_pjsip: Creating Channel Causes Asterisk to Crash When Duplicate AOR 88/288/1
Ashley Sanders [Tue, 28 Apr 2015 05:29:42 +0000 (00:29 -0500)] 
chan_pjsip: Creating Channel Causes Asterisk to Crash When Duplicate AOR
            Sections Exist in pjsip.conf

This patch modifies the current loading strategy of the pjsip configuration. If
duplicate sections (e.g. sections containing the same [id/type]) are defined in
[pjsip.conf], the loader will consider the configuration for the given type as
invalid when the duplicate section is encountered. The entire configuration
(including what was previously loaded) for the duplicate [id/type] sections
will be rejected and destroyed, an error message is logged and the load
processing for the given stops.

ASTERISK-24996
Reported By: Ashley Sanders

Change-Id: I35090ca4cd40f1f34881dfe701a329145c347aef

10 years agores_pjsip_outbound_registration: Add virtual line support. 87/287/1
Joshua Colp [Tue, 4 Nov 2014 12:03:35 +0000 (12:03 +0000)] 
res_pjsip_outbound_registration: Add virtual line support.

Virtual line support establishes a relationship between messages
related to an outbound registration and a local endpoint. This is
accomplished by attaching a parameter to the Contact of the outbound
registration and looking for it on any received requests. If the
parameter exists and can be matched to an outbound registration
the configured endpoint is associated with the request.

ASTERISK-24949 #close
Reported by: Joshua Colp

Change-Id: I7df909d2625479110a83fdd354c21ac539e8615d

10 years agoARI: Fix missing dependencies. 75/275/2
Corey Farrell [Wed, 29 Apr 2015 11:39:22 +0000 (07:39 -0400)] 
ARI: Fix missing dependencies.

ARI modules that are generated by 'make ari-stubs' are all dependent on
res_ari_model.  Additionally some of the same modules depend on one or more
res_stasis_* modules.

ASTERISK-25027 #close
Reported by: Corey Farrell

Change-Id: I8e07fe7e81fedacb87232f2b6f8b5f47927b4153

10 years agores_pjsip: Remove incorrect MODULEINFO from presence_xml.c. 84/284/1
Corey Farrell [Wed, 29 Apr 2015 11:26:13 +0000 (07:26 -0400)] 
res_pjsip: Remove incorrect MODULEINFO from presence_xml.c.

Remove incorrect MODULEINFO block and unneeded header includes
from presence_xml.c.

ASTERISK-25027
Reported by: Corey Farrell

Change-Id: I977c609ab9d1fe05373027c4138900f6985990eb

10 years agoGit Migration: Create doc/rest-api when needed. 82/282/1
Corey Farrell [Wed, 29 Apr 2015 11:17:00 +0000 (07:17 -0400)] 
Git Migration: Create doc/rest-api when needed.

Create the directory './doc/rest-api' at the start of 'make ari-stubs'
to prevent an error when documentation is generated.  The directory is
also added to git ignores.

ASTERISK-25027
Reported by: Corey Farrell

Change-Id: Iaccc7f0138501c23aa78feaca2f3cce9e68cbc1b

10 years agores_pjsip_outbound_registration: Fix build due to removal of transaction. 81/281/1
Joshua Colp [Wed, 29 Apr 2015 10:17:58 +0000 (07:17 -0300)] 
res_pjsip_outbound_registration: Fix build due to removal of transaction.

Change-Id: I7a8a7beec3334cec304943f2dd7597eabe2e3150

10 years agoMerge "res_pjsip_outbound_registration: Add debugging messages." into 13
Joshua Colp [Wed, 29 Apr 2015 00:18:46 +0000 (19:18 -0500)] 
Merge "res_pjsip_outbound_registration: Add debugging messages." into 13

10 years agoMerge "res_pjsip_outbound_registration: Don't fail on delayed processing: 13." into 13
Joshua Colp [Wed, 29 Apr 2015 00:18:16 +0000 (19:18 -0500)] 
Merge "res_pjsip_outbound_registration: Don't fail on delayed processing: 13." into 13

10 years agores_pjsip_outbound_registration: Don't fail on delayed processing: 13. 65/265/3
Mark Michelson [Mon, 27 Apr 2015 21:56:31 +0000 (16:56 -0500)] 
res_pjsip_outbound_registration: Don't fail on delayed processing: 13.

This is the Asterisk 13 version of a change to master that allows for
registration responses to be processed successfully potentially after
the original transaction has timed out. The main difference between this
and the master change is that the master version has API changes that
are unacceptable for 13. For 13, this is worked around by adding a new
API call that the outbound registration code uses instead.

The following is the text from the master version of this commit:

Odd behaviors have been observed during outbound registrations. The most
common problem witnessed has been one where a request with
authentication credentials cannot be created after receiving a 401
response. Other behaviors include apparently processing an incorrect SIP
response.

Inspecting the code led to an apparent issue with regards to how we
handle transactions in outbound registration code. When a response to a
REGISTER arrives, we save a pointer to the transaction and then push a
task onto the registration serializer. Between the time that we save the
pointer and push the task, it's possible for the transaction to be
destroyed due to a timeout. It's also possible for the address to be
reused by the transaction layer for a new transaction.

To allow for authentication of a REGISTER request to be authenticated
after the transaction has timed out, we now also hold a reference to the
original REGISTER request instead of the transaction. The function for
creating a request with authentication has been altered to take the
original request instead of the transaction where the original request
was sent.

ASTERISK-25020
Reported by Mark Michelson

Change-Id: If1ee5f601be839479a219424f0358a229f358f7c

10 years agores_pjsip_outbound_registration: Add debugging messages. 66/266/3
Mark Michelson [Mon, 27 Apr 2015 19:44:16 +0000 (14:44 -0500)] 
res_pjsip_outbound_registration: Add debugging messages.

When problems occur regarding outbound registrations, it currently
is difficult to debug. Most off-nominal paths had warning messages,
but sometimes we want to know what's going on before hitting the
off-nominal path. This patch adds lots of debugging output that
should give a clearer picture of what is happening with regards
to outbound registrations.

ASTERISK-25020
Reported by Mark Michelson

Change-Id: I577bde7860be0a6c872b5bcb4d5047340bf45d45

10 years agoMerge "Example script for scan-build (the llvm static analyzer)" into 13
Joshua Colp [Tue, 28 Apr 2015 12:13:53 +0000 (07:13 -0500)] 
Merge "Example script for scan-build (the llvm static analyzer)" into 13

10 years agores_rtp_asterisk: Resolve 2 discrete memory leaks in DTLS 69/269/4
Steve Davies [Tue, 28 Apr 2015 10:38:30 +0000 (11:38 +0100)] 
res_rtp_asterisk: Resolve 2 discrete memory leaks in DTLS

ao2 ref leak in res_rtp_asterisk.c when a DTLS policy is created.
The resources are linked into a table, but the original alloc refs
are never released. ast_strdup leak in rtp_engine.c. If
ast_rtp_dtls_cfg_copy() is called twice on the same destination struct,
a pointer to an alloc'd string is overwritten before the string is free'd.

ASTERISK-25022
Reported by: one47

Change-Id: I62a8ceb8679709f6c3769136dc6aa9a68202ff9b

10 years agoMerge "cdr/cdr_odbc.c: Added to record new columns add on CDR 1.8 Asterisk Version...
Joshua Colp [Tue, 28 Apr 2015 11:55:20 +0000 (06:55 -0500)] 
Merge "cdr/cdr_odbc.c: Added to record new columns add on CDR 1.8 Asterisk Version" into 13

10 years agores_pjsip: Fix SEGV on pending-qualify contacts 61/261/1
George Joseph [Mon, 27 Apr 2015 17:11:40 +0000 (11:11 -0600)] 
res_pjsip: Fix SEGV on pending-qualify contacts

Permanent contacts that hadn't been qualified yet were missing
their contact_status entries causing SEGVs when running CLI
commands.

This patch makes sure that contact_statuses are created for
both dynamic and permanent contacts when they are created.
It also adds checks in the CLI code to make sure there's a
contact_status, just in case.

ASTERISK-25018 #close
Reported-by: Ivan Poddubny
Tested-by: Ivan Poddubny
Tested-by: George Joseph
Change-Id: I3cc13e5cedcafb24c400368b515b02d7fb81e029

10 years agocdr/cdr_odbc.c: Added to record new columns add on CDR 1.8 Asterisk Version 58/258/3
Rodrigo Ramírez Norambuena [Wed, 15 Apr 2015 23:55:33 +0000 (20:55 -0300)] 
cdr/cdr_odbc.c: Added to record new columns add on CDR 1.8 Asterisk Version

Add new column to INSERT new columns added in cdr 1.8 version. The columns are:
 * peeraccount
 * linkedid
 * sequence
This feature is configurable in cdr_odbc.conf using a new configuration
option, 'newcdrcolumns'.

ASTERISK-24976 #close

Change-Id: Ibe0c7540a88305c6012786f438a0813ad8b19127

10 years agochannels/chan_skinny: Fix compilation error introduced in f8e21a1adf 60/260/1
Matt Jordan [Sun, 26 Apr 2015 22:21:15 +0000 (17:21 -0500)] 
channels/chan_skinny: Fix compilation error introduced in f8e21a1adf

A typo in commit f8e21a1adf resulted in a compilation error in
chan_skinny. This patch fixes the typo.

ASTERISK-24917

Change-Id: Id7f4ad1fe948eb2408622e80c27936ce4516c33c

10 years agoMerge "Clang: Fix some more tautological-compare warnings." into 13
Matt Jordan [Sun, 26 Apr 2015 20:53:50 +0000 (15:53 -0500)] 
Merge "Clang: Fix some more tautological-compare warnings." into 13

10 years agoMerge "app_confbridge: Default the template option to a compatible default profile...
Matt Jordan [Fri, 24 Apr 2015 18:07:06 +0000 (13:07 -0500)] 
Merge "app_confbridge: Default the template option to a compatible default profile." into 13

10 years agoapp_confbridge: Default the template option to a compatible default profile. 43/243/6
Kevin Harwell [Thu, 23 Apr 2015 20:11:27 +0000 (15:11 -0500)] 
app_confbridge: Default the template option to a compatible default profile.

Confbridge dynamic profiles did not have a default profile unless you
explicitly used Set(CONFBRIDGE(bridge,template)=default_bridge). If a
template was not set prior to the bridge being created then some
options were left with no default values set. This patch makes it so
the default templates are set to the default bridge and user profiles.

ASTERISK-24749 #close
Reported by: philippebolduc

Change-Id: I1bd6e94b38701ac2112d842db68de63d46f60e0a

10 years agores_pjsip_outbound_authenticator: Increase CSeq on authed requests. 49/249/2
Mark Michelson [Fri, 24 Apr 2015 14:17:25 +0000 (09:17 -0500)] 
res_pjsip_outbound_authenticator: Increase CSeq on authed requests.

The way PJSIP generates an authenticated request is to use a previous
request as a template. This means that the authenticated request will
have the same Call-ID, From header (including tag), and CSeq as the
original request. PJSIP generates a new branch on the Via header to
indicate that this is a new transaction, though.

There are some SIP implementations, though, that do not notice the
change in the branch and therefore will match the authed request to the
original request's transaction. Since the CSeq is the same, the server
will repeat the response it sent to the original request.

This patch aids interoperability by increasing the CSeq of the authed
request by one.

ASTERISK-24845 #close
Reported by: Carl Fortin
Tested by: Carl Fortin

Change-Id: I39c4ca52e688a9f83bcc1878371334becdc5be01

10 years agoMerge "res_pjsip_t38: Don't crash on authenticated reinvite after originated T.38...
Matt Jordan [Fri, 24 Apr 2015 14:24:47 +0000 (09:24 -0500)] 
Merge "res_pjsip_t38: Don't crash on authenticated reinvite after originated T.38 FAX." into 13

10 years agoExample script for scan-build (the llvm static analyzer) 58/158/6
Diederik de Groot [Mon, 20 Apr 2015 18:06:20 +0000 (20:06 +0200)] 
Example script for scan-build (the llvm static analyzer)

 - Added Pre-amble (Options / Flags / Usage Example / GNU License)
 - Extended Configurability
 - Made Executable

ASTERISK-24917
Change-Id: I70405fe54e4be7dbfbcb62e291690069b88617a8

10 years agoMerge "Clang: change previous tautological-compare fixes." into 13
Mark Michelson [Thu, 23 Apr 2015 22:23:37 +0000 (17:23 -0500)] 
Merge "Clang: change previous tautological-compare fixes." into 13

10 years agores_pjsip_t38: Don't crash on authenticated reinvite after originated T.38 FAX. 37/237/2
Mark Michelson [Thu, 23 Apr 2015 17:54:30 +0000 (12:54 -0500)] 
res_pjsip_t38: Don't crash on authenticated reinvite after originated T.38 FAX.

When Asterisk originates a channel to an application, the channel is
hung up once the application finishes executing. When the application
in question is SendFax, the Asterisk PJSIP code will attempt to reinvite
the T.38 session to audio after the FAX completes. The hangup of the
channel happens in the midst of this reinvite transaction. In most
circumstances, this works out okay because the BYE is delayed until the
reinvite transaction can complete.

However, if the reinvite that Asterisk sends receives a 401/407
response, then Asterisk's attempt to re-send the reinvite with
authentication will fail. This is because the session supplement in
res_pjsip_t38 makes the assumption that the channel on the session will
always be non-NULL. Since the channel has been hung up, though, the
channel is now NULL. Attempting to operate on the channel causes a
crash.

This patch fixes the issue by ensuring that the channel on the session
is not NULL before attempting to mess with the T.38 framehook.

This patch also contains some corrections for comments that were
incorrect and really confused me when I first started looking at the
code.

ASTERISK-25004 #close
Reported by Mark Michelson

Change-Id: Ic5a1230668369dda4bb13524098aed9306ab45a0

10 years agores_pjsip: Validate that contact uris start with sip: or sips: 32/232/4
George Joseph [Thu, 23 Apr 2015 14:16:45 +0000 (08:16 -0600)] 
res_pjsip:  Validate that contact uris start with sip: or sips:

Currently we use pjsip_parse_hdr to validate contact uris but it
appears that it allows uris without a scheme if there's a port
supplied.  I.E myexample.com will fail but myexample.com:5060 will
pass even though it has no scheme.  This causes SEGVs later on
whenever the uri is used.

To prevent this, permanent_contact_validate has been updated to check
that the scheme is either 'sip' or 'sips'.

2 uses of possibly-null endpoint have also been fixed in
create_out_of_dialog_request.

ASTERISK-24999

Change-Id: Ifc17d16a4923e1045d37fe51e43bbe29fa556ca2
Reported-by: Brad Latus
10 years agoClang: change previous tautological-compare fixes. 31/231/2
Diederik de Groot [Thu, 23 Apr 2015 13:00:42 +0000 (15:00 +0200)] 
Clang: change previous tautological-compare fixes.

clang can warn about a so called tautological-compare, when it finds
comparisons which are logically always true, and are therefor deemed
unnecessary.

Exanple:
unsigned int x = 4;
if (x > 0)    // x is always going to be bigger than 0

Enum Case:
Each enumeration is its own type. Enums are an integer type but they
do not have to be *signed*. C leaves it up to the compiler as an
implementation option what to consider the integer type of a particu-
lar enumeration is. Gcc treats an enum without negative values as
an int while clang treats this enum as an unsigned int.

rmudgett & mmichelson: cast the enum to (unsigned int) in assert.
The cast does have an effect. For gcc, which seems to treat all enums
as int, the cast to unsigned int will eliminate the possibility of
negative values being allowed. For clang, which seems to treat enums
without any negative members as unsigned int, the cast will have no
effect. If for some reason in the future a negative value is ever
added to the enum the assert will still catch the negative value.

ASTERISK-24917

Change-Id: I0557ae0154a0b7de68883848a609309cdf0aee6a

10 years agoMerge "Astobj2: Ensure all calls to __adjust_lock pass a valid object." into 13
Matt Jordan [Thu, 23 Apr 2015 11:50:44 +0000 (06:50 -0500)] 
Merge "Astobj2: Ensure all calls to __adjust_lock pass a valid object." into 13

10 years agores_corosync: Add check for config file before calling corosync apis 23/223/8
George Joseph [Wed, 22 Apr 2015 21:22:10 +0000 (15:22 -0600)] 
res_corosync: Add check for config file before calling corosync apis

On some systems, res_corosync isn't compatible with the installed version of
corosync so corosync_cfg_initialize fails, load_module returns LOAD_FAILURE,
and Asterisk terminates.  The work around has been to remember to add
res_corosync as a noload in modules.conf.  A better solution though is to have
res_corosync check for its config file before attempting to call corosync apis
and return LOAD_DECLINE if there's no config file.  This lets Asterisk loading
continue.

If you have a res_corosync.conf file and res_corosync fails, you get the same
behavior as today and the fatal error tells you something is wrong with the
install.

ASTERISK-24998

Change-Id: Iaf94a9431a4922ec4ec994003f02135acfdd3889

10 years agoAstobj2: Ensure all calls to __adjust_lock pass a valid object. 21/221/5
Corey Farrell [Wed, 22 Apr 2015 20:17:53 +0000 (16:17 -0400)] 
Astobj2: Ensure all calls to __adjust_lock pass a valid object.

__adjust_lock doesn't check for invalid objects, and doesn't have an
appropriate return value for invalid objects.  Most callers of
__adjust_lock pass objects that have already been confirmed valid,
this change adds checks before the remaining calls.

ASTERISK-24997 #close
Reported by: Corey Farrell

Change-Id: I669100f87937cc3f867cec56a27ae9c01292908f

10 years ago.gitignore: Add .gcno and .gcda 26/226/1
George Joseph [Wed, 22 Apr 2015 21:32:53 +0000 (15:32 -0600)] 
.gitignore:  Add .gcno and .gcda

Products of --enable-coverage

Change-Id: Ie20882d64b60692e2c941ea8872ab82a86ce77a3

10 years agoMerge "Fix/Update clang-RAII macro implementation" into 13
Matt Jordan [Wed, 22 Apr 2015 19:25:40 +0000 (14:25 -0500)] 
Merge "Fix/Update clang-RAII macro implementation" into 13

10 years agoMerge "res_pjsip_mwi: Send unsolicited MWI NOTIFY on startup and when endpoint regist...
Mark Michelson [Wed, 22 Apr 2015 19:07:34 +0000 (14:07 -0500)] 
Merge "res_pjsip_mwi: Send unsolicited MWI NOTIFY on startup and when endpoint registers." into 13

10 years agoClang: Fix some more tautological-compare warnings. 60/160/8
Diederik de Groot [Wed, 22 Apr 2015 09:17:56 +0000 (11:17 +0200)] 
Clang: Fix some more tautological-compare warnings.

clang can warn about a so called tautological-compare, when it finds
comparisons which are logically always true, and are therefor deemed
unnecessary.

Exanple:
unsigned int x = 4;
if (x > 0)    // x is always going to be bigger than 0

Enum Case:
Each enumeration is its own type. Enums are an integer type but they
do not have to be *signed*. C leaves it up to the compiler as an
implementation option what to consider the integer type of a particu-
lar enumeration is. Gcc treats an enum without negative values as
an int while clang treats this enum as an unsigned int.

rmudgett & mmichelson: cast the enum to (unsigned int) in assert.
The cast does have an effect. For gcc, which seems to treat all enums
as int, the cast to unsigned int will eliminate the possibility of
negative values being allowed. For clang, which seems to treat enums
without any negative members as unsigned int, the cast will have no
effect. If for some reason in the future a negative value is ever
added to the enum the assert will still catch the negative value.

ASTERISK-24917
Change-Id: Ief23ef68916192b9b72dabe702b543ecfeca0b62

10 years agoMerge "Check for ao2_alloc failure in __ast_channel_internal_alloc." into 13
Joshua Colp [Wed, 22 Apr 2015 10:45:20 +0000 (05:45 -0500)] 
Merge "Check for ao2_alloc failure in __ast_channel_internal_alloc." into 13

10 years agores_pjsip_mwi: Send unsolicited MWI NOTIFY on startup and when endpoint registers. 75/175/3
Joshua Colp [Tue, 14 Apr 2015 19:04:46 +0000 (16:04 -0300)] 
res_pjsip_mwi: Send unsolicited MWI NOTIFY on startup and when endpoint registers.

Currently the res_pjsip_mwi module only sends an unsolicited MWI NOTIFY upon
a mailbox state change (such as a new message being left, or one being deleted).
In practice this is not sufficient to keep clients aware of the current MWI status.

This change makes the module send unsolicited MWI NOTIFY on startup so that
clients are guaranteed to have the most up to date MWI information. It also makes
clients receive an unsolicited MWI NOTIFY upon registration so if they are unaware
of the current MWI status they receive it.

ASTERISK-24982 #close
Reported by: Joshua Colp

Change-Id: I043f20230227e91218f18a82c7d5bb2aa62b1d58

10 years agoMerge "res_pjsip_pubsub: Set the endpoint on SUBSCRIBE dialogs." into 13
Joshua Colp [Wed, 22 Apr 2015 10:29:33 +0000 (05:29 -0500)] 
Merge "res_pjsip_pubsub: Set the endpoint on SUBSCRIBE dialogs." into 13

10 years agoCheck for ao2_alloc failure in __ast_channel_internal_alloc. 89/189/1
Corey Farrell [Tue, 21 Apr 2015 20:17:33 +0000 (16:17 -0400)] 
Check for ao2_alloc failure in __ast_channel_internal_alloc.

Fix a crash that could occur in __ast_channel_internal_alloc if
ao2_alloc fails.

ASTERISK-24991 #close

Change-Id: I4ca89189eb22f907408cb87d0a1645cfe1314a90

10 years agores_pjsip_pubsub: Set the endpoint on SUBSCRIBE dialogs. 66/166/2
Mark Michelson [Mon, 20 Apr 2015 19:30:47 +0000 (14:30 -0500)] 
res_pjsip_pubsub: Set the endpoint on SUBSCRIBE dialogs.

When SUBSCRIBE dialogs were established, we never associated
the endpoint that created the subscription with the dialog
we end up creating. In most cases, this ended up not causing
any problems.

The actual bug that was observed was that when a device that
was behind NAT established a subscription with Asterisk, Asterisk
would end up sending in-dialog NOTIFY requests to the device's
private IP addres instead of the public address of the NAT router.

When Asterisk receives the initial SUBSCRIBE from the device,
res_pjsip_nat rewrites the contact to the public address on which the
SUBSCRIBE was received. This allows for the dialog to have its target
address set to the proper public address. Asterisk then would send a 200
OK response to the SUBSCRIBE, then a NOTIFY with the initial
subscription state. The device would then send a 200 OK response to
Asterisk's NOTIFY.

Here's where things went wrong. When the 200 OK arrived, res_pjsip_nat
did not rewrite the address in the Contact header. Then, when the PJSIP
dialog layer processed the 200 OK, PJSIP would perform a comparison
between the IP address in the Contact header and its saved target
address for the dialog. Since they differed, PJSIP would update the
target dialog address to be the address in the Contact header. From this
point, if Asterisk needed to send a NOTIFY to the device, the result was
that the NOTIFY would be sent to the private address that the device
placed in the Contact header.

The reason why res_pjsip_nat did not rewrite the address when it
received the 200 OK response was that it could not associate the
incoming response with a configured endpoint. This is because on a
response, the only way to associate the response to an endpoint is by
finding the dialog that the response is associated with and then finding
the endpoint that is associated with that dialog. We do not perform
endpoint lookups on responses. res_pjsip_pubsub skipped the step of
associating the endpoint with the dialog we created, so res_pjsip_nat
could not find the associated endpoint and therefore couldn't rewrite
the contact.

This commit message is like 50x longer than the actual fix.

ASTERISK 24981 #close
Reported by Mark Michelson

Change-Id: I2b963c58c063bae293e038406f7d044a8a5377cd

10 years agochan_dahdi/sig_pri: Make post AMI HangupRequest events on PRI channels. 72/172/1
Richard Mudgett [Mon, 20 Apr 2015 23:00:34 +0000 (18:00 -0500)] 
chan_dahdi/sig_pri: Make post AMI HangupRequest events on PRI channels.

The chan_dahdi channel driver is a very old driver.  The ability for it to
support ISDN was added well after the initial analog support.  Setting the
softhangup flags is a carry over from the original analog code.  The
driver was not updated to call ast_queue_hangup() which will post the AMI
HangupRequest event.

* Changed sig_pri.c to call ast_queue_hangup() instead of setting the
softhangup flag when the remote party initiates a hangup.

ASTERISK-24895 #close
Reported by: Andrew Zherdin

Change-Id: I5fe2e48556507785fd8ab8e1c960683fd5d20325

10 years agoMerge "pjsip_options: Fix non-qualified contacts showing as unavailable" into 13
Joshua Colp [Mon, 20 Apr 2015 22:23:56 +0000 (17:23 -0500)] 
Merge "pjsip_options:  Fix non-qualified contacts showing as unavailable" into 13

10 years agoFix/Update clang-RAII macro implementation 59/159/4
Diederik de Groot [Mon, 20 Apr 2015 18:01:35 +0000 (20:01 +0200)] 
Fix/Update clang-RAII macro implementation

- When you need to refer to 'variable XXX' outside a block, it needs
to be declared as '__block XXX', otherwise it will not be available with-
in the block, making updating that variable hard to do, and ast_free
lead to issues.

- Removed the #error message
because it creates complications when compiling external projects
against asterisk For example when using a different compiler than the
one used to compile asterisk. The warning/error should be generated
during the configure process not the compilation process

ASTERISK-24917
Change-Id: I12091228090e90831bf2b498293858f46ea7a8c2

10 years agopjsip_options: Fix format specifier for int64_t rtt. 61/161/1
George Joseph [Mon, 20 Apr 2015 14:53:00 +0000 (08:53 -0600)] 
pjsip_options:  Fix format specifier for int64_t rtt.

Contact status rtt is an int64_t and needs the PRId64 macro to
properly create the format specifier on 32-bit systems.

Change-Id: I4b8ab958fc1e9a179556a9b4ffa49673ba9fdec7

10 years agoMerge "main/pbx: Don't attempt to destroy a previously destroyed exten/priority tuple...
Matt Jordan [Mon, 20 Apr 2015 11:29:56 +0000 (06:29 -0500)] 
Merge "main/pbx: Don't attempt to destroy a previously destroyed exten/priority tuple" into 13

10 years agoMerge "Fix issue with AST_THREADSTORAGE_RAW when DEBUG_THREADLOCALS is enabled."...
Joshua Colp [Mon, 20 Apr 2015 10:54:00 +0000 (05:54 -0500)] 
Merge "Fix issue with AST_THREADSTORAGE_RAW when DEBUG_THREADLOCALS is enabled." into 13

10 years agopjsip_options: Fix non-qualified contacts showing as unavailable 47/147/4
George Joseph [Sat, 18 Apr 2015 18:36:19 +0000 (12:36 -0600)] 
pjsip_options:  Fix non-qualified contacts showing as unavailable

The "Add qualify_timeout processing and eventing" patch introduced
an issue where contacts that had qualify_frequency set to 0 were
showing Unavailable instead Unknown.  This patch checks for
qualify_frequency=0 and create an "Unknown"  contact_status
with an RTT = 0.

Previously, the lack of contact_status implied Unknown but since
we're now changing endpoint state based on contact_status, I've
had to add new UNKNOWN status so that changes could trigger the
appropriate contact_status observers.

ASTERISK-24977: #close

Change-Id: Ifcbc01533ce57f0e4e584b89a395326e098b8fe7

10 years agomain/pbx: Don't attempt to destroy a previously destroyed exten/priority tuple 55/155/1
Matt Jordan [Sun, 19 Apr 2015 20:49:43 +0000 (15:49 -0500)] 
main/pbx: Don't attempt to destroy a previously destroyed exten/priority tuple

When a PBX registrar is unloaded, it will fail to remove its extension from
the context root_table if a dialplan application used by that extension is
still loaded. This can be the case for AGI, which can be unloaded after several
of the standard PBX providers. Often, this is harmless; however, if the
extension's priorities are removed during the failed unloading *and* the
dialplan application later unregisters, it leaves a ticking timebomb for the
next PBX provider that attempts to iterate over the extensions. When that
occurs, the peer_table pointer on the extension will already be set to NULL.
The current code does not check to see if the pointer is NULL before passing
it to a hashtab function this is not NULL tolerant.

Since it is possible for the peer_table to be NULL when we normally would not
expect that to be the case, the solution in this patch is to simply skip over
processing an extension's priorities if peer_table is NULL.

Prior to this patch, the tests/pbx/callerid_match test would crash during
module unload. With this patch, the test no longer crashes after running.

ASTERISK-24774 #close
Reported by: Corey Farrell

Change-Id: I2bbeecb7e0f77bac303a1b9135e4cdb4db6d4c40

10 years agores_fax: Fix latent bug exposed by ASTERISK-24841 changes. 45/145/1
Richard Mudgett [Fri, 17 Apr 2015 23:05:37 +0000 (18:05 -0500)] 
res_fax: Fix latent bug exposed by ASTERISK-24841 changes.

Three fax related tests started failing as a result of changes made for
ASTERISK-24841:
tests/fax/pjsip/gateway_t38_g711
tests/fax/sip/gateway_mix1
tests/fax/sip/gateway_mix3

Historically, ast_channel_make_compatible() did nothing if the channels
were already "compatible" even if they had a sub-optimal translation path
already setup.  With the changes from ASTERISK-24841 this is no longer
true in order to allow the best translation paths to always be picked.  In
res_fax.c:fax_gateway_framehook() code manually setup the channels to go
through slin and then called ast_channel_make_compatible().  With the
previous version of ast_channel_make_compatible() this was always a
no-operation.

* Remove call to ast_channel_make_compatible() in fax_gateway_framehook()
that now undoes what was just setup when the framehook is attached.

* Fixed locking around saving the channel formats in
fax_gateway_framehook() to ensure that the formats that are saved are
consistent.

* Fix copy pasta errors in fax_gateway_framehook() that confuses read and
write when dealing with saved channel formats.

ASTERISK-24841
Reported by: Matt Jordan

Change-Id: I6fda0877104a370af586a5e8cf9e161a484da78d

10 years agoFix issue with AST_THREADSTORAGE_RAW when DEBUG_THREADLOCALS is enabled. 42/142/1
Corey Farrell [Fri, 17 Apr 2015 21:19:24 +0000 (17:19 -0400)] 
Fix issue with AST_THREADSTORAGE_RAW when DEBUG_THREADLOCALS is enabled.

When DEBUG_THREADLOCALS is enabled it causes the threadlocal cleanup to be
called as a function.  This causes a compile error with raw threadstorage as
it uses NULL for cleanup.  This fix uses a macro that provides NULL when
DEBUG_THREADLOCALS is disabled, and replaces the call to "c_cleanup(data);"
with "{};" when DEBUG_THREADLOCALS is enabled.

ASTERISK-24975 #close
Reported by: Ashley Sanders

Change-Id: I3ef7428ee402816d9fcefa1b3b95830c00d5c402

10 years agoMerge "Detect potential forwarding loops based on count." into 13
Matt Jordan [Fri, 17 Apr 2015 20:57:49 +0000 (15:57 -0500)] 
Merge "Detect potential forwarding loops based on count." into 13

10 years agoDetect potential forwarding loops based on count. 21/121/4
Mark Michelson [Wed, 15 Apr 2015 15:38:02 +0000 (10:38 -0500)] 
Detect potential forwarding loops based on count.

A potential problem that can arise is the following:

* Bob's phone is programmed to automatically forward to Carol.
* Carol's phone is programmed to automatically forward to Bob.
* Alice calls Bob.

If left unchecked, this results in an endless loops of call forwards
that would eventually result in some sort of fiery crash.

Asterisk's method of solving this issue was to track which interfaces
had been dialed. If a destination were dialed a second time, then
the attempt to call that destination would fail since a loop was
detected.

The problem with this method is that call forwarding has evolved. Some
SIP phones allow for a user to manually forward an incoming call to an
ad-hoc destination. This can mean that:

* There are legitimate use cases where a device may be dialed multiple
times, or
* There can be human error when forwarding calls.

This change removes the old method of detecting forwarding loops in
favor of keeping a count of the number of destinations a channel has
dialed on a particular branch of a call. If the number exceeds the
set number of max forwards, then the call fails. This approach has
the following advantages over the old:

* It is much simpler.
* It can detect loops involving local channels.
* It is user configurable.

The only disadvantage it has is that in the case where there is a
legitimate forwarding loop present, it takes longer to detect it.
However, the forwarding loop is still properly detected and the
call is cleaned up as it should be.

Address review feedback on gerrit.

* Correct "mfgium" to "Digium"
* Decrement max forwards by one in the case where allocation of the
  max forwards datastore is required.
* Remove irrelevant code change from pjsip_global_headers.c

ASTERISK-24958 #close

Change-Id: Ia7e4b7cd3bccfbd34d9a859838356931bba56c23

10 years agopjsip_options: Add qualify_timeout processing and eventing 44/44/11
George Joseph [Sat, 11 Apr 2015 21:56:52 +0000 (15:56 -0600)] 
pjsip_options: Add qualify_timeout processing and eventing

This is the second follow-on to https://reviewboard.asterisk.org/r/4572/ and the
discussion at
http://lists.digium.com/pipermail/asterisk-dev/2015-March/073921.html

The basic issues are that changes in contact status don't cause events to be
emitted for the associated endpoint.  Only dynamic contact add/delete actions
update the endpoint.  Also, the qualify timeout is fixed by pjsip at 32 seconds
which is a long time.

This patch makes use of the new transaction timeout feature in r4585 and
provides the following capabilities...

1.  A new aor/contact variable 'qualify_timeout' has been added that allows the
user to specify the maximum time in milliseconds to wait for a response to an
OPTIONS message.  The default is 3000ms.  When the timer expires, the contact is
marked unavailable.

2.  Contact status changes are now propagated up to the endpoint as follows...
When any contact is 'Available', the endpoint is marked as 'Reachable'.  When
all contacts are 'Unavailable', the endpoint is marked as 'Unreachable'.  The
existing endpoint events are generated appropriately.

ASTERISK-24863 #close

Change-Id: Id0ce0528e58014da1324856ea537e7765466044a
Tested-by: Dmitriy Serov
Tested-by: George Joseph <george.joseph@fairview5.com>
10 years agoMerge "res_pjsip: Refactor endpt_send_request to include transaction timeout" into 13
Matt Jordan [Fri, 17 Apr 2015 20:29:40 +0000 (15:29 -0500)] 
Merge "res_pjsip: Refactor endpt_send_request to include transaction timeout" into 13

10 years agoMerge "res_pjsip: Add global option to limit the maximum time for initial qualifies...
Matt Jordan [Fri, 17 Apr 2015 15:30:37 +0000 (10:30 -0500)] 
Merge "res_pjsip: Add global option to limit the maximum time for initial qualifies" into 13

10 years agoMerge "res_pjsip_pubsub: On notify fail deleted sub_tree is then referenced" into 13
Joshua Colp [Fri, 17 Apr 2015 15:25:44 +0000 (10:25 -0500)] 
Merge "res_pjsip_pubsub: On notify fail deleted sub_tree is then referenced" into 13

10 years agobridge.c: NULL app causes crash during attended transfer 33/133/5
Kevin Harwell [Thu, 16 Apr 2015 15:51:50 +0000 (10:51 -0500)] 
bridge.c: NULL app causes crash during attended transfer

Due to a race condition there was a chance that during an attended transfer the
channel's application would return NULL. This, of course, would cause a crash
when attempting to access the memory. This patch retrieves the channel's app
at an earlier time in processing in hopes that the app name is available.
However, if it is not then "unknown" is used instead. Since some string value
is now always present the crash can no longer occur.

ASTERISK-24869 #close
Reported by: viniciusfontes
Review:

Change-Id: I5134b84c4524906d8148817719d76ffb306488ac

10 years agores_pjsip_pubsub: On notify fail deleted sub_tree is then referenced 36/136/2
Scott Griepentrog [Thu, 16 Apr 2015 18:20:29 +0000 (13:20 -0500)] 
res_pjsip_pubsub: On notify fail deleted sub_tree is then referenced

This change makes the send_notify of the sub_tree
not happen when the sub_tree has been deleted due
to the notify call failing, which avoids a crash.

ASTERISK-24970 #close

Change-Id: I1f20ffc08b192f59c457293b218025a693992cbf

10 years agores_pjsip: Refactor endpt_send_request to include transaction timeout 43/43/8
George Joseph [Sat, 11 Apr 2015 21:39:29 +0000 (15:39 -0600)] 
res_pjsip: Refactor endpt_send_request to include transaction timeout

This is the first follow-on to https://reviewboard.asterisk.org/r/4572/ and the
discussion at
http://lists.digium.com/pipermail/asterisk-dev/2015-March/073921.html

Since we currently have no control over pjproject transaction timeout, this
patch pulls the pjsip_endpt_send_request function out of pjproject and into
res_pjsip/endpt_send_transaction in order to implement that capability.

Now when the transaction is initiated, we also schedule our own pj_timer with
our own desired timeout.

If the transaction completes before either timeout, pjproject cancels its timer,
and calls our tsx callback where we cancel our timer and run the app callback.

If the pjproject timer times out first, pjproject calls our tsx callback where
we cancel our timer and run the app callback.

If our timer times out first, we terminate the transaction which causes
pjproject to cancel its timer and call our tsx callback where we run the app
callback.

Regardless of the scenario, pjproject is calling the tsx callback inside the
group_lock and there are checks in the callback to make sure it doesn't run
twice.

As part of this patch ast_sip_send_out_of_dialog_request was created to replace
its similarly named private function.  It takes a new timeout argument in
milliseconds (<= 0 to disable the timeout).

ASTERISK-24863 #close
Reported-by: George Joseph <george.joseph@fairview5.com>
Tested-by: George Joseph <george.joseph@fairview5.com>
Change-Id: I0778dc730d9689c5147a444a04aee3c1026bf747

10 years agores_pjsip: Add global option to limit the maximum time for initial qualifies 45/45/6
George Joseph [Sat, 11 Apr 2015 22:04:32 +0000 (16:04 -0600)] 
res_pjsip: Add global option to limit the maximum time for initial qualifies

Currently when Asterisk starts initial qualifies of contacts are spread out
randomly between 0 and qualify_timeout to prevent network and system overload.
If a contact's qualify_frequency is 5 minutes however, that contact may be
unavailable to accept calls for the entire 5 minutes after startup.  So while
staggering the initial qualifies is a good idea, basing the time on
qualify_timeout could leave contacts unavailable for too long.

This patch adds a new global parameter "max_initial_qualify_time" that sets the
maximum time for the initial qualifies.  This way you could make sure that all
your contacts are initialy, randomly qualified within say 30 seconds but still
have the contact's ongoing qualifies at a 5 minute interval.

If max_initial_qualify_time is > 0, the formula is initial_interval =
min(max_initial_interval, qualify_timeout * random().  If not set,
qualify_timeout is used.

The default is "0" (disabled).

ASTERISK-24863 #close

Change-Id: Ib80498aa1ea9923277bef51d6a9015c9c79740f4
Tested-by: George Joseph <george.joseph@fairview5.com>
10 years agoMore .gitignore updates 28/128/1
George Joseph [Wed, 15 Apr 2015 21:08:09 +0000 (15:08 -0600)] 
More .gitignore updates

Added .pyc and .sha1 to the top-level .gitignore.

Change-Id: I7dfc4f554d54d22947b38140d3305007503cc16a
Tested-by: George Joseph <george.joseph@fairview5.com>
10 years agoMerge "Build System: Replace comment about setting menuselect defaults." into 13
Matt Jordan [Wed, 15 Apr 2015 18:36:09 +0000 (13:36 -0500)] 
Merge "Build System: Replace comment about setting menuselect defaults." into 13

10 years agocel_pgsql: Fix name string for log on unable allocate memory. 15/115/2
Rodrigo Ramírez Norambuena [Tue, 14 Apr 2015 18:16:45 +0000 (15:16 -0300)] 
cel_pgsql: Fix name string for log on unable allocate memory.

The LOG_ERROR has reference to CDR instead of CEL  for LENGTHEN_BUF1 and
LENGTHEN_BUF2.

ASTERISK-24965 #close
Reported by: Rodrigo Ramirez Norambuena

Change-Id: Icc818697d7d66d34bfe3048cdd15ca2b06c89744