asterisk/asterisk.git
23 months agores_rtp_asterisk: Avoid close the rtp/rtcp fd twice.
Aaron An [Mon, 18 Dec 2017 12:14:11 +0000 (20:14 +0800)]
res_rtp_asterisk:  Avoid close the rtp/rtcp fd twice.

When RTCP-MUX enabled. rtp->s is the same as rtcp->s, check this before
close the file descriptor. Close the FD twice will hangs the asterisk
under heavy load.

ASTERISK-27299 #close
Reported-by: Aaron An
Tested-by: AaronAn

Change-Id: I870a072d73fd207463ac116ef97100addbc0820a

23 months agoMerge "res_smdi: Fix shutdown ref."
Jenkins2 [Fri, 15 Dec 2017 18:24:43 +0000 (12:24 -0600)]
Merge "res_smdi: Fix shutdown ref."

23 months agoMerge "res_rtp_asterisk.c: Disable packet flood detection for video streams."
Jenkins2 [Fri, 15 Dec 2017 18:15:42 +0000 (12:15 -0600)]
Merge "res_rtp_asterisk.c: Disable packet flood detection for video streams."

23 months agoMerge "res_hep: hepv3_is_loaded() should check if we are enabled"
Jenkins2 [Fri, 15 Dec 2017 17:52:37 +0000 (11:52 -0600)]
Merge "res_hep: hepv3_is_loaded() should check if we are enabled"

23 months agoMerge "res_clialiases: Fix completion pass-through."
Joshua Colp [Fri, 15 Dec 2017 17:17:02 +0000 (11:17 -0600)]
Merge "res_clialiases: Fix completion pass-through."

23 months agoMerge "coverity: Fix warnings in res_smdi"
Jenkins2 [Fri, 15 Dec 2017 17:11:59 +0000 (11:11 -0600)]
Merge "coverity: Fix warnings in res_smdi"

23 months agoMerge "loader: Minor fix to module registration."
Joshua Colp [Fri, 15 Dec 2017 16:48:02 +0000 (10:48 -0600)]
Merge "loader: Minor fix to module registration."

23 months agoMerge "res_musiconhold: Start playlist after initial announcement"
Jenkins2 [Fri, 15 Dec 2017 16:31:21 +0000 (10:31 -0600)]
Merge "res_musiconhold: Start playlist after initial announcement"

23 months agoMerge "app_queue: Fix extension state subscriptions removed on dialplan reload"
Joshua Colp [Fri, 15 Dec 2017 15:55:12 +0000 (09:55 -0600)]
Merge "app_queue: Fix extension state subscriptions removed on dialplan reload"

23 months agoMerge "pjsip_options: wrongly applied "UNKNOWN" status"
Jenkins2 [Fri, 15 Dec 2017 15:49:50 +0000 (09:49 -0600)]
Merge "pjsip_options: wrongly applied "UNKNOWN" status"

23 months agores_smdi: Fix shutdown ref.
Corey Farrell [Fri, 15 Dec 2017 13:56:13 +0000 (08:56 -0500)]
res_smdi: Fix shutdown ref.

When adding shutdown refs for OPTIONAL_API components I accidentally
added it to the unload_module function in res_smdi.  Move it to
load_module.

Change-Id: I2b9da38fbc11ef78ea23dbb2df92b684be7f647c

23 months agores_hep: hepv3_is_loaded() should check if we are enabled
Sean Bright [Fri, 15 Dec 2017 00:55:03 +0000 (19:55 -0500)]
res_hep: hepv3_is_loaded() should check if we are enabled

res_hep_pjsip.so and res_hep_rtcp.so will still load and do a lot of
unnecessary work even if 'enabled' is set to 'no' in hep.conf.

Change-Id: I3eddfeea09c6b5bc7c641952ee0ae487fd09b64b

23 months agoMerge "pjsip: Ignore state changes from old transactions."
Jenkins2 [Fri, 15 Dec 2017 00:39:24 +0000 (18:39 -0600)]
Merge "pjsip: Ignore state changes from old transactions."

23 months agoloader: Minor fix to module registration.
Corey Farrell [Wed, 22 Nov 2017 02:34:56 +0000 (21:34 -0500)]
loader: Minor fix to module registration.

This protects the module loader itself against crashing if dlopen is
called on a module from outside loader.c.

* Expand scope of lock inside ast_module_register to include reading of
  resource_being_loaded.
* NULL check resource_being_loaded.
* Set resource_being_loaded NULL as soon as dlopen returns.  This fixes
  some error paths where it was not NULL'ed.
* Create module_destroy function to deduplicate code from
  ast_module_unregister and modules_shutdown.
* Resolve leak that occured if a module did not successfully register.
* Simplify checking for successful registration.

Change-Id: I40f07a315e55b92df4fc7faf525ed6d4f396e7d2

23 months agoMerge "configs: Comment out and change IP of iax.conf [demo]"
Jenkins2 [Thu, 14 Dec 2017 21:57:33 +0000 (15:57 -0600)]
Merge "configs: Comment out and change IP of iax.conf [demo]"

23 months agores_clialiases: Fix completion pass-through.
Corey Farrell [Thu, 14 Dec 2017 21:27:45 +0000 (16:27 -0500)]
res_clialiases: Fix completion pass-through.

Never ignore contents of line when generating completion options.

Change-Id: I74389efdfea154019d3b56a9f381610614c044c8

23 months agoMerge "res_pjsip_session: Reinvite using active stream topology if none requested."
Jenkins2 [Thu, 14 Dec 2017 21:22:21 +0000 (15:22 -0600)]
Merge "res_pjsip_session: Reinvite using active stream topology if none requested."

23 months agores_rtp_asterisk.c: Disable packet flood detection for video streams.
Richard Mudgett [Tue, 12 Dec 2017 00:20:06 +0000 (18:20 -0600)]
res_rtp_asterisk.c: Disable packet flood detection for video streams.

We should not do flood detection on video RTP streams.  Video RTP streams
are very bursty by nature.  They send out a burst of packets to update the
video frame then wait for the next video frame update.  Really only audio
streams can be checked for flooding.  The others are either bursty or
don't have a set rate.

* Added code to selectively disable packet flood detection for video RTP
streams.

ASTERISK-27440

Change-Id: I78031491a6e75c2d4b1e9c2462dc498fe9880a70

23 months agores_pjsip_sdp_rtp: Add NULL check in add_crypto_to_stream
George Joseph [Thu, 14 Dec 2017 20:05:23 +0000 (13:05 -0700)]
res_pjsip_sdp_rtp: Add NULL check in add_crypto_to_stream

add_crypto_to_stream wasn't checking for a NULL
session->inv_session->neg before calling pjmedia_sdp_neg_get_state.
This was causing a crash if the negotiation hadn't already been
completed and asterisk was compiled with --enable-dev-mode.

Change-Id: I57c6229954a38145da9810fc18657bfcc4d9d0c9

23 months agores_musiconhold: Start playlist after initial announcement
Sean Bright [Thu, 14 Dec 2017 18:14:10 +0000 (13:14 -0500)]
res_musiconhold: Start playlist after initial announcement

Reset the samples counter to zero when we are done playing an
announcement so that we don't skip into the middle of the first file in
the playlist.

Also add the selected annoucement to the output of 'moh show classes.'

ASTERISK-24329 #close
Reported by: Thomas Frederiksen

Change-Id: I2a5f986a31279c981592f49391409ebf38d6f6d0

23 months agocoverity: Fix warnings in res_smdi
Sean Bright [Thu, 14 Dec 2017 16:51:02 +0000 (11:51 -0500)]
coverity: Fix warnings in res_smdi

ASTERISK-19657 #close
Reported by: Matt Jordan III, Esq.

Change-Id: I59a5e6ef3e7d9e848bec1f4b40cb73321bc7956a

23 months agoconfigs: Comment out and change IP of iax.conf [demo]
Sean Bright [Thu, 14 Dec 2017 16:22:13 +0000 (11:22 -0500)]
configs: Comment out and change IP of iax.conf [demo]

This no longer appears to exist, so no sense in causing confusion.

ASTERISK-27175 #close
Reported by: Tzafrir Cohen

Change-Id: Idde967924c69f6a741dc9a5ab7dacb44d22cf100

23 months agoMerge "menuselect: Tweak check for recently run configure."
Joshua Colp [Thu, 14 Dec 2017 13:08:57 +0000 (07:08 -0600)]
Merge "menuselect: Tweak check for recently run configure."

23 months agoMerge "README: Remove outdated references to tex docs"
Joshua Colp [Thu, 14 Dec 2017 12:48:17 +0000 (06:48 -0600)]
Merge "README: Remove outdated references to tex docs"

23 months agoMerge "Add new AMI action for app_voicemail"
Joshua Colp [Thu, 14 Dec 2017 12:14:32 +0000 (06:14 -0600)]
Merge "Add new AMI action for app_voicemail"

23 months agoMerge "chan_sip: 3PCC patch for AMI "SIPnotify""
Joshua Colp [Thu, 14 Dec 2017 12:14:16 +0000 (06:14 -0600)]
Merge "chan_sip: 3PCC patch for AMI "SIPnotify""

23 months agoMerge "pjsip_options: contacts sometimes not being updated on reload"
Kevin Harwell [Wed, 13 Dec 2017 22:50:56 +0000 (16:50 -0600)]
Merge "pjsip_options: contacts sometimes not being updated on reload"

23 months agoMerge "res_pjsip: Assign support levels to a few modules"
Jenkins2 [Wed, 13 Dec 2017 21:33:41 +0000 (15:33 -0600)]
Merge "res_pjsip: Assign support levels to a few modules"

23 months agoREADME: Remove outdated references to tex docs
George Joseph [Wed, 13 Dec 2017 20:26:04 +0000 (13:26 -0700)]
README: Remove outdated references to tex docs

Added links to the wiki to replace references to outdated
tex docs.

ASTERISK-27430
Reported by: Corey Farrell

Change-Id: I5007e732b30bc7b63d124c530ae8857c89991209

23 months agoMerge "pjsip_options: dynamic contact's fields not updated on reload"
Jenkins2 [Wed, 13 Dec 2017 20:27:52 +0000 (14:27 -0600)]
Merge "pjsip_options: dynamic contact's fields not updated on reload"

23 months agoMerge "CLI: Fix 'core show sysinfo' function ordering."
George Joseph [Wed, 13 Dec 2017 19:12:27 +0000 (13:12 -0600)]
Merge "CLI: Fix 'core show sysinfo' function ordering."

23 months agoMerge "chan_pjsip/res_pjsip: Add CHANNEL(pjsip,request_uri)"
Joshua Colp [Wed, 13 Dec 2017 17:21:15 +0000 (11:21 -0600)]
Merge "chan_pjsip/res_pjsip: Add CHANNEL(pjsip,request_uri)"

23 months agoAdd new AMI action for app_voicemail
pchero [Fri, 8 Dec 2017 12:48:12 +0000 (12:48 +0000)]
Add new AMI action for app_voicemail

Currently, to figure out specified voicemail's status, there's only one
way to do it, which is use a VoicemailUserEntry AMI message.
But it consumed it too much resource(it check everything).
So, added new AMI action.

ASTERISK-27470

Change-Id: Ie4eba1424a142e5fbd1d9fb1821a3fc1a1e238b7

23 months agoAST-2017-012: Place single RTCP report block at beginning of report.
Joshua Colp [Thu, 30 Nov 2017 16:12:55 +0000 (16:12 +0000)]
AST-2017-012: Place single RTCP report block at beginning of report.

When the RTCP code was transitioned over to Stasis a code change
was made to keep track of how many reports are present. This count
controlled where report blocks were placed in the RTCP report.

If a compound RTCP packet was received this logic would incorrectly
place a report block in the wrong location resulting in a write
to an invalid location.

This change removes this counting logic and always places the report
block at the first position. If in the future multiple reports are
supported the logic can be extended but for now keeping a count
serves no purpose.

ASTERISK-27382
ASTERISK-27429

Change-Id: Iad6c8a9985c4b608ef493e19c421211615485116

23 months agoMerge "chan_sip: Don't crash in Dial on invalid destination"
Jenkins2 [Wed, 13 Dec 2017 13:14:13 +0000 (07:14 -0600)]
Merge "chan_sip: Don't crash in Dial on invalid destination"

23 months agores_pjsip_session: Reinvite using active stream topology if none requested.
Joshua Colp [Wed, 13 Dec 2017 12:54:58 +0000 (12:54 +0000)]
res_pjsip_session: Reinvite using active stream topology if none requested.

When a connected line update is sent to an endpoint we do not request
a specific stream topology to be used. Previously this resulted in the
configured stream topology being used which may actually differ from the
currently negotiated topology. PJSIP is helpful in this regard in that
it will fill in any missing streams with removed ones. This results in
our own state not matching the SDP, though, and we do not apply the
negotiated SDP.

This change tweaks the code to use the actively negotiated stream
topology if it is present with a fallback to the configured one. This
results in the SDP and the state having matching information and the
world is happy.

ASTERISK*27397

Change-Id: I7a57117f0183479e6884b7bf3a53bb8c7464f604

23 months agoMerge "chan_sip: Don't send trailing \0 on keep alive packets"
Jenkins2 [Wed, 13 Dec 2017 12:36:03 +0000 (06:36 -0600)]
Merge "chan_sip: Don't send trailing \0 on keep alive packets"

23 months agopjsip: Ignore state changes from old transactions.
Joshua Colp [Wed, 6 Dec 2017 14:24:03 +0000 (14:24 +0000)]
pjsip: Ignore state changes from old transactions.

When we fail over to a new target we create a new transaction
and it becomes the current INVITE transaction. This does not
prevent the previous transaction from raising state changes
and causing the session to be prematurely disconnected if a
transport error occurs immediately.

This change backports a fix from PJSIP that eliminates the
incorrect state change and reduces when they would be raised
in the first place.

ASTERISK-27408

Change-Id: Id22d087591782eee31311753d11e7eca4b95ef34

23 months agochan_sip: 3PCC patch for AMI "SIPnotify"
Yasuhiko Kamata [Wed, 13 Dec 2017 04:42:35 +0000 (13:42 +0900)]
chan_sip: 3PCC patch for AMI "SIPnotify"

A patch for sending in-dialog SIP NOTIFY message
with "SIPnotify" AMI action.

ASTERISK-27461

Change-Id: I5797ded4752acd966db6b13971284db684cc5ab4

23 months agoapp_queue: Fix extension state subscriptions removed on dialplan reload
Ivan Poddubny [Tue, 12 Dec 2017 21:38:01 +0000 (22:38 +0100)]
app_queue: Fix extension state subscriptions removed on dialplan reload

The approach with having a single global subscription to all extension
state changes has one issue: dynamically created hints don't have any
watchers and are therefore garbage collected on the first dialplan
reload.

This change creates a state subscription for every queue member with a
hint as state_interface, thus increasing the count of watches for
hints, so they are not destroyed prematurely anymore.

There are 2 side effects:
1. The state change callback in app_queue is not executed when
   there are no members referring to the extension.
2. The callback is called multiple times for the same hint if it's
   associated with more than one queue member.

Reported by: Steven T. Wheeler

ASTERISK-18411 #close

Change-Id: I4956af2136ea2a7f110ac9272eae5f6e676d8f89

23 months agochan_sip: Don't send trailing \0 on keep alive packets
Sean Bright [Tue, 12 Dec 2017 21:28:54 +0000 (16:28 -0500)]
chan_sip: Don't send trailing \0 on keep alive packets

This is a partial fix for ASTERISK~25817 but does not address the
comments regarding RFC 5626.

Change-Id: I227e2d10c0035bbfa1c6e46ae2318fd1122d8420

23 months agochan_sip: Don't crash in Dial on invalid destination
Sean Bright [Tue, 12 Dec 2017 21:19:09 +0000 (16:19 -0500)]
chan_sip: Don't crash in Dial on invalid destination

Stripping the DNID in a SIP dial string can result in attempting to call
the argument parsing macros on an empty string, causing a crash.

ASTERISK-26131 #close
Reported by: Dwayne Hubbard
Patches:
dw-asterisk-master-dnid-crash.patch (license #6257) patch
uploaded by Dwayne Hubbard

Change-Id: Ib84c1f740a9ec0539d582b09d847fc85ddca1c5e

23 months agomenuselect: Tweak check for recently run configure.
Corey Farrell [Tue, 12 Dec 2017 21:16:38 +0000 (16:16 -0500)]
menuselect: Tweak check for recently run configure.

Recently menuselect has randomly produced an error stating that
configure was just run and make had to be restarted.  I believe this is
due to an incorrect menuselect/Makefile rule.  The original rule
produced an error if makeopts or autoconfig.h were older than
makeopts.in or autoconfig.h.in.  I believe this can create an issue if
makeopts is older than autoconfig.h.in or if autoconfig.h is older than
makeopts.in.  The new rules compare files independently.

Change-Id: Ibca155035fa1392c95e33cbf25f257902abba17b

23 months agochan_pjsip/res_pjsip: Add CHANNEL(pjsip,request_uri)
Richard Mudgett [Thu, 7 Dec 2017 23:51:08 +0000 (17:51 -0600)]
chan_pjsip/res_pjsip: Add CHANNEL(pjsip,request_uri)

This patch does three things associated with the initial incoming INVITE
request URI.

1) Add access to the full initial incoming INVITE request URI.

2) We were not setting DNID on incoming PJSIP channels.  The DNID is the
user portion of the initial incoming INVITE Request-URI.  The value is
accessed by reading CALLERID(dnid).

3) Fix CHANNEL(pjsip,target_uri) documentation.

* The initial incoming INVITE request URI is now available using
CHANNEL(pjsip,request_uri).

* Set the DNID on PJSIP channel creation so CALLERID(dnid) can return the
initial incoming INVITE request URI user portion.

* CHANNEL(pjsip,target_uri) now correctly documents that the target URI is
the contact URI.

* Refactored print_escaped_uri() out of channel_read_pjsip() to handle
pjsip_uri_print() error condition when the buffer is too small.

ASTERISK-27478

Change-Id: I512e60d1f162395c946451becb37af3333337b33

23 months agores_pjsip: Add TLSv1.1 and TLSv1.2 support
Sean Bright [Tue, 12 Dec 2017 15:28:45 +0000 (10:28 -0500)]
res_pjsip: Add TLSv1.1 and TLSv1.2 support

Support for these protocols was added in the same commit as the 'proto'
field, so we can safely use the same ./configure check.

For reference: https://trac.pjsip.org/repos/changeset/4968

Change-Id: Icf4975d785d6bfb8f30ac7ffa695a0adf9382dac

23 months agores_pjsip: Assign support levels to a few modules
Sean Bright [Tue, 12 Dec 2017 14:06:32 +0000 (09:06 -0500)]
res_pjsip: Assign support levels to a few modules

Change-Id: I51f6945c4023cb93fc7b87be5ab4c50e9e6ee27d

23 months agoCLI: Fix 'core show sysinfo' function ordering.
Corey Farrell [Sat, 9 Dec 2017 06:35:12 +0000 (01:35 -0500)]
CLI: Fix 'core show sysinfo' function ordering.

Handle CLI initialization before any processing occurs.

Change-Id: I598b911d2e409214bbdfd0ba0882be1d602d221c

23 months agopjsip_options: wrongly applied "UNKNOWN" status
Kevin Harwell [Mon, 11 Dec 2017 21:27:29 +0000 (15:27 -0600)]
pjsip_options: wrongly applied "UNKNOWN" status

A couple of places were setting the status to "UNKNOWN" when qualifies were
being disabled. Instead this should be set to the "CREATED" status that
represents when a contact is given (uri available), but the qualify frequency
is set to zero so we don't know the status.

This patch updates the relevant places with "CREATED". It also updates the
"CREATED" status description (value shown in CLI/AMI/ARI output) to a value
of "NonQualified"/"NonQual" as this description is hopefully less confusing.

ASTERISK-27467

Change-Id: Id67509d25df92a72eb3683720ad2a95a27b50c89

23 months agostasis_channels.c: Don't set channel snapshot caller_dnid twice.
Richard Mudgett [Fri, 8 Dec 2017 18:04:25 +0000 (12:04 -0600)]
stasis_channels.c: Don't set channel snapshot caller_dnid twice.

Change-Id: Ib8d45bbdfbda81e65045f6dff874d189b74e5471

23 months agoMerge "codec_opus: Make libcurl a dependency in menuselect"
Jenkins2 [Mon, 11 Dec 2017 18:22:21 +0000 (12:22 -0600)]
Merge "codec_opus: Make libcurl a dependency in menuselect"

23 months agoMerge "astdb: Improve prefix searches in astdb"
Jenkins2 [Mon, 11 Dec 2017 18:12:58 +0000 (12:12 -0600)]
Merge "astdb: Improve prefix searches in astdb"

23 months agoMerge "loader: Refactor resource_name_match."
Jenkins2 [Mon, 11 Dec 2017 17:44:34 +0000 (11:44 -0600)]
Merge "loader: Refactor resource_name_match."

2 years agoMerge "res_stasis and res_speech: Fix load order."
Joshua Colp [Mon, 11 Dec 2017 17:12:25 +0000 (11:12 -0600)]
Merge "res_stasis and res_speech: Fix load order."

2 years agoMerge "utils: Add convenience function for setting fd flags"
Jenkins2 [Mon, 11 Dec 2017 16:13:09 +0000 (10:13 -0600)]
Merge "utils: Add convenience function for setting fd flags"

2 years agocodec_opus: Make libcurl a dependency in menuselect
Sean Bright [Mon, 11 Dec 2017 15:45:17 +0000 (10:45 -0500)]
codec_opus: Make libcurl a dependency in menuselect

ASTERISK-27475 #close

Change-Id: If7384bc6ed002ef140dec69798d14c52b7cfd800

2 years agoMerge "pjsip: Improve CLI completion performance"
Jenkins2 [Mon, 11 Dec 2017 15:36:54 +0000 (09:36 -0600)]
Merge "pjsip: Improve CLI completion performance"

2 years agoMerge "CDR: Fix deadlock setting some CDR values."
Jenkins2 [Mon, 11 Dec 2017 15:06:41 +0000 (09:06 -0600)]
Merge "CDR: Fix deadlock setting some CDR values."

2 years agopjsip: Improve CLI completion performance
Sean Bright [Fri, 8 Dec 2017 18:48:48 +0000 (13:48 -0500)]
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

2 years agoastdb: Improve prefix searches in astdb
Sean Bright [Thu, 7 Dec 2017 20:19:40 +0000 (15:19 -0500)]
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

2 years agoloader: Refactor resource_name_match.
Corey Farrell [Sat, 9 Dec 2017 00:19:34 +0000 (19:19 -0500)]
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

2 years agopjsip_configuration: Add correct file header
Sean Bright [Fri, 8 Dec 2017 20:58:54 +0000 (15:58 -0500)]
pjsip_configuration: Add correct file header

Change-Id: I25348c386a222bb704aff07f54375108a6402906

2 years agoutils: Add convenience function for setting fd flags
Sean Bright [Thu, 7 Dec 2017 15:52:39 +0000 (10:52 -0500)]
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

2 years agores_stasis and res_speech: Fix load order.
Corey Farrell [Fri, 8 Dec 2017 01:33:27 +0000 (20:33 -0500)]
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

2 years agopjsip_options: contacts sometimes not being updated on reload
Kevin Harwell [Fri, 8 Dec 2017 00:22:34 +0000 (18:22 -0600)]
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

2 years agopjsip_options: dynamic contact's fields not updated on reload
Kevin Harwell [Fri, 8 Dec 2017 00:18:00 +0000 (18:18 -0600)]
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

2 years agoMerge "translate: Skip matrix_rebuild during shutdown."
Jenkins2 [Thu, 7 Dec 2017 20:33:47 +0000 (14:33 -0600)]
Merge "translate: Skip matrix_rebuild during shutdown."

2 years agoMerge "sounds_index: Avoid repeatedly reindexing."
George Joseph [Thu, 7 Dec 2017 19:26:22 +0000 (13:26 -0600)]
Merge "sounds_index: Avoid repeatedly reindexing."

2 years agoMerge "media_index: Improve startup."
George Joseph [Thu, 7 Dec 2017 19:26:06 +0000 (13:26 -0600)]
Merge "media_index: Improve startup."

2 years agotranslate: Skip matrix_rebuild during shutdown.
Corey Farrell [Thu, 7 Dec 2017 05:35:14 +0000 (00:35 -0500)]
translate: Skip matrix_rebuild during shutdown.

Change-Id: I1e5eef4029cba56e33d786c5a5ade8091e531a1e

2 years agosounds_index: Avoid repeatedly reindexing.
Corey Farrell [Wed, 6 Dec 2017 20:49:32 +0000 (15:49 -0500)]
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

2 years agoCDR: Fix deadlock setting some CDR values.
Richard Mudgett [Wed, 6 Dec 2017 00:04:47 +0000 (18:04 -0600)]
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

2 years agomedia_index: Improve startup.
Corey Farrell [Wed, 6 Dec 2017 18:42:55 +0000 (13:42 -0500)]
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

2 years agobridge_basic.c: Update transfer diagnostic messages addendum.
Richard Mudgett [Wed, 6 Dec 2017 13:36:02 +0000 (07:36 -0600)]
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

2 years agoMerge "bridge_basic.c: Update transfer diagnostic messages."
Jenkins2 [Wed, 6 Dec 2017 12:51:31 +0000 (06:51 -0600)]
Merge "bridge_basic.c: Update transfer diagnostic messages."

2 years agoMerge "Add new object for VoicemailUserEntry"
Jenkins2 [Wed, 6 Dec 2017 02:10:51 +0000 (20:10 -0600)]
Merge "Add new object for VoicemailUserEntry"

2 years agoMerge "res_rtp_asterisk.c: Increase strictrtp learning timeout time."
Joshua Colp [Wed, 6 Dec 2017 01:31:14 +0000 (19:31 -0600)]
Merge "res_rtp_asterisk.c: Increase strictrtp learning timeout time."

2 years agoMerge "pjproject: Clean up disabling of WebRTC support."
Jenkins2 [Wed, 6 Dec 2017 00:30:42 +0000 (18:30 -0600)]
Merge "pjproject: Clean up disabling of WebRTC support."

2 years agobridge_basic.c: Update transfer diagnostic messages.
Niklas Larsson [Wed, 29 Nov 2017 12:21:42 +0000 (13:21 +0100)]
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

2 years agosecurity-events: Fix SuccessfulAuth using_password declaration.
Richard Mudgett [Fri, 1 Dec 2017 19:54:26 +0000 (13:54 -0600)]
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

2 years agoMerge "res_rtp_asterisk: Correct default in sample configuration file."
Jenkins2 [Mon, 4 Dec 2017 17:47:13 +0000 (11:47 -0600)]
Merge "res_rtp_asterisk: Correct default in sample configuration file."

2 years agores_rtp_asterisk.c: Increase strictrtp learning timeout time.
Richard Mudgett [Thu, 30 Nov 2017 18:50:58 +0000 (12:50 -0600)]
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

2 years agoMerge "README-SERIOUSLY.bestpractices.txt: Convert to markdown"
Jenkins2 [Mon, 4 Dec 2017 16:27:54 +0000 (10:27 -0600)]
Merge "README-SERIOUSLY.bestpractices.txt: Convert to markdown"

2 years agoMerge "autoconf: Remove use of m4_ifblank."
Jenkins2 [Mon, 4 Dec 2017 15:38:31 +0000 (09:38 -0600)]
Merge "autoconf: Remove use of m4_ifblank."

2 years agoMerge "config: Speed up config template lookup"
Joshua Colp [Mon, 4 Dec 2017 14:51:11 +0000 (08:51 -0600)]
Merge "config: Speed up config template lookup"

2 years agores_rtp_asterisk: Correct default in sample configuration file.
Alexander Traud [Mon, 4 Dec 2017 14:33:16 +0000 (15:33 +0100)]
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

2 years agoMerge "config: Speed up ACO & sorcery initialization"
Joshua Colp [Mon, 4 Dec 2017 13:41:28 +0000 (07:41 -0600)]
Merge "config: Speed up ACO & sorcery initialization"

2 years agoMerge "res_http_post: Not all versions of gmime have GMIME_MAJOR_VERSION."
Joshua Colp [Mon, 4 Dec 2017 13:40:06 +0000 (07:40 -0600)]
Merge "res_http_post: Not all versions of gmime have GMIME_MAJOR_VERSION."

2 years agoAdd new object for VoicemailUserEntry
Sungtae Kim [Mon, 4 Dec 2017 09:40:18 +0000 (10:40 +0100)]
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

2 years agopjproject: Clean up disabling of WebRTC support.
Joshua Colp [Mon, 4 Dec 2017 00:49:14 +0000 (00:49 +0000)]
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

2 years agoautoconf: Remove use of m4_ifblank.
Corey Farrell [Sat, 2 Dec 2017 21:55:31 +0000 (16:55 -0500)]
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

2 years agoAST-2017-013: chan_skinny: Call pthread_detach when sess threads end
George Joseph [Thu, 30 Nov 2017 20:38:50 +0000 (13:38 -0700)]
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 8f5dff543e457ee3450d21e741901609af0cd779)

2 years agoconfig: Speed up config template lookup
Sean Bright [Fri, 1 Dec 2017 16:01:01 +0000 (11:01 -0500)]
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

2 years agoconfig: Speed up ACO & sorcery initialization
Sean Bright [Fri, 1 Dec 2017 14:29:43 +0000 (09:29 -0500)]
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

2 years agores_http_post: Not all versions of gmime have GMIME_MAJOR_VERSION.
Joshua Colp [Fri, 1 Dec 2017 12:07:52 +0000 (08:07 -0400)]
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

2 years agoREADME-SERIOUSLY.bestpractices.txt: Convert to markdown
Corey Farrell [Fri, 1 Dec 2017 03:24:42 +0000 (22:24 -0500)]
README-SERIOUSLY.bestpractices.txt: Convert to markdown

Follow-up to conversion of README.md.

Change-Id: I17ee7cf25bc027ece844efa2c1dfe613aff1e35b

2 years agoMerge "translate: Transcode siren14, speex32, silk24, and silk12 via slin16."
Jenkins2 [Thu, 30 Nov 2017 16:16:17 +0000 (10:16 -0600)]
Merge "translate: Transcode siren14, speex32, silk24, and silk12 via slin16."

2 years agoMerge "autoconf: Use m4 conditionals where possible."
Jenkins2 [Thu, 30 Nov 2017 15:22:27 +0000 (09:22 -0600)]
Merge "autoconf: Use m4 conditionals where possible."

2 years agoMerge "autoconf: Fix call to AC_CONFIG_AUX_DIR."
Jenkins2 [Thu, 30 Nov 2017 14:42:24 +0000 (08:42 -0600)]
Merge "autoconf: Fix call to AC_CONFIG_AUX_DIR."

2 years agoMerge "CLI: Remove compatibility code."
Jenkins2 [Tue, 28 Nov 2017 18:50:28 +0000 (12:50 -0600)]
Merge "CLI: Remove compatibility code."

2 years agoMerge "translate: Show sample rate for silk, speex, and slin in translation table."
Joshua Colp [Tue, 28 Nov 2017 18:37:51 +0000 (12:37 -0600)]
Merge "translate: Show sample rate for silk, speex, and slin in translation table."