Commit Graph

31752 Commits

Author SHA1 Message Date
Sean Bright 00b36bb045 build: Update config.guess and config.sub
Pulled from the authoritative respository at:

  https://git.savannah.gnu.org/cgit/config.git/tree/

Change-Id: I748708ce24d4d47ff1f395075d0b08d3da3355e0
2018-12-11 09:34:31 -05:00
Joshua C. Colp fe49d04519 Merge "chan_sip: Fix leak using contact ACL" 2018-12-10 07:05:21 -06:00
David M. Lee b899119a5d Removing registrar_expire from basic-pbx config
The module has been removed, so it shouldn't be in the default config any more.

Change-Id: Ie7e09f00f9c9a885574e29478250de4c2cefd9f1
2018-12-06 06:26:04 -05:00
Giuseppe Sucameli 0bde3751a0 chan_sip: Fix leak using contact ACL
Free old peer's contactacl before overwrite it within build_peer.

ASTERISK-28194

Change-Id: Ie580db6494e50cee0e2a44b38e568e34116ff54c
2018-12-05 17:17:57 -05:00
George Joseph 64b0bcacb5 Merge "test_websocket_client.c: Disable websocket_client_create_and_connect test." 2018-12-05 08:18:36 -06:00
Kevin Harwell cbb7633ad3 pjsip_add_use_callerid_contact: fixed alembic script
Change-Id: I413f1583c797fb79651786cd8d0b003599f8ed10
2018-12-03 18:47:16 -05:00
Sean Bright 8f5df046f6 core: Add some documentation to the malloc_trim code
This adds documentation to handle_cli_malloc_trim() indicating how it
can be useful when debugging OOM conditions.

Change-Id: I1936185e78035bf123cd5e097b793a55eeebdc78
2018-12-03 17:47:26 -05:00
George Joseph ff02c93d9e Merge "core: Merge malloc_trim patch" 2018-12-03 16:26:51 -06:00
Chris-Savinovich 58e50e56cb core: Merge malloc_trim patch
We've had multiple opportunities where Richard Mudgett's
malloc_trim patch has been useful. Let's get it
pushed up to gerrit and merged.

Since malloc_trim is only available in libc, an entry is
added to configure.ac to create a definition for
HAVE_MALLOC_TRIM.

Change-Id: Ia38308c550149d9d6eae4ca414a649957de9700c
2018-12-03 14:01:01 -06:00
lvl 140702ba2d app_queue: Revert broken queue channel reference patch
Revert commit 6409e7b11a, and add
NULL checks for all app_queue event handling code.

Related issues: ASTERISK~25185, ASTERISK~27006, ASTERISK~25844

ASTERISK-28125

Change-Id: I37334ea184ebb56e54471496b82937d4927815a0
2018-12-03 11:12:20 +01:00
Chris-Savinovich 6c13b20803 test_websocket_client.c: Disable websocket_client_create_and_connect test.
This test was occasionally failing, with:

  WARNING[5812]: http.c:1939 httpd_helper_thread: Failed to set
      TCP_NODELAY on HTTP connection: Bad file descriptor
  ERROR[5812]: iostream.c:91 ast_iostream_nonblock: Failed to get
      fcntl() flags for file descriptor: Bad file descriptor
  ERROR[5812]: iostream.c:569 ast_iostream_close: close() failed: Bad
      file descriptor

Disabled for now by making the test explicit only.

Change-Id: I778f6cbb6104c6b4e89737a2eaf1a9540888d351
2018-12-02 08:55:23 -05:00
George Joseph efeab21b52 Merge "Revert "app_voicemail: Remove need to subscribe to stasis"" 2018-11-30 07:30:35 -06:00
George Joseph 945451af90 Merge "bridges: Remove reliance on stasis caching" 2018-11-29 15:05:33 -06:00
George Joseph 4f0bf0270e Revert "app_voicemail: Remove need to subscribe to stasis"
This reverts commit 29115e2384.

That commit closed a long standing hole which allowed subscriptions
to mailboxes that weren't configured in voicemail.conf.  This
caused an issue with FreePBX which depdended on that behavior.
The commit is being reverted until FreePBX can handle the new
behavior.

ASTERISK-28151
Reported by: Ronald Raikes

Change-Id: I57b7b85e75d7dd97c742b5c69d718a0f61260c15
2018-11-29 12:29:34 -07:00
Kevin Harwell 7d37967e7e Merge "jansson: Upgrade to 2.12." 2018-11-29 12:57:32 -06:00
George Joseph f4924d40db test_cel: Plug a few ref leaks
These are only a few of the leaks.  The large number of macros
and return paths in this file would make a weeks worth of work
to plug them all.

Change-Id: Ie2369fa944023d44767871c5c30974cb077ffb56
2018-11-26 15:18:00 -07:00
George Joseph 3667c5e1d2 bridges: Remove reliance on stasis caching
* The bridging core no longer uses the stasis cache for bridge
  snapshots.  The latest bridge snapshot is now stored on the
  ast_bridge structure itself.

* The following APIs are no longer available since the stasis cache
  is no longer used:
    ast_bridge_topic_cached()
    ast_bridge_topic_all_cached()

* A topic pool is now used for individual bridge topics.

* The ast_bridge_cache() function was removed since there's no
  longer a separate container of snapshots.

* A new function "ast_bridges()" was created to retrieve the
  container of all bridges.  Users formerly calling
  ast_bridge_cache() can use the new function to iterate over
  bridges and retrieve the latest snapshot directly from the
  bridge.

* The ast_bridge_snapshot_get_latest() function was renamed to
  ast_bridge_get_snapshot_by_uniqueid().

* A new function "ast_bridge_get_snapshot()" was created to retrieve
  the bridge snapshot directly from the bridge structure.

* The ast_bridge_topic_all() function now returns a normal topic
  not a cached one so you can't use stasis cache functions on it
  either.

* The ast_bridge_snapshot_type() stasis message now has the
  ast_bridge_snapshot_update structure as it's data.  It contains
  the last snapshot and the new one.

* cdr, cel, manager and ari have been updated to use the new
  arrangement.

Change-Id: I7049b80efa88676ce5c4666f818fa18ad1985369
2018-11-26 14:30:02 -07:00
Jenkins2 4ca709768d Merge "stasis: Segment channel snapshot to reduce creation cost." 2018-11-26 14:07:47 -06:00
Joshua Colp a6b37e5c43 Merge "astobj2: Create function to copy weak proxied objects from container." 2018-11-26 13:48:00 -06:00
Joshua Colp b80c9071e3 Merge "RTP: need to reset DTMF last seqno/timestamp on voice packet with marker bit" 2018-11-26 13:47:32 -06:00
Joshua Colp 50ac85cb40 stasis: Segment channel snapshot to reduce creation cost.
When a channel snapshot was created it used to be done
from scratch, copying all data (many strings). This incurs
a cost when doing so.

This change segments the channel snapshot into different
components which can be reused if unchanged from the
previous snapshot creation, reducing the cost. In normal
cases this results in some pointers being copied with
reference count being bumped, some integers being set,
and a string or two copied. The other benefit is that it
is now possible to determine if a channel snapshot update
is redundant and thus stop it before a message is published
to stasis.

The specific segments in the channel snapshot were split up
based on whether they are changed together, how often they
are changed, and their general grouping. In practice only
1 (or 0) of the segments actually get changed in normal
operation.

Invalidation is done by setting a flag on the channel when
the segment source is changed, forcing creation of a new
segment when the channel snapshot is created.

ASTERISK-28119

Change-Id: I5d7ef3df963a88ac47bc187d73c5225c315f8423
2018-11-26 12:56:24 -06:00
Joshua Colp d0ccbb3377 stasis: Use an implementation specific channel snapshot cache.
Channels no longer use the Stasis cache for channel snapshots. Instead
they are stored in a hash table in stasis_channels which reduces the
number of Stasis messages created and allows better storage.

As a result the following APIs are no longer available since the stasis
cache is no longer used:
ast_channel_topic_cached()
ast_channel_topic_all_cached()

The ast_channel_cache_all() and ast_channel_cache_by_name() functions
now return an ao2_container of ast_channel_snapshots rather than
a container of stasis_messages therefore you can't (and don't need
to) call stasis_cache functions on it.

The ast_channel_topic_all() function now returns a normal topic not
a cached one so you can't use stasis cache functions on it either.

The ast_channel_snapshot_type() stasis message now has the
ast_channel_snapshot_update structure as it's data. It contains the
last snapshot and the new one.

ast_channel_snapshot_get_latest() still returns the latest snapshot.

The latest snapshot is now stored on the channel itself to eliminate
cache hits when Stasis messages that have the snapshot as a payload
are created.

ASTERISK-28102

Change-Id: I9334febff60a82d7c39703e49059fa3a68825786
2018-11-26 18:43:53 +00:00
Joshua Colp 0a60bc1a68 Merge "func_strings: HASHKEY - negative array index can cause corruption" 2018-11-26 07:44:11 -06:00
Corey Farrell 8e1ab4f11c
jansson: Upgrade to 2.12.
This brings in jansson-2.12, removes all patches that were merged
upstream.  README is created in third-party/jansson/patches to explain
how to add patches but also because the patches folder must exist for
the build process to succeed.

Change-Id: If0f2d541c50997690660c21fb7b03d625a5cdadd
2018-11-26 07:17:54 -05:00
Alexei Gradinari 3f53041267 RTP: need to reset DTMF last seqno/timestamp on voice packet with marker bit
The marker bit set on the voice packet indicates the start
of a new stream and a new time stamp.
Need to reset the DTMF last sequence number and the timestamp
of the last END packet.

If the new time stamp is lower then the timestamp of the last DTMF END packet
the asterisk drops all DTMF frames as out of order.

This bug was caught using Cisco ip-phone SPA50X and codec g722.
On SIP session update the SPA50X resets stream indicating it with market bit
and a new timestamp is twice smaller then the previous.

ASTERISK-28162 #close

Change-Id: If9c5742158fa836ad549713a9814d46a5d2b1620
2018-11-23 10:41:52 -05:00
Corey Farrell 021ce938ca
astobj2: Remove legacy ao2_container_alloc routine.
Replace usage of ao2_container_alloc with ao2_container_alloc_hash or
ao2_container_alloc_list.  Remove ao2_container_alloc macro.

Change-Id: I0907d78bc66efc775672df37c8faad00f2f6c088
2018-11-21 09:56:16 -05:00
Corey Farrell bc7f4f4db3
astobj2: Create function to copy weak proxied objects from container.
Create ao2_container_dup_weakproxy_objs to perform a similar function to
ao2_container_dup.  This function expects the source container to have
weakproxy objects, inserts the associated non-weak objects into the
destination container.  Orphaned weakproxy objects are ignored.

Create test for this new function and for ao2_weakproxy_find.

Change-Id: I898387f058057e08696fe9070f8cd94ef3a27482
2018-11-21 08:47:27 -05:00
Joshua Colp b7af9c8b19 Merge "stasis: Remove stringfields and lock from change message." 2018-11-20 05:06:01 -06:00
Joshua Colp 9b0808e2d0 Merge "app_queue: Cleanup queue_ref / queue_unref routines." 2018-11-20 05:05:32 -06:00
Kevin Harwell 4b5d11ec17 func_strings: HASHKEY - negative array index can cause corruption
This patch makes it so only matching non-empty key names, and keys created by
the HASH function are eligible for inclusion in the comma separated string. It
also fixes a bug where it was possible to write to a negative index if the
result buffer was empty.

ASTERISK-28159
patches:
  ASTERISK-28159.diff submitted by Michael Walton (license 6502)

Change-Id: I6e57fe7307dfd856271753aed5ba64c59b511487
2018-11-19 14:41:57 -05:00
George Joseph bcdfb90362 CI: Get job timeouts from environment
The job timeouts were hard coded in the jenkinsfiles which
means changes had to go through gerrit.  Now they are taken
from the following environment variables (and their defaults) that
can be set in Jenkins configuration...

TIMEOUT_GATES =      "60 MINUTES"
TIMEOUT_DAILIES =    "3 HOURS"
TIMEOUT_REF_DEBUG =  "24 HOURS"
TIMEOUT_UNITTESTS =  "30 MINUTES"

Change-Id: I673a551c1780bf665a3bc160b245da574aa4bbab
2018-11-19 13:05:11 -05:00
Joshua Colp 9df772530f Merge "test_res_pjsip_scheduler: Fix possible write after free in scheduler_policy." 2018-11-19 09:38:50 -06:00
Joshua Colp 9f996ca1f0 Merge "res/res_ari: Fix null endpoint handle" 2018-11-19 09:37:22 -06:00
Joshua Colp e0816637a4 Merge "bridge_native_rtp.c: Fail native bridge if no framing match." 2018-11-19 09:36:17 -06:00
Joshua Colp b285333673 Merge "res_pjsip_caller_id: Use static pj_str_t for fromto header names." 2018-11-19 08:40:05 -06:00
Joshua Colp 614c8a60d7 Merge "stasis: Add internal filtering of messages." 2018-11-19 08:36:50 -06:00
Corey Farrell 64e21c9ea9 app_queue: Cleanup queue_ref / queue_unref routines.
This replaces the inline functions with macros.  This removes the need
to directly use __ao2_ref, opts instead for standard ao2_bump and
ao2_cleanup macros.

Change-Id: If4e04e9bab2e3c883188437cb9f487b3e498a21b
2018-11-19 08:04:01 -05:00
George Joseph ece5f8015f backtrace: Refactor ast_bt_get_symbols so it doesn't crash
We've been seeing crashes in libbfd when we attempt to generate
a stack trace from multiple threads.  It turns out that libbfd
is NOT thread-safe.  It can cache the bfd structure and give it to
multiple threads without protecting itself.  To get around this,
we've added a global mutex around the bfd functions and also have
refactored the use of those functions to be more efficient and
to provide more information about inlined functions.

Also added a few more tests to test_pbx.c.  One just calls
ast_assert() and the other calls ast_log_backtrace().  Neither are
run by default.

WARNING:  This change necessitated changing the return value of
ast_bt_get_symbols() from an array of strings to a VECTOR of
strings.  However, the use of this function outside Asterisk is not
likely.

ASTERISK-28140

Change-Id: I79d02862ddaa2423a0809caa4b3b85c128131621
2018-11-19 05:49:39 -07:00
Joshua C. Colp 56eb18f395 stasis: Remove stringfields and lock from change message.
When a subscribe or unsubscribe occurs a message is published
containing this information. This change makes it so that the
message no longer uses stringfields or a lock, as both are not
really needed for the message.

Change-Id: I3f4831931d79f94fd979baf48048738df5dc1632
2018-11-18 19:53:14 -04:00
Alexei Gradinari fa048183aa pjsip: New function PJSIP_PARSE_URI to parse URI and return part of URI
New dialplan function PJSIP_PARSE_URI added to parse an URI and return
a specified part of the URI.

This is useful when need to get part of the URI instead of cutting it
using a CUT function.

For example to get 'user' part of Remote URI
${PJSIP_PARSE_URI(${CHANNEL(pjsip,remote_uri)},user)}

ASTERISK-28144 #close

Change-Id: I5d828fb87f6803b6c1152bb7b44835f027bb9d5a
2018-11-18 15:27:48 -05:00
George Joseph d81a43893d Merge "pjproject-bundled: Use AST_DEVMODE for conditional compilation." 2018-11-18 14:11:58 -06:00
Joshua Colp 3077ad0c24 stasis: Add internal filtering of messages.
This change adds the ability for subscriptions to indicate
which message types they are interested in accepting. By
doing so the filtering is done before being dispatched
to the subscriber, reducing the amount of work that has
to be done.

This is optional and if a subscriber does not add
message types they wish to accept and set the subscription
to selective filtering the previous behavior is preserved
and they receive all messages.

There is also the ability to explicitly force the reception
of all messages for cases such as AMI or ARI where a large
number of messages are expected that are then generically
converted into a different format.

ASTERISK-28103

Change-Id: I99bee23895baa0a117985d51683f7963b77aa190
2018-11-18 15:08:16 -05:00
George Joseph 915b80709d CI: Add tmpfs to all jenkinsfiles
Change-Id: Ida29d70d48d5f39aabf0b25c66b51f79324a8cba
2018-11-18 11:39:21 -05:00
George Joseph ccc981e91a Merge "res/res_pjsip_nat: Fix logic for REINVITES" 2018-11-18 08:47:10 -06:00
George Joseph fe64ca0be8 Merge "taskprocessor: Prevent race creating new taskprocessor." 2018-11-17 17:28:41 -06:00
George Joseph f5e3832dff CI: Mount a tmpfs on /tmp for testsuite docker containers
Change-Id: I0566d81b0852f22066cd76d58eae5f1fda5602aa
(cherry picked from commit 73efe86436)
2018-11-17 17:07:31 -05:00
George Joseph be87185f6d CI: Pass work directory to runTestsuite
The testsuite can now use a user-specified work directory for
all it's temp files.  This allows the docker containers to use
a tmpfs backed directory for the temp files instead of it's
own write-layer image.

* runTestsuite.sh now accepts a --work-dir command line argument
  that gets exported as AST_WORK_DIR before running the testsuite.

* gates.jenkinsfile now specifies --work-dir to be
  <testsuite_dir>/astroot.

Since the Asterisk CI docker hosts now mount /srv/jenkins/workspace
on a tmpfs, asterisk should be compiled and the testsuite run all in
memory.

Change-Id: If5ee905a15821296c355bb84cda38950ad8edc45
(cherry picked from commit a335f4c9ad)
2018-11-17 17:05:39 -05:00
George Joseph 8399c8dae6 Merge "CI: Allow runUnittests to use 'expect' to run the tests" 2018-11-17 11:30:30 -06:00
Sungtae Kim 1dea497454 res/res_ari: Fix null endpoint handle
The res_ari(POST /channels/create handler) deos not check the endpoint
parameter length. And it causes core
dump.
Fixed it to check the parameter length. Also fixed memory leak.

ASTERISK-28169

Change-Id: Ibf10a9eb8a2e3a9ee1e13fbe748b2ecf955c3993
2018-11-17 04:05:39 +01:00
George Joseph d2f784cc3a Merge "core: Fix handling of restart from remote console." 2018-11-16 09:22:26 -06:00