summaryrefslogtreecommitdiff
path: root/main
AgeCommit message (Collapse)Author
2017-09-01rtp_engine: Prevent possible double free with DTLS configSean Bright
ASTERISK-27225 #close Reported by: Richard Kenner Change-Id: I097b81734ef730f8603c0b972909d212a3a5cf89
2017-08-30AST-2017-006: Fix app_minivm application MinivmNotify command injectionCorey Farrell
An admin can configure app_minivm with an externnotify program to be run when a voicemail is received. The app_minivm application MinivmNotify uses ast_safe_system() for this purpose which is vulnerable to command injection since the Caller-ID name and number values given to externnotify can come from an external untrusted source. * Add ast_safe_execvp() function. This gives modules the ability to run external commands with greater safety compared to ast_safe_system(). Specifically when some parameters are filled by untrusted sources the new function does not allow malicious input to break argument encoding. This may be of particular concern where CALLERID(name) or CALLERID(num) may be used as a parameter to a script run by ast_safe_system() which could potentially allow arbitrary command execution. * Changed app_minivm.c:run_externnotify() to use the new ast_safe_execvp() instead of ast_safe_system() to avoid command injection. * Document code injection potential from untrusted data sources for other shell commands that are under user control. ASTERISK-27103 Change-Id: I7552472247a84cde24e1358aaf64af160107aef1
2017-08-29Merge "core: Reduce video update queueing." into 15Jenkins2
2017-08-28core: Reduce video update queueing.Joshua Colp
A video update frame is used to indicate that a channel with video negotiated should provide a full frame so the decoder decoding the stream is able to do so. In situations where a queue is used to store frames it makes no sense for the queue to contain multiple video update frames. One is sufficient to have a full frame be sent. ASTERISK-27222 Change-Id: Id3f40a6f51b740ae4704003a1800185c0c658ee7
2017-08-22bridge_channel.c: Fix FRACK when mapping frames to the bridge.Richard Mudgett
* Add protection checks when mapping streams to the bridge. The channel and bridge may be in the process of updating the stream mapping when a media frame comes in so we may not be able to map the frame at the time. * We need to map the streams to the bridge's stream numbers right before they are written into the bridge. That way we don't have to keep locking/unlocking the bridge and we won't have any synchronization problems before the frames actually go into the bridge. * Protect the deferred queue with the bridge_channel lock. ASTERISK-27212 Change-Id: Id6860dd61b594b90c8395f6e2c0150219094c21a
2017-08-22bridge: Fix softmix bridge deadlock.Richard Mudgett
* Fix deadlock in bridge_softmix.c:softmix_bridge_stream_topology_changed() between bridge_channel and channel locks. * The new bridge technology topology change callbacks must be called with the bridge locked. The callback references the bridge channel list, the bridge technology could change, and the bridge stream mapping is updated. ASTERISK-27212 Change-Id: Ide4360ab853607e738ad471721af3f561ddd83be
2017-08-22channel: Fix topology API locking.Richard Mudgett
* ast_channel_request_stream_topology_change() must not be called with any channel locks held. * ast_channel_stream_topology_changed() must be called with only the passed channel lock held. ASTERISK-27212 Change-Id: I843de7956d9f1cc7cc02025aea3463d8fe19c691
2017-08-16manager: hook event is not being raisedKevin Harwell
When the iostream code went in it introduced a conditional that made it so the hook event was not being raised even if a hook is present. This patch adds a check to see if a hook is present in astman_append. If so then call into the send_string function, which in turn raises the even for specified hook. Also updated the ami hooks unit test, so the test could be automated. ASTERISK-27200 #close Change-Id: Iff37f02f9708195d8f23e68f959d6eab720e1e36
2017-08-10STUN/netsock2: Fix some valgrind uninitialized memory findings.Richard Mudgett
* netsock2.c: Test the addr->len member first as it may be the only member initialized in the struct. * stun.c:ast_stun_handle_packet(): The combinded[] local array could get used uninitialized by ast_stun_request(). The uninitialized string gets copied to another location and could overflow the destination memory buffer. These valgrind findings were found for ASTERISK_27150 but are not necessarily a fix for the issue. Change-Id: I55f8687ba4ffc0f69578fd850af006a56cbc9a57
2017-08-07Merge "bridge: Fix stream topology/participant locking and video ↵Jenkins2
misrouting." into 15
2017-08-06bridge: Fix stream topology/participant locking and video misrouting.Joshua Colp
This change fixes a few locking issues and some video misrouting. 1. When accessing the stream topology of a channel the channel lock must be held to guarantee the topology remains valid. 2. When a channel was joined to a bridge the bridge specific implementation for stream mapping was not invoked, causing video to be misrouted for a brief period of time. ASTERISK-27182 Change-Id: I5d2f779248b84d41c5bb3896bf22ba324b336b03
2017-08-05channel: Fix leak on successful call to chan->tech->requester.Corey Farrell
joint_cap needs to be released unconditionally as chan->tech->requester does not steal the reference even on success. ASTERISK-27180 #close Change-Id: I647728992559bdb0a9c7357c20be1b36400d68b6
2017-08-03Fix compile error for old versions of GCC.Corey Farrell
Use -Wno-format-truncation only if supported by compiler. ASTERISK-27171 #close Change-Id: Iac0aed7a5bcaa16c21b7d62c4e4678d244c4ccb6
2017-08-01Fix compiler warnings on Fedora 26 / GCC 7.Corey Farrell
GCC 7 has added capability to produce warnings, this fixes most of those warnings. The specific warnings are disabled in a few places: * app_voicemail.c: truncation of paths more than 4096 chars in many places. * chan_mgcp.c: callid truncated to 80 chars. * cdr.c: two userfields are combined to cdr copy, fix would break ABI. * tcptls.c: ignore use of deprecated method SSLv3_client_method(). ASTERISK-27156 #close Change-Id: I65f280e7d3cfad279d16f41823a4d6fddcbc4c88
2017-07-26Merge "bridge_softmix / res_rtp_asterisk: Fix packet loss and renegotiation ↵Joshua Colp
issues." into 15
2017-07-26Merge "Core: Add support for systemd socket activation." into 15Jenkins2
2017-07-26bridge_softmix / res_rtp_asterisk: Fix packet loss and renegotiation issues.Joshua Colp
This change does a few things to improve packet loss and renegotiation: 1. On outgoing RTP streams we will now properly reflect out of order packets and packet loss in the sequence number. This allows the remote jitterbuffer to better reorder things. 2. Video updates can now be discarded for a period of time after one has been sent to prevent flooding of clients. 3. For declined and removed streams we will now release any media session resources associated with them. This was not previously done and caused an issue where old state was being used for a new stream. 4. RTP bundling was not actually removing bundled RTP instances from the parent. This has been resolved by removing based on the RTP instance itself and not the SSRC. 5. The code did not properly handle explicitly unbundling an RTP instance from its parent. This now works as expected. ASTERISK-27143 Change-Id: Ibd91362f0e4990b6129638e712bc8adf0899fd45
2017-07-25Merge "core: Add VP9 passthrough support." into 15Jenkins2
2017-07-24core: Add VP9 passthrough support.Joshua Colp
This change adds VP9 as a known codec and creates a cached "vp9" media format for use. Change-Id: I025a93ed05cf96153d66f36db1839109cc24c5cc
2017-07-21say.c: Fix file locations for second, seconds, minute, minutes filesRusty Newton
The seconds and minutes files have always existed in the base language directory of the Core package. So say.c has always been calling the wrong location (under digits/) for those two files and in the case of second and minute they didn't exist in the Core packages at all. The 1.6 sounds release moves the second and minute files into Core from Extra for the languages that already had them. A future release will include the second and minute files for languages that didn't already have them. This patch just changes all the target locations for second, seconds, minute, and minutes that were under the digits subdir to be under the root of sounds instead. Which is where the sounds will be for some languages after 1.6 sounds and for all languages after a future release. ASTERISK-25810 #close Change-Id: I05d9d4bee6a7237030530a46e7eb3df15f13f702 Reported-by: Nicolas Riendeau
2017-07-21Core: Add support for systemd socket activation.Corey Farrell
This change adds support for socket activation of certain SOCK_STREAM listeners in Asterisk: * AMI / AMI over TLS * CLI * HTTP / HTTPS Example systemd units are provided. This support extends to any socket which is initialized using ast_tcptls_server_start, so any unknown modules using this function will support socket activation. Asterisk continues to function as normal if socket activation is not enabled or if systemd development headers are not available during build. ASTERISK-27063 #close Change-Id: Id814ee6a892f4b80d018365c8ad8d89063474f4d
2017-07-19Merge "core: Add digit filtering to ast_waitfordigit_full"Joshua Colp
2017-07-19Merge "core: Add PARSE_TIMELEN support to ast_parse_arg and ACO."Jenkins2
2017-07-17Merge "bridge/core_unreal: Fix SFU bugs with forwarding frames."Jenkins2
2017-07-13Merge "res_rtp_asterisk / res_pjsip: Add support for BUNDLE."Jenkins2
2017-07-13core: Add PARSE_TIMELEN support to ast_parse_arg and ACO.Corey Farrell
This adds support for parsing timelen values from config files. This includes support for all flags which apply to PARSE_INT32. Support for this parser is added to ACO via the OPT_TIMELEN_T option type. Fixes an issue where extra characters provided to ast_app_parse_timelen were ignored, they now cause an error. Testing is included. ASTERISK-27117 #close Change-Id: I6b333feca7e3f83b4ef5bf2636fc0fd613742554
2017-07-13res_rtp_asterisk / res_pjsip: Add support for BUNDLE.Joshua Colp
BUNDLE is a specification used in WebRTC to allow multiple streams to use the same underlying transport. This reduces the number of ICE and DTLS negotiations that has to occur to 1 normally. This change implements this by adding support for it to the RTP SDP module in PJSIP. BUNDLE can be turned on using the "bundle" option and on an offer we will offer to bundle streams together. On an answer we will accept any bundle groups provided. Once accepted each stream is bundled to another RTP instance for transport. For the res_rtp_asterisk changes the ability to bundle an RTP instance to another based on the SSRC received from the remote side has been added. For outgoing traffic if an RTP instance is bundled to another we will use the other RTP instance for any transport related things. For incoming traffic received from the transport instance we look up the correct instance based on the SSRC and use it for any non-transport related data. ASTERISK-27118 Change-Id: I96c0920b9f9aca7382256484765a239017973c11
2017-07-12core: Add digit filtering to ast_waitfordigit_fullCorey Farrell
This adds a parameter to ast_waitfordigit_full which can be used to only stop waiting when certain expected digits are received. Any unexpected DTMF digits are simply ignored. This also creates a new dialplan application WaitDigit. ASTERISK-27129 #close Change-Id: Id233935ea3d13e71c75a0861834c5936c3700ef9
2017-07-12Merge "Avoid setting maxfiles for a remote asterisk"Joshua Colp
2017-07-11Merge "http.c: Reduce log spam"Jenkins2
2017-07-11bridge/core_unreal: Fix SFU bugs with forwarding frames.Joshua Colp
This change fixes a few things uncovered during SFU testing. 1. Unreal channels incorrectly forwarded video frames when no video stream was present on them. This caused a crash when they were read as the core requires a stream to exist for the underlying media type. The Unreal channel will now ensure a stream exists for the media type before forwarding the frame and if no stream exists then the frame is dropped. 2. Mapping of frames during bridging from the stream number of the underlying channel to the stream number of the bridge was done in the wrong location. This resulted in the frame getting dropped. This mapping now occurs on reading of the frame from the channel. 3. Bridging was using the wrong ast_read function resulting in it living in a non-multistream world. 4. In bridge_softmix when adding new streams to existing channels the wrong stream topology was copied resulting in no streams being added. Change-Id: Ib7445722c3219951d6740802a0feddf2908c18c8
2017-07-11Avoid setting maxfiles for a remote asteriskTzafrir Cohen
Setting maxfiles (maximum number of open files) has no practical effect on a remote asterisk (rasterisk, rasterisk -x). It has an ill effect of printing an extra message, which may be annoying in case of -x. ASTERISK-27105 #close Change-Id: Iaf9eb344e4b4b517df91b736b27ec55f6a6921a2
2017-07-11http.c: Reduce log spamGeorge Joseph
Messages like "fwrite() failed: Connection reset by peer" are no help whatsoever, especially since they can be caused simply by a client disconnecting. * Make those WARNINGs DEBUGs. * Check the return from ast_iostream_printf of headers. Change-Id: I17bd5f3621514152a7b2b263c801324c5e96568b
2017-07-07json.c: Add backtrace log to find 'Invalid UTF-8 string' errorsRichard Mudgett
Change-Id: I9020ff9f2b3749904317c0c173f47a1bbed6f929
2017-07-07Merge "core: Remove 'Data Retrieval API'"Jenkins2
2017-07-05core: Remove 'Data Retrieval API'Sean Bright
This API was not actively maintained, was not added to new modules (such as res_pjsip), and there exist better alternatives to acquire the same information, such as the ARI. Change-Id: I4b2185a83aeb74798b4ad43ff8f89f971096aa83
2017-07-01channel: Clear channel flag in error branch.Corey Farrell
Clear channel flag AST_FLAG_END_DTMF_ONLY in ast_waitfordigit_full when ast_read returns NULL. ASTERISK-27100 #close Change-Id: Id3039e9a4e74e0cb359f636c9fd0c9740ebf7d9d
2017-06-28chan_pjsip: Add support for multiple streams of the same type.Mark Michelson
The stream topology (list of streams and order) is now stored with the configured PJSIP endpoints and used during the negotiation process. Media negotiation state information has been changed to be stored in a separate object. Two of these objects exist at any one time on a session. The active media state information is what was previously negotiated and the pending media state information is what the media state will become if negotiation succeeds. Streams and other state information is stored in this object using the index (or position) of each individual stream for easy lookup. The ability for a media type handler to specify a callback for writing has been added as well as the ability to add file descriptors with a callback which is invoked when data is available to be read on them. This allows media logic to live outside of the chan_pjsip module. Direct media has been changed so that only the first audio and video stream are directly connected. In the future once the RTP engine glue API has been updated to know about streams each individual stream can be directly connected as appropriate. Media negotiation itself will currently answer all the provided streams on an offer within configured limits and on an offer will use the topology created as a result of the disallow/allow codec lines. If a stream has been removed or declined we will now mark it as such within the resulting SDP. Applications can now also request that the stream topology change. If we are told to do so we will limit any provided formats to the ones configured on the endpoint and send a re-invite with the new topology. Two new configuration options have also been added to PJSIP endpoints: max_audio_streams: determines the maximum number of audio streams to offer/accept from an endpoint. Defaults to 1. max_video_streams: determines the maximum number of video streams to offer/accept from an endpoint. Defaults to 1. ASTERISK-27076 Change-Id: I8afd8dd2eb538806a39b887af0abd046266e14c7
2017-06-21Merge "bridge: stuck channel(s) after failed attended transfer"Jenkins2
2017-06-21core_local: local channel data not being properly unref'ed and unlockedKevin Harwell
In an earlier version of Asterisk a local channel [un]lock all functions were added in order to keep a crash from occurring when a channel hung up too early during an attended transfer. Unfortunately, when a transfer failure occurs and depending on the timing, the local channels sometime do not get properly unlocked and deref'ed after being locked and ref'ed. This happens because the underlying local channel structure gets NULLed out before unlocking. This patch reworks those [un]lock functions and makes sure the values that get locked and ref'ed later get unlocked and deref'ed. ASTERISK-27074 #close Change-Id: Ice96653e29bd9d6674ed5f95feb6b448ab148b09
2017-06-21bridge: stuck channel(s) after failed attended transferKevin Harwell
If an attended transfer failed it was possible for some of the channels involved to get "stuck" because Asterisk was not hanging up the transfer target. This patch ensures Asterisk hangs up the transfer target when an attended transfer failure occurs. ASTERISK-27075 #close Change-Id: I98a6ecd92d3461ab98c36f0d9451d23adaf3e5f9
2017-06-19Merge "res_stasis: Plug reference leak on stolen channels"Joshua Colp
2017-06-19Merge "SDP: Add get/set option calls for RTP sched context per type."George Joseph
2017-06-16res_stasis: Plug reference leak on stolen channelsGeorge Joseph
When a stasis channel is stolen by another app, the control structure is unreffed but never unlinked from the app_controls container. This causes the channel reference to leak. Added OBJ_UNLINK to the callback in channel_stolen_cb. Also added some additional channel lifecycle debug messages to channel.c. ASTERISK-27059 #close Repoorted-by: George Joseph Change-Id: Ib820936cd49453f20156971785e7f4f182c56e14
2017-06-16Core/PBX: Deadlock between dialplan execution and application unregistration.Frederic LE FOLL
Not easy to reproduce, but we have noticed deadlocks when unloading a module while dialplan is handling a request. The deadlock is between : 1) Dialplan execution: pbx_extension_helper() first taking conlock, then pbx_findapp() [when called] asking for lock on apps list. 2) Application unregistration: ast_unregister_application() first taking lock on apps list, then unreference_cached_app() [when called] asking for conlock. As a protection, I suggest to modify ast_unregister_application(), so that it anticipates the need of conlock, before taking the lock on apps list. The side effect is a longer unavailability of conlock when unregistering an application. ASTERISK-27041 Change-Id: I0db0f1eb320da6a5758cce3a47d765be1face8e2
2017-06-16Merge "SDP: Search for the ice-lite attribute in the right place."Joshua Colp
2017-06-16Merge changes from topic 'sdp_api_adjustments'Jenkins2
* changes: SDP: Set the remote c= line in RTP instance. SDP: Add t= line in sdp_create_from_state() stream: Ignore declined streams for some topology calls.
2017-06-16Merge "stream: Add ast_stream_topology_del_stream() and unit test."Jenkins2
2017-06-15Merge "channel: Fix reference counting in ast_channel_suppress."Joshua Colp
2017-06-15SDP: Add get/set option calls for RTP sched context per type.Richard Mudgett
Change-Id: I82dc75c63c48904e9e5a49e2205dcc06e88487e4