Commit Graph

28306 Commits

Author SHA1 Message Date
Corey Farrell
f373de3020 Fix shutdown crash caused by modules being left open.
It is only safe to run ast_register_cleanup callbacks when all modules
have been unloaded.  Previously these callbacks were run during graceful
shutdown, making it possible to crash during shutdown.

ASTERISK-26513 #close

Change-Id: Ibfa635bb688d1227ec54aa211d90d6bd45052e21
2016-10-28 01:11:21 -04:00
Joshua Colp
e8a3af2629 Merge "pjsip: Fix a few media bugs with reinvites and asymmetric payloads." into 13 2016-10-27 16:51:33 -05:00
zuul
66044dd606 Merge "res_pjsip_caller_id: Fix crash on session timers UPDATE on inbound calls." into 13 2016-10-27 16:48:05 -05:00
zuul
12ee2fd58d Merge "pjproject_bundled: Remove usage of tar's --strip-components option" into 13 2016-10-27 15:05:15 -05:00
zuul
f20b5ef36e Merge "app_voicemail: Clear voice mailbox in MailboxExists and MAILBOX_EXISTS." into 13 2016-10-27 13:26:59 -05:00
George Joseph
61a5c3460e pjproject_bundled: Remove usage of tar's --strip-components option
Older versions of tar don't support the --strip-components option so
instead of doing 'tar --strip-components=1 -C source', we now just
untar to the tarball's root directory (pjproject-<version>) and
rename that directory to 'source'.

Also fixed an issue where the pjproject source directory is a hard
coded absolute pathname.

ASTERISK-26510 #close
ASTERISK-22480 #close

Change-Id: I9ec92952507a91ff4e4d01e0149e09fd8e8f32b0
2016-10-27 08:28:16 -06:00
Joshua Colp
675c71ae8c res_pjsip_caller_id: Fix crash on session timers UPDATE on inbound calls.
The res_pjsip_caller_id module wrongly assumed that a
saved From header would always exist on sessions. This
is true until an inbound call is received and a session
timer causes an UPDATE to be sent. In this case there will
be no saved From header and a crash will occur. This change
makes it fall back to the From header of the outgoing request
if no saved From header is present.

ASTERISK-26307 #close

Change-Id: Iccc3bc8d243b5ede9b81abf960292930c908d4fa
2016-10-27 13:23:03 +00:00
Joshua Colp
46863c9d9a Merge "test_astobj2_thrash: Fix multithreaded issues" into 13 2016-10-26 18:00:42 -05:00
Joshua Colp
dc13003dd9 Merge "chan_pjsip: segfault on already disconnected session" into 13 2016-10-26 09:14:39 -05:00
Joshua Colp
14496ce1e5 app_voicemail: Clear voice mailbox in MailboxExists and MAILBOX_EXISTS.
When executing the MailboxExists dialplan application and
MAILBOX_EXISTS dialplan function the passed in temporary voice
mailbox was not cleared, causing it to try to free garbage.

ASTERISK-26503 #close

Change-Id: Ie21ccfa1b80b9c59318e596f6b8e17da2b5a7cb3
2016-10-26 12:52:47 +00:00
Joshua Colp
e0bc17edff pjsip: Fix a few media bugs with reinvites and asymmetric payloads.
When channel format changes occurred as a result of an RTP
re-negotiation the bridge was not informed this had happened.
As a result the bridge technology was not re-evaluated and the
channel may have been in a bridge technology that was incompatible
with its formats. The bridge is now unbridged and the technology
re-evaluated when this occurs.

The chan_pjsip module also allowed asymmetric codecs for sending
and receiving. This did not work with all devices and caused one
way audio problems. The default has been changed to NOT do this
but to match the sending codec to the receiving codec. For users
who want asymmetric codecs an option has been added, asymmetric_rtp_codec,
which will return chan_pjsip to the previous behavior.

The codecs returned by the chan_pjsip module when queried by
the bridge_native_rtp module were also not reflective of the
actual negotiated codecs. The nativeformats are now returned as
they reflect the actual negotiated codecs.

ASTERISK-26423 #close

Change-Id: I6ec88c6e3912f52c334f1a26983ccb8f267020dc
2016-10-26 12:47:59 +00:00
Joshua Colp
f534f67f52 res_pjsip_sdp_rtp: Fix address family of explicit media_address.
When an explicit media_address is provided the address family
in the SDP needs to be set to reflect it.

ASTERISK-26309

Change-Id: Ib9350cc91c120eb2f96f0623d3907d12af67eb79
2016-10-26 11:32:04 +00:00
George Joseph
3a2092b722 test_astobj2_thrash: Fix multithreaded issues
The test uses 4 threads to grow, count, lookup and shrink 15K objects
in a container.  If there's only 1 execution engine available, the test
will complete in <50ms.  If each threads gets its own execution engine,
the test may timeout after 60 seconds because the count thread does a
locked ao2_callback on the whole container in a tight loop with only
a sched_yield to give up time.  The lock contention makes the test
execution times wildly variable and mostly timeout.  2 execution
engines are OK, 3 results in about 33% failure rate and >=4 causes
a 80% failure rate.

To fix, the sched_yield was changed to a usleep(500).

Also, the number of buckets specified for the container was an even
number so that was changed to the next prime number greater than
(MAX_HASH_ENTRIES / 100).  That's 151 currently.

Change-Id: I50cd2344161ea61bfe4b96d2a29a6ccf88385c77
2016-10-25 11:31:46 -05:00
Joshua Colp
2bd8af6d0b Merge "pjsip: Support dual stack automatically." into 13 2016-10-25 05:29:08 -05:00
zuul
2203a50042 Merge "pjproject_bundled: Fixed various build issues" into 13 2016-10-24 21:55:30 -05:00
Joshua Colp
5677e18631 Merge "typo: s/paranthesis/parenthesis/ in a comment" into 13 2016-10-24 18:21:17 -05:00
Joshua Colp
578e34b445 Merge "ARI: Detect duplicate channel IDs" into 13 2016-10-24 18:20:33 -05:00
Pascal Cadotte Michaud
640203802e typo: s/paranthesis/parenthesis/ in a comment
Change-Id: I7c1f4eb051177ee22cbe97e063d4a3effe29be30
2016-10-24 17:48:17 -05:00
George Joseph
9b3557e054 pjproject_bundled: Fixed various build issues
* CFLAGS is now properly set when using older gcc.
* All third-party pjproject targets have been removed.  This fixes
  an issue with older libsrtp in some distros.
* Manually removing the source directory now causes a rebuild.
* EXTERNALS_CACHE_DIR is now properly checked.
* Whitespace fixes.

Change-Id: I98fec6847efc5602a9f41cb95096fd660a49fa60
2016-10-24 14:05:41 -06:00
Joshua Colp
bb982480d8 pjsip: Support dual stack automatically.
This change adds support for dual stack automatically. No
configuration is required and the IP address and version
in the SIP messages and SDP will be automatically changed
based on the transport over which the message is being
sent. RTP usage has also been changed to listen on both
IPv4 and IPv6 simultaneously to allow media to flow, and
to allow ICE support on both simultaneously. This also
allows failover between IPv6 and IPv4 to work as expected.

ASTERISK-26309 #close

Change-Id: I235a421d8f9a326606d861b449fa6fe3a030572d
2016-10-23 13:51:42 +00:00
Mark Michelson
eff97808fb ARI: Detect duplicate channel IDs
ARI and AMI allow for an explicit channel ID to be specified
when originating channels. Unfortunately, there is nothing in
place to prevent someone from using the same ID for multiple
channels. Further complicating things, adding ID validation to channel
allocation makes it impossible for ARI to discern why channel allocation
failed, resulting in a vague error code being returned.

The fix for this is to institute a new method for channel errors to be
discerned. The method mirrors errno, in that when an error occurs, the
caller can consult the channel errno value to determine what the error
was. This initial iteration of the feature only introduces "unknown" and
"channel ID exists" errors. However, it's possible to add more errors as
needed.

ARI uses this feature to determine why channel allocation failed and can
return a 409 error during origination to show that a channel with the
given ID already exists.

ASTERISK-26421

Change-Id: Ibba7ae68842dab6df0c2e9c45559208bc89d3d06
2016-10-20 12:50:02 -05:00
snuffy
c2036c827c Fix issue with CLI not returning to prompt after running "features show"
ASTERISK-26444 #close

Change-Id: I91d645b7e6e5dba35f8c410df2be77a8c0e3acb8
2016-10-19 17:55:39 -05:00
zuul
87483f3545 Merge "utils.c: Fix ast_set_default_eid for multiple platforms" into 13 2016-10-19 17:35:50 -05:00
zuul
a2af51fab1 Merge "res_rtp_asterisk: Add ice_blacklist option" into 13 2016-10-19 15:02:16 -05:00
zuul
ad2dde8106 Merge "chan_sip: Support nat=auto_comedia or nat=force_rport,auto_comedia." into 13 2016-10-19 10:57:01 -05:00
Joshua Colp
1bde92f68c Merge "CDR: Alter destruction pattern for CDR chains." into 13 2016-10-19 08:31:42 -05:00
Michael Walton
3c62b60e56 res_rtp_asterisk: Add ice_blacklist option
Introduces ice_blacklist configuration in rtp.conf. Subnets listed in the
form ice_blacklist = <subnet spec>, e.g. ice_blacklist =
192.168.1.0/255.255.255.0, are excluded from ICE host, srflx and relay
discovery. This is useful for optimizing the ICE process where a system
has multiple host address ranges and/or physical interfaces and certain
of them are not expected to be used for RTP. Multiple ice_blacklist
configuration lines may be used. If left unconfigured, all discovered
host addresses are used, as per previous behavior.

Documention in rtp.conf.sample.

ASTERISK-26418 #close

Change-Id: Ibee88f80d7693874fda1cceaef94a03bd86012c9
2016-10-19 12:14:53 +00:00
Mark Michelson
012fda29d2 CDR: Alter destruction pattern for CDR chains.
CDRs form chains. When the root of the chain is destroyed, it then
unreferences the next CDR in the chain. That CDR is destroyed, and it
then unreferences the next CDR in the chain. This repeats until the end
of the chain is reached. While this typically does not cause any sort of
problems, it is possible in strange scenarios for the CDR chain to grow
way longer than expected. In such a scenario, the destruction pattern
can result in a stack overflow.

This patch fixes the problem by switching from a recursive pattern to an
iterative pattern for destruction. When the root CDR is destroyed, it is
responsible for iterating over the rest of the CDRs and unreferencing
each one. Other CDRs in the chain, since they are not the root, will
simply destroy themselves and be done. This causes the stack depth not
to increase.

ASTERISK-26421 #close
Reported by Andrew Nagy

Change-Id: I3ca90c2b8051f3b7ead2e0e43f60d2c18fb204b8
2016-10-18 16:58:02 -05:00
zuul
6adc293b14 Merge "cli: Auto-complete File not Module for core set debug." into 13 2016-10-18 12:34:41 -05:00
zuul
0384bae66f Merge "chan_rtp: Set a sane default rtp engine for unicast." into 13 2016-10-18 12:24:53 -05:00
Alexei Gradinari
6d462b9eaf chan_pjsip: segfault on already disconnected session
On heavy loaded system the TCP/TLS incoming calls could be
disconnected by pjproject while these calls are being
processed by asterisk.

This patch uses functions pjsip_inv_add_ref/pjsip_inv_dec_ref
to inform pjproject that an INVITE session is in use.

ASTERISK-26482 #close

Change-Id: Ia2e3e2f75358cdb530252a9ce158af3d5d9fdf33
2016-10-18 10:04:54 -04:00
Joshua Colp
c25163993d Merge "menuselect: invalid test for GTK2" into 13 2016-10-18 08:17:43 -05:00
Alexander Traud
662b560c35 cli: Auto-complete File not Module for core set debug.
Since Asterisk 1.8, the command "core set debug" on the command-line interface
asks not for a file (.c) but a module name. This change shows modules (.so) on
the auto-completion via a tabulator or the question mark. Now, when you
partially type a module name, TAB or ?, you get the correct candidiates.

ASTERISK-26480

Change-Id: I1213f1dd409bd4ff8de08ad80cb0c73cafb1bae0
2016-10-18 03:34:59 -05:00
zuul
633c9062ab Merge "res/ari: Add the Asterisk EID field to outgoing events" into 13 2016-10-17 23:58:31 -05:00
zuul
1a8a15e931 Merge "app_queue: Added initialization for "context" parameter" into 13 2016-10-17 15:45:43 -05:00
Tzafrir Cohen
6f5880913f menuselect: invalid test for GTK2
configuire.ac was only checking for the existence of pkg-config
and not the gtk2 package itself.  Now it calls AST_PKG_CONFIG_CHECK
for gtk+-2.0.

ASTERISK-26356 #close

Change-Id: I8079d515d6ea99f9ab320a7eaa71c2aaa101ccd5
2016-10-17 12:39:16 -05:00
George Joseph
546ec4b038 pjproject_bundled: Add patch to address SSL crash
Addresses crashes when an attempt is made to operate on an SSL socket
after the socket has been closed.

ASTERISK-26477 #close

Change-Id: I421305b357558b4f9e690210dc0f4831ef4b3002
2016-10-17 11:55:35 -05:00
Moises Silva
644fad7477 chan_rtp: Set a sane default rtp engine for unicast.
ASTERISK-26439

Change-Id: I7f5ee2eeba8906e9ecb3293dbe3a747770bb5011
2016-10-17 08:13:57 -05:00
Matt Jordan
42cfdcd1b7 res/ari: Add the Asterisk EID field to outgoing events
This patch adds the Asterisk EID field to all outgoing ARI events.
Because this field should be added to all events as they are
transmitted, it is appended to the JSON message just prior to it being
handed off to the application message handler. This makes it somewhat
resilient to both new events being added to ARI, as well as other
potential event transport mechanisms.

ASTERISK-26470 #close

Change-Id: Ieff0ecc24464e83f3f44e9c3e7bd9a5d70b87a1d
2016-10-17 08:13:46 -05:00
George Joseph
74d9385273 utils.c: Fix ast_set_default_eid for multiple platforms
ast_set_default_eid was searching for ethX, emX, enoX, ensX and even
pciD#U interface names.  While this was a good attempt, it wasn't
inclusive enough to capture interfaces like enp6s0 or ens6d1, etc.

Rather than relying on interface names, we now simply find the first
interface returned by the OS that has a hardware address and that
address isn't all 0x00 or all 0xff.  The code IS different for BSD,
Solaris and Linux based on what method is available for enumerating
interfaces.

Tested on:
FreeBSD9
CentOS6
Ubuntu14
Fedora24

I was unable to test on Solaris at this time but the code for Solaris
is used elsewhere at Digium.

Change-Id: Iaa6db87ca78a9a375e47d70e043ae08c1448cb72
2016-10-16 17:33:10 -06:00
Michael Kuron
f1fd873df0 chan_sip: Only send video on outgoing channel if incoming channel supports it
Previously, the settings videosupport=always and videosupport=yes behaved
identically and unconditionally caused a video offer to be sent in the SDP on
an outgoing call. This was a regression introduced with commit
5a1d90e1fb in Asterisk 1.6.1.

This commit restores correct behavior: videosupport=always causes a video offer
to be sent unconditionally, while videosupport=yes will only offer video on an
outbound channel if the incoming channel it is bridged to also supports video.
That way, the device receiving the outgoing call can display the correct user
interface elements for audio or video and will not unnecessarily show a blank
video window on an audio-only call.

ASTERISK-17470 #close

Change-Id: I782f4409d436114dbc97061c3570c0cd24f7c3ae
2016-10-15 12:17:12 +02:00
zuul
d1d446b237 Merge "Fix issues with bundled pjproject cached download." into 13 2016-10-14 18:48:56 -05:00
Leandro Dardini
0306869399 app_queue: Added initialization for "context" parameter
When using Asterisk Realtime Architecture, empty fields are skipped and the
default values are used. If the "context" parameter in queue was set and then
cleared from the database, the old value remains in memory and it continues
to be used. This change initialize the "context" parameter with an empty value,
allowing clearing the parameter.

ASTERISK-26462 #close

Change-Id: I64be73d5044ce38dd02408bd0e53de965ef65905
2016-10-14 17:49:36 -05:00
zuul
3bdd7c0e38 Merge "Audit ast_json_pack() calls for needed UTF-8 checks." into 13 2016-10-14 17:17:12 -05:00
zuul
8d12d6021b Merge "json: Check party id name, number, subaddresses for UTF-8." into 13 2016-10-14 16:29:53 -05:00
zuul
05c6ab0d8f Merge "json: Add UTF-8 check call." into 13 2016-10-14 12:54:52 -05:00
zuul
4d1cb6a46d Merge "res_config_mysql: Fix several issues related to recent table changes" into 13 2016-10-14 12:46:48 -05:00
zuul
0fa6036b97 Merge "aoc.c: Whitespace cleanup" into 13 2016-10-14 11:01:22 -05:00
zuul
1b9ef66c50 Merge "app_queue.c: Fix clearing of pause reason string." into 13 2016-10-14 09:07:22 -05:00
Corey Farrell
ce4cfd2eca Fix issues with bundled pjproject cached download.
Previously when testing I had a preexisting makeopts in ASTTOPDIR.  The
ordering of configure.ac causes --with-externals-cache to be processed
after third-party configure.  In cases where the Asterisk clone is
cleaned it would cause pjproject to be downloaded to /tmp.  This
moves processing of the externals cache and sounds cache to happen
before third-party configure.

This also addresses a possible issue with the third-party Makefile.  If
TMPDIR is set by the environment it would override the path given to
--with-externals-cache.

ASTERISK-26416

Change-Id: Ifab7f35bfcd5a31a31a3a4353cc26a68c8c6592d
2016-10-14 07:48:32 -05:00