Commit Graph

6503 Commits

Author SHA1 Message Date
George Joseph 45eb9a28eb Merge "astobj2: Comment on OBJ_NOLOCK in ao2_container_clone." 2018-10-04 07:25:47 -05:00
George Joseph f55e20ae83 Merge "http.c: Reload TLS even if http.conf hasn't changed" 2018-10-04 07:23:49 -05:00
George Joseph 967fffb569 Merge "core/frame: Fix ast_frdup() and ast_frisolate() for empty text frames" 2018-10-03 13:55:24 -05:00
Corey Farrell 932d0a40cf astobj2: Comment on OBJ_NOLOCK in ao2_container_clone.
The test for OBJ_NOLOCK looks wrong but it isn't.  Add comments to
prevent confusion.

Change-Id: I9662b82eb39e7627a1f1944fd18f967a2b987344
2018-10-03 11:03:48 -05:00
George Joseph bc9a7c419c Merge "astobj2: Record lock usage to refs log when DEBUG_THREADS is enabled." 2018-10-03 10:17:27 -05:00
George Joseph 24dc6ee8ae Merge "loader: Fix result of module reload error." 2018-10-03 10:17:07 -05:00
George Joseph 910f5dbd44 Merge "core: Disable astobj2 locking for some common objects." 2018-10-03 10:16:20 -05:00
Sean Bright 286339aa34 http.c: Reload TLS even if http.conf hasn't changed
There is currently no way to indicate to Asterisk that TLS certificates
and/or keys have been updated other than by modifying http.conf or
restarting Asterisk.

There is already code in main/tcptls.c that determines if a reload is
actually necessary based on the hashes of the certicate and dependent
files, so this change merely gives us a way to request a reload without
explicitly modifying http.conf.

Change-Id: Ie795420dcc7eb3d91336820688a29adbcc321276
2018-10-03 08:35:12 -05:00
Corey Farrell cacbe32534
core: Disable astobj2 locking for some common objects.
* ACO options
* Indications
* Module loader ref_debug object
* Media index info and variants
* xmldoc items

These allocation locations were identified using reflocks.py on the
master branch.

Change-Id: Ie999b9941760be3d1946cdb6e30cb85fd97504d8
2018-10-02 16:47:23 -04:00
Corey Farrell b25a261aa5
loader: Fix result of module reload error.
When a module reload fails we never set AST_MODULE_RELOAD_ERROR.  This
caused reload failures to incorrectly report 'No module found'.

Change-Id: I5f3953e0f7d135e53ec797f24c97ee3f73f232e7
2018-10-02 14:12:58 -04:00
Corey Farrell e4cf513f81
loader: Improve error handling.
* Display list of unavailable dependencies when they cause another
  module to fail loading.
* When a module declines to load find all modules which depend on it so
  they can be declined and listed together.
* Prevent retry of declined modules during startup.
* When a module fails to dlopen try loading it with RTLD_LAZY so we can
  attempt to display the list of missing dependencies.

These changes are meant to reduce logger spam that is caused when a
module has many dependencies and declines to load.  This also fixes some
error paths which failed to recognize required modules.

Module load/start errors are delayed until the end of loader startup.

Change-Id: I046052c71331c556c09d39f47a3b92975f3e1758
2018-10-02 13:18:12 -04:00
neutrino88 24cece660b core/frame: Fix ast_frdup() and ast_frisolate() for empty text frames
If a channel creates an AST_TEXT_FRAME with datalen == 0, the ast_frdup()
and ast_frisolate() functions could create a clone frame with an invalid
data.ptr which would cause a crash.  The proposed fix is to make sure that
for such empty text frames, ast_frdup() and ast_frisolate() return cloned
text frames with a valid data.ptr.

ASTERISK-28076
Reported by: Emmanuel BUU
Tested by: Emmanuel BUU

Change-Id: Ib882dd028598f13c4c233edbfdd7e54ad44a68e9
2018-10-02 11:25:25 -05:00
Corey Farrell 13df745278
astobj2: Record lock usage to refs log when DEBUG_THREADS is enabled.
When DEBUG_THREADS is enabled we can know if the astobj2 mutex / rwlock
was ever used, so it can be recorded in the REF_DEBUG destructor entry.

Create contrib/scripts/reflocks.py to process locking used by
allocator.  This can be used to identify places where
AO2_ALLOC_OPT_LOCK_NOLOCK should be used to reduce memory usage.

Change-Id: I2e3cd23336a97df2692b545f548fd79b14b53bf4
2018-10-01 22:27:30 -04:00
Jenkins2 252e4a8fd4 Merge "astobj2: Reduce memory overhead." 2018-10-01 09:02:37 -05:00
Joshua Colp 69f4740fa1 Merge "lock: Improve performance of DEBUG_THREADS." 2018-10-01 08:32:49 -05:00
Corey Farrell 205c6be895
lock: Improve performance of DEBUG_THREADS.
Add a volatile flag to lock tracking structures so we only need to use
the global lock when first initializing tracking.

Additionally add support for DEBUG_THREADS_LOOSE_ABI.  This is used by
astobj2.c to eliminate storage for tracking fields when DEBUG_THREADS is
not defined.

Change-Id: Iabd650908901843e9fff47ef1c539f0e1b8cb13b
2018-09-28 14:42:04 -04:00
George Joseph 930cbec67d Merge "config.c: Cleanup AST_INCLUDE_GLOB" 2018-09-28 13:16:17 -05:00
Corey Farrell 62a0db2df1
astobj2: Reduce memory overhead.
Reduce options to 2-bit field, magic to 30 bit field.  Move ref_counter
next to options and explicitly use int32_t so the fields will pack.

This reduces memory overhead for every ao2 object by 8 bytes on x86_64.

Change-Id: Idc1baabb35ec3b3d8de463c4fa3011eaf7fcafb5
2018-09-27 18:02:04 -04:00
Sean Bright ac23e5ad48 config.c: Cleanup AST_INCLUDE_GLOB
* In main/config.c, AST_INCLUDE_GLOB is fixed to '1' making the #ifdefs
  pointless.

* In utils/extconf.c, AST_INCLUDE_GLOB is never defined so there is a
  lot of dead code.

Change-Id: I1bad1a46d7466ddf90d52cc724e997195495226c
2018-09-27 15:07:08 -05:00
Corey Farrell 39bf9881e0
astobj2: Fix shutdown order.
When REF_DEBUG and AO2_DEBUG are both enabled we closed the refs log
before we shutdown astobj2_container.  This caused the AO2_DEBUG
container registration container to be reported as a leak.

Change-Id: If9111c4c21c68064b22c546d5d7a41fac430430e
2018-09-27 06:33:22 -04:00
George Joseph aa10d6d5eb Merge "jansson: Backport fixes to bundled, use json_vsprintf if available." 2018-09-26 11:09:50 -05:00
George Joseph de14ed0b93 Merge "rtp_engine: rtcp_report_to_json can overflow the ssrc integer value" 2018-09-26 08:02:28 -05:00
Corey Farrell adf539b2f0 jansson: Backport fixes to bundled, use json_vsprintf if available.
Use json_vsprintf from versions which contain fix for va_copy leak.

Apply fixes from jansson master:
* va_copy leak fix.
* Avoid potential invalid memory read in json_pack.
* Rename variable that shadowed another.

Change-Id: I7522e462d2a52f53010ffa1e7d705c666ec35539
2018-09-24 18:00:26 -05:00
Corey Farrell 93777faf36
json: Take advantage of new API's.
* Use "o*" format specifier for optional fields in ast_json_party_id.
* Stop using ast_json_deep_copy on immutable objects, it is now thread
  safe to just use ast_json_ref.

Additional changes to ast_json_pack calls in the vicinity:
* Use "O" when an object needs to be bumped.  This was previously
  avoided as it was not thread safe.
* Use "o?" and "O?" to replace NULL with ast_json_null().  The
  "?" is a new feature of ast_json_pack starting with Asterisk 16.

Change-Id: I8382d28d7d83ee0ce13334e51ae45dbc0bdaef48
2018-09-24 15:47:37 -04:00
George Joseph 06c0676da0 app_voicemail: Cleanup mailbox topic and cache
app_voicemail wasn't properly cleaning up the stasis cache or the
mwi topic pool when the module was unloaded or when a user was
deleted as a result of a reload.  This resulted in leaks in both
areas.

* app_voicemail now calls ast_delete_mwi_state_full when it frees
  a user structure and ast_delete_mwi_state_full in turn now calls
  the new stasis_topic_pool_delete_topic function to clear the topic
  from the pool.

Change-Id: Ide23144a4a810e7e0faad5a8e988d15947965df8
2018-09-24 10:10:48 -05:00
George Joseph 9ec08d7532 Merge "stasis: Add function to delete topic from pool" 2018-09-24 09:29:14 -05:00
Kevin Harwell 31fba4e869
rtp_engine: rtcp_report_to_json can overflow the ssrc integer value
When writing an RTCP report to json the code attempts to pack the "ssrc" and
"source_ssrc" unsigned integer values as a signed int value type. This of course
means if the ssrc's unsigned value is greater than that which can fit into a
signed integer value it gets converted to a negative number. Subsequently, the
negative value goes out in the json report.

This patch now packs the value as a json_int_t, which is the widest integer type
available on a given system. This should make it so the value no longer
overflows.

Note, this was caught by two failing tests hep/rtcp-receiver/ and
hep/rtcp-sender.

Change-Id: I2af275286ee5e795b79f0c3d450d9e4b28e958b0
2018-09-21 18:06:21 -04:00
George Joseph 4d51a8e05b channel.c: Address stack overflow in does_id_conflict()
does_id_conflict() was passing a pointer to an int to a callback
that expected a pointer to a size_t.

Found by the Address Sanitizer.

Change-Id: I0ff542067eef63a14a60301654d65d34fe2ad503
2018-09-21 15:32:31 -05:00
George Joseph d277db4a38 stasis: Add function to delete topic from pool
There's been a long standing leak when using topic pools.  The
topics in the pool get cleaned up when the last pool reference is
released but you can't remove a topic specifically.  If you reloaded
app_voicemail for instance, and mailboxes went away, their topics
were left in the pool.

* Added stasis_topic_pool_delete_topic() so modules can clean up
  topics from pools.
* Registered the topic pool containers so it can be examined from
  the CLI when AO2_DEBUG is enabled.  They'll be named
  "<topic_pool_name>-pool".

Change-Id: Ib7957951ee5c9b9b4482af7b9b4349112d62bc25
2018-09-20 12:13:22 -06:00
George Joseph e3e24a0844 Merge "stasis: No need to keep a stasis type ref in a stasis msg or cache object." 2018-09-20 13:08:45 -05:00
Joshua Colp b793f8ccf2 Merge "stasis_cache: Stop caching stasis subscription change messages" 2018-09-20 09:43:26 -05:00
Richard Mudgett c99a9b228b stasis: No need to keep a stasis type ref in a stasis msg or cache object.
Stasis message types are global ao2 objects and we make stasis messages
and cache entries hold references to them.  Since there are currently
situations where cache objects are never deleted, the reference count on
the types can exceed 100000 and generate a FRACK assertion message.  The
stasis message cache could conceivably also have that many messages
legitimately on large systems.

The only down side to not holding the message type ref in the stasis
message is it only makes a crash either at shutdown or when manually
unloading a busy module slightly more likely.  However, this is more
exposing a pre-existing stasis shutdown ordering issue than a problem with
not holding a message type ref in stasis messages.

* Made stasis messages and cache entries no longer hold a ref to the
message type.

Change-Id: Ibaa28efa8d8ad3836f0c65957192424c7f561707
2018-09-19 12:32:46 -05:00
Richard Mudgett 79e3becc5d stasis_message.c: Don't create immutable stasis objects with locks.
* Create the stasis message object without a lock as it is immutable.
* Create the stasis message type object without a lock as it is immutable.
* Creating the stasis message type could crash if the passed in type name
is NULL and REF_DEBUG is enabled.  Added missing NULL check when passing
the ao2 object tag string.

Change-Id: I28763c58bb9f0b427c11971d0103bf94055e7b32
2018-09-18 13:18:15 -05:00
George Joseph 5ec6d2c33e stasis_cache: Stop caching stasis subscription change messages
Since app_voicemail no longer uses the cache to maintain its state
there is no longer a need to cache these messages.

ASTERISK-27121

Change-Id: I321c708505f5ad8d00e1b0afc4c27dc2ac12ecb4
2018-09-14 06:04:58 -05:00
Joshua Colp 2969d2ac5c Merge "manager: Set AMI event "Newexten" to the EVENT_FLAG_DIALPLAN class" 2018-09-12 11:01:25 -05:00
lvl 012272a114 manager: Set AMI event "Newexten" to the EVENT_FLAG_DIALPLAN class
The documentation already specified EVENT_FLAG_DIALPLAN for this
event, but the implementation was using EVENT_FLAG_CALL.

Using EVENT_FLAG_DIALPLAN allows AMI clients to opt out of receiving
this highly verbose event.

ASTERISK-28033

Change-Id: I45b3119f30e4dbc17b49831f2b1a4f2c1beadafe
2018-09-12 11:22:02 -03:00
Jenkins2 29d4109b3c Merge "core: Don't stop generators when writing RTCP frames." 2018-09-07 07:02:38 -05:00
Joshua Colp c1942e1cca Merge "stasis_cache: Prune stasis_subscription_change messages" 2018-09-07 05:40:36 -05:00
Joshua Colp f97d92bd0a core: Don't stop generators when writing RTCP frames.
Generators provide such functionality as tone generation or
silence generation. RTCP frames provide RTCP information and
should not stop generators from operating.

ASTERISK-28005

Change-Id: Ieadada07b068a7aa426e8763f1b73a18e1ac34a9
2018-09-06 17:08:55 -05:00
George Joseph 16df182155 Merge "http.c: Give HTTP error response when received lines are too long." 2018-09-06 11:49:25 -05:00
George Joseph 0dd8ab3532 stasis_cache: Prune stasis_subscription_change messages
The stasis cache provides a way to reconstruct the current state
of topic subscribers.  Unfortunately, since every subscribe and
unsubscribe is cached, the cache continues to grow unabated while
asterisk is running.  This patch removes subscribe messages from
the cache when the corresponding unsubscribe is received.

This patch also registers the cache containers with ao2 so that if
AO2_DEBUG is turned on, you can list the container and get its
stats from the CLI.

ASTERISK-27121

Change-Id: I3d18905e477f3721815da91f30da8d3fbb2d4f56
2018-09-05 13:52:17 -05:00
Richard Mudgett e387750104 http.c: Give HTTP error response when received lines are too long.
Added a check when we receive a HTTP request line or header line that is
too long.  We now return an error response to the sender because we are
not able to process the request.

Change-Id: I6df2705435fd7dde4d5d3bdf7acec859cfb7c12d
2018-08-30 17:22:38 -05:00
Richard Mudgett f657793ee4 iostream.c: Fix ast_iostream_gets() needlessly returning failure.
Providing a buffer larger than the internal buffer of ast_iostream_gets()
fails to get lines longer than the internal buffer.

* Made ast_iostream_gets() fill the supplied buffer with read data until
either a '\n' is found or the supplied buffer is filled just like fgets().

Change-Id: If18b3f6ee500e22f0633a68779ed09f7e0f305ed
2018-08-30 17:12:11 -05:00
Jaco Kroon a74f8e51a6 AMI: be less verbose when adding HTTP headers to AMI/HTTP messages.
All HTTP/AMI message headers are being sent to the verbose channel.
There are multiple places this is happening.  Consolidate the loop into
a function.  Drop the debug/verbose message.

Convert to using ast_asprintf to perform the length calculation, memory
allocation and snprintf all in one step.

Change-Id: Ic45e673fde05bd544be95ad5cdbc69518207c1a1
2018-08-23 21:43:38 +02:00
Richard Mudgett 5ec27d5206 AMI: Remove docs for nonexistent AMI ContactStatus event headers
Change-Id: I5736965c64c44338f7330e85a24bb46818607f19
2018-08-20 12:32:58 -05:00
Jenkins2 5241a53acd Merge "Build System: Improve ccache matching for different menuselect options." 2018-08-14 13:41:32 -05:00
Joshua Colp 455ca1095e stasis: Reduce calculation of stasis message type hash.
When the stasis cache is used a hash is calculated for
retrieving or inserting messages. This change calculates
a hash when the message type is initialized that is then
used each time needed. This ensures that the hash is
calculated only once for the message type.

Change-Id: I4fe6bfdafb55bf5c322dd313fbd8c32cce73ef37
2018-08-06 11:18:04 -05:00
Corey Farrell a10a3aff6a Build System: Improve ccache matching for different menuselect options.
Changing any Menuselect option in the `Compiler Flags` section causes a
full rebuild of the Asterisk source tree.  Every enabled option causes
a #define to be added to buildopts.h, thus breaking ccache caching for
every source file that includes "asterisk.h".  In most cases each option
only applies to one or two files.  Now we only define those options for
the specific sources which use them, this causes much better cache
matching when working with multiple builds.  For example testing code
with an without MALLOC_DEBUG will now use just over half the ccache
size, only main/astmm.o will have two builds cached instead of every
file.

Reorder main/Makefile so _ASTCFLAGS set on specific object files are all
together, sorted by filename.  Stop adding -DMALLOC_DEBUG to CFLAGS of
bundled pjproject, this define is no longer used by any header so only
serves to break cache.

The only code change is a slight adjustment to how main/astmm.c is
initialized.  Initialization functions always exist so main/asterisk.c
can call them unconditionally.  Additionally rename the astmm
initialization functions so they are not exported.

Change-Id: Ie2085237a964f6e1e6fff55ed046e2afff83c027
2018-08-01 12:01:15 -04:00
Joshua Colp 4febeaefa6 Merge "devicestate: Don't create topic when change isn't cached." 2018-07-27 06:09:50 -05:00
Corey Farrell 709f4b81e7 loader: Process dependencies for built-in modules.
With the new module loader it was missed that built-in modules never
parsed dependencies from mod->info into vectors of mod.  This caused
manager to be initialized before acl (named_acl).  If manager.conf
used any named ACL's they would not be found and result in no ACL being
applied to the AMI user.

In addition to the manager ACL fix this adds "extconfig" to all builtin
modules which support realtime configuration.  This only matters if one
of the builtin modules is configured with 'preload', depending on
"extconfig" will cause config.c to automatically be initialize during
the preload stage.

Change-Id: I482ed6bca6c1064b05bb538d7861cd7a4f02d9fc
2018-07-26 14:29:18 -05:00
Kevin Harwell 783bff0637 json.c: improve ast_json_to_ast_variables performance
When converting from a json object to an ast variables list the conversion
algorithm was doing a complete traversal of the entire variables list for
every item appended from the json structure.

This patch makes it so the list is no longer traversed for each new ast
variable being appended.

Change-Id: I8bf496a1fc449485150d6db36bfc0354934a3977
2018-07-25 15:37:28 -05:00
Joshua Colp 66f581313f devicestate: Don't create topic when change isn't cached.
When publishing a device state the change can be marked as being
cachable or not. If it is not cached the change is just published
to all interested and not stored away for later query. This was not
fully taken into account when publishing in stasis. The act of
publishing would create a topic for the device even if it may be
ephemeral.

This change makes it so messages which are not cached won't create
a topic for the device. If a topic does already exist it will be
published to but otherwise the change will only be published to
the device state all topic.

ASTERISK-27591

Change-Id: I18da0e8cbb18e79602e731020c46ba4101e59f0a
2018-07-25 14:21:06 -05:00
Jenkins2 8f890374cb Merge "Enable bundling of jansson, require 2.11." 2018-07-24 10:07:23 -05:00
George Joseph 1b7607922b Merge "asterisk.c: Make displayed copyright always consistent" 2018-07-24 04:32:09 -05:00
George Joseph d48d6a7ecc Merge "sched: Make ABI compatible between dev mode and non-dev mode." 2018-07-23 13:32:01 -05:00
Richard Mudgett 0f8657aae9 asterisk.c: Make displayed copyright always consistent
Change-Id: I4f5499486e8ec90d7c7ffeebc659ceda1db6d5b5
2018-07-23 12:51:32 -05:00
George Joseph 5d30319e89 Merge "asterisk.c: Update displayed copyright year for v16 release." 2018-07-23 09:40:37 -05:00
George Joseph ba8f2c401c xmldoc.c: Fix dump of xml document
The "xmldoc dump" cli command was simply concatenating xml documents
into the output file.  The resulting file had multiple "xml"
processing instructions and multiple root elements which is illegal.
Normally this isn't an issue because Asterisk has only 1 main xml
documentation file but codec_opus has its own file so if it's
downloaded and you do "xmldoc dump", the result is invalid.

* Added 2 new functions to xml.c:
    ast_xml_copy_node_list creates a copy of a list of children.
    ast_xml_add_child_list adds a list to an existing list.

* Modified handle_dump_docs to create a new output document and
  add to it the children from each input file.  It then dumps the
  new document to the output file.

Change-Id: I3f182d38c75776aee76413dadd2d489d54a85c07
2018-07-23 06:47:20 -05:00
Joshua Colp 33f855bb69 sched: Make ABI compatible between dev mode and non-dev mode.
In the past there was an assertion in the ast_sched_del function
and in order to ensure it was useful the calling function name,
line number, and filename had to be passed in. This cause the ABI
to be different between dev mode and non-dev mode.

This assertion is no longer present so the special logic can be
removed to make it the same between them both.

Change-Id: Icbc69c801e357d7004efc5cf2ab936d9b83b6ab8
2018-07-22 10:46:39 -05:00
Richard Mudgett 09c4be9433 asterisk.c: Update displayed copyright year for v16 release.
Change-Id: I60622731d928ee9506b1d28934095f0dc3e5306e
2018-07-20 15:53:18 -05:00
Corey Farrell ee154464d7 Enable bundling of jansson, require 2.11.
Change-Id: Ib3111b151d37cbda40768cf2a8a9c6cf6c5c7cbd
2018-07-20 13:42:02 -04:00
George Joseph 85a95b8a29 Merge "res_rtp_asterisk: Add support for sending NACK requests." 2018-07-18 14:46:28 -05:00
George Joseph 56740c6a57 Merge "module: Remove deprecated modules and update support levels." 2018-07-18 14:13:45 -05:00
Ben Ford 5bacde37a2 res_rtp_asterisk: Add support for sending NACK requests.
Support has been added for receiving a NACK request and handling it.
Now, Asterisk can detect when a NACK request should be sent and knows
how to construct one based on the packets we've received from the remote
end. A buffer has been added that will store out of order packets until
we receive the packet we are expecting. Then, these packets are handled
like normal and frames are queued to the core like normal. Asterisk
knows which packets to request in the NACK request using a vector
which stores the sequence numbers of the packets we are currently missing.

If a missing packet is received, cycle through the buffer until we reach
another packet we have not received yet. If the buffer reaches a certain
size, send a NACK request. If the buffer reaches its max size, queue all
frames to the core and wipe the buffer and vector.

According to RFC3711, the NACK request must be sent out in a compound
packet. All compound packets must start with a sender or receiver
report, so some work was done to refactor the current sender / receiver
code to allow it to be used without having to also include sdes
information and automatically send the report.

Also added additional functionality to ast_data_buffer, along with some
testing.

For more information, refer to the wiki page:
https://wiki.asterisk.org/wiki/display/AST/WebRTC+User+Experience+Improvements

ASTERISK-27810 #close

Change-Id: Idab644b08a1593659c92cda64132ccc203fe991d
2018-07-18 13:37:03 -05:00
Joshua Colp 134e2f0ddc module: Remove deprecated modules and update support levels.
I have removed the STATIC_BUILD option immediately as it has not
been maintained in many years and is non-functional.

ASTERISK-27965

Change-Id: I64783d017b86dba9ee3c7bcfb97e59889a3f76d7
2018-07-18 18:15:53 +00:00
Chris-Savinovich 94dd0544e5 stasis: Improve message type "Use of before/init after destruction"
Fixes issue where error msg
"Use of before/init after destruction"
was being printed on disabled messages
in dev mode.  With this
fix if message is disabled
a warning will print.

ASTERISK-25548
Change-Id: Ie0d866d1cbc60c16dbef08bc65e99505c3c1adfa
2018-07-18 13:11:28 -05:00
Corey Farrell 49f83a7490 loader: Fix startup issues.
* Merge the preload and load stages, use load ordering to try preload's
  first.  This fixes an issue where `preload=res_config_curl` would fail
  unless res_curl and func_curl were also preloaded.  Now it is only
  required that those modules be loaded during startup: autoload or
  regular load is good enough.
* The configuration option `require` and `preload-require` were only
  effective if the modules failed to load.  These options will now abort
  Asterisk startup if required modules fail to reach the 'Running'
  state.
* Missing or invalid 'module.conf' did not prevent startup.  Asterisk
  doesn't do anything without modules so this a fatal error.

Change-Id: Ie4176699133f0e3a823b43f90c3348677e43a5f3
2018-07-16 18:21:52 -04:00
George Joseph c1e49720fa test.c: Make output jUnit compatible
Separate "name" into "classname" and "name".
Use '.' for classname separator instead of '/'.
Prefix reserved words with '_'.
Wrap output with a top-level "testsuites" element.

Change-Id: Iec1a985eba1c478e5c1d65d5dfd95cb708442099
2018-07-06 12:53:03 -05:00
Joshua Colp 454aa952fa Merge "main/cdr.c: Alleviate CDR deadlock" 2018-07-02 06:54:18 -05:00
Matthew Fredrickson db02218db2 main/cdr.c: Alleviate CDR deadlock
There is a rare case (do to the infrequent timing involved) where
CDR submission threads in batch mode can deadlock with a currently
running CDR batch process.  This patch should remove the need for
holding the lock in the scheduler and should clean a few code
paths up that inconsistently submitted new work to the CDR batch
processor.

ASTERISK-27909

Change-Id: I6333e865db7c593c102c2fd948cecdb96481974d
Reported-by: Denis Lebedev
2018-06-29 09:46:27 -06:00
Richard Mudgett 7a238fe74d AMI SendText action: Fix to use correct thread to send the text.
The AMI action was directly sending the text to the channel driver.
However, this makes two threads attempt to handle media and runs afowl of
CHECK_BLOCKING.

* Queue a read action to make the channel's media handling thread actually
send the text message.  This changes the AMI actions success/fail response
to just mean the text was queued to be sent not that the text actually got
sent.  The channel driver may not even support sending text messages.

ASTERISK-27943

Change-Id: I9dce343d8fa634ba5a416a1326d8a6340f98c379
2018-06-28 12:20:30 -06:00
George Joseph e3585353f6 res_pjsip_messaging: Allow application/* for in-dialog MESSAGEs
In addition to text/* content types, incoming_in_dialog_request now
accepts application/* content types.

Also fixed a length issue when copying the body text.  It was one
character short.

ASTERISK-27942

Change-Id: I4e54d8cc6158dc47eb8fdd6ba0108c6fd53f2818
2018-06-27 06:47:35 -06:00
Alexander Traud 675e2ddb49 uuid: Enable UUID in Solaris 11.
ASTERISK-27933
Reported by: bautsche

Change-Id: I9b8362824efbfb2a16981e46e85f7c8322908c49
2018-06-23 08:26:19 +02:00
Jenkins2 bbd962bc4b Merge "utils: Avoid an unused variable in Solaris 11." 2018-06-22 07:42:53 -05:00
George Joseph d87631d21f Merge changes from topic 'ASTERISK-27625'
* changes:
  channel.c: Make CHECK_BLOCKING() save thread LWP id for messages.
  channel.c: Fix usage of CHECK_BLOCKING()
  autoservice: Don't start channel autoservice if the thread is a user interface.
2018-06-21 10:26:31 -05:00
George Joseph 98bd5908a2 Merge "ARI POST DTMF: Make not compete with channel's media thread." 2018-06-21 10:26:23 -05:00
George Joseph 46c1f81fad Merge "AMI PlayDTMF Action: Make not compete with channel's media thread." 2018-06-21 10:25:32 -05:00
Alexander Traud a5c53bd323 utils: Avoid an unused variable in Solaris 11.
With ./configure --enable-dev-mode[=noisy], the build fails because every
warning gets an error. Therefore, Asterisk has to be free of warnings and this
variable must go.

Change-Id: I63dd2bc4833b9bdb04602f83422d16caf289d46a
2018-06-21 12:01:53 +02:00
Jenkins2 5065cb2c24 Merge "Fix some doxygen and curly placement." 2018-06-20 17:01:10 -05:00
Jenkins2 8892a9b8d9 Merge "Dialplan functions: Fix some channel autoservice misuse." 2018-06-20 16:46:00 -05:00
Richard Mudgett eb8bbe660e channel.c: Make CHECK_BLOCKING() save thread LWP id for messages.
* Removed an unnecessary call to ast_channel_blocker_set() in
__ast_read().

ASTERISK-27625

Change-Id: I342168b999984666fb869cd519fe779583a73834
2018-06-19 15:02:52 -05:00
Richard Mudgett da54605b8a ARI POST DTMF: Make not compete with channel's media thread.
There can be one and only one thread handling a channel's media at a time.
Otherwise, we don't know which thread is going to handle the media frames.

ASTERISK-27625

Change-Id: I4d6a2fe7386ea447ee199003bf8ad681cb30454e
2018-06-19 15:02:52 -05:00
Richard Mudgett 7d874c1af7 AMI PlayDTMF Action: Make not compete with channel's media thread.
There can be one and only one thread handling a channel's media at a time.
Otherwise, we don't know which thread is going to handle the media frames.

ASTERISK-27625

Change-Id: Ia341f1a6f4d54f2022261abec9021fe5b2eb4905
2018-06-19 15:02:52 -05:00
Richard Mudgett 080508d2eb channel.c: Fix usage of CHECK_BLOCKING()
The CHECK_BLOCKING() macro is used to indicate if a channel's handling
thread is about to do a blocking operation (poll, read, or write) of
media.  A few operations such as ast_queue_frame(), soft hangup, and
masquerades use the indication to wake up the blocked thread to reevaluate
what is going on.

ASTERISK-27625

Change-Id: I4dfc33e01e60627d962efa29d0a4244cf151a84d
2018-06-19 15:02:52 -05:00
Richard Mudgett 0989b63047 autoservice: Don't start channel autoservice if the thread is a user interface.
Executing dialplan functions from either AMI or ARI by getting a variable
could place the channel into autoservice.  However, these user interface
threads do not handle the channel's media so we wind up with two threads
attempting to handle the media.

There can be one and only one thread handling a channel's media at a time.
Otherwise, we don't know which thread is going to handle the media frames.

ASTERISK-27625

Change-Id: If2dc94ce15ddabf923ed1e2a65ea0ef56e013e49
2018-06-19 15:02:52 -05:00
Richard Mudgett 91c3ac19cb Dialplan functions: Fix some channel autoservice misuse.
* Fix off nominal paths leaving the channel in autoservice.
* Remove unnecessary start/stop channel autoservice.
* Fix channel locking around a channel datastore search.

Change-Id: I7ff2e42388064fe3149034ecae57604040b8b540
2018-06-19 10:56:33 -06:00
Richard Mudgett 720c2d1da2 Fix some doxygen and curly placement.
Change-Id: I9a784a7c804120a8fa826c2a4cb9957e4b0b2fc8
2018-06-19 10:46:46 -06:00
Richard Mudgett a470bb9e27 channel: Fix some more unprotected channel flag setting.
Change-Id: I34c3b1201b1de539945bcfdcb264fff30332d48c
2018-06-18 09:55:59 -06:00
Joshua Colp 41175caee0 rtp: Don't negotiate dynamic codecs using payload.
In Asterisk there are some dynamic codecs that have
a fixed payload number. This number was being improperly
used to negotiate the codec, instead of using the name
and sample rate. This could result in the wrong payload
number being negotiated for a codec.

This change makes it so that only static payloads
will be negotiated using their payload number.

ASTERISK-27848

Change-Id: Ia865830170fd3f808cdb33104f3d4c4ffdc77570
2018-06-12 03:51:47 -06:00
Sean Bright b649682caa AST-2018-007: iostreams potential DoS when client connection closed prematurely
Before Asterisk sends an HTTP response (at least in the case of errors),
it attempts to read & discard the content of the request. If the client
lies about the Content-Length, or the connection is closed from the
client side before "Content-Length" bytes are sent, the request handling
thread will busy loop.

ASTERISK-27807

Change-Id: I945c5fc888ed92be625b8c35039fc6d2aa89c762
2018-06-11 09:28:43 -06:00
Joshua Colp c98c1b3f74 Merge "bridge_channel.c: Fix Deadlock when using Local channels and fax gateway" 2018-06-06 05:46:47 -05:00
Joshua Colp 2151903a16 Merge "tcptls: Allow OpenSSL configured with no-dh." 2018-06-06 04:36:06 -05:00
George Joseph 76339b1962 Merge "tcptls.h: Repair ./configure --with-ssl=PATH." 2018-06-05 14:21:15 -05:00
George Joseph 99aad2f0af Merge "tcptls: Allow OpenSSL 1.1.x configured with enable-ssl3-method no-deprecated." 2018-06-05 13:01:31 -05:00
Pirmin Walthert e078558038 bridge_channel.c: Fix Deadlock when using Local channels and fax gateway
ast_indicate is invoked with the bridge locked. As ast_indicate locks the
other end of the bridge as well this can lead to a deadlock in some situations.
(Especially when a different thread does the same in the reverse order).
This patch calls ast_indicate after unlocking the bridge which fixes the
deadlock. Calling ast_indicate with these parameters without locking the
bridge should be safe as this is done at different places without a
bridge lock.

ASTERISK-27094 #close
Reported-by: David Brillert

Change-Id: I5f86c1e2ce75b9929a36ab589b18c450e62ea35f
2018-06-05 05:37:54 -06:00
George Joseph 437ab41881 app_sendtext: Allow content types other than text/plain
There was no real reason to limit the conteny type to text/plain other
than that's what it was limited to before.  Now any text/* content
type will be allowed for channel drivers that don't support enhanced
messaging and any type will be allowed for channel drivers that do
support enhanced messaging.

Change-Id: I94a90cfee98b4bc8e22aa5c0b6afb7b862f979d9
2018-06-04 13:20:34 -06:00
Joshua Colp c63cd006ba Merge "libasteriskssl: Allow OpenSSL 1.0.2 configured with no-deprecated." 2018-05-29 12:07:51 -05:00
Alexander Traud 24503fb600 tcptls.h: Repair ./configure --with-ssl=PATH.
asterisk/tcptls.h was included (explicitly, implicitly, or transitively). Those
inclusions got replaced by forward declarations. As side effect, the inclusions
got completed.

ASTERISK-27878

Change-Id: I9d102728e30336d6522e5e4ae9e964013a0835f7
2018-05-28 17:29:23 +02:00
Alexander Traud d36338ce2b tcptls: Allow OpenSSL configured with no-dh.
Additionally, this change allows auto-negotiation of the elliptic curve/group
for servers, not only with OpenSSL 1.0.2 but also with OpenSSL 1.1.0 and newer.
This enables X25519 (since OpenSSL 1.1.0) and X448 (since OpenSSL 1.1.1) as a
side-effect.

ASTERISK-27876

Change-Id: I62c2aba4a630aefc231b71f646207e8c027d9497
2018-05-25 16:55:26 +02:00
Alexander Traud 91616f4524 tcptls: Allow OpenSSL 1.1.x configured with enable-ssl3-method no-deprecated.
ASTERISK-27874

Change-Id: Ica65113511c7a1c13f7988e7d9e7d9e7f3f620dd
2018-05-25 14:22:14 +02:00
Joshua Colp 4ea98e49f1 Merge "rtp: Add support for RTP extension negotiation and abs-send-time." 2018-05-24 15:26:57 -05:00
Joshua Colp fbb33ba6e8 Merge "tcptls: Repair ./configure --with-ssl=PATH." 2018-05-24 06:20:15 -05:00
Joshua Colp ca9120a1f0 Merge "config.c: Fix successful DELETE treated as failure" 2018-05-24 05:49:21 -05:00
Joshua Colp 7e655b26d1 Merge "channel.c: Fix off nominal channel allocation failure path." 2018-05-24 05:18:16 -05:00
Joshua Colp 25764691b0 Merge "netsock2: Add ast_sockaddr_resolve_first_af to netsock2 public API" 2018-05-23 12:10:13 -05:00
Joshua Colp a507c73a78 rtp: Add support for RTP extension negotiation and abs-send-time.
When RTP was originally created it had the ability to place a single
extension in an RTP packet. In practice people wanted to potentially
put multiple extensions in one and so RFC 5285 (obsoleted by RFC
8285) came into existence. This allows RTP extensions to be negotiated
with a unique identifier to be used in the RTP packet, allowing
multiple extensions to be present in the packet.

This change extends the RTP engine API to add support for this. A
user of it can enable extensions and the API provides the ability to
retrieve the information (to construct SDP for example) and to provide
negotiated information (from SDP). The end result is that the RTP
engine can then query to see if the extension has been negotiated and
what unique identifier is to be used. It is then up to the RTP engine
implementation to construct the packet appropriately.

The first extension to use this support is abs-send-time which is
defined in the REMB draft[1] and is a second timestamp placed in an
RTP packet which is for when the packet has left the sending system.
It is used to more accurately determine the available bandwidth.

ASTERISK-27831

[1] https://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03

Change-Id: I508deac557867b1e27fc7339be890c8018171588
2018-05-23 09:41:59 -06:00
Richard Mudgett 1bec0c73b3 channel.c: Fix off nominal channel allocation failure path.
__ast_channel_alloc_ap() had a failure exit path that hadn't setup the fd
descriptors to -1 yet.  The destructor would then attempt to close these
fd's that had never been opened.

Change-Id: Icf21093f36c60781e8cf6ee9d586536302af33e3
2018-05-22 16:41:42 -06:00
Alexei Gradinari 39632c7e00 config.c: Fix successful DELETE treated as failure
The config engine destroy_func callback function returns the number of
rows deleted or -1 on error.  But the function
ast_destroy_realtime_fields treated non-zero return values as error.

ASTERISK-27863

Change-Id: Ied02b38e8196cb03043e609a0679feebd288d17b
2018-05-22 08:29:29 -06:00
Matthew Fredrickson 9f9dce05b2 netsock2: Add ast_sockaddr_resolve_first_af to netsock2 public API
This function originally was used in chan_sip to enable some simplifying
assumptions and eventually was copy and pasted into res_pjsip_logger and
res_hep.  Since it's replicated in three places, it's probably best to
move it into the public netsock2 API for these modules to use.

Change-Id: Id52e23be885601c51d70259f62de1a5e59d38d04
2018-05-21 11:03:10 -05:00
Alexander Traud 1424f42d25 libasteriskssl: Allow OpenSSL 1.0.2 configured with no-deprecated.
Use CRYPTO_set_id_callback(.) only with OpenSSL 0.9.8 and older.

ASTERISK-27867

Change-Id: Iadd58d5bf6f538eb224203970a4e88e26f259655
2018-05-20 13:55:26 +02:00
Alexander Traud 2228ae3f27 tcptls: Repair ./configure --with-ssl=PATH.
SSL_OP_NO_TLSv1_1 and SSL_OP_NO_TLSv1_2 got discovered without honoring a PATH.

ASTERISK-27865

Change-Id: I8cd358eed7411726d08fa7b01691bef122fbeb71
2018-05-19 15:23:30 +02:00
Kevin Harwell 357654313f Merge "rtp_engine: Allow Media Formats with add_static_payload(-1) on egress again." 2018-05-18 16:42:29 -05:00
Joshua Colp 60ce5d0003 Merge "cli: Display correct unit for HTTP timeout in "manager show settings"." 2018-05-16 13:56:48 -05:00
Joshua Colp 195af35026 Merge "Fix GCC 8 build issues." 2018-05-16 13:56:34 -05:00
Alexander Traud 71d1e8d8c8 rtp_engine: Remove the double assigned RTP payload ID of H.263+.
Mantis-3709 (Commit 68ff3c3, Asterisk 1.2) added support for the video format
H.263+. For this, the RTP payload ID 103 got assigned statically. Commit f1aadc8
assigned another payload ID 98 for this format in Asterisk 1.6.

Change-Id: I90e35b158487f8f1f8187da6241b54cd3b74e667
2018-05-11 19:49:12 +02:00
Corey Farrell 4722a653f4 cli: Display correct unit for HTTP timeout in "manager show settings".
HTTP timeout is in seconds, not minutes.

ASTERISK-27852 #close

Change-Id: Ie6640835cb07307555741f9b559c2eb876d9343e
2018-05-11 11:28:49 -06:00
Corey Farrell b5914d90ac Fix GCC 8 build issues.
This fixes build warnings found by GCC 8.  In some cases format
truncation is intentional so the warning is just suppressed.

ASTERISK-27824 #close

Change-Id: I724f146cbddba8b86619d4c4a9931ee877995c84
2018-05-11 09:48:58 -04:00
Alexander Traud 919b0eb3f2 rtp_engine: Allow Media Formats with add_static_payload(-1) on egress again.
This issue affected only installations with rtp_use_dynamic=yes in asterisk.conf
which is the default since Asterisk 15. Codec 2 and SiLK were built-in examples
of media formats which were affected.

ASTERISK-27850
Reported by: Dinis Brazão, Selene Feigl

Change-Id: I08c1e76433a67e4350141d38cacf3a1cb5086496
2018-05-11 14:10:51 +02:00
Jaco Kroon 9f1e1d153a manager: fix digest auth for ami/http mechanism.
Due to a fixed size buffer the digest authentication could be
incorrectly calculated if a large URI was provided, causing
authentication failure. The buffer is now dynamically allocated to allow
any size URI within the normal limits of the HTTP request size.

ASTERISK-27841

Change-Id: I660609db13b8f9e5f9567f339dd804f4985d41b3
2018-05-08 08:25:20 -06:00
Jenkins2 d83a37f0cc Merge "stream: Make the topology a reference counted object." 2018-05-08 05:42:53 -05:00
Jenkins2 dcaaae6cd1 Merge "iostreams: Add some documentation for the ast_iostream_* functions" 2018-05-04 06:14:56 -05:00
Joshua Colp 7528b86cad stream: Make the topology a reference counted object.
The stream topology has no lock of its own resulting in
another lock protecting it in some way (for example the
channel lock). If multiple channels are being juggled at
the same time this can be problematic. This change makes
the topology a reference counted object instead which
guarantees it will remain valid even without the channel
lock being held.

Change-Id: I4f4d3dd856a033ed55fe218c3a4fab364afedb03
2018-05-03 16:31:56 +00:00
Sean Bright 069a0b7593 iostreams: Add some documentation for the ast_iostream_* functions
Change-Id: Id71b87637f0a484eb5a1cd26c3d1c7c15c7dcf26
2018-05-02 18:08:30 -06:00
Gaurav Khurana 0827d5cc53 Add the ability to read the media file type from HTTP header for playback
How it works today:
media_cache tries to parse out the extension of the media file to be played
from the URI provided to Asterisk while caching the file.

What's expected:
Better will be to have Asterisk get extension from other ways too. One of the
common ways is to get the type of content from the CONTENT-TYPE header in the
HTTP response for fetching the media file using the URI provided.

Steps to Reproduce:
Provide a URL of the form: http://host/media/1234 to Asterisk for media
playback. It fails to play and logs show the following error line:

[Sep 15 15:48:05] WARNING [29148] [C-00000092] file.c:
File http://host/media/1234 does not exist in any format

Scenario this issue is blocking:
In the case where the media files are stored in some cloud object store,
following can block the media being played via Asterisk:

Cloud storage generally needs authenticated access to the storage. The way
to do that is by using signed URIs. With the signed URIs there's no way to
preserve the name of the file.
In most cases Cloud storage returns a key to access the object and preserving
file name is also not a thing there

ASTERISK-27286

 Reporter: Gaurav Khurana

Change-Id: I1b14692a49b2c1ac67688f58757184122e92ba89
2018-04-30 16:30:44 -04:00
George Joseph 3bad41257b Merge "BuildSystem: Add DragonFly BSD." 2018-04-30 09:07:30 -05:00
Jenkins2 8e368d0eaf Merge "translate: generic plc not filled in after translation" 2018-04-30 08:33:09 -05:00
Jenkins2 9c430569d4 Merge "bridge_softmix: Forward TEXT frames" 2018-04-27 10:06:30 -05:00
Richard Mudgett 661fec4b59 core: Remove unused/incomplete SDP modules.
Change-Id: Icc28fbdc46f58e54a21554e6fe8b078f841b1f86
2018-04-25 15:58:24 -03:00
Joshua Colp 1dedc73951 Merge "streams: Add string metadata capability" 2018-04-25 13:45:26 -05:00
Jenkins2 56a9338fc1 Merge "Build System: Add missing ASTMM_LIBC to flex output." 2018-04-25 10:02:13 -05:00
Kevin Harwell ff652711c7 translate: generic plc not filled in after translation
If during translation a codec could not handle a given frame the translation
core would return NULL, thus not passing along the "missing" frame. Due to this
there was no frame to apply generic plc to, thus rendering it useless.

This patch makes it so the translation core produces an interpolated slin frame
in the cases where an attempt was made to translate to slin, but failed. This
interpolated frame is then passed along and can be used by the generic plc
algorithms to fill in the frame.

ASTERISK-27814 #close

Change-Id: I133d084da87adef913bf2ecc9c9240e3eaf4f40a
2018-04-24 14:54:25 -06:00
Alexander Traud efe40ff671 BuildSystem: Add DragonFly BSD.
ASTERISK-27820

Change-Id: I310896143e94d65da1c2be3bb448204a8b86d557
2018-04-20 12:50:03 +02:00
Jenkins2 6ccf08c543 Merge "stringfields: Collect extended stringfields into the stringfield section." 2018-04-18 17:43:02 -05:00
Corey Farrell 179ae87cf4 Build System: Add missing ASTMM_LIBC to flex output.
Redirect libc allocation functions to use Asterisk functions for
main/ast_expr2f.c and res/ael/ael_lex.c.  This will resolve errors
produced by astmm.h when these files are regenerated, though other
issues still remain.

ASTERISK~27813

Change-Id: I7263e9e4217a17bde4ffaa2087a8f8aeb2a8588c
2018-04-18 14:50:53 -06:00
Joshua Colp 8de3fa2b56 bridge_softmix / app_confbridge: Add support for REMB combining.
This change adds the ability for multiple REMB reports in
bridge_softmix to be combined according to a configured
behavior into a single report. This single report is sent
back to the sender of video, which adjusts the encoding bitrate
to be at or below the bitrate of the report. The available
behaviors are: lowest, highest, and average. Lowest uses the
lowest received bitrate. Highest uses the highest received
bitrate. Average goes through the received bitrates adding
them to the previous average and creates a new average.

Other behaviors can be added in the future and the existing
average one may be adjusted, but this provides the foundation
to do so.

Support for configuring which behavior to use has been
added to app_confbridge.

ASTERISK-27804

Change-Id: I9eafe4e7c1f72d67074a8d6acb26bfcf19322b66
2018-04-17 11:25:17 -06:00
George Joseph f79a372941 streams: Add string metadata capability
Replaces the never used opaque data array.

Updated stream tests to include get/set metadata and
stream clone with metadata.

Added stream metadata dump to "core show channel"

Change-Id: Id7473aa4b374d7ab53046c20e321037ba9a56863
2018-04-17 11:03:55 -06:00
George Joseph 4fb7967c73 bridge_softmix: Forward TEXT frames
Core bridging and, more specifically, bridge_softmix have been
enhanced to relay received frames of type TEXT or TEXT_DATA to all
participants in a softmix bridge.  res_pjsip_messaging and
chan_pjsip have been enhanced to take advantage of this so when
res_pjsip_messaging receives an in-dialog MESSAGE message from a
user in a conference call, it's relayed to all other participants
in the call.

res_pjsip_messaging already queues TEXT frames to the channel when
it receives an in-dialog MESSAGE from an endpoint and chan_pjsip
will send an MESSAGE when it gets a TEXT frame.  On a normal
point-to-point call, the frames are forwarded between the two
correctly.  bridge_softmix was not though so messages weren't
getting forwarded to conference bridge participants.  Even if they
were, the bridging code had no way to tell the participants who
sent the message so it would look like it came from the bridge
itself.

* The TEXT frame type doesn't allow storage of any meta data, such
as sender, on the frame so a new TEXT_DATA frame type was added that
uses the new ast_msg_data structure as its payload.  A channel
driver can queue a frame of that type when it receives a message
from outside.  A channel driver can use it for sending messages
by implementing the new send_text_data channel tech callback and
setting the new AST_CHAN_TP_SEND_TEXT_DATA flag in its tech
properties.  If set, the bridging/channel core will use it instead
of the original send_text callback and it will get the ast_msg_data
structure. Channel drivers aren't required to implement this.  Even
if a TEXT_DATA enabled driver uses it for incoming messages, an
outgoing channel driver that doesn't will still have it's send_text
callback called with only the message text just as before.

* res_pjsip_messaging now creates a TEXT_DATA frame for incoming
in-dialog messages and sets the "from" to the display name in the
"From" header, or if that's empty, the caller id name from the
channel.  This allows the chat client user to set a friendly name
for the chat.

* bridge_softmix now forwards TEXT and TEXT_DATA frames to all
participants (except the sender).

* A new function "ast_sendtext_data" was added to channel which
takes an ast_msg_data structure and calls a channel's
send_text_data callback, or if that's not defined, the original
send_text callback.

* bridge_channel now calls ast_sendtext_data for TEXT_DATA frame
types and ast_sendtext for TEXT frame types.

* chan_pjsip now uses the "from" name in the ast_msg_data structure
(if it exists) to set the "From" header display name on outgoing text
messages.

Change-Id: Idacf5900bfd5f22ab8cd235aa56dfad090d18489
2018-04-17 10:30:23 -06:00
Richard Mudgett d50d637764 stringfields: Collect extended stringfields into the stringfield section.
Use of extended stringfields is a temporary mechanism to avoid ABI
breakage in released branches without resorting to more inconvienient
methods.

* Collect existing extended stringfields into the parent stringfield
section of the struct.

Change-Id: I8d46d037801b4518837c3ea4b6df95ceadc9436b
2018-04-16 16:43:20 -05:00
Jenkins2 fabfe701bb Merge "res_pjsip_refer/chan_sip: Fix INVITE with replaces transfer to ConfBridge" 2018-04-11 07:11:16 -05:00
Richard Mudgett 0c03eab962 res_pjsip_refer/chan_sip: Fix INVITE with replaces transfer to ConfBridge
There is a problem when an INVITE-with-Replaces transfer targets a channel
in a ConfBridge.  The transfer will unconditionally swap out the
ConfBridge channel.  Unfortunately, the ConfBridge state will not be aware
of this change.  Unexpected behavior will happen as a result since
ConfBridge channels currently can only be replaced by a masquerade and not
normal bridge channel moves.

* We just need to pretend that the channel isn't in a bridge (like other
transfer methods already do) so the transfer channel will masquerade into
the ConfBridge channel.

Change-Id: I209beb0e748fa4f4b92a576f36afa8f495ba4c82
2018-04-06 16:12:57 -06:00
Joshua Colp 0f6431e8e4 app_confbridge / bridge_softmix: Add ability to configure REMB interval.
This change adds a configuration option to app_confbridge which can be
used to set the interval at which we will send a combined REMB (remote
estimated maximum bitrate) frame to sources of video. The bridging API
has also been extended slightly to allow setting this so bridge_softmix
can use it.

ASTERISK-27786

Change-Id: I0e49eae60f369c86434414f3cb8278709c793c82
2018-04-03 08:13:11 -06:00
George Joseph df7277ac5d Merge "main: Update copyright notice with year 2018" 2018-04-02 10:14:15 -05:00
Jenkins2 c66fde8247 Merge "BuildSystem: With external editline, do not require libs for internal editline." 2018-04-02 08:36:01 -05:00
Jenkins2 0718964e32 Merge "core: Create main/options.c." 2018-04-02 08:31:08 -05:00
Kevin Harwell 48ef239a01 Merge "res_rtp_asterisk: Add support for raising additional RTCP messages." 2018-03-29 15:19:17 -05:00
Kevin Harwell d8a2ced3ad Merge "main/indications: Use ast_cli_completion_add for all completions." 2018-03-29 15:06:45 -05:00
Jenkins2 7b744bac60 Merge "Add data buffer API to store packets." 2018-03-29 13:38:02 -05:00
Ben Ford 138e0eff4e Add data buffer API to store packets.
Adds a data buffer with a configurable size that can store different
kinds of packets (like RTP packets for retransmission). Given a number
it will store a data packet at that position relative to the others.
Given a number it will retrieve the given data packet if it is present.
This is purposely a storage of arbitrary things so it can be used not
just for RTP packets but also Asterisk frames in the future if needed.
The API does not internally use a lock, so it will be up to the user of
the API to properly protect the data buffer.

For more information, refer to the wiki page:
https://wiki.asterisk.org/wiki/display/AST/WebRTC+User+Experience+Improvements

Change-Id: Iff13c5d4795d52356959fe2a57360cd57dfade07
2018-03-28 14:25:21 -06:00
Joshua Colp e14b0e960d res_rtp_asterisk: Add support for raising additional RTCP messages.
This change extends the existing AST_FRAME_RTCP frame type to be
able to contain additional RTCP message types, such as feedback
messages. The payload type is contained in the subclass which allows
knowing what is in the frame itself.

The RTCP feedback message type is now handled and REMB[1] messages
are raised with their containing information.

This also fixes a bug where all feedback messages were triggering
video updates instead of just FIR and FUR.

Finally RTCP frames are now passed up through the Asterisk core to
what is handling the channel, mapped appropriately in the case of
bridging, and written to an outgoing stream. Since RTCP frames are
on a per-stream basis this is only done on multistream capable
channels.

[1] https://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03

ASTERISK-27758
ASTERISK-26366

Change-Id: I680da0ad8d5059d5e9655d896fb9d92e9da8491e
2018-03-27 08:39:00 -06:00
Florian Floimair 455cee99ae main: Update copyright notice with year 2018
Change-Id: I2d80bc5edf940fab914cba3d8a0fa0b5eb2a3148
2018-03-27 15:27:09 +02:00
Guido Falsi 48190c7f93 core: fix getopt(3) usage
Setting optind = 0 is forced to 1 in glibc implementation, but
causes option parsing to be flawed in other implementations, for
example on FreeBSD.

ASTERISK-27773 #close

Change-Id: Ia548e69f8302e9754dbbedb6bc451c0700c66f61
2018-03-26 06:50:54 -06:00
Corey Farrell 318bf45928 main/indications: Use ast_cli_completion_add for all completions.
Change-Id: I371be01f178fb542a9fbe8d97e7ae21aa4d82c36
2018-03-23 02:28:10 -04:00
Alexander Traud d6fda173a4 BuildSystem: With external editline, do not require libs for internal editline.
ASTERISK-27761

Change-Id: Ib17a7415297a210cfcdbf149e4df9b6edadbfab6
2018-03-22 11:43:18 +01:00
Corey Farrell a6d58c518a core: Create main/options.c.
This creates a separate source to 'own' symbols related to options.h and
paths.h.  This significantly reduces the number of exports created by
main/asterisk.o.  This change is required to eventually be able to
link unmodified Asterisk sources to utilities and/or stand-alone tests.

ASTERISK~26245

Change-Id: I5cf184f4757f9363b80c9e678bdc35c477122380
2018-03-22 00:33:12 -04:00
Jenkins2 fa892d8dfd Merge "core: Stop using AST_INLINE_API for allocator functions." 2018-03-21 10:46:30 -05:00
Joshua Colp f03b984724 Merge "core: Remove additional symbols." 2018-03-20 11:44:06 -05:00
Jenkins2 60a06fbd1d Merge "core: Remove dead symbols from asterisk.exports.in." 2018-03-20 11:40:39 -05:00
Jenkins2 f863f1f91b Merge "channel.c: Allow generic plc then channel formats are equal" 2018-03-20 11:16:52 -05:00
Jenkins2 fcad222d7f Merge "BuildSystem: Instead of $PJPROJECT_LIBS with s, use $PJPROJECT_LIB everywhere." 2018-03-20 10:24:11 -05:00
Jenkins2 b68dae189d Merge "main/sounds: Use ast_cli_completion_add." 2018-03-20 10:09:26 -05:00
Joshua Colp dc2ce3ce32 Merge "named_acl: Use ast_cli_completion_add." 2018-03-20 09:51:41 -05:00
Joshua Colp 1a2f12e288 Merge "manager: Use ast_cli_completion_add for completion generators." 2018-03-20 09:36:56 -05:00
Joshua Colp e3a5874c12 Merge "main/test: Use ast_cli_completion_add." 2018-03-20 09:18:57 -05:00
Jenkins2 c1344d3f77 Merge "core: Minor cleanup of ast_el_read_char." 2018-03-20 08:47:15 -05:00
Joshua Colp 06424ebde1 Merge "aco: Use ast_cli_completion_add for 'config show help'." 2018-03-20 08:31:49 -05:00
Jenkins2 716e2d46e7 Merge "main/config: Use ast_cli_completion_add for reload completion." 2018-03-20 08:20:54 -05:00
Jenkins2 bf9631ea0b Merge "main/translate: Use ast_cli_completion_add." 2018-03-20 07:58:00 -05:00
Joshua Colp 650f561bbb Merge "main/taskprocessor: Use ast_cli_completion_add." 2018-03-20 07:38:03 -05:00
Jenkins2 5f5bb31f74 Merge "main/bridge: Use ast_cli_completion_add." 2018-03-20 07:29:24 -05:00
Jenkins2 ffc20301fa Merge "stringfields: Remove MALLOC_DEBUG fields from struct ast_string_field_mgr." 2018-03-20 06:58:56 -05:00
Corey Farrell 040bb21771 core: Remove additional symbols.
Remove symbols that are depreacated and replaced:
* ast_channel_datastore_alloc
* ast_channel_datastore_free
* ast_channel_cmpwhentohangup
* ast_channel_setwhentohangup
* config_text_file_save
* devstate2str
* ast_device_state_changed
* ast_device_state_changed_literal
* ast_verbose_get_by_module

Remove unused symbols:
* channelreloadreason2txt (last used in Asterisk 12).

Remove unused ast_options flags:
* AST_OPT_FLAG_END_CDR_BEFORE_H_EXTEN / ast_opt_end_cdr_before_h_exten
* AST_OPT_FLAG_VERBOSE_MODULE / ast_opt_verb_module
* AST_OPT_FLAG_INITIATED_SECONDS

Change-Id: I841255995d195f8efc1ed47af9c7a2f131c08645
2018-03-19 18:00:20 -04:00
Corey Farrell de77cf8698 core: Remove dead symbols from asterisk.exports.in.
* dahdi_chan_name
* dahdi_chan_name_len
* dahdi_chan_mode
* __manager_event
* dialed_interface_info

Added comment about __progname and environ being needed for FreeBSD to
prevent accidental removal in the future.

Change-Id: I3ae026bc541cd9cb572be2ffa95fc359547642b5
2018-03-19 17:59:59 -04:00
Corey Farrell 201762f161 named_acl: Use ast_cli_completion_add.
Change-Id: I317a82de976bbdbfe4352c243e32a7bb8f66c377
2018-03-19 17:49:00 -04:00
Corey Farrell 645203a422 main/sounds: Use ast_cli_completion_add.
Change-Id: I140e1137906bbfcdb61c0c6304159be459ad873e
2018-03-19 17:45:09 -04:00
George Joseph 5d097f8236 channel.c: Allow generic plc then channel formats are equal
If the two formats on a channel are equal, we don't transcode and since
the generic plc needs slin to work, it doesn't get invoked.

* A new configuration option "genericplc_on_equal_codecs" was added
  to the "plc" section of codecs.conf to allow generic packet loss
  concealment even if no transcoding was originally needed.
  Transcoding via SLIN is forced in this case.

ASTERISK-27743

Change-Id: I0577026a179dea34232e63123254b4e0508378f4
2018-03-19 15:36:09 -06:00
Corey Farrell 8d01ec572d manager: Use ast_cli_completion_add for completion generators.
Change-Id: I658141c6ec490a3e866b02d2afea757928ceaabf
2018-03-19 16:26:56 -04:00
Corey Farrell 2c1ad2f510 main/test: Use ast_cli_completion_add.
Change-Id: I5133ff2ba4e030f9733fb3d050c863d72a22ae6b
2018-03-19 15:41:45 -04:00
Jenkins2 5843a19797 Merge "loader: Convert reload_classes to built-in modules." 2018-03-19 12:53:12 -05:00
Jenkins2 19196a98d0 Merge "main/cdr: Use ast_cli_completion_add for CDR channel completion." 2018-03-19 06:17:42 -05:00
Corey Farrell 8c25a72d57 main/bridge: Use ast_cli_completion_add.
Change-Id: I3775a696d6a57139fdf09651ecb786bcf1774509
2018-03-17 19:48:54 -04:00
Corey Farrell 5b40441197 core: Minor cleanup of ast_el_read_char.
* Define CHAR_T_LIBEDIT and CHAR_TO_LIBEDIT based on
  HAVE_LIBEDIT_IS_UNICODE.  This avoids needing to repeatedly use
  conditional blocks, eliminates having multiple function prototypes.
* Remove parenthesis from return values.
* Add missing code block brackets {}.
* Reduce use of 'else' conditional statements where possible.

Change-Id: I4315328ebea2f62641faf6881de2ac20a9f9d08e
2018-03-17 18:32:40 -04:00
Corey Farrell 1136a22a1e main/translate: Use ast_cli_completion_add.
Change-Id: I0e2402660e54d91f74ab0804c62a5b1925577413
2018-03-17 03:25:17 -04:00
Corey Farrell 91ac95993e main/taskprocessor: Use ast_cli_completion_add.
Change-Id: Ie5f812a988ed811fd11967151932de62bc131b48
2018-03-17 03:00:45 -04:00
Corey Farrell 3ad56aa929 main/config: Use ast_cli_completion_add for reload completion.
Change-Id: Ia3fa4c03f2285a1ec8814bbe7f4624ead9111ad1
2018-03-17 01:55:53 -04:00
Corey Farrell 9e335f22e7 aco: Use ast_cli_completion_add for 'config show help'.
In addition this removes:
* RAII_VAR usage
* Duplicate check of pos
* Unneeded arguments.

Change-Id: I2da8eac2670d1d8d6474c04037129804f55ebf39
2018-03-17 01:55:16 -04:00
Corey Farrell 4d1c9d8711 core: Stop using AST_INLINE_API for allocator functions.
This replaces AST_INLINE_API allocators in utils.h with real functions
implemented in astmm.c.  Associated macro's are also moved from utils.h
to astmm.h.

Remove menuselect conflicts between MALLOC_DEBUG and DEBUG_CHAOS as they
can now be combined.

This has multiple benefits:
* Simplifies asterisk/utils.h by removing inline functions and use of
  the logger.
* Removal of these inline functions decreases size of Asterisk and
  module binaries by 1% or more.
* Puts memory management functions together with and without
  MALLOC_DEBUG enabled, simplifying management of the code.
* Enables DEBUG_CHAOS for ASTMM_REDIRECT and bundled pjproject.

Change-Id: If9df4377f74bdbb627461b27a473123e05525887
2018-03-17 01:06:33 -04:00
Joshua Colp d5bfba60d2 Merge "astobj2_container: Use ast_cli_completion_add for container names." 2018-03-16 19:09:48 -05:00
Jenkins2 6df575541b Merge "main/ccss: Use ast_cli_completion_add for core id." 2018-03-16 19:07:58 -05:00
Jenkins2 6c4719fc2a Merge "main/channel: Use ast_cli_completion_add for channeltypes." 2018-03-16 10:51:38 -05:00
Corey Farrell ebe957c5e9 main/cdr: Use ast_cli_completion_add for CDR channel completion.
Change-Id: Ie81830647a23aad61c1162583b6d50adbe6e7822
2018-03-15 10:32:37 -04:00
Corey Farrell 89ba4d4e3d main/ccss: Use ast_cli_completion_add for core id.
Change-Id: I44b25d6d24c7d9bc1bb38a50774b38883162f98f
2018-03-15 09:19:58 -04:00
Corey Farrell aa0d95c730 astobj2_container: Use ast_cli_completion_add for container names.
Change-Id: I4f0fc09e820eb8d8da2354a177dbcf503c56ddd1
2018-03-15 08:29:50 -04:00
Corey Farrell b929a7fb8d main/channel: Use ast_cli_completion_add for channeltypes.
Change-Id: Ia845fae6a84801cc7d9996767b99efb2753cbb48
2018-03-15 08:11:23 -04:00
Corey Farrell b45bb476bb cli: Enable ast_cli_completion_add on public completion generators.
* ast_cli_complete
* ast_complete_channels
* ast_complete_applications

These generators will now use ast_cli_completion_add if state == -1.

Change-Id: I7ff311f0873099be0e43a3dc5415c0cd06d15756
2018-03-15 07:25:28 -04:00
Jenkins2 1a9ed413a1 Merge "core: Remove incorrect usage of attribute_malloc." 2018-03-14 20:56:34 -05:00
Jenkins2 15bf51af73 Merge "core: Remove non-critical cleanup from startup aborts." 2018-03-14 07:00:57 -05:00
Corey Farrell 572a508ef2 loader: Convert reload_classes to built-in modules.
* acl (named_acl.c)
* cdr
* cel
* ccss
* dnsmgr
* dsp
* enum
* extconfig (config.c)
* features
* http
* indications
* logger
* manager
* plc
* sounds
* udptl

These modules are now loaded at appropriate time by the module loader.
Unlike loadable modules these use AST_MODULE_LOAD_FAILURE on error so
the module loader will abort startup on failure of these modules.

Some of these modules are still initialized or shutdown from outside the
module loader.  logger.c is initialized very early and shutdown very
late, manager.c is initialized by the module loader but is shutdown by
the Asterisk core (too much uses it without holding references).

Change-Id: I371a9a45064f20026c492623ea8062d02a1ab97f
2018-03-14 05:20:12 -04:00
Corey Farrell 9e488dd482 core: Remove incorrect usage of attribute_malloc.
GCC documentation states that when __attribute__((malloc)) is used it
should not return storage which contains any valid pointers.  It
specifically mentions that realloc functions should not have the malloc
attribute, but this also means that complex initializers which could
contain initialized pointers should not use this attribute.

Change-Id: If507f33ffb3ca3b83b702196eb0e8215d27fc7d2
2018-03-13 17:39:48 -04:00
Corey Farrell ea9768ff07 stringfields: Remove MALLOC_DEBUG fields from struct ast_string_field_mgr.
This causes MALLOC_DEBUG reporting to be slightly different, calls which
cause additional memory pools to be allocated now report the callers
location rather than the location which originally allocated the
string field structure.  This reduces storage needed by string fields
and allows MALLOC_DEBUG to identify the source of additional allocations
rather than obscuring it by reporting the original allocation caller.

Change-Id: Idd18e6639a87ab862079b580c114d90361412289
2018-03-13 16:24:06 -04:00
Jenkins2 4b7872c9db Merge "core: Remove ABI effects of MALLOC_DEBUG." 2018-03-13 13:54:19 -05:00
Corey Farrell fee929c8ac core: Remove non-critical cleanup from startup aborts.
When built-in components of Asterisk fail to start they cause the
Asterisk startup to abort.  In these cases only the most critical
cleanup should be performed - closing databases and terminating
proceses.  These cleanups are registered using ast_register_atexit, all
other cleanups should not be run during startup abort.

The main reason for this change is that these cleanup procedures are
untestable from the partially initialized states, if they fail it could
prevent us from ever running the critical cleanup with ast_run_atexits.

Create separate initialization for dns_core.c to be run unconditionally
during startup instead of being initialized by the first dns resolver to
be registered. This ensures that 'sched' is initialized before it can be
potentially used.

Replace ast_register_atexit with ast_register_cleanup in media_cache.c.
There is no reason for this cleanup to happen unconditionally.

Change-Id: Iecc2df98008b21509925ff16740bd5fa29527db3
2018-03-13 13:46:08 -04:00
Jenkins2 1485719531 Merge "Replace direct checks of option_debug with DEBUG_ATLEAST macro." 2018-03-12 10:44:46 -05:00
Alexander Traud fc64a0e2b3 BuildSystem: Instead of $PJPROJECT_LIBS with s, use $PJPROJECT_LIB everywhere.
In the script ./configure,
xyz_LIB  is set by AST_PKG_CONFIG_CHECK and
xyz_LIBS is set by PKG_CHECK_MODULES within
AST_PKG_CONFIG_CHECK. Both are the same. In Asterisk normally the former and
only three times the latter was used. Let us use xyz_LIB without s, for
consistency with AST_EXT_LIB_CHECK. That eases understanding because now readers
do not have to know that xyz_LIB equals xyz_LIBS.

Change-Id: I7359860a5d730cdc784c2c48e501a082196434d3
2018-03-08 12:28:37 +01:00
Corey Farrell c8a521b6c8 Replace direct checks of option_debug with DEBUG_ATLEAST macro.
Checking option_debug directly is incorrect as it ignores file/module
specific debug settings.  This system-wide change replaces nearly all
direct checks for option_debug with the DEBUG_ATLEAST macro.

Change-Id: Ic342d4799a945dbc40ac085ac142681094a4ebf0
2018-03-07 16:03:01 -06:00
Alexander Traud 58f44f225a utils: In Solaris, avoid a warning about an unused variable.
When HAVE_GETHOSTBYNAME_R_5 was set by the script ./configure, GCC 7.3.0 found
an unused variable. Actually, the variable was used (set to a dummy value) but
the compiler optimization might have removed that. Instead, this change ensures
that the variable 'res' is only used when it is really required.

Change-Id: Ic3ea23ccf84ac4bc2d501b514985b989030abab5
2018-03-07 16:32:05 +01:00
Jenkins2 91a8c7a281 Merge "BuildSystem: Cast any intptr_t explicitly to its proposed type." 2018-03-06 13:17:54 -06:00
Jenkins2 e21f168477 Merge "BuildSystem: Detect whether uselocale(.) is available." 2018-03-05 11:49:11 -06:00
Jenkins2 3afc2c52af Merge "core: Fix handling of maximum length lines in config files." 2018-03-05 08:32:35 -06:00
Alexander Traud 5d19762b5f BuildSystem: Cast any intptr_t explicitly to its proposed type.
ASTERISK-27713

Change-Id: I90c769e3c7f8c26de8a3af11335862cec15a1b22
2018-03-03 15:30:47 +01:00
Alexander Traud 9749524520 BuildSystem: Detect whether uselocale(.) is available.
ASTERISK-27712
Reported by: Joerg Sonnenberger, D'Arcy Cain

Change-Id: Idf1c9d43617a3e13028b95b313415903d80ef807
2018-03-03 13:56:03 +01:00
Richard Mudgett c711e4076a core: Remove ABI effects of MALLOC_DEBUG.
This allows asterisk to be compiled with MALLOC_DEBUG to load modules
built without MALLOC_DEBUG.  Now pre-compiled third-party modules will
still work regardless of MALLOC_DEBUG being enabled or not.

Change-Id: Ic07ad80b2c2df894db984cf27b16a69383ce0e10
2018-03-01 13:13:55 -06:00
Richard Mudgett 1a36a452bd pjproject: Add cache_pools debugging option.
The pool cache gets in the way of finding use after free errors of memory
pool contents.  Tools like valgrind and MALLOC_DEBUG don't know when a
pool is released because it gets put into the cache instead of being
freed.

* Added the "cache_pools" option to pjproject.conf.  Disabling the option
helps track down pool content mismanagement when using valgrind or
MALLOC_DEBUG.  The cache gets in the way of determining if the pool
contents are used after free and who freed it.

To disable the pool caching simply disable the cache_pools option in
pjproject.conf and restart Asterisk.

Sample pjproject.conf setting:
[startup]
cache_pools=no

* Made current users of the caching pool factory initialization and
destruction calls call common routines to create and destroy cached pools.

ASTERISK-27704

Change-Id: I64d5befbaeed2532f93aa027a51eb52347d2b828
2018-02-28 11:41:30 -06:00
Corey Farrell a7927471ad core: Fix handling of maximum length lines in config files.
When a line is the maximum length "\n" is found at sizeof(buf) - 2 since
the last character is actually the null terminator.  In addition if a
line was exactly 8190 plus a multiple of 8192 characters long the config
parser would skip the following line.

Additionally fix comment in voicemail.conf sample config.  It previously
stated that emailbody can only contain up to 512 characters which is
always wrong.  The buffer is normally 8192 characters unless LOW_MEMORY
is enabled then it is 512 characters.  The updated comment states that
the line can be up to 8190 or 510 characters since the line feed and
NULL terminator each use a character.

ASTERISK-26688 #close

Change-Id: I80864a0d40d2e2d8cd79d72af52a8f0a3a99c015
2018-02-23 12:12:04 -05:00
Richard Mudgett f083edc43c manager.c: Fix lseek() parameter order.
ASTERISK-27659

Change-Id: I04a2705d2cb7df250769967bc59e2b397a49b797
2018-02-21 12:56:41 -06:00
Joshua Colp e70c4ec84d AST-2018-001: rtp / channel: Don't allow an unnegotiated format to be passed up.
When an RTP packet is received by an RTP engine it has to map the
payload into the Asterisk format. The code was incorrectly checking
our own static list for ALL payloads if it couldn't find a negotiated one.
This included dynamic payloads. If the payload mapped to a format
of a different type (for example receiving a video packet on an audio
RTP instance) then the core stream code could cause a crash if a legacy
channel driver was in use as no stream would be present.

To provide further protection the core stream code will no longer assume
that a video or audio frame will always have a stream for legacy channel
drivers. If no stream is present the frame is dropped.

ASTERISK-27488

Change-Id: I022556f524ad8379ee73f14037040af17ea3316a
2018-02-21 08:27:51 -06:00
Richard Mudgett e2f98fbd63 channel.c: Fix typo.
Change-Id: I4eeedf89085697e81c354eb92d546686c67b0b5b
2018-02-20 13:30:23 -06:00
Jenkins2 3c5784315d Merge "core: Rename sounds_index.c to sounds.c." 2018-02-20 07:05:55 -06:00
Jenkins2 fd353237f0 Merge "config: Fix locking for extconfig reload." 2018-02-20 06:14:08 -06:00
Jenkins2 ff4351952b Merge "optional_api: Refactor to use vector's and standard allocators." 2018-02-19 20:40:20 -06:00
Jenkins2 fbe2f1fe01 Merge "rtp_engine: Load format name / mime type in uppercase again." 2018-02-19 20:00:24 -06:00
Jenkins2 15886d5833 Merge "manager: Add AMI event Load/Unload" 2018-02-19 06:43:27 -06:00
Corey Farrell 97c21e9cb3 core: Rename sounds_index.c to sounds.c.
This will make the source filename match the 'module reload sounds'
command.  This will allow conversion to a built-in module in Asterisk 16
without needing to redefine AST_MODULE.

Change-Id: Ifb8e489575b27eb33d8c0b6a531f266670557f6e
2018-02-19 04:21:23 -06:00
Corey Farrell e03f0f9572 config: Fix locking for extconfig reload.
Expand locking to include full reload process for extconfig to ensure
nothing can read the config mappings between clearing and reloading.

Change-Id: I378316bad04f1b599ea82d0fef62b8978a644b92
2018-02-19 03:09:02 -06:00
Alexander Traud a70c92121d rtp_engine: Load format name / mime type in uppercase again.
This reverts a previous change partly.

ASTERISK-27689

Change-Id: Ia3d2f282db6995be8c1c253b5d52f6038761e8af
2018-02-17 15:49:15 +01:00
Sean Bright af2dd3a678 bridge_roles: Use a non-locking linked list where appropriate
Also explicitly initialize with the AST_LIST_HEAD_NOLOCK_INIT macro for
clarity.

Change-Id: I4bc39ec33bc3ff77e1a971a01ace87deb965be3f
2018-02-15 14:31:32 -06:00
Jenkins2 d6147aa6a3 Merge "main/asterisk.c: Remove silly usage of RAII_VAR." 2018-02-14 12:55:18 -06:00
Jenkins2 41a05aacc9 Merge "core: Remove embedded editline." 2018-02-13 08:22:28 -06:00
Joshua Colp d494cc1c88 Merge "json: Add conditionals to avoid locking if Jansson is thread safe." 2018-02-13 07:30:35 -06:00
Corey Farrell 9e45d3f893 main/asterisk.c: Remove silly usage of RAII_VAR.
Change-Id: I7e2996397fbd3c3a6a69dd805c38448ddfc34ae9
2018-02-12 22:15:34 -06:00
Corey Farrell 02ee296f81 optional_api: Refactor to use vector's and standard allocators.
* Replace ad-hoc array management with macro's from vector.h.
* Remove redundent logger messages.
* Use normal Asterisk allocators instead of directly using libc
  allocators.
* Free memory when an API has no implementation or users.

Change-Id: Ic6ecb31798d4a78e7df39ece86a68b60eac05bf5
2018-02-12 22:53:35 -05:00
Jenkins2 0461286123 Merge "cdr.c: Fix runtime leak of CDR records." 2018-02-12 16:03:46 -06:00
Sungtae Kim cb4cfb8c43 manager: Add AMI event Load/Unload
Add an AMI events Load and Unload for notify when the
module has been loaded and unloaded.

ASTERISK-27661

Change-Id: Ib916c41eddd63651952998f2f49c57c42ef87a64
2018-02-12 21:34:09 +01:00
Corey Farrell 04490fb1d8 json: Add conditionals to avoid locking if Jansson is thread safe.
Jansson is thread safe for all read-only functions and reference
counting starting v2.11.  This allows simplification of our code and
removal of locking around reference counting and dumping.

Change-Id: Id985cb3ffa6681f9ac765642e20fcd187bd4aeee
2018-02-12 13:27:08 -05:00
Corey Farrell 9fddc8b4dc core: Remove embedded editline.
This removes the embedded copy of editline from the Asterisk source
tree, making a system copy of libedit mandatory in Asterisk 16+.

ASTERISK-27634 #close

Change-Id: Iedb64ad92acb78419f3caefedaa2bb7cd2a1a33f
2018-02-12 04:44:26 -05:00
Alexander Traud 32e610d9e6 backtrace: Avoid potential spurious output.
clang 4.0 found this via -Wlogical-not-parentheses.

ASTERISK-27642

Change-Id: I9ec3e144d425a976c02811bd23cd0c533d2eca4e
2018-02-10 14:55:42 +01:00
Richard Mudgett b2fcb30d38 cdr.c: Fix runtime leak of CDR records.
Need to remove all CDR's listed by a CDR object from the active_cdrs_all
container including the root/master record.

ASTERISK-27656

Change-Id: I48b4970663fea98baa262593d2204ef304aaf80e
2018-02-09 14:26:46 -06:00
Jenkins2 2d90b1efd9 Merge "manager.c: Fixed "(null):" header in AMI AsyncAGIEnd event" 2018-02-05 12:23:19 -06:00
Jenkins2 5c524e3287 Merge "manager_channels.c: Reordered ast_manager_build_channel_state_string_prefix()" 2018-02-03 10:26:55 -06:00
Sungtae Kim 7e32adf044 manager.c: Fixed "(null):" header in AMI AsyncAGIEnd event
* Changed to create ami_event string only when the given blob is not
json_null().
* Fixed bad expression.

ASTERISK-27621

Change-Id: Ice58c16361f9d9e8648261c9ed5d6c8245fb0d8f
2018-02-01 17:24:14 -06:00
Richard Mudgett 3419a048b9 manager.c: Fix potential memory leak and corruption.
ast_str_append_event_header() could potentially leak and corrupt memory if
the ast_str needed to expand to add the AMI event header.

* Fixed to return error if the ast_str_append() failed.

Change-Id: I92f36b855540743b208d76e274152ee2d758176d
2018-02-01 13:51:27 -06:00
Richard Mudgett bcfe172f8d manager_channels.c: Reordered ast_manager_build_channel_state_string_prefix()
* Made not allocate memory if the channel snapshot is an internal channel.

* Free memory earlier when no longer needed.

Change-Id: Ia06e0c065f1bd095781aa3f4a626d58fa4d28b38
2018-02-01 12:28:32 -06:00
Richard Mudgett b9024197ab app_confbridge: Update dsp_silence_threshold and dsp_talking_threshold docs.
The dsp_talking_threshold does not represent time in milliseconds.  It
represents the average magnitude per sample in the audio packets.  This is
what the DSP uses to determine if a packet is silence or talking/noise.

Change-Id: If6f939c100eb92a5ac6c21236559018eeaf58443
2018-01-31 13:13:27 -06:00
Jenkins2 093484d137 Merge "loader: Use ast_cli_completion_add for 'module load' completion." 2018-01-31 07:48:21 -06:00
Jenkins2 8f6978d7b8 Merge "pbx_variables.c: Misc fixes in variable substitution." 2018-01-31 06:52:24 -06:00
Jenkins2 da4ddb1faa Merge "Build System: Require __sync or __atomic functions." 2018-01-30 06:56:08 -06:00
Jenkins2 21bcd85bba Merge "core: Fix unused variable error in handle_show_sysinfo." 2018-01-29 11:45:27 -06:00
Jenkins2 1e44d50893 Merge "core: Tweak startup order." 2018-01-29 10:49:58 -06:00
Jenkins2 7c77365549 Merge "editline: Avoid shifting a negative signed value." 2018-01-29 10:44:44 -06:00
Corey Farrell 84a6365164 loader: Use ast_cli_completion_add for 'module load' completion.
This addresses all performance issues with 'module load' completion.  In
addition to using ast_cli_completion_add we stop using libedit's
filename_completion_function, instead using ast_file_read_dir.  This
ensures all results are produced from a single call to opendir.

Change-Id: I8bf51ffaa7ef1606f3bd1b5bb13f1905d72c6134
2018-01-27 15:18:45 -05:00
Alexander Traud d9e42f27b9 core: Fix unused variable error in handle_show_sysinfo.
The previous fix broke the case
HAVE_SYSINFO = no
HAVE_SYSCTL = yes
HAVE_SWAPCTL = no
which occurs on FreeBSD 11.1 for example.

ASTERISK-26563

Change-Id: If77c39bc75f0b83a6c8a24ecb2fa69be8846160a
2018-01-27 16:44:21 +01:00