Commit Graph

32114 Commits

Author SHA1 Message Date
George Joseph
a2a8a41db3 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:26:16 -07:00
Kevin Harwell
618f081c3c Merge "test_cel: Plug a few ref leaks" into 16 2018-11-29 12:57:19 -06:00
Jenkins2
e67537dd98 Merge "jansson: Upgrade to 2.12." into 16 2018-11-29 12:14:06 -06:00
lvl
aa004295f9 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-11-27 15:26:33 -05:00
George Joseph
a5e77e9c37 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 17:19:43 -05:00
George Joseph
0ad0e89ba3 Merge "astobj2: Create function to copy weak proxied objects from container." into 16 2018-11-26 13:49:47 -06:00
Joshua Colp
450ca98220 Merge "RTP: need to reset DTMF last seqno/timestamp on voice packet with marker bit" into 16 2018-11-26 13:47:10 -06:00
Joshua Colp
53d0664781 Merge "func_strings: HASHKEY - negative array index can cause corruption" into 16 2018-11-26 07:43:35 -06:00
Corey Farrell
606304eb54 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:16:07 -05:00
Alexei Gradinari
331c906c48 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 11:18:47 -05:00
Corey Farrell
ed7a5664b6 astobj2: Eliminate usage of legacy ao2_container_alloc routine.
Replace usage of ao2_container_alloc with ao2_container_alloc_hash or
ao2_container_alloc_list.

ao2_container_alloc is now restricted to modules only and is being
removed from Asterisk 17.

Change-Id: I0907d78bc66efc775672df37c8faad00f2f6c088
2018-11-21 09:56:12 -05:00
Corey Farrell
0d2b39065f 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:48:25 -05:00
Sungtae Kim
1b6df87816 res_pjsip: Patch for res_pjsip_* module load/reload crash
The session_supplements for the pjsip makes crashes when the module
load/unload.

ASTERISK-28157

Change-Id: I5b82be3a75d702cf1933d8d1417f44aa10ad1029
2018-11-21 07:04:24 -05:00
Joshua Colp
0e096aefac Merge "app_queue: Cleanup queue_ref / queue_unref routines." into 16 2018-11-20 05:05:21 -06:00
Jenkins2
5f9a17bcdb Merge "stasis: Remove stringfields and lock from change message." into 16 2018-11-20 05:03:56 -06:00
Kevin Harwell
72e532136c 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:52 -05:00
George Joseph
729967e99c 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:03 -05:00
Joshua C. Colp
d05c219aad 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-19 12:00:28 -05:00
Joshua Colp
3506f84a37 Merge "test_res_pjsip_scheduler: Fix possible write after free in scheduler_policy." into 16 2018-11-19 09:38:41 -06:00
Joshua Colp
2d4146d005 Merge "res/res_ari: Fix null endpoint handle" into 16 2018-11-19 09:37:32 -06:00
Joshua Colp
d388977efb Merge "bridge_native_rtp.c: Fail native bridge if no framing match." into 16 2018-11-19 09:35:58 -06:00
Joshua Colp
7f813cdec8 Merge "res_pjsip_caller_id: Use static pj_str_t for fromto header names." into 16 2018-11-19 08:40:13 -06:00
Joshua Colp
cc0157d0d3 Merge "stasis: Add internal filtering of messages." into 16 2018-11-19 08:37:05 -06:00
Corey Farrell
f9b9bdd0b0 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:00:03 -05:00
George Joseph
41eab5b3b8 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:48:42 -07:00
Sungtae Kim
cb83350230 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-19 06:22:10 -05:00
George Joseph
e0a4df64cd Merge "pjsip: New function PJSIP_PARSE_URI to parse URI and return part of URI" into 16 2018-11-18 16:11:21 -06:00
Alexei Gradinari
e6005f1227 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 13:27:15 -07:00
George Joseph
2ca3813c52 Merge "pjproject-bundled: Use AST_DEVMODE for conditional compilation." into 16 2018-11-18 14:13:37 -06:00
Joshua Colp
8d436a95e7 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:07 -05:00
George Joseph
dd0a3c0bba CI: Add tmpfs to all jenkinsfiles
Change-Id: Ida29d70d48d5f39aabf0b25c66b51f79324a8cba
2018-11-18 11:39:13 -05:00
George Joseph
9bb155d95e Merge "res/res_pjsip_nat: Fix logic for REINVITES" into 16 2018-11-18 08:46:53 -06:00
George Joseph
7d11718a80 Merge "taskprocessor: Prevent race creating new taskprocessor." into 16 2018-11-17 17:28:21 -06:00
George Joseph
77e9c877b5 CI: Mount a tmpfs on /tmp for testsuite docker containers
Change-Id: I0566d81b0852f22066cd76d58eae5f1fda5602aa
(cherry picked from commit 73efe86436)
2018-11-17 17:07:25 -05:00
George Joseph
0552bc2a94 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:24 -05:00
George Joseph
0ba1993887 Merge "CI: Allow runUnittests to use 'expect' to run the tests" into 16 2018-11-17 11:30:21 -06:00
George Joseph
ccf38b3e34 Merge "core: Fix handling of restart from remote console." into 16 2018-11-16 09:22:36 -06:00
George Joseph
7ba8f32632 CI: Allow runUnittests to use 'expect' to run the tests
There seems to be a race condition between starting the asterisk
daemon and attempting to use 'asterisk -r' that can cause the
control socket file to not be created.  Since all of the Jenkins
slaves have 'expect' installed, the runUnittests script can use
it to start asterisk in the forground and issue the commands
interactively.  This is much more reliable and it can also make
startup errors more visible since they'll be in the Jenkins console
output.

If 'expect' isn't installed, the original daemon/asterisk -r
process is used.

Also added a "core show settings" before running the tests
and added "notice,warning,error" to the console log.

Change-Id: Idd656085f854afede813ac241b9e312b31358160
2018-11-16 10:03:43 -05:00
Corey Farrell
699dfa9401 taskprocessor: Prevent race creating new taskprocessor.
Task processors are retrieved using a 'get or create' pattern.  The
singleton container was unlocked between the get and create steps so
it's possible that two threads could create task processors with the
same name at the same time.

Change-Id: Id64fae94a6a1e940ddf38fde622dcd4391635382
2018-11-16 08:55:52 -05:00
Corey Farrell
3bdf6ac918 pjproject-bundled: Use AST_DEVMODE for conditional compilation.
We previously allowed resample and g711 codecs to be built when
TEST_FRAMEWORK was enabled.  This could cause errors if the testsuite
was run without this option enabled.  Switch the build system to allow
those codecs to be built when --enable-dev-mode is used.  This removes a
chance for strange testsuite errors from use of an inadequate pjsua
binary.

Change-Id: Iee8a3613cdb711fa7e7d217c5a775a575907ae22
2018-11-16 08:27:07 -05:00
Corey Farrell
2a76489eba res_pjsip_caller_id: Use static pj_str_t for fromto header names.
PJSIP assumes that these header names are not allocated, does not clone
the name strings when reusing headers.

Block unload of res_pjsip_caller_id until shutdown to ensure static
memory stays valid.  It was previously unsafe to unload while any
sessions are active.

Change-Id: I190854dea943d6e441cf03733f8a0da661aea27f
2018-11-15 15:48:31 -05:00
George Joseph
6e1471c0b2 Merge "pbx_config: Only the first [globals] section is seen." into 16 2018-11-15 07:48:38 -06:00
Torrey Searle
7b2282c890 res/res_pjsip_nat: Fix logic for REINVITES
The presence of Record-Route in re-invites is optional, thus it is
important to make sure the dialog doesn't have a routset before
rewriting the contact header.

ASTERISK-28129 #close

Change-Id: Ic8ceb54ccfc93f7e315e476c514a2c777f2da7dc
2018-11-15 06:35:14 -05:00
Corey Farrell
a36cd6960c core: Fix handling of restart from remote console.
We cannot use need_el_end and SIGURG when restarting.  Instead we need
to run el_end within the SIGHUP restartnow handler.

ASTERISK-28158

Change-Id: Ia852276363c81bdcf1aa29eb4558c5c2fa1218a0
2018-11-15 06:33:11 -05:00
George Joseph
009d67cd28 AST-2018-010: Fix length of buffer needed for SRV and NAPTR results
When dn_expand was being called on SRV and NAPTR results, the
return value was being used to calculate the size of the buffer
needed to store the host names.  Since dn_expand returns the
length of the COMPRESSED name the buffer could be too short
to hold the EXPANDED name.  The expanded name is NULL terminated
so using strlen() is the correct way to determine the length
actually needed for the buffer.

ASTERISK-28127
Reported by: Jan Hoffmann

patches:
  patch.diff submitted by janhoffmann (license 6986)

Change-Id: I4d35d6c431c6c6836cb61d37b1378cc47f0b414d
2018-11-14 09:25:06 -05:00
Joshua Colp
bd5dde4e83 Merge "taskprocessor: Do not use separate allocation for stats or name." into 16 2018-11-14 07:05:42 -06:00
George Joseph
0785af921d Merge "jansson-bundled: Patch for off-nominal crash." into 16 2018-11-13 14:39:53 -06:00
Corey Farrell
89d97da8a4 test_res_pjsip_scheduler: Fix possible write after free in scheduler_policy.
It's possible for a 4th task to be spawned before we cancel.  This
results in a write to the already freed test_data1.  Wait long enough to
verify success of the cancelation before freeing test_data1.

Change-Id: I057e2fcbe97f8a175e50890be89c28c20490a20f
2018-11-13 13:26:01 -05:00
George Joseph
ff7a772395 Merge "core: Ensure that el_end is always run when needed." into 16 2018-11-13 10:50:49 -06:00
Robert Cripps
df703c1853 bridge_native_rtp.c: Fail native bridge if no framing match.
ASTERISK-28110 #close

Change-Id: Ic64b8fc6a140a93fbdb2f97550a40d0ff334e607
2018-11-13 04:07:22 -05:00