Commit Graph

30575 Commits

Author SHA1 Message Date
Jenkins2 38dcdf2d68 Merge "codec_opus: Make libcurl a dependency in menuselect" 2017-12-11 12:22:21 -06:00
Jenkins2 b7e79d7baf Merge "astdb: Improve prefix searches in astdb" 2017-12-11 12:12:58 -06:00
Jenkins2 f81a884033 Merge "loader: Refactor resource_name_match." 2017-12-11 11:44:34 -06:00
Joshua Colp 5d43a4d4ff Merge "res_stasis and res_speech: Fix load order." 2017-12-11 11:12:25 -06:00
Jenkins2 710b3a29c3 Merge "utils: Add convenience function for setting fd flags" 2017-12-11 10:13:09 -06:00
Sean Bright 00578fae0a codec_opus: Make libcurl a dependency in menuselect
ASTERISK-27475 #close

Change-Id: If7384bc6ed002ef140dec69798d14c52b7cfd800
2017-12-11 09:45:36 -06:00
Jenkins2 cd741136c5 Merge "pjsip: Improve CLI completion performance" 2017-12-11 09:36:54 -06:00
Jenkins2 6d25b26933 Merge "CDR: Fix deadlock setting some CDR values." 2017-12-11 09:06:41 -06:00
Sean Bright 521f741b04 pjsip: Improve CLI completion performance
Use the new ast_cli_completion_add() function to improve completion
performance for commands like 'pjsip show endpoint.'

Change-Id: I76d802294d2ac1766110dc75f7d117c8541ce348
2017-12-10 12:57:24 -06:00
Sean Bright 9a9edc6c9e astdb: Improve prefix searches in astdb
Using the LIKE operator requires a full table scan of 'astdb', whereas a
comparison operation is able to use the primary key index.

This patch adds a new function to the AstDB API for quick prefix matches
and updates res_sorcery_astdb to utilize it. This showed substantial
performance improvement in my test environment.

Related to ASTERISK~26806, but does not completely resolve it.

Change-Id: I7d37f9ba2aea139dabf2ca72d31fbe34bd9b2fa1
2017-12-10 12:51:16 -06:00
Corey Farrell d2e87b8e14 loader: Refactor resource_name_match.
Optimize resource_name_match.  This change eliminates use of
ast_strdupa, instead verifying that both basename's are the same length,
then using strncasecmp.

Change-Id: I477275c0e954c99d74be5abfc8bb6545b04e5a3d
2017-12-08 19:51:09 -05:00
Sean Bright dbb376f166 pjsip_configuration: Add correct file header
Change-Id: I25348c386a222bb704aff07f54375108a6402906
2017-12-08 14:59:05 -06:00
Sean Bright 2ffe52a116 utils: Add convenience function for setting fd flags
There are many places in the code base where we ignore the return value
of fcntl() when getting/setting file descriptior flags. This patch
introduces a convenience function that allows setting or clearing file
descriptor flags and will also log an error on failure for later
analysis.

Change-Id: I8b81901e1b1bd537ca632567cdb408931c6eded7
2017-12-08 13:28:04 -06:00
Corey Farrell e2dbc26376 res_stasis and res_speech: Fix load order.
res_stasis was missing AST_MODFLAG_LOAD_ORDER.  Set res_stasis and
res_speech to start at (AST_MODPRI_APP_DEPEND - 1) so they are ready for
dependent modules.

Change-Id: I27f4f3810a95b6be8a5bfbf62be2ace6bfab6ff3
2017-12-07 19:39:04 -06:00
Kevin Harwell 0e4d31eb9c pjsip_options: contacts sometimes not being updated on reload
For both dynamic and static contacts it was possible that potential AOR
changes were not being applied to all contacts. This was because the qualify
and schedule code was only retrieving AOR's, and contacts with frequencies
greater than zero.

For instance the following could happen: and AOR/contact has a frequency of 5,
it then gets set to 0, and then a reload occurs. All scheduled OPTIONS are
stopped, a list of AOR's is retrieved with frequency > 0, but none are
selected since in this scenario all are 0. The contact for the one previously
set to 5 though does not get updated, so it's status remains "AVAILABLE".

This patch makes it so all contacts (static and dynamic) are selected, and
appropriately updated if need be.

ASTERISK-27467 #close

Change-Id: I7a920170f89c683af9505d4723a44fc6841decdb
2017-12-07 18:40:34 -06:00
Kevin Harwell bd2218ce63 pjsip_options: dynamic contact's fields not updated on reload
Dynamic contacts were not being properly updated on reload. As a matter of
fact any changes to the AOR that a dynamic contact was associated with were
not being applied.

On reload, this patch makes it so for each dynamic contact, the associated
AOR is now retrieved and the AOR's fields are applied to the contact.

ASTERISK-27467

Change-Id: I8e3165dc6a745218c1c9db837f77fafa0516985d
2017-12-07 18:38:23 -06:00
Jenkins2 b0b28446c1 Merge "translate: Skip matrix_rebuild during shutdown." 2017-12-07 14:33:47 -06:00
George Joseph d7f3f8c283 Merge "sounds_index: Avoid repeatedly reindexing." 2017-12-07 13:26:22 -06:00
George Joseph 5cef8b2f3e Merge "media_index: Improve startup." 2017-12-07 13:26:06 -06:00
Corey Farrell c2c9995830 translate: Skip matrix_rebuild during shutdown.
Change-Id: I1e5eef4029cba56e33d786c5a5ade8091e531a1e
2017-12-07 00:35:14 -05:00
Corey Farrell ab191e9782 sounds_index: Avoid repeatedly reindexing.
The sounds index is rebuilt each time a format is registered or
unregistered.  This causes the index to be repeatedly rebuilt during
startup and shutdown.

This patch significantly reduces the work done by delaying sound index
initialization until after modules are loaded.  This way a reindex only
occurs if a format module is loaded after startup.  We also skip
reindexing when format modules are unloaded during shutdown.

Change-Id: I585fd6ee04200612ab1490dc804f76805f89cf0a
2017-12-06 18:47:28 -05:00
Richard Mudgett 3078b7adc2 CDR: Fix deadlock setting some CDR values.
Setting channel variables with the AMI Originate action caused a deadlock
when you set CDR(amaflags) or CDR(accountcode).  This path has the channel
locked when the CDR function is called.  The CDR function then
synchronously passes the job to a stasis thread.  The stasis handling
function then attempts to lock the channel.  Deadlock results.

* Avoid deadlock by making the CDR function handle setting amaflags and
accountcode directly on the channel rather than passing it off to the CDR
processing code under a stasis thread to do it.

* Made the CHANNEL function and the CDR function process amaflags the same
way.

* Fixed referencing the wrong message type in cdr_prop_write().

ASTERISK-27460

Change-Id: I5eacb47586bc0b8f8ff76a19bd92d1dc38b75e8f
2017-12-06 15:59:59 -06:00
Corey Farrell 2af59ebb3a media_index: Improve startup.
This eliminates some wasteful operations in media_index startup.

* Replace statically set string-fields with char[0].
* Eliminate pointless RAII_VAR's.
* alloc_variant: Avoid pointless ao2_find on new info->variant.
* Stop trying find_variant before alloc_variant.
* process_media_file: replace ast_str with ast_asprintf.  This avoids
  reallocation of file_id_str.

Overall sounds_index.c is about 27% of Asterisk startup time when using
sample configs.  This patch reduces it to 20%.  This is a half-fix.  The
real problem is that the media_index is regenerated repeatedly - 68
times in my test.

Change-Id: Ia50b752f8efb356f852b05c4be495a6631af8652
2017-12-06 14:34:32 -05:00
Richard Mudgett e97e41552e bridge_basic.c: Update transfer diagnostic messages addendum.
* Added start DTMF transfer verbose messages.
* Made associated transfer messages use a similar message format.
* Adjusted message verbose level as requested by initial reporter.

ASTERISK-27449

Change-Id: I2045714586414b3c5ef1f3cc56c1c4af4b31f551
2017-12-06 07:51:24 -06:00
Jenkins2 3fc1490bcb Merge "bridge_basic.c: Update transfer diagnostic messages." 2017-12-06 06:51:31 -06:00
Jenkins2 f761206f47 Merge "Add new object for VoicemailUserEntry" 2017-12-05 20:10:51 -06:00
Joshua Colp 628a0af6de Merge "res_rtp_asterisk.c: Increase strictrtp learning timeout time." 2017-12-05 19:31:14 -06:00
Jenkins2 cc81f4eb42 Merge "pjproject: Clean up disabling of WebRTC support." 2017-12-05 18:30:42 -06:00
Niklas Larsson 9d00583164 bridge_basic.c: Update transfer diagnostic messages.
* Add the channel name to diagnostic messages so you will know which
channel failed to transfer.

* Promoted some debug messages to verbose 4 messages.

ASTERISK-27449 #close

Change-Id: Idac66b7628c99379cc9269158377fd87dc97a880
2017-12-05 15:39:19 -06:00
Richard Mudgett 8536a09b86 security-events: Fix SuccessfulAuth using_password declaration.
The SuccessfulAuth using_password field was declared as a pointer to a
uint32_t when the field was later read as a uint32_t value.  This resulted
in unnecessary casts and a non-portable field value reinterpret in
main/security_events.c:add_json_object().  i.e., It would work on a 32 bit
architecture but not on a 64 bit big endian architecture.

Change-Id: Ia08bc797613a62f07e5473425f9ccd8d77c80935
2017-12-04 17:21:27 -06:00
Jenkins2 890ffcd672 Merge "res_rtp_asterisk: Correct default in sample configuration file." 2017-12-04 11:47:13 -06:00
Richard Mudgett ab63448fa6 res_rtp_asterisk.c: Increase strictrtp learning timeout time.
More complicated direct media reinvite negotiations can result in longer
delays before direct media flows.  The strictrtp learning timeout time
was too short.  One log showed that the first RTP packet came in just
after three seconds.

* Increase the strictrtp learning timeout time from 1.5 to 5 seconds.

ASTERISK-27453

Change-Id: Ic5e711164cbb91b4d1c1e40c83697755640f138c
2017-12-04 10:45:01 -06:00
Jenkins2 b184972d65 Merge "README-SERIOUSLY.bestpractices.txt: Convert to markdown" 2017-12-04 10:27:54 -06:00
Jenkins2 93920f1f1f Merge "autoconf: Remove use of m4_ifblank." 2017-12-04 09:38:31 -06:00
Joshua Colp 93c2cd1383 Merge "config: Speed up config template lookup" 2017-12-04 08:51:11 -06:00
Alexander Traud e0354bbe82 res_rtp_asterisk: Correct default in sample configuration file.
With Asterisk 12 (commit 866d968), the default of "icesupport" changed to
- "yes" in the module "res_rtp_asterisk" and
- "no" in the module "chan_sip".
The latter was reflected in the sample configuration file for "sip.conf". The
former did not make it into "rtp.conf.sample".

ASTERISK-20643

Change-Id: I2a2e0a900455d0767a99ea576e30adc6d7608a36
2017-12-04 15:33:16 +01:00
Joshua Colp ea1578ed7a Merge "config: Speed up ACO & sorcery initialization" 2017-12-04 07:41:28 -06:00
Joshua Colp 1182abb0ff Merge "res_http_post: Not all versions of gmime have GMIME_MAJOR_VERSION." 2017-12-04 07:40:06 -06:00
Sungtae Kim 0611fe581c Add new object for VoicemailUserEntry
Currently, when the app_voicemail sending VoicemailUserEntry AMI event, there's
no OldMessageCount info for default.
To check the OldMessageCount info, it required IMAP_STORAGE define, but this is
not correct.
Added OldMessageCount item as a default.

ASTERISK-27456

Change-Id: I5c71521c2d1daf8b7b161e31c34d28cca6aea4c7
2017-12-04 10:51:49 +01:00
Joshua Colp e2715d2cd4 pjproject: Clean up disabling of WebRTC support.
The definition in config_site.h and the argument to the
configure script are not necessary to disable WebRTC
support. The correct argument, --disable-libwebrtc, is
already passed.

ASTERISK-26980

Change-Id: I27da2c894f87914956a72710222e17462d8a44bc
2017-12-03 18:54:04 -06:00
Corey Farrell 39939cecfa autoconf: Remove use of m4_ifblank.
The m4_ifblank macro is not available on CentOS 6, reverse conditionals
to allow use of m4_ifval instead.  ./bootstrap.sh was run but this patch
does not result in any difference to the generated configure script.

Change-Id: I280785deb872ed8d3339d99cce63a2b54d5f1438
2017-12-02 16:59:31 -05:00
George Joseph 075faac2fd AST-2017-013: chan_skinny: Call pthread_detach when sess threads end
chan_skinny creates a new thread for each new session.  In trying
to be a good cleanup citizen, the threads are joinable and the
unload_module function does a pthread_cancel() and a pthread_join()
on any sessions that are active at that time.  This has an
unintended side effect though. Since you can call pthread_join on a
thread that's already terminated, pthreads keeps the thread's
storage around until you explicitly call pthread_join (or
pthread_detach()).   Since only the module_unload function was
calling pthread_join, and even then only on the ones active at the
tme, the storage for every thread/session ever created sticks
around until asterisk exits.

* A thread can detach itself so the session_destroy() function
  now calls pthread_detach() just before it frees the session
  memory allocation.  The module_unload function still takes care
  of the ones that are still active should the module be unloaded.

ASTERISK-27452
Reported by: Juan Sacco

Change-Id: I9af7268eba14bf76960566f891320f97b974e6dd
(cherry picked from commit 8f5dff543e)
2017-12-01 13:29:52 -06:00
Sean Bright d9fdeae6a4 config: Speed up config template lookup
ast_category_get() has an (undocumented) implementation detail where it
tries to match the category name first by an explicit pointer comparison
and if that fails falls back to a normal match.

When initially building an ast_config during ast_config_load, this
pointer comparison can never succeed, but we will end up iterating all
categories twice. As the number of categories using a template
increases, this dual looping becomes quite expensive. So we pass a flag
to category_get_sep() indicating if a pointer match is even possible
before trying to do so, saving us a full pass over the list of current
categories.

In my tests, loading a file with 3 template categories and 12000
additional categories that use those 3 templates (this file configures
4000 PJSIP endpoints with AOR & Auth) takes 1.2 seconds. After this
change, that drops to 22ms.

Change-Id: I59b95f288e11eb6bb34f31ce4cc772136b275e4a
2017-12-01 11:14:04 -06:00
Sean Bright 1ad0fbc80e config: Speed up ACO & sorcery initialization
When starting Asterisk in the foreground, there is a perceptible delay
when loading modules that use the ACO and sorcery config frameworks.
For example, a lightly configured res_pjsip took 853ms to load on my
VM.

I tracked down the slowness to the XPath queries used to associate the
relevant documentation with the config options. One improvement was
adding a call to xmlXPathOrderDocElems after loading an XML document.
From the libxml2 docs:

  Call this routine to speed up XPath computation on static documents.

The second change was to remove recursive descent and wildcard
operators from the XPath queries. After these changes, res_pjsip takes
85ms to load on my VM and there is no longer a perceptible delay when
starting Asterisk in the foreground.

Change-Id: I45d457f1580e26bf5a2b0dab16e8e9ae46dcbd82
2017-12-01 08:41:02 -06:00
Joshua Colp 892df22ccd res_http_post: Not all versions of gmime have GMIME_MAJOR_VERSION.
This change makes the presence of the GMIME_MAJOR_VERSION
definition optional, as not all versions of gmime actually
define it.

ASTERISK-27454

Change-Id: I01d99590045971ed6787899147170a5954077238
2017-12-01 06:08:42 -06:00
Corey Farrell 35a7036a0d README-SERIOUSLY.bestpractices.txt: Convert to markdown
Follow-up to conversion of README.md.

Change-Id: I17ee7cf25bc027ece844efa2c1dfe613aff1e35b
2017-11-30 22:49:50 -05:00
Jenkins2 5de9754313 Merge "translate: Transcode siren14, speex32, silk24, and silk12 via slin16." 2017-11-30 10:16:17 -06:00
Jenkins2 85d83dd0ca Merge "autoconf: Use m4 conditionals where possible." 2017-11-30 09:22:27 -06:00
Jenkins2 4066f853b1 Merge "autoconf: Fix call to AC_CONFIG_AUX_DIR." 2017-11-30 08:42:24 -06:00
Jenkins2 f98dad52d2 Merge "CLI: Remove compatibility code." 2017-11-28 12:50:28 -06:00