Commit Graph

28255 Commits

Author SHA1 Message Date
Matt Jordan
82529ae4e6 app_queue: Prevent crash when a call is forwarded to an invalid location
When a call forward attempt is made from a Queue member, the current
code will hang up the forwarding channel in an off-nominal condition
prior to raising the Stasis events informing the rest of Asterisk that
the call was forwarded. This will result in a slew of dreaded FRACKs,
most likely leading to a crash.

This patch modifies the code such that we don't hang up the forwarding
channel even in an off-nominal condition until we've safely raised the
Stasis messages.

ASTERISK-25797 #close

Change-Id: Ife5abed351691fd79105321636eaa8ea8dcdba38
2016-08-11 13:56:12 -05:00
zuul
ef7361659f Merge "res_resolver_unbound: Allow compilation with libunbound version < 1.5" into 14 2016-08-11 12:30:19 -05:00
zuul
b08497c048 Merge "channels/chan_pjsip: Add PJSIP_SEND_SESSION_REFRESH" into 14 2016-08-11 11:43:20 -05:00
Joshua Colp
01c49ac889 Merge "res_srtp: Move SDP SRTP code from the core to res_srtp." into 14 2016-08-11 06:20:38 -05:00
zuul
9c5bc68e0f Merge "alembic/sqlalchemy: auto increment only allowed on a single column" into 14 2016-08-10 20:26:06 -05:00
Richard Mudgett
34d366eb0c res_srtp: Move SDP SRTP code from the core to res_srtp.
A patch made to the master branch (Now the 14 branch) inadvertently made
libsrtp a required dependency in order to compile Asterisk.  Rather than
create dummy defines to substitute for the defines supplied by libsrtp
when libsrtp is not available, most of the code in sdp_srtp.c is moved
into res_srtp.c.  This gets more code out of Asterisk's core that isn't
used when SRTP is not available.  This also makes another inadvertent
required dependency on libsrtp by Asterisk's core unlikely.

ASTERISK-26253 #close
Reported by: Ben Merrills

Change-Id: I0a46cde81501c0405399c2588633ae32706d1ee7
2016-08-10 17:32:42 -05:00
Alexei Gradinari
ecad35e147 pjsip: Fix deadlock with suspend taskprocessor on masquerade
If both channels which should be masqueraded
are in the same serializer:
1st channel will be locked waiting condition 'complete'
2nd channel will be locked waiting condition 'suspended'

On heavy load system a chance that both channels will be in
the same serializer 'pjsip/distibutor' is very high.

To reproduce compile res_pjsip/pjsip_distributor.c with
DISTRIBUTOR_POOL_SIZE=1

Steps to reproduce:
1. Party A calls Party B (bridged call 'AB')
2. Party B places Party A on hold
3. Party B calls Voicemail app (non-bridged call 'BV')
4. Party B attended transfers Party A to voicemail using REFER.
5. When asterisk masquerades calls 'AB' and 'BV',
   a deadlock is happened.

This patch adds a suspension indicator to the taskprocessor.
When a session suspends/unsuspends the serializer
it sets the indicator to the appropriate state.
The session checks the suspension indicator before
suspend the serializer.

ASTERISK-26145 #close

Change-Id: Iaaebee60013a58c942ba47b1b4930a63e686663b
2016-08-10 15:14:56 -05:00
Kevin Harwell
223b7756a6 alembic/sqlalchemy: auto increment only allowed on a single column
The extensions table defined two columns (id and priority) as primary key
autoincrement columns. However only one is allowed when defining the primary
key.

This patch removes the autoincrement attribute from the priority column since
it does not need to be as such and really should not have been on there in the
first place.

This patch also removes 'context', 'exten', and 'priority' from the primary key
index and creates a new combined unique contraint index on them.

ASTERISK-26183 #close

Change-Id: Ib9c712c612a4d7ec1edb0dcb77f1bae0905a470b
2016-08-10 13:50:20 -05:00
George Joseph
a8512f9afe res_resolver_unbound: Allow compilation with libunbound version < 1.5
libunbound at version 1.4.20 (which CentOS still uses) declared all
of their string function parameters as as 'char *'.  1.4.21 changed
them all to 'const char *'.  Thankfully 1.4.21 also introduced the
UNBOUND_VERSION_MAJOR define so configure now checks for that and
sets HAVE_UNBOUND_CONST_PARAMS.  res_resolver_unbound then checks
that and casts away the 'const' if it's not set.

Tested compile and testsuite on CentOS6 (1.4.20), Ubuntu14 (1.4.22) and
Fedora24 (1.5.4).  There are a few failing tests to be addressed though.

ASTERISK-26283 #close

Change-Id: Ib708b19b706c5d0ba7b7d5473e6df339d9ae4148
2016-08-10 11:08:25 -06:00
Matt Jordan
eec60dd773 channels/chan_pjsip: Add PJSIP_SEND_SESSION_REFRESH
This patch adds a new PJSIP specific dialplan function,
PJSIP_SEND_SESSION_REFRESH. When invoked on a PJSIP channel, the media
session will be refreshed via either an UPDATE or re-INVITE request.
When used in conjunction with the PJSIP_MEDIA_OFFER dialplan function,
the formats in use on a PJSIP channel can be re-negotiated and changed
dynamically after call setup.

ASTERISK-26277 #close

Change-Id: Ib98fe09ba889aafe26d58d32f0fd1323f8fd9b1b
2016-08-10 11:26:33 -05:00
zuul
d85e9d99cb Merge "res_rtp_asterisk: Cache local RTCP address." into 14 2016-08-10 10:37:40 -05:00
zuul
400ce294e6 Merge "Produce friendly error when AST_MODULE_SELF_SYM is not defined." into 14 2016-08-09 19:09:36 -05:00
zuul
00a0101f2a Merge "res_pjsip_mwi: fix unsolicited mwi blocks PJSIP stack" into 14 2016-08-09 16:36:02 -05:00
Mark Michelson
5c203c6ca3 res_rtp_asterisk: Cache local RTCP address.
When an RTCP packet is sent or received, res_rtp_asterisk generates a
Stasis event that contains the RTCP report as well as the local and
remote addresses that the report pertains to.

The addresses are determined using ast_find_ourip(). For the local
address, this will typically result in a lookup of the hostname of the
server, and then a DNS lookup of that hostname. If you do not have the
host in /etc/hosts, then this results in a full DNS lookup, which can
potentially block for some time.

This is especially problematic when performing RTCP reads, since those
are done on the same thread responsible for reading and writing media.

This patch addresses the issue by performing a lookup of the local
address when RTCP is allocated. We then use this cached local address
for the Stasis events when necessary.

ASTERISK-26280 #close
Reported by Mark Michelson

Change-Id: I3dd61882c2e57036f09f0c390cf38f7c87e9b556
2016-08-09 16:22:47 -05:00
zuul
028171f465 Merge "res_pjsip_outbound_publish: Use a serializer shutdown group for unload." into 14 2016-08-09 16:19:01 -05:00
Corey Farrell
bbaebd75c4 Produce friendly error when AST_MODULE_SELF_SYM is not defined.
Modules must define AST_MODULE_SELF_SYM to be used as the name of a
generated function.  This produces a friendly error when it's not
defined.

ASTERISK-26278 #close

Change-Id: Ib9d35a08104529c516d636771365e02c6e77a45b
2016-08-08 20:48:33 -04:00
Alexei Gradinari
4d6d3eb268 res_pjsip_mwi: fix unsolicited mwi blocks PJSIP stack
The PJSIP taskprocessors could be overflowed on startup
if there are many (thousands) realtime endpoints
configured with unsolicited mwi.
The PJSIP stack could be totally unresponsive for a few minutes
after boot completed.

This patch creates a separate PJSIP serializers pool for mwi
and makes unsolicited mwi use serializers from this pool.
This patch also adds 2 new global options to tune taskprocessor
alert levels: 'mwi_tps_queue_high' and 'mwi_tps_queue_low'.

This patch also adds new global option 'mwi_disable_initial_unsolicited'
to disable sending unsolicited mwi to all endpoints on startup.
If disabled then unsolicited mwi will start processing
on next endpoint's contact update.

ASTERISK-26230 #close

Change-Id: I4c8ecb82c249eb887930980a800c9f87f28f861a
2016-08-08 13:58:31 -05:00
Alexei Gradinari
5d74c0ea30 app_voicemail: Add taskprocessor alert level options.
On heavy loaded system with IMAP or DB storage,
'app_voicemail' taskprocessor queue could reach 500 scheduled tasks.
It could happen when the IMAP or DB server dies or is unreachable.
It could happen on startup when there are many (thousands)
realtime endpoints configured with unsolicited mwi.
If the taskprocessor queue reaches the high water level
then the alert is triggered and pjsip stops processing new requests
until the queue reaches the low water level to clear the alert.

This patch adds 2 new 'general' configuration options
to tune taskprocessor alert levels:
'tps_queue_high' - Taskprocessor high water alert trigger level.
'tps_queue_low' - Taskprocessor low water clear alert level

ASTERISK-26229 #close

Change-Id: I766294fbffedf64053c0d9ac0bedd3109f043ee8
2016-08-05 16:45:38 -04:00
Joshua Colp
a9592043dc res_pjsip_outbound_publish: Use a serializer shutdown group for unload.
This change replaces the custom unload process for the outbound
publish module with the common serializer shutdown group.

ASTERISK-25217 #close

Change-Id: I280a0384d860c486202d87d2d674394cca77ffb6
2016-08-04 15:35:09 +00:00
Kevin Harwell
93aa3f74a2 resource_channels: Sync with ARI stubs
This file was out of sync with the current ARI definitions.

Change-Id: Ie7cb7d6d3c2eeb9cc9d683ca87b43b117e713d0a
2016-08-04 10:27:48 -05:00
Corey Farrell
8e6a28e86b Add missing checks during startup.
This ensures startup is canceled due to allocation failures from the
following initializations.
* channel.c: ast_channels_init
* config_options.c: aco_init

ASTERISK-26265 #close

Change-Id: I911ed08fa2a3be35de55903e0225957bcdbe9611
2016-08-03 16:41:04 -04:00
Joshua Colp
d1f973906a astconfigparser: Really handle case where line is simply a comment.
The regular expression would match causing the code that handled
the line if it was merely a comment to never get executed.

Change-Id: I3e4022481037ebcba9905587fe8c764b4ce21819
2016-08-03 09:49:38 -05:00
zuul
2306c71052 Merge "res_pjsip: SIP/SDP origin (o=) contained square brackets on IP6 transports." into 14 2016-08-02 15:13:19 -05:00
Kevin Harwell
9b926ac4f0 make_ari_stubs: Updated WIKI_PREFIX for 14
Change-Id: Id5678d20d8892fdcde7849c810d492527e77c15d
2016-08-02 14:26:21 -05:00
zuul
177ea926b2 Merge "menuselect: Add an opaque "member_data" string to the acceptable xml" into 14 2016-08-02 13:43:41 -05:00
Kevin Harwell
63dd0fab30 rest-api: Code out of sync with the model
Change-Id: Idccaa26fd4a423d47d013ee592b8fa6a0349c006
2016-08-02 13:04:05 -05:00
zuul
be170d0ed9 Merge "sorcery: Use more compatible regex for local expressions." into 14 2016-08-02 11:28:19 -05:00
zuul
342a2e53b7 Merge "pjproject: fixed a few bugs" into 14 2016-08-02 10:50:47 -05:00
Joshua Colp
b63262e7bf sorcery: Use more compatible regex for local expressions.
This changes the use of an empty regex for both res_sorcery_config
and res_sorcery_memory to "." instead. This is a more compatible
regular expression which also works on FreeBSD.

ASTERISK-26206 #close

Change-Id: Ia9166dd176f1597555ba22b6931180d0626c1388
2016-08-02 05:25:28 -05:00
Alexander Traud
7e0178925f res_pjsip: SIP/SDP origin (o=) contained square brackets on IP6 transports.
ASTERISK-26256 #close

Change-Id: I3fd68df561f81fdb8c6c497d465b50c12422f058
2016-08-02 03:16:10 -05:00
George Joseph
eefd446b9f menuselect: Add an opaque "member_data" string to the acceptable xml
Change-Id: Id5ac43b95c8d7395f3be37f983632169db3d1afe
2016-08-01 16:14:18 -05:00
zuul
ca721b7629 Merge "astconfigparser: Handle case where line is simply a comment." into 14 2016-08-01 15:05:09 -05:00
Joshua Colp
44b1492c83 Merge "Remove SILK payload mappings from Asterisk core." into 14 2016-08-01 14:52:27 -05:00
zuul
62c3bb566c Merge "pbx.c: Fix handling of '-' in extension name and callerid" into 14 2016-08-01 09:06:50 -05:00
Mark Michelson
d50895c7b0 Remove SILK payload mappings from Asterisk core.
SILK is a bit of a hog when it comes to using up our limited number of
dynamic payload types in the RTP engine. By freeing up four slots, it
allows for other codecs to potentially take the place.

Now, codec_silk.so will dynamically use the payload slots in the RTP
engine when it loads.

A better fix would be make RTP dynamic payload types actually
dynamic. However, at this stage of Asterisk 14 development, this is a
risky move that would be imprudent.

Change-Id: I5774e09408f9a203db189529eabdc0d3f4c1e612
2016-07-29 13:13:55 -05:00
zuul
c7c4fbe0bf Merge "pjproject_bundled: Update for pjproject 2.5.5" into 14 2016-07-29 11:19:08 -05:00
Joshua Colp
6b5058acd8 astconfigparser: Handle case where line is simply a comment.
Change-Id: I2dea5815363f4d787d709228a04f33baee383ef5
2016-07-29 10:35:38 -05:00
zuul
a4771230fe Merge "pbx.c: Allow dangerous functions when adding a hint to dialplan." into 14 2016-07-29 06:55:32 -05:00
Joshua Colp
b1a1ba0a9b Merge "astconfigparser.py: Update with realtime fixes." into 14 2016-07-28 19:17:55 -05:00
Joshua Colp
94a3c1f178 Merge "dsp.c: Add fax and DTMF detection unit tests." into 14 2016-07-28 19:17:42 -05:00
Joshua Colp
baa2629845 Merge "dsp.c: Added descriptive comments to Goertzel calculations." into 14 2016-07-28 19:17:34 -05:00
Joshua Colp
0dcbed074b Merge "dsp.c: Fix incorrect format reference typo." into 14 2016-07-28 19:17:30 -05:00
zuul
6eb9feb707 Merge "dsp.c: Correct DTMF twist dsp.conf documentation." into 14 2016-07-28 19:15:31 -05:00
Corey Farrell
5597193f62 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
2016-07-28 19:02:29 -05:00
Richard Mudgett
5316f49a2d 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
2016-07-28 15:11:20 -05:00
zuul
e8d3b8a1ce Merge "rtp_engine: Failed assertion and wrong name given for codec" into 14 2016-07-28 13:18:46 -05:00
zuul
fa45b0f93b Merge "Portably sscanf tv_usec" into 14 2016-07-28 12:47:17 -05:00
Alexei Gradinari
fc24faf1d9 pjproject: fixed a few bugs
This patch fixes the issue in pjsip_tx_data_dec_ref()
when tx_data_destroy can be called more than once,
and checks if invalid value (e.g. NULL) is passed to.

This patch updates array limit checks and docs
in pjsip_evsub_register_pkg() and pjsip_endpt_add_capability().

Change-Id: I4c7a132b9664afaecbd6bf5ea4c951e43e273e40
2016-07-28 12:09:56 -05:00
George Joseph
4cf02b5584 pjproject_bundled: Update for pjproject 2.5.5
Add more --disable-* switches to Makefile.rules including
--disable-opus which was causing bundled pjproject to fail with
"undefined reference" errors in libasteriskpj.

Changed PJ_ENABLE_EXTRA_CHECK to 1.

Removed 2 obsolete patches and added a new one.
The new one was merged by Teluu on 6/27/2016.

ASTERISK-26148 #close

Change-Id: Ib8af6c6a9d31f7238ce65b336134c2efdc855063
2016-07-28 08:07:11 -05:00
David M. Lee
34087b0d43 Portably sscanf tv_usec
In a timeval, tv_usec is defined as a suseconds_t, which could be
different underlying types on different platforms. Instead of trying to
scanf directly into the timeval, scanf into a long int, then copy that
into the timeval.

Change-Id: I29f22d049d3f7746b6c0cc23fbf4293bdaa5eb95
2016-07-27 13:08:48 -05:00