]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
8 years agochan_sip: Fix session timeout on retransmit of non-UDP packets 87/3887/3
Steve Davies [Tue, 13 Sep 2016 10:34:47 +0000 (11:34 +0100)] 
chan_sip: Fix session timeout on retransmit of non-UDP packets

Change-Id I1cd33453c77c56c8e1394cd60a6f17bb61c1d957 Enable Session-Timers for
SIP over TCP (and TLS) also disables SIP retransmits in chan_sip for non-UDP
connections, allowing the TCP layer to handle the retransmits. Unfortunately,
this caused sessions to be terminated with a retransmit timeout becasue it
stopped at the point of the first retrans call.

This patch waits for the 64*T1 timer to expire instead.

ASTERISK-19968

Change-Id: I844f26801aada10bc94e9bebe6e151f0a8443204

8 years agoapp_queue: Fix CLI "queue show" and AMI Queues action output truncation. 81/3881/1
Richard Mudgett [Mon, 12 Sep 2016 17:25:54 +0000 (12:25 -0500)] 
app_queue: Fix CLI "queue show" and AMI Queues action output truncation.

The output of CLI "queue show" and AMI Queues action is truncated and
"failed to extend from 240 to 327" messages are generated if the queue
member and interface names are lengthy.

* Increase the string buffer size from 240 to 512 in order to accommodate
for more information fields added to the output since v1.8.

ASTERISK-26360 #close
Reported by: Richard Mudgett

Change-Id: Id99c03cf5362453b80491a4b3b0434cb67aa966d

8 years agocontrib: Let safe_asterisk script continue without /dev/tty9. 70/3870/1
Walter Doekes [Fri, 9 Sep 2016 11:26:01 +0000 (13:26 +0200)] 
contrib: Let safe_asterisk script continue without /dev/tty9.

If you use the safe_asterisk script, it uses hardcoded defaults before
running configurable values from /etc/asterisk/startup.d. The hardcoded
default has TTY=9. Some containerized environments don't have such a
TTY, and safe_asterisk would stop.

The custom configuration from /etc/asterisk/startup.d/* isn't read until
after it stopped, so changing TTY in a custom config did not help.

This changeset changes safe_asterisk to continue if the TTY setting was
untouched and /dev/tty9 and /dev/vc/9 aren't found.

Change-Id: I2c7cdba549b77f418a0af4cb1227e8e6fe4148fc

8 years agochan_sip: Don't allocate new RTP instances on top of old ones.
Joshua Colp [Tue, 23 Aug 2016 11:31:05 +0000 (11:31 +0000)] 
chan_sip: Don't allocate new RTP instances on top of old ones.

In some scenarios dialog_initialize_rtp can be called multiple times on
the same dialog.  This can cause RTP instances to be leaked along with
multiple file descriptors for each instance.

This change makes it so the existing RTP instances are destroyed and
not overwritten, stopping the memory leak.

ASTERISK-26272 #close
patches:
  ASTERISK-26272-11.patch submitted by Corey Farrell (license 5909)

Change-Id: I3c1d94dea8594fe0702168cb979b898ae0f5fc5d

8 years agofollowme: initialize all config items on reload 81/3581/2
Tzafrir Cohen [Thu, 11 Aug 2016 17:10:44 +0000 (20:10 +0300)] 
followme: initialize all config items on reload

Some configuration directives were not initialized on reload, and hence
were not reset to default if they were removed from followme.conf.

ASTERISK-26288 #close

Change-Id: Ief829e16374ad1e0ecfd63e6ee4923b5a1d1c150

8 years agochan_sip: Don't refuse calls with "optional crypto"; fall back to RTP. 31/3831/1
Walter Doekes [Tue, 6 Sep 2016 08:04:30 +0000 (10:04 +0200)] 
chan_sip: Don't refuse calls with "optional crypto"; fall back to RTP.

Certain SNOM phones send so-called "optional crypto" in their SDP body.
Regular SRTP setup looks like this:

    m=audio 64620 RTP/SAVP 8 0 9 99 3 18 4 101
    a=crypto:1 AES_CM_128_HMAC_SHA1_32 inline:...

SNOM-style "optional crypto" looks like this:

    m=audio 61438 RTP/AVP 8 0 9 99 3 18 4 101
    a=crypto:1 AES_CM_128_HMAC_SHA1_32 inline:...

A crypto line is supplied, but the m-line does not have SAVP.

When res_srtp.so is *not* loaded, then chan_sip.so treats the optional
crypto as regular RTP, but when res_srtp.so *is* loaded, it refuses the
incoming call with the following message:

    WARNING: process_sdp: Failed to receive SDP offer/answer with
    required SRTP crypto attributes for audio

For platforms that want to start providing SRTP this presents a
compatibility problem.

This changeset lets chan_sip handle the SDP as if no crypto-line was
supplied: i.e. accept the call as regular RTP, just like it did before
res_srtp was loaded.

Now you'll get this informative warning instead:

    WARNING: Ignoring crypto attribute in SDP because RTP transport is
    insecure

ASTERISK-23989 #close
Reported by: Olle Johansson

Change-Id: I91a15ae05a0296e398d6b65f53bb11afde1d80e2

8 years agoapp_mp3: Use correct buffer size and the same sample rate as the channel 39/3739/2
Michael Kuron [Wed, 31 Aug 2016 17:23:09 +0000 (19:23 +0200)] 
app_mp3: Use correct buffer size and the same sample rate as the channel

Previously, the buffer used for MP3 streamed from HTTP servers had a size of
1 MB. For 8 kHz mono audio at 16 bit resolution, such a buffer covers about 1
minute. Only when the buffer is full does audio start to play.
For MP3 files streamed from a server, that is usually not a big deal as long as
the connection to the server is fast enough to supply that much data within a
second or two. For MP3 live streams however, it takes 1 minute to download 1
minute of audio, so without this change, app_mp3 wasn't really usable for MP3
live streams.
This commit changes the buffer size so that it covers 6 seconds of an MP3 file
streamed from a server and 0.5 seconds of an MP3 live stream. The latter is
identified by the use of a .m3u file extension.

app_mp3 so far only supported 8 kHz audio.
Now it always runs at the sample rate of the channel.

ASTERISK-26085 #close

Change-Id: Id1ee274733cd804a0edecf7450329b72f1235af0

8 years agoMerge "pbx.c: Prevent infinite recursion in manager_show_dialplan_helper." into 11
Joshua Colp [Mon, 29 Aug 2016 19:57:53 +0000 (14:57 -0500)] 
Merge "pbx.c: Prevent infinite recursion in manager_show_dialplan_helper." into 11

8 years agoMerge "app_queue: Ensure member is removed from pending when hanging up." into 11
zuul [Mon, 29 Aug 2016 18:16:50 +0000 (13:16 -0500)] 
Merge "app_queue: Ensure member is removed from pending when hanging up." into 11

8 years agoapp_macro: Consider '~~s~~' as a macro start extension. 58/3758/1
chrisderock [Wed, 17 Aug 2016 07:51:17 +0000 (09:51 +0200)] 
app_macro: Consider '~~s~~' as a macro start extension.

As described in issue ASTERISK-26282 the AEL parser creates macros with
extension '~~s~~'.  app_macro searches only for extension 's' so the
created extension cannot be found.  with this patch app_macro searches for
both extensions and performs the right extension.

ASTERISK-26282 #close

Change-Id: I939aa2a694148cc1054dd75ec0c47c47f47c90fb

8 years agopbx.c: Prevent infinite recursion in manager_show_dialplan_helper. 54/3754/1
Etienne Lessard [Mon, 29 Aug 2016 12:11:47 +0000 (08:11 -0400)] 
pbx.c: Prevent infinite recursion in manager_show_dialplan_helper.

Previously, if context A was including context B and context B was including
context A, i.e. if there was a circular dependency between contexts, then
calling manager_show_dialplan_helper could lead to an infinite recursion,
resulting in a crash.

This commit applies the same solution as the one implemented in the
show_dialplan_helper function. The manager_show_dialplan_helper and
show_dialplan_helper functions contain lots of code in common, but the former
was missing the "infinite recursion avoidance" code.

ASTERISK-26226 #close

Change-Id: I1aea85133c21787226f4f8442253a93000aa0897

8 years agoapp_queue: Ensure member is removed from pending when hanging up. 45/3745/1
Joshua Colp [Thu, 25 Aug 2016 12:06:41 +0000 (12:06 +0000)] 
app_queue: Ensure member is removed from pending when hanging up.

When dialing channels it is possible that they may not ever
leave the not in use state (Local channels in particular) by
the time we cancel them. If this occurs but we know they were
dialed we explicitly remove them from the pending members
container so that subsequent call attempts occur.

ASTERISK-26299 #close

Change-Id: I6ad0d17c36480c92cebf840626228ce3f7e4bd65

8 years agoMerge "channel: No hung-up on failing security requirements." into 11
zuul [Fri, 26 Aug 2016 23:21:34 +0000 (18:21 -0500)] 
Merge "channel: No hung-up on failing security requirements." into 11

8 years agochannel: No hung-up on failing security requirements. 28/3728/2
Alexander Traud [Fri, 26 Aug 2016 13:41:16 +0000 (15:41 +0200)] 
channel: No hung-up on failing security requirements.

In your Diaplan, if you specify
 same => n,Set(CHANNEL(secure_bridge_media)=1)
 same => n,Set(CHANNEL(secure_bridge_signaling)=1)
only the SIP channel driver chan_sip supports this. All other channels drivers
like res_pjsip fail. In case of failure, the original sRTP source code released
the whole channel, even if not hung-up, yet. This change does not release the
channel but instead hangs-up the channel.

ASTERISK-26306

Change-Id: I0489f0cb660fab6673b0db8af027d116e70a66db

8 years agores_fax: Fix deadlock in ast_channel_get_t38_state(). 05/3705/1
Richard Mudgett [Tue, 23 Aug 2016 16:02:35 +0000 (11:02 -0500)] 
res_fax: Fix deadlock in ast_channel_get_t38_state().

ast_channel_get_t38_state() calls ast_channel_queryoption() with
AST_OPTION_T38_STATE.  If the passed in channel is a local channel then a
deadlock can happen if a channel lock is held when called.

* Made ast_channel_get_t38_state() callers not hold a channel lock before
calling.

* Update ast_channel_get_t38_state() doxygen to note that no channel locks
can be held when calling the function.

ASTERISK-26203 #close
Reported by: Etienne Lessard

ASTERISK-24822 #close
Reported by: David Brillert

ASTERISK-22732 #close
Reported by: Richard Mudgett

Change-Id: I49fd76fa9af628b4198009b5c0b82c8b03681214

8 years agores_fax.c, res_fax_spandsp.c: Misc deadlock fixes. 04/3704/1
Richard Mudgett [Tue, 23 Aug 2016 20:57:58 +0000 (15:57 -0500)] 
res_fax.c, res_fax_spandsp.c: Misc deadlock fixes.

* Fixed locking inconsistency in fax_gateway_start() when calling the
gateway technology start_session callback.  The callback was called with
and without the channel lock held.  Calling the callback with the channel
lock held could deadlock in spandsp_fax_gateway_start() which calls
ast_channel_get_t38_state().

* Fixed deadlock potential in fax_detect_framehook() when calling
ast_channel_make_compatible().

ASTERISK-26203
Reported by: Etienne Lessard

ASTERISK-24822
Reported by: David Brillert

ASTERISK-22732
Reported by: Richard Mudgett

Change-Id: I5a7b8e9e7b198802df06dff0ea48d96bd6d7b912

8 years agores_fax.c: Fix deadlock in fax_gateway_indicate_t38(). 03/3703/1
Richard Mudgett [Mon, 22 Aug 2016 17:31:24 +0000 (12:31 -0500)] 
res_fax.c: Fix deadlock in fax_gateway_indicate_t38().

fax_gateway_indicate_t38() calls ast_indicate_data() which cannot be
called with any channel locks already held.  A deadlock can happen if the
function is operating on a local channel.

* Made fax_gateway_indicate_t38() unlock the channel before calling
ast_indicate_data() since fax_gateway_indicate_t38() is always called with
the channel locked.

* Made fax_gateway_indicate_t38() return void since nothing cared about
its return value.

ASTERISK-26203
Reported by: Etienne Lessard

ASTERISK-24822
Reported by: David Brillert

ASTERISK-22732
Reported by: Richard Mudgett

Change-Id: I701ff2d26c5fc23e0d5a48a3fd98759a9fd09407

8 years agores_fax.c: Add chan locked precondition comments. 02/3702/1
Richard Mudgett [Tue, 23 Aug 2016 16:16:04 +0000 (11:16 -0500)] 
res_fax.c: Add chan locked precondition comments.

Change-Id: Ic10ae434536bbf7fb7055d6ab36cc50b8748a4e7

8 years agoast_framehook_detach() must be called with the channel locked. 01/3701/1
Richard Mudgett [Tue, 23 Aug 2016 15:42:08 +0000 (10:42 -0500)] 
ast_framehook_detach() must be called with the channel locked.

The framehook container could become corrupted if the channel lock is not
held before calling.

Change-Id: If0a1c7ba0484ed3a191106a7516526b905952584

8 years agores_fax: Fix latent bug exposed by ASTERISK-24841 changes. 00/3700/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

Backported from v13 revision 82bc0fd3ade77394e13062b6097732c224e77eaa
mainly to get the diff between v11 and v13 smaller but this also fixes
a potential deadlock when dealing with the chan and the peer together.

Change-Id: I6fda0877104a370af586a5e8cf9e161a484da78d

8 years agores_fax.c: Remove redundant locking. 99/3699/1
Richard Mudgett [Thu, 15 Jan 2015 17:35:05 +0000 (17:35 +0000)] 
res_fax.c: Remove redundant locking.

When FAX was developed, apparently the faxregistry.container used to be a
linked list that was converted to an ao2 container.  Some of the
replacement ao2 container operations still had explicit lock/unlocks
around them.

Two off nominal code paths in res_fax.c unlock the channel even though the
routine did not lock the channel and other code paths in the routine do
not unlock the channel.

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

Backported from v13 revision fa80d9658df8aff71a8975ab7d1fe477ea3f99b9.

Change-Id: I59a1b95a91dac8375e0db568ddb217bcd6d7d2fa

8 years agores_fax: Fix some curlies on the end of function definitions. 98/3698/1
Richard Mudgett [Thu, 15 Jan 2015 17:18:14 +0000 (17:18 +0000)] 
res_fax: Fix some curlies on the end of function definitions.

Backported from v13 revision 6c426e86bd470c3a2f3b73b3a070583c92c19af4.

Change-Id: Iaa561a17c88d4383971f4b4fc8cee24318e779c4

8 years agoMerge "Fix checks for allocation debugging." into 11
Joshua Colp [Wed, 24 Aug 2016 21:53:10 +0000 (16:53 -0500)] 
Merge "Fix checks for allocation debugging." into 11

8 years agoFix checks for allocation debugging. 93/3693/1
Corey Farrell [Fri, 19 Aug 2016 23:19:28 +0000 (19:19 -0400)] 
Fix checks for allocation debugging.

MALLOC_DEBUG should not be used to check if debugging is actually
enabled, __AST_DEBUG_MALLOC should be used instead.  MALLOC_DEBUG only
indicates that debugging is requested, __AST_DEBUG_MALLOC indicates it
is active.

Change-Id: I3ce9cdb6ec91b74ee1302941328462231be1ea53

8 years agoMerge "sip.conf: tlsclientmethod is using sslv23 as default." into 11
zuul [Fri, 19 Aug 2016 19:20:37 +0000 (14:20 -0500)] 
Merge "sip.conf: tlsclientmethod is using sslv23 as default." into 11

8 years agosip.conf: tlsclientmethod is using sslv23 as default. 38/3638/2
Alexander Traud [Thu, 18 Aug 2016 14:25:53 +0000 (16:25 +0200)] 
sip.conf: tlsclientmethod is using sslv23 as default.

When 'tlsclientmethod' is not specified in sip.conf, chan_sip uses the OpenSSL
SSLv23_method. This was documented incorrectly in the file sip.conf.sample.

SSLv23_method got its name in the 90s. Today, with OpenSSL 1.0.2, this method
enables (just) the secure TLSv1.0 and TLSv1.2. Or stated differently, that
function should have been called 'secure_method' or 'automatic_method' back in
the 90s.

Consequently please, specify 'tlsclientmethod=tlsv1' in your sip.conf only if
you face a server which has problems like not falling back to TLSv1.0
automatically.

ASTERISK-24425

Change-Id: I502ce6146b4504cadfd3973af8d6ec3994f54fa3

8 years agopbx.c: Crash in handle_hint_change due to uninitialized values 01/3601/2
Kevin Harwell [Wed, 17 Aug 2016 21:40:49 +0000 (16:40 -0500)] 
pbx.c: Crash in handle_hint_change due to uninitialized values

handle_hint_change calls extension_presence_state_helper, which returns the
presence state subtype and message when a valid state is available. If the
state is invalid then those values are not filled. If they have not been
properly initialized to NULL then when ast_free is later called on them
Asterisk crashes.

This patch initializes the subtype and message to NULL.

ASTERISK-25706 #close
patches:
  0008-handle_hint_change-initialize-presence_state.patch
   submitted by Tzafrir Cohen (license 5035)

Change-Id: I2eb08c68951b327c42df0798de60484c3a225a50

8 years agopbx.c: Additional fixes to ast_context_remove_extension_callerid2. 57/3557/1
Corey Farrell [Fri, 12 Aug 2016 04:30:27 +0000 (00:30 -0400)] 
pbx.c: Additional fixes to ast_context_remove_extension_callerid2.

Do not check registrar of the first extension head.  We should only check
the registrar when we match the priority.

Additionally fix a couple calls to strcmp which used the input callerid
instead of the clean version ex.cidmatch.

ASTERISK-26233

Change-Id: I17ea6881a18f40840ae9c1f5394aab1fbb3769f1

8 years agoRun mandatory cleanup when startup fails. 15/3515/1
Corey Farrell [Fri, 12 Aug 2016 03:11:23 +0000 (23:11 -0400)] 
Run mandatory cleanup when startup fails.

Errors during startup result in an exit.  These error branches should be
calling ast_run_atexit(0) to ensure mandatory cleanup is run.

ASTERISK-26267 #close

Change-Id: If226f2326ae2df7add20040696132214cf2bb680

9 years agoAdd missing checks during startup. 10/3410/1
Corey Farrell [Wed, 3 Aug 2016 20:38:21 +0000 (16:38 -0400)] 
Add missing checks during startup.

This ensures startup is canceled due to allocation failures from the
following initializations.
* channel.c: ast_channels_init
* format.c: ast_format_attr_init and ast_format_list_init

ASTERISK-26265 #close

Change-Id: I911ed08fa2a3be35de55903e0225957bcdbe9611

9 years agoMerge "pbx.c: Fix handling of '-' in extension name and callerid" into 11
zuul [Mon, 1 Aug 2016 13:36:07 +0000 (08:36 -0500)] 
Merge "pbx.c: Fix handling of '-' in extension name and callerid" into 11

9 years agoMerge "pbx.c: Allow dangerous functions when adding a hint to dialplan." into 11
zuul [Fri, 29 Jul 2016 10:49:37 +0000 (05:49 -0500)] 
Merge "pbx.c: Allow dangerous functions when adding a hint to dialplan." into 11

9 years agopbx.c: Fix handling of '-' in extension name and callerid 53/3353/6
Corey Farrell [Tue, 26 Jul 2016 22:42:50 +0000 (18:42 -0400)] 
pbx.c: Fix handling of '-' in extension name and callerid

This adds a two strings to ast_exten.  name to go with exten and
cidmatch_display to go with cidmatch.  The new fields contain input used
to add the extension in the first place.  The existing fields now
contain stripped input that excludes insignificant spaces and dashes.
These stripped fields should always be used for comparisons.  The
unstripped fields should normally be used for display, but displaying
stripped values will not cause runtime errors.

Note the actual string is only stored twice if it contains dashes.  If
no dashes are found then both 'char *' fields point to the same memory.
So this change has a minimum effect on memory usage.

The existing functions ast_get_extension_name and
ast_get_extension_cidmatch return unstripped values as they did before
this change.  Other similar bugs likely still exist where unstripped
extensions are saved outside pbx.c then passed back in.

ASTERISK-26233 #close

Change-Id: I6cd61ce57acc1570ca6cc14960c4c3b0a9eb837f

9 years agopbx.c: Allow dangerous functions when adding a hint to dialplan. 68/3368/1
Richard Mudgett [Wed, 27 Jul 2016 22:17:53 +0000 (17:17 -0500)] 
pbx.c: Allow dangerous functions when adding a hint to dialplan.

We can allow dangerous functions when adding a hint since altering
dialplan is itself a privileged activity.  Otherwise, we could never
execute dangerous functions.

ASTERISK-25996 #close
Reported by: Andrew Nagy

Change-Id: I4929ff100ad1200a0198262d069a34f2296e77ba

9 years agodsp.c: Correct DTMF twist dsp.conf documentation. 35/3335/2
Richard Mudgett [Tue, 26 Jul 2016 02:18:21 +0000 (21:18 -0500)] 
dsp.c: Correct DTMF twist dsp.conf documentation.

Change-Id: Idf97e3a72f1edc5fca58f2fa7b20785922be0cae

9 years agodsp.c: Fix erroneous fax tone detection. 34/3334/1
Richard Mudgett [Fri, 22 Jul 2016 03:28:25 +0000 (22:28 -0500)] 
dsp.c: Fix erroneous fax tone detection.

The Goertzel calculations get less accurate the lower the signal level
being worked with becomes because there is less resolution remaining.
If it is too low we can erroneously detect a tone where none really
exists.  The searched for fax frequencies not only need to be so much
stronger than the background noise they must also be a minimum strength.

* Add needed minimum threshold test to tone_detect().

* Set TONE_THRESHOLD to allow low volume frequency spread detection.

ASTERISK-26237 #close
Reported by: Richard Mudgett

Change-Id: I84dbba7f7628fa13720add6a88eae3b129e066fc

9 years agoMerge "chan_sip: Enable Session-Timers for SIP over TCP (and TLS)." into 11
zuul [Fri, 22 Jul 2016 21:07:00 +0000 (16:07 -0500)] 
Merge "chan_sip: Enable Session-Timers for SIP over TCP (and TLS)." into 11

9 years agochan_sip: Enable Session-Timers for SIP over TCP (and TLS). 32/3232/2
Alexander Traud [Tue, 19 Jul 2016 11:30:39 +0000 (13:30 +0200)] 
chan_sip: Enable Session-Timers for SIP over TCP (and TLS).

Asterisk defaults to timers=accept/refresher=uas. In that scenario, only in that
scenario, Sessions-Timers (RFC 4028) had no effect via TCP. This change enables
Session-Timers for SIP over TCP (and for SIP over TLS).

However with longer international calls via TCP, the SIP channel might break,
because all hops on the Internet route must stay online (have not a single power
outage, for example). Therefore with Session-Timers enabled (which are enabled
at default), you might see dropped calls. Consequently even with this change,
you might be better-off going for session-timers=refuse in your sip.conf.

ASTERISK-19968 #close

Change-Id: I1cd33453c77c56c8e1394cd60a6f17bb61c1d957

9 years agochan_sip: Prevent deadlock when issuing "sip show channels" 73/3273/4
George Joseph [Thu, 21 Jul 2016 14:05:03 +0000 (08:05 -0600)] 
chan_sip: Prevent deadlock when issuing "sip show channels"

sip_show_channels locks the dialogs container first then locks each
sip_pvt so it can spit out the details.  The rest of sip dialog
processing locks the sip_pvt first then locks the dialogs container
if it needs to.  Both lock in the order they need but deadlocks can
result.  To fix, sip_show_channels and sip_show_channelstats have
been converted to use an iterator rather than ao2_callback.  This way
the container is locked only while getting the next entry and is
unlocked when the callback is called.

ASTERISK-23013 #close

Change-Id: Id9980419909e811f89484950ed46ef117b9eb990

9 years agoMerge "Add conditional support for noreturn functions." into 11
zuul [Thu, 21 Jul 2016 19:20:36 +0000 (14:20 -0500)] 
Merge "Add conditional support for noreturn functions." into 11

9 years agoMerge "Unit tests: Use AST_TEST_DEFINE in conditional code only." into 11
zuul [Wed, 20 Jul 2016 15:57:51 +0000 (10:57 -0500)] 
Merge "Unit tests: Use AST_TEST_DEFINE in conditional code only." into 11

9 years agoMerge "res_rtp_asterisk: Count a roll-over of the sequence number even on lost packet...
zuul [Wed, 20 Jul 2016 15:29:21 +0000 (10:29 -0500)] 
Merge "res_rtp_asterisk: Count a roll-over of the sequence number even on lost packets." into 11

9 years agoAdd conditional support for noreturn functions. 56/3256/1
Corey Farrell [Wed, 20 Jul 2016 03:37:22 +0000 (23:37 -0400)] 
Add conditional support for noreturn functions.

This adds support for tagging functions with the noreturn attribute.
If DO_CRASH is enabled then ast_do_crash never returns.  If AST_DEVMODE
and DO_CRASH are enabled then failed assertions never return.  This can
resolve a large number of false positives with static analyzers.

ASTERISK-26220 #close

Change-Id: Icfb61e5fe54574eced4c3e88b317244f467ec753

9 years agoUnit tests: Use AST_TEST_DEFINE in conditional code only. 25/3225/1
Corey Farrell [Mon, 18 Jul 2016 23:36:02 +0000 (19:36 -0400)] 
Unit tests: Use AST_TEST_DEFINE in conditional code only.

If AST_TEST_DEFINE is not conditional to TEST_FRAMEWORK it produces dead
code.  This places all existing unit tests into a conditional block if
they weren't already.

ASTERISK-26211 #close

Change-Id: I8ef83ee11cbc991b07b7a37ecb41433e8c734686

9 years agores_rtp_asterisk: Count a roll-over of the sequence number even on lost packets. 22/3222/1
Alexander Traud [Mon, 18 Jul 2016 10:13:25 +0000 (12:13 +0200)] 
res_rtp_asterisk: Count a roll-over of the sequence number even on lost packets.

With this change, the initial RTP sequence number is randomly chosen not between
0 and 65535 (0xffff) but 0 and 32767 (0x7fff). This assures, the roll-over
counter (ROC) synchronization is not lost for sRTP, when the very first RTP
packets get lost; see http://srtp.sourceforge.net/faq.html#Q6

ASTERISK-26207 #close

Change-Id: I9a527e3aa3ce8f3becc5131d7ba32b57b5845464

9 years agoMakefile: Suppress echoing of target 'config' again. 19/3219/1
Alexander Traud [Mon, 18 Jul 2016 09:35:33 +0000 (11:35 +0200)] 
Makefile: Suppress echoing of target 'config' again.

ASTERISK-26038 #close

Change-Id: I5746cf639f3fdc6332e8a97cf01f979e30bf403f

9 years agoMerge "app_queue: Only remove queue member from pending when state changes." into 11
zuul [Fri, 15 Jul 2016 17:26:54 +0000 (12:26 -0500)] 
Merge "app_queue: Only remove queue member from pending when state changes." into 11

9 years agoMerge "pbx: Fix leak of timezone for time based includes." into 11
zuul [Thu, 14 Jul 2016 17:05:22 +0000 (12:05 -0500)] 
Merge "pbx: Fix leak of timezone for time based includes." into 11

9 years agoMerge "BuildSystem: Avoid obsolete warning with pthread.m4 on autoconf." into 11
zuul [Thu, 14 Jul 2016 15:48:55 +0000 (10:48 -0500)] 
Merge "BuildSystem: Avoid obsolete warning with pthread.m4 on autoconf." into 11

9 years agoMerge "res_rtp_asterisk: Enable Forward Secrecy (PFS) for DTLS." into 11
zuul [Thu, 14 Jul 2016 14:55:09 +0000 (09:55 -0500)] 
Merge "res_rtp_asterisk: Enable Forward Secrecy (PFS) for DTLS." into 11

9 years agoapp_queue: Only remove queue member from pending when state changes. 04/3204/1
Joshua Colp [Thu, 14 Jul 2016 12:45:10 +0000 (09:45 -0300)] 
app_queue: Only remove queue member from pending when state changes.

It is possible for a not in use state change to occur multiple
times causing a queue member to be removed from the pending call
container prematurely.

The first not in use state change will remove the queue member
from the container. At this moment the member may be called and
placed in the pending container. After this another not in use
state change can be received which will remove it from the
container. Despite being called at this point the code will
incorrectly see that there are no pending calls to it.

This change only removes it from the pending container if the
state has actually changed.

ASTERISK-26133 #close
patches:
  app_queue.diff submitted by Richard Miller (license 5685)

Change-Id: Ie5a7f17a44f98e9159e9b85009ce3f8393aa78c0

9 years agopbx: Fix leak of timezone for time based includes. 01/3201/1
Corey Farrell [Thu, 14 Jul 2016 07:40:26 +0000 (03:40 -0400)] 
pbx: Fix leak of timezone for time based includes.

Create include_free to run ast_destroy_timing and ast_free, use that in
all places that freed an ast_include structure.  This fixes a couple of
paths that previously did not run ast_destroy_timing.

ASTERISK-26196 #close

Change-Id: I1671bd111bef0dc113e8bf8f77f89fcfc395d838

9 years agores_rtp_asterisk: Enable Forward Secrecy (PFS) for DTLS. 68/3068/4
Alexander Traud [Wed, 22 Jun 2016 12:29:26 +0000 (14:29 +0200)] 
res_rtp_asterisk: Enable Forward Secrecy (PFS) for DTLS.

Since July 2014, TLS based protocols (SIP over TLS, Secure WebSockets, HTTPS)
support PFS thanks to ASTERISK-23905. In July 2015, the same feature was added
for DTLS. The source code from main/tcptls.c should have been re-used to ease
security audits. Therefore, this change rolls back the change from July 2015 and
re-uses the code from July 2014. This has the additional benefits to work under
CentOS 7 and enabling not just ECDHE but DHE based cipher suites as well.

ASTERISK-25659 #close
Reported by: StefanEng86, urbaniak, pay123
Tested by: sarumjanuch, traud
patches:
res_rtp_asterisk.patch submitted by sarumjanuch
dtls_centos_step_1.patch submitted by traud
dtls_centos_step_2.patch submitted by traud

Change-Id: I537cadf4421f092a613146b230f2c0ee1be28d5c

9 years agoBuildSystem: Avoid obsolete warning with pthread.m4 on autoconf. 85/3185/1
Alexander Traud [Wed, 13 Jul 2016 13:57:08 +0000 (15:57 +0200)] 
BuildSystem: Avoid obsolete warning with pthread.m4 on autoconf.

Updated the macro-set autoconf/ax_pthread.m4 to its latest upstream version.

ASTERISK-26046 #close

Change-Id: I11abc11d17acd2b6a8a5a5be8ae8e0949dab9cc7

9 years agoMerge "BuildSystem: Allow own CFLAGS on ./configure." into 11
zuul [Wed, 13 Jul 2016 11:13:29 +0000 (06:13 -0500)] 
Merge "BuildSystem: Allow own CFLAGS on ./configure." into 11

9 years agoMerge "BuildSystem: Avoid obsolete warning with libcurl.m4 on autoconf." into 11
zuul [Tue, 12 Jul 2016 20:44:40 +0000 (15:44 -0500)] 
Merge "BuildSystem: Avoid obsolete warning with libcurl.m4 on autoconf." into 11

9 years agoBuildSystem: Allow own CFLAGS on ./configure. 71/3171/1
Alexander Traud [Tue, 12 Jul 2016 08:50:22 +0000 (10:50 +0200)] 
BuildSystem: Allow own CFLAGS on ./configure.

Before this change, make failed with the error
Unknown value '' found in build_tools/menuselect-deps for NATIVE_ARCH
when CFLAGS were supplied to the configure script. This was introduced with
<https://reviewboard.asterisk.org/r/1852/> which disabled BUILD_NATIVE when
CFLAGS were supplied. Those who need different -march= values, please, go for
./configure
make menuselect.makeopts or make menuselect
./menuselect/menuselect --disable BUILD_NATIVE

ASTERISK-25289 #close

Change-Id: Ic6365d5a97bb9b3556858f06432a8d1cfa83eebc

9 years agoast_expr2: Fix off-nominal memory leak. 66/3166/1
Richard Mudgett [Mon, 11 Jul 2016 18:42:55 +0000 (13:42 -0500)] 
ast_expr2: Fix off-nominal memory leak.

Thanks to ibercom for pointing out a memory leak that was missed
in the earlier patch for the issue.

ASTERISK-26119
Reported by: Alexei Gradinari

Change-Id: I9a151f5c4725d97fb82a9e938bc73dc659532b71

9 years agochan_sip: Handle a request to negotiate T.38 after it is enabled. 52/3152/1
Joshua Colp [Thu, 7 Jul 2016 15:38:45 +0000 (12:38 -0300)] 
chan_sip: Handle a request to negotiate T.38 after it is enabled.

Some T.38 implementations may send another re-invite after the initial
one which adds additional negotiation details (such as the max bitrate).
Currently this will fail when passthrough is being done in chan_sip as we
do nothing if T.38 is already active.

Other handlers of T.38 inside of Asterisk (such as res_fax) handle this
scenario so this change adds support for it to chan_sip. If a request
to negotiate is received while T.38 is already enabled a new re-INVITE is
sent and negotiation is done again.

ASTERISK-26179 #close

Change-Id: I0298494d3da6df3219bbfa4be9aa04015043145c

9 years agoBuildSystem: Avoid obsolete warning with libcurl.m4 on autoconf. 43/3143/1
Alexander Traud [Mon, 4 Jul 2016 10:58:39 +0000 (12:58 +0200)] 
BuildSystem: Avoid obsolete warning with libcurl.m4 on autoconf.

Updated the macro-set autoconf/libcurl.m4 to its latest upstream version. This
avoids a warning about an obsolete macro on AC_HELP_STRING, because Asterisk is
using AS_HELP_STRING everywhere else already.

ASTERISK-26046

Change-Id: I8299faf504ceaeee3e39930c59293809e116c631

9 years agoMerge "BuildSystem: Avoid obsolete warning with AC_TYPE_SIGNAL on autoconf." into 11
zuul [Wed, 29 Jun 2016 14:34:21 +0000 (09:34 -0500)] 
Merge "BuildSystem: Avoid obsolete warning with AC_TYPE_SIGNAL on autoconf." into 11

9 years agoBuildSystem: Fix a few issues hightlighted by gcc 6.x 97/3097/1
George Joseph [Tue, 28 Jun 2016 13:22:24 +0000 (07:22 -0600)] 
BuildSystem:  Fix a few issues hightlighted by gcc 6.x

gcc 6.1.1 caught a few more issues.
Made sure the unit tests still pass for the func_env and stdtime
issues.

ASTERISK-26157 #close

Change-Id: I6664d8f34a45bc1481d2a854481c7878b0c1cf8e

9 years agoBuildSystem: Avoid obsolete warning with AC_TYPE_SIGNAL on autoconf. 87/3087/1
Alexander Traud [Thu, 23 Jun 2016 09:33:06 +0000 (11:33 +0200)] 
BuildSystem: Avoid obsolete warning with AC_TYPE_SIGNAL on autoconf.

Removed the obsolete macro AC_TYPE_SIGNAL because Asterisk does not use K&R C
but requires ANSI C anyway.

ASTERISK-26046

Change-Id: I914c014385e1862102d90fe7650621def78db02e

9 years agoMerge "res_fax: Fix reference leak in fax_v21_session_new." into 11
zuul [Thu, 23 Jun 2016 02:50:23 +0000 (21:50 -0500)] 
Merge "res_fax: Fix reference leak in fax_v21_session_new." into 11

9 years agoMerge "res_rtp_asterisk: Fix a self-comparison identified by gcc 6" into 11
zuul [Thu, 23 Jun 2016 01:36:42 +0000 (20:36 -0500)] 
Merge "res_rtp_asterisk:  Fix a self-comparison identified by gcc 6" into 11

9 years agoMerge "chan_unistim: Fix memcpy in get_to_address" into 11
zuul [Wed, 22 Jun 2016 23:50:55 +0000 (18:50 -0500)] 
Merge "chan_unistim:  Fix memcpy in get_to_address" into 11

9 years agores_fax: Fix reference leak in fax_v21_session_new. 84/3084/1
Corey Farrell [Wed, 22 Jun 2016 20:04:54 +0000 (16:04 -0400)] 
res_fax: Fix reference leak in fax_v21_session_new.

fax_v21_session_new created a session details object but only released
the allocation reference during error conditions.  fax_session_new adds
it's own reference to details if needed so the caller is always
responsible for cleaning it's own reference.

ASTERISK-26141 #close

Change-Id: Ie7fc52a83b6596ce9ce2d5a2bd9f3e204f48fc88

9 years agores_rtp_asterisk: Fix a self-comparison identified by gcc 6 81/3081/1
George Joseph [Wed, 22 Jun 2016 18:41:57 +0000 (12:41 -0600)] 
res_rtp_asterisk:  Fix a self-comparison identified by gcc 6

gcc 6 caught a previously unidentified self-comparison in
ice_candidate_cmp.  Fixed it and re-ordered the predicates for better
short-circuiting.

ASTERISK-26140 #close

Change-Id: I3da713c568e24064430257b3502fbdafd35af7a7

9 years agochan_unistim: Fix memcpy in get_to_address 73/3073/2
George Joseph [Wed, 22 Jun 2016 15:37:23 +0000 (09:37 -0600)] 
chan_unistim:  Fix memcpy in get_to_address

A code block only enabled when HAVE_PKTINFO is not defined (FreeBSD)
was using a pointer to a pointer as the destination of a memcpy and a
'&' instead of '*' in the sizeof.

ASTERISK-26138 #close

Change-Id: Id4927ff256c0e470bdf7bcfc025146a2f656e708

9 years agoBuildSystem: Avoid obsolete warning with AC_FUNC_SETVBUF_REVERSED on autoconf. 77/3077/1
Alexander Traud [Wed, 22 Jun 2016 15:55:05 +0000 (17:55 +0200)] 
BuildSystem: Avoid obsolete warning with AC_FUNC_SETVBUF_REVERSED on autoconf.

Removed the obsolete macro AC_FUNC_SETVBUF_REVERSED because Asterisk does not
support the platform SVR2 from the year 1987 anymore.

ASTERISK-26046

Change-Id: I28161b037feb2d29ab46ed20e785928460226c22

9 years agoMerge "res_rtp_asterisk: fix memory leak in dtls" into 11
zuul [Wed, 22 Jun 2016 15:16:53 +0000 (10:16 -0500)] 
Merge "res_rtp_asterisk: fix memory leak in dtls" into 11

9 years agores_rtp_asterisk: fix memory leak in dtls 51/3051/2
Torrey Searle [Tue, 21 Jun 2016 11:52:20 +0000 (13:52 +0200)] 
res_rtp_asterisk: fix memory leak in dtls

ensure that cert bios get freed after creating the fingerprint

ASTERISK-26129 #close

Change-Id: I44d23aea07dce80176ca1ff877c5ace9452ef451

9 years agoMerge "res_rtp_asterisk: Use latest DTLS version available by underlying platform...
zuul [Wed, 22 Jun 2016 00:04:41 +0000 (19:04 -0500)] 
Merge "res_rtp_asterisk: Use latest DTLS version available by underlying platform." into 11

9 years agores_rtp_asterisk: Use latest DTLS version available by underlying platform. 53/3053/2
Alexander Traud [Tue, 21 Jun 2016 12:05:30 +0000 (14:05 +0200)] 
res_rtp_asterisk: Use latest DTLS version available by underlying platform.

Do not use DTLSv1_method() but DTLS_method() when available in OpenSSL of the
underlying platform. This change enables DTLS 1.2 since OpenSSL 1.0.2, for
WebRTC (DTLS-SRTP via SIP-over-WebSockets). This change enables AEAD-based
cipher-suites.

ASTERISK-26130 #close

Change-Id: I41f24448d6d2953e8bdb97c9f4a6bc8a8f055fd0

9 years agoBuildSystem: Avoid obsolete warning with HELP_STRING on autoconf. 56/3056/1
Alexander Traud [Tue, 21 Jun 2016 13:01:40 +0000 (15:01 +0200)] 
BuildSystem: Avoid obsolete warning with HELP_STRING on autoconf.

Some configure scripts used both AC_HELP_STRING and its replacement
AS_HELP_STRING. For consistency and to avoid obsolete warnings, those were
changed to AS_HELP_STRING.

ASTERISK-26046

Change-Id: I8aad4fd2bdee40aa2a31ce3339a1eb33ff4f5b0f

9 years agofix: memory and resource leaks 50/3050/1
Alexei Gradinari [Mon, 20 Jun 2016 20:09:05 +0000 (16:09 -0400)] 
fix: memory and resource leaks

ASTERISK-26119 #close

Change-Id: Iecbf7d0f360a021147344c4e83ab242fd1e7512c

9 years agohttp: leverage 'bindaddr' for TLS in http.conf 42/3042/1
Alexander Traud [Mon, 20 Jun 2016 13:05:09 +0000 (15:05 +0200)] 
http: leverage 'bindaddr' for TLS in http.conf

The internal HTTP/WebSocket server supports both TCP and TLS, which can be
activated separately via the file http.conf. The source code intends to re-use
the TCP parameter 'bindaddr' for TLS, even if 'tlsbindaddr' is not specified
explicitly. This did not work because of a typo. This change resolves this typo.

ASTERISK-26126 #close

Change-Id: I5efb0409ae12044dfb3495b6b97b6d40a8c9c51f

9 years agochan_sip: bigger buffers for headers, better failure mode 35/3035/1
Vasil Kolev [Tue, 31 May 2016 14:10:29 +0000 (17:10 +0300)] 
chan_sip: bigger buffers for headers, better failure mode

Currently chan_sip can give weird messages if the contacts don't
fit in the From: or To: headers. This fix changes the from,to and
invite variables to use ast_str, allocates and deallocates them and
resizes them if needed.

ASTERISK-26069 #close

Change-Id: I1b68fcbddca6f6cc7d7a92fe1cb0d5430282b2b3

9 years agoMerge "core: Not the configured but granted number of possible file descriptors....
Joshua Colp [Fri, 10 Jun 2016 20:51:53 +0000 (15:51 -0500)] 
Merge "core: Not the configured but granted number of possible file descriptors." into 11

9 years agocore: Not the configured but granted number of possible file descriptors. 71/2971/3
Alexander Traud [Wed, 8 Jun 2016 12:20:26 +0000 (14:20 +0200)] 
core: Not the configured but granted number of possible file descriptors.

With CLI "core show settings", simply the parameter maxfiles of the file
asterisk.conf was shown. If that parameter was not set, nothing was displayed
although the environment might have set a default number itself. Or if maxfiles
were not granted (completely), still maxfiles was shown. Now, the maximum number
of possible file descriptors in the environment is shown.

ASTERISK-26097

Change-Id: I2df5c58863b5007b34b77adbe28b885dfcdf7e0b

9 years agobuild: Fix ast_sockaddr initialization to be more portable 81/2981/2
George Joseph [Thu, 9 Jun 2016 14:20:33 +0000 (08:20 -0600)] 
build:  Fix ast_sockaddr initialization to be more portable

A change to glibc 2.22 changed the order of the sockadddr_storage
members which caused the places where we do an initialization of
ast_sockaddr with '{ { 0, 0, } }' to fail compilation.  Those
initializers (which we shouldn't have been using anyway) have been
replaced with memsets.

Change-Id: Idd1b3b320903d8771bfe221f0b015685de628fa4

9 years agoMerge "astfd: Not maximum size of a single file but maximum file descriptors." into 11
zuul [Thu, 9 Jun 2016 12:53:37 +0000 (07:53 -0500)] 
Merge "astfd: Not maximum size of a single file but maximum file descriptors." into 11

9 years agoMerge "BuildSystem: Avoid 'ar cru' and use 'ar cr' instead." into 11
zuul [Thu, 9 Jun 2016 02:49:05 +0000 (21:49 -0500)] 
Merge "BuildSystem: Avoid 'ar cru' and use 'ar cr' instead." into 11

9 years agoastfd: Not maximum size of a single file but maximum file descriptors. 67/2967/1
Alexander Traud [Wed, 8 Jun 2016 10:58:48 +0000 (12:58 +0200)] 
astfd: Not maximum size of a single file but maximum file descriptors.

With menuselect "DEBUG_FD_LEAKS" and CLI "core show fd", the maximum size of a
single file was shown. Now, the maximum number of possible file descriptors is
shown.

ASTERISK-26097

Change-Id: Icf98d145774b38cac144ca76d19eaef42ce659a3

9 years agoFix #include poll.h and sys/cdefs.h 64/2964/1
Timo Teräs [Thu, 2 Jun 2016 19:53:39 +0000 (22:53 +0300)] 
Fix #include poll.h and sys/cdefs.h

POSIX defines poll.h, sys/poll.h should not be used at is c-library
internal header which may or may not exist. Notable in musl it
generates warning of being incorrect. And add explict include of
sys/cdefs.h where needed.

Change-Id: I142930df53fe7585a06b854b6faddc5301e024be

9 years agores_srtp: Instead of libSRTP use OpenSSL as random source. 62/2962/1
Alexander Traud [Tue, 7 Jun 2016 10:45:34 +0000 (12:45 +0200)] 
res_srtp: Instead of libSRTP use OpenSSL as random source.

Since libSRTP 1.5, its Random Number Generator (RNG) is not maintained anymore.
Therefore, the symbol RAND_bytes is used instead of crypto_get_random.

ASTERISK-24436 #close

Change-Id: Iea0bae4d4e3c9aa0926ea442b6484b5159789d96

9 years agoBuildSystem: Avoid 'ar cru' and use 'ar cr' instead. 59/2959/1
Alexander Traud [Tue, 7 Jun 2016 07:16:02 +0000 (09:16 +0200)] 
BuildSystem: Avoid 'ar cru' and use 'ar cr' instead.

In several internal library projects, the files are archived with the help of
'ar cr'. Only the projects editline and the Objective Open H.323 stack
implementation in C (ooh323c) use 'ar cru' instead. Recently, some platforms
changed the default parameters of AR which creates "/usr/bin/ar: `u' modifier
ignored since `D' is the default (see `U')". For consistency and to avoid this
message all projects use 'ar cr' now.

ASTERISK-26091 #close

Change-Id: I710a9b1c01c1b5a1931a646098c044c8161ead40

9 years agoMerge "Makefile: remove OSARCH check for init install" into 11
zuul [Mon, 23 May 2016 21:16:12 +0000 (16:16 -0500)] 
Merge "Makefile: remove OSARCH check for init install" into 11

9 years agoMakefile: remove OSARCH check for init install 95/2895/1
Tzafrir Cohen [Wed, 18 May 2016 15:58:20 +0000 (18:58 +0300)] 
Makefile: remove OSARCH check for init install

There are more specific checks for the platform.

Specifically this allows installing OS/X init scripts.

ASTERISK-26038 #close

Change-Id: If08933621145b10362a0cfe73c079301d9c13f50
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
9 years agofunc_curl: Don't trim response text on non-ASCII characters 93/2893/1
Ivan Poddubny [Sat, 21 May 2016 10:42:45 +0000 (13:42 +0300)] 
func_curl: Don't trim response text on non-ASCII characters

The characters 0x80-0xFF were trimmed as well as 0x00-0x20 because of
a signed comparison.

ASTERISK-25669 #close
Reported by: Jesper
patches:
  strings.curl.trim.patch submitted by Jesper (License 5518)

Change-Id: Ia51e169f24e3252a7ebbaab3728630138ec6f60a

9 years agoMerge "udptl: Don't eat sequence numbers until OK is received" into 11
zuul [Thu, 19 May 2016 09:32:29 +0000 (04:32 -0500)] 
Merge "udptl:  Don't eat sequence numbers until OK is received" into 11

9 years agoudptl: Don't eat sequence numbers until OK is received 69/2869/3
George Joseph [Wed, 18 May 2016 12:54:14 +0000 (06:54 -0600)] 
udptl:  Don't eat sequence numbers until OK is received

Scenario:
Local fax -> Asterisk w/ firewall -> Provider -> Remote fax

* Local fax starts rtp call to remote fax
* Remote fax starts t38 call back to local fax.
* Local fax sends t38 no-signal to Asterisk before sending an OK.
* udptl processes the frame and increments the expected sequence number.
* chan_sip drops the frame because the call isn't up so nothing goes out
  the external interface to open the port for incoming packets.
* Local fax sends OK and Asterisk sends OK to the remote fax.
* Remote fax sends t38 packets which are dropped by the firewall.
* Local fax re-sends t38 no-signal with the same sequence number.
* udptl drops the frame because it thinks it's a dup.
* Still no outgoing packets to open the firewall.
* t38 negotiation fails.

The patch drops frames t38 received before udptl sequence processing
when the call hasn't been answered yet.  The second no-signal frame
is then seen as new and is relayed out the external interface which
opens the port and allows negotiation to continue.

ASTERISK-26034 #close

Change-Id: I11744b39748bd2ecbbe8ea84cdb4f3c5943c5af9

9 years agochan_sip: Prevent extra Session-Expires headers from being added 54/2854/2
George Joseph [Tue, 17 May 2016 16:14:51 +0000 (10:14 -0600)] 
chan_sip:  Prevent extra Session-Expires headers from being added

When chan_sip does a re-INVITE to refresh a session and authentication
is required, the INVITE with the Authorization header containes a
second Session-Expires header without the ";refersher=" parameter.
This is causing some proxies to return a 400.  Also, when Asterisk is
the uas and the refresher, it is including the Session-Expires and
Min-SE headers in OPTIONS messages which is not allowed per RFC4028.

This patch (based on the reporter's) Checks to see if a Session-Expires
header is already in the message before adding another one.  It also
checks that the method is INVITE or UPDATE.

ASTERISK-26030 #close

Change-Id: I58a7b07bab5a3177748d8a7034fb8ad8e11ce1d9

9 years agoMerge "logger: Add PID to syslog messages." into 11
zuul [Sun, 15 May 2016 00:50:47 +0000 (19:50 -0500)] 
Merge "logger: Add PID to syslog messages." into 11

9 years agofollowme: delete the right recorded name file 29/2829/1
Tzafrir Cohen [Tue, 10 May 2016 13:17:29 +0000 (16:17 +0300)] 
followme: delete the right recorded name file

FollowMe with the option a records the name of the caller and plays it
to the callee. However it has failed to clean up that recorded file
as it tried to delete the file name without the '.sln' extension.

ASTERISK-26008 #close

Change-Id: I79d7b1be7d5cde57bf076d9389e2a8a4422776ec
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
9 years agologger: Add PID to syslog messages. 12/2812/1
Alexei Gradinari [Thu, 5 May 2016 21:41:21 +0000 (17:41 -0400)] 
logger: Add PID to syslog messages.

During refactoring of this support the addition of
the PID to messages was removed. This change adds it
back in.

ASTERISK-25538 #close

Change-Id: Ie2d43b0652e59b7ac319a7dba94501540d70ba36

9 years agores_fax/t38_gateway: Peer V.21 session is created on wrong channel 98/2798/1
Alexei Gradinari [Tue, 10 May 2016 14:20:54 +0000 (10:20 -0400)] 
res_fax/t38_gateway: Peer V.21 session is created on wrong channel

The channel and peer V.21 sessions are created on the same channel now.
The peer V.21 session should be created only on peer channel
when one of channel can handle T.38.

Also this patch enable debug for T.38 gateway session
if global fax debug enabled.

ASTERISK-25982

Change-Id: I78387156ea521a77eb0faf170179ddd37a50430e

9 years agoapp_voicemail: always copy dynamic struct to avoid race condition 46/2746/2
Andrew Nagy [Thu, 17 Mar 2016 19:29:38 +0000 (12:29 -0700)] 
app_voicemail: always copy dynamic struct to avoid race condition

Voicemail email addresses can be corrupt or voicemail
emails can end up being sent to the wrong email address if asterisk is
reading voicemail.conf during a reload and processing an email at the
same time. This patch always copies the struct that would otherwise only
be copied once.

ASTERISK-24463 #close
Reported by: John Campbell
Tested by: Etienne Lessard
Tested by: Andrew Nagy
Change-Id: I3a0643813116da84e2617291903d0d489b7425fb

9 years agoMerge "config: Fix ast_config_text_file_save writability check for missing files...
Joshua Colp [Wed, 27 Apr 2016 20:40:16 +0000 (15:40 -0500)] 
Merge "config:  Fix ast_config_text_file_save writability check for missing files" into 11

9 years agoMerge "Fix case sensitive actions in AMI QueueSummary and QueueStatus" into 11
zuul [Tue, 26 Apr 2016 00:10:37 +0000 (19:10 -0500)] 
Merge "Fix case sensitive actions in AMI QueueSummary and QueueStatus" into 11