Commit Graph

6337 Commits

Author SHA1 Message Date
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