summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-04-27Merge "vector: defaults and indexes"Jenkins2
2017-04-27Merge "cleanup: Fix fread() and fwrite() error handling"Joshua Colp
2017-04-27Merge "pjproject_bundled: Add --disable-libwebrtc to configure"Jenkins2
2017-04-27Merge "res_rtp_asterisk.c: Fix crash in RTCP DTLS operation."Jenkins2
2017-04-27Merge "sdp: Add support for T.38"Joshua Colp
2017-04-27Merge "SDP: Ensure SDPs "merge" properly."Joshua Colp
2017-04-26vector: defaults and indexesKevin Harwell
Added an pre-defined integer vector declaration. This makes integer vectors easier to declare and pass around. Also, added the ability to default a vector up to a given size with a default value. Lastly, added functionality that returns the "nth" index of a matching value. Also, updated a unit test to test these changes. Change-Id: Iaf4b51b2540eda57cb43f67aa59cf1d96cdbcaa5
2017-04-26Merge "res_pjsip_sdp_rtp: No rtpmap for static RTP payload IDs in SDP."Jenkins2
2017-04-26pjproject_bundled: Add --disable-libwebrtc to configureGeorge Joseph
Without the disable, pjproject tries to build it's internal webrtc implementation which requires sse2. This fails on platforms without sse2. ASTERISK-26930 #close Reported-by: abelbeck Change-Id: I07231f9160c35cfa42b194d3aad4e7d51fd9a410
2017-04-26Merge "alembic: Add table for 'resource_list' PJSIP RLS type."George Joseph
2017-04-25Merge "res_pjsip_session.c: Send 100 Trying out earlier to prevent ↵Jenkins2
retransmissions."
2017-04-25Merge "res_hep: Add additional config initialization and validation"George Joseph
2017-04-25cleanup: Fix fread() and fwrite() error handlingSean Bright
Cleaned up some of the incorrect uses of fread() and fwrite(), mostly in the format modules. Neither of these functions will ever return a value less than 0, which we were checking for in some cases. I've introduced a fair amount of duplication in the format modules, but I plan to change how format modules work internally in a subsequent patch set, so this is simply a stop-gap. Change-Id: I8ca1cd47c20b2c0b72088bd13b9046f6977aa872
2017-04-25Merge "res_pjsip_session.c: Restructure ast_sip_session_alloc()"George Joseph
2017-04-25alembic: Add table for 'resource_list' PJSIP RLS type.Joshua Colp
This change adds an Alembic migration which adds a ps_resource_list table that can contain resource_list RLS configuration objects. ASTERISK-26929 Change-Id: I7c888fafc67b3e87012de974f71ca7a5b8b1ec05
2017-04-25sdp: Add support for T.38Joshua Colp
This change adds a T.38 format which can be used in a stream topology to specify that a UDPTL stream needs to be created. The SDP API has been changed to understand T.38 and create the UDPTL session, add the attributes, and parse the attributes. This change does not change the boundary of the T.38 state machine. It is still up to the channel driver to implement and act on it (such as queueing control frames or reacting to them). ASTERISK-26949 Change-Id: If28956762ccb8ead562ac6c03d162d3d6014f2c7
2017-04-25SDP: Ensure SDPs "merge" properly.Mark Michelson
The gist of this work ensures that when a remote SDP is received, it is merged properly with the local capabilities. The remote SDP is converted into a stream topology. That topology is then merged with the current local topology on the SDP state. That new merged topology is then used to create an SDP. Finally, adjustments are made to RTP instances based on knowledge gained from the remote SDP. There are also a battery of tests in this commit that ensure that some basic SDP merges work as expected. While this may not sound like a big change, it has the property that it caused lots of ancillary changes. * The remote SDP is no longer stored on the SDP state. Biggest reason: there's no need for it. The remote SDP is used at the time it is being set and nowhere else. * Some new SDP APIs were added in order to find attributes and convert generic SDP attributes into rtpmap structures. * Writing tests made me realize that retrieving a value from an SDP options structure, the SDP options needs to be made const. * The SDP state machine was essentially gutted by a previous commit. Initially, I attempted to reinstate it, but I found that as it had been defined, it was not all that useful. What was more useful was knowing the role we play in SDP negotiation, so the SDP state machine has been transformed into an indicator of role. * Rather than storing separate local and joint stream state capabilities, it makes more sense to keep track of current stream state and update it as things change. Change-Id: I5938c2be3c6f0a003aa88a39a59e0880f8b2df3d
2017-04-24res_hep: Add additional config initialization and validationSean Bright
* Initialize hepv3_runtime_data.sockfd to -1 so that our ao2 destructor does not close fd 0 * Add logging output when the required option - capture_address - is not specified. * Remove a no longer relevant #define and correct related documentation * Pass appropriate flags to aco_option_register so that capture_address cannot be the empty string. ASTERISK-26953 #close Change-Id: Ief08441bc6596d6f1718fa810e54a5048124f076
2017-04-24core: Use eventfd for alert pipes on Linux when possibleSean Bright
The primary win of switching to eventfd when possible is that it only uses a single file descriptor while pipe() will use two. This means for each bridge channel we're reducing the number of required file descriptors by 1, and - if you're using timerfd - we also now have 1 less file descriptor per Asterisk channel. The API is not ideal (passing int arrays), but this is the cleanest approach I could come up with to maintain API/ABI. I've also removed what I believe to be an erroneous code block that checked the non-blocking flag on the pipe ends for each read. If the file descriptor is 'losing' its non-blocking mode, it is because of a bug somewhere else in our code. In my testing I haven't seen any measurable difference in performance. Change-Id: Iff0fb1573e7f7a187d5211ddc60aa8f3da3edb1d
2017-04-21Merge "pbx: Use same thread if AST_OUTGOING_WAIT_COMPLETE specified"George Joseph
2017-04-21Merge "rtp_engine/res_rtp_asterisk: Fix RTP struct reentrancy crashes."George Joseph
2017-04-21res_pjsip_session.c: Send 100 Trying out earlier to prevent retransmissions.Richard Mudgett
If ICE is enabled and a STUN server does not respond then we will block until we give up on the STUN response. This will take nine seconds. In the mean time the peer that sent the INVITE will send retransmissions. * Restructure res_pjsip_session.c:new_invite() to send a 100 Trying out earlier to prevent these retransmissions. ASTERISK-26890 Change-Id: Ie3fc611e53a0eff6586ad55e4aacad81cf6319a8
2017-04-21res_pjsip_session.c: Restructure ast_sip_session_alloc()Richard Mudgett
* Restructure ast_sip_session_alloc() to need less cleanup on off nominal error paths. * Made ast_sip_session_alloc() and ast_sip_session_create_outgoing() avoid unnecessary ref manipulation to return a session. This is faster than calling a function. That function may do logging of the ref changes with REF_DEBUG enabled. Change-Id: I2a0affc4be51013d3f0485782c96b8fee3ddb00a
2017-04-20Merge "build: Update config.guess and config.sub"George Joseph
2017-04-20Merge "res_stun_monitor: Don't fail to load if DNS resolution fails"George Joseph
2017-04-20Merge "make ari-stubs so doc periodic jobs can run"George Joseph
2017-04-19pbx: Use same thread if AST_OUTGOING_WAIT_COMPLETE specifiedSean Bright
Both ast_pbx_outgoing_app() and ast_pbx_outgoing_exten() cause the core to spawn a new thread to perform the dial. When AST_OUTGOING_WAIT_COMPLETE is passed to these functions, the calling thread will be blocked until the newly created channel has been hung up. After this patch, we run the dial on the current thread rather than spawning a new one. The only in-tree code that passes AST_OUTGOING_WAIT_COMPLETE is pbx_spool, so you should see reduced thread usage if you are using .call files. Change-Id: I512735d243f0a9da2bcc128f7a96dece71f2d913
2017-04-19res_rtp_asterisk.c: Fix crash in RTCP DTLS operation.Richard Mudgett
Occasionally a crash happens when processing the RTCP DTLS timeout handler. The RTCP DTLS timeout timer could be left running if we have not completed the DTLS handshake before we place the call on hold or we attempt direct media. * Made ast_rtp_prop_set() stop the RTCP DTLS timer when disabling RTCP. * Made some sanity tweaks to ast_rtp_prop_set() when switching from standard RTCP mode to RTCP multiplexed mode. ASTERISK-26692 #close Change-Id: If6c64c79129961acfa4b3d63a864e8f6b664acc0
2017-04-19rtp_engine/res_rtp_asterisk: Fix RTP struct reentrancy crashes.Richard Mudgett
The struct ast_rtp_instance has historically been indirectly protected from reentrancy issues by the channel lock because early channel drivers held the lock for really long times. Holding the channel lock for such a long time has caused many deadlock problems in the past. Along comes chan_pjsip/res_pjsip which doesn't necessarily hold the channel lock because sometimes there may not be an associated channel created yet or the channel pointer isn't available. In the case of ASTERISK-26835 a pjsip serializer thread was processing a message's SDP body while another thread was reading a RTP packet from the socket. Both threads wound up changing the rtp->rtcp->local_addr_str string and interfering with each other. The classic reentrancy problem resulted in a crash. In the case of ASTERISK-26853 a pjsip serializer thread was processing a message's SDP body while another thread was reading a RTP packet from the socket. Both threads wound up processing ICE candidates in PJPROJECT and interfering with each other. The classic reentrancy problem resulted in a crash. * rtp_engine.c: Make the ast_rtp_instance_xxx() calls lock the RTP instance struct. * rtp_engine.c: Make ICE and DTLS wrapper functions to lock the RTP instance struct for the API call. * res_rtp_asterisk.c: Lock the RTP instance to prevent a reentrancy problem with rtp->rtcp->local_addr_str in the scheduler thread running ast_rtcp_write(). * res_rtp_asterisk.c: Avoid deadlock when local RTP bridging in bridge_p2p_rtp_write() because there are two RTP instance structs involved. * res_rtp_asterisk.c: Avoid deadlock when trying to stop scheduler callbacks. We cannot hold the instance lock when trying to stop a scheduler callback. * res_rtp_asterisk.c: Remove the lock in struct dtls_details and use the struct ast_rtp_instance ao2 object lock instead. The lock was used to synchronize two threads to prevent a race condition between starting and stopping a timeout timer. The race condition is no longer present between dtls_perform_handshake() and __rtp_recvfrom() because the instance lock prevents these functions from overlapping each other with regards to the timeout timer. * res_rtp_asterisk.c: Remove the lock in struct ast_rtp and use the struct ast_rtp_instance ao2 object lock instead. The lock was used to synchronize two threads using a condition signal to know when TURN negotiations complete. * res_rtp_asterisk.c: Avoid deadlock when trying to stop the TURN ioqueue_worker_thread(). We cannot hold the instance lock when trying to create or shut down the worker thread without a risk of deadlock. This patch exposed a race condition between a PJSIP serializer thread setting up an ICE session in ice_create() and another thread reading RTP packets. * res_rtp_asterisk.c:ice_create(): Set the new rtp->ice pointer after we have re-locked the RTP instance to prevent the other thread from trying to process ICE packets on an incomplete ICE session setup. A similar race condition is between a PJSIP serializer thread resetting up an ICE session in ice_create() and the timer_worker_thread() processing the completion of the previous ICE session. * res_rtp_asterisk.c:ast_rtp_on_ice_complete(): Protect against an uninitialized/null remote_address after calling update_address_with_ice_candidate(). * res_rtp_asterisk.c: Eliminate the chance of ice_reset_session() destroying and setting the rtp->ice pointer to NULL while other threads are using it by adding an ao2 wrapper around the PJPROJECT ice pointer. Now when we have to unlock the RTP instance object to call a PJPROJECT ICE function we will hold a ref to the wrapper. Also added some rtp->ice NULL checks after we relock the RTP instance and have to do something with the ICE structure. ASTERISK-26835 #close ASTERISK-26853 #close Change-Id: I780b39ec935dcefcce880d50c1a7261744f1d1b4
2017-04-19build: Update config.guess and config.subSean Bright
Change-Id: Id078a1df07a771808775e1053cdfe1d99c8fb172
2017-04-19Merge "format_wav: Read 16khz wav samples properly"Joshua Colp
2017-04-19Merge "format_ogg_vorbis: Clear ogg/vorbis data structures on close"Joshua Colp
2017-04-19Merge "Revert "bridging: Ensure successful T.38 negotation""Joshua Colp
2017-04-17format_wav: Read 16khz wav samples properlySean Bright
When opening a PCM wave file for reading, we aren't tracking the frequency of the opened file, so we treat 16khz files as 8khz and do half reads. This patch also cleans up some of the data types and an unnecessarily complex `if` expression. ASTERISK-26613 #close Reported by: Vitaly K Change-Id: I05f8b263058dc573ea8ffe0c62e7964506e11815
2017-04-16make ari-stubs so doc periodic jobs can runGeorge Joseph
The periodic doc job does a make ari-stubs and checks that there are no changes before generating the docs. Since I changed the mustache template (and the generated code directly) recently and forgot to regenerate the stubs, the doc job thinks they're out of date. Change-Id: I94b97035311eccf52b0101b8590223265a7881d4
2017-04-15format_ogg_vorbis: Clear ogg/vorbis data structures on closeSean Bright
On filestream close, we need to clear out the ogg & vorbis data structures to prevent a memory leak. ASTERISK-26169 #close Reported by: Ivan Myalkin Change-Id: Iee94c5a5d5bdafbf8b181c5c064d15d90ace8274
2017-04-14Revert "bridging: Ensure successful T.38 negotation"Richard Mudgett
This reverts commit 7819f95791fe0ca0e0cdc417e2687a5900444053. Change-Id: Ib91a7e6c9856f5f41329e42f40ba2394fee861a4
2017-04-14res_stun_monitor: Don't fail to load if DNS resolution failsSean Bright
res_stun_monitor will fail to load if DNS resolution of the STUN server fails. Instead, we continue without the STUN server being resolved and we will re-attempt the resolution on the STUN refresh interval. ASTERISK-21856 #close Reported by: Jeremy Kister Change-Id: I6334c54a1cc798f8a836b4b47948e0bb4ef59254
2017-04-14format_pcm: Track actual header size of .au filesSean Bright
Sun's Au file format has a minimum data offset 24 bytes, but this offset is encoded in each .au file. Instead of assuming the minimum, read the actual value and store it for later use. ASTERISK-20984 #close Reported by: Roman S. Patches: asterisk-1.8.20.0-au-clicks-2.diff (license #6474) patch uploaded by Roman S. Change-Id: I524022fb19ff2fd5af2cc2d669d27a780ab2057c
2017-04-13modules: change module LOAD_FAILUREs to LOAD_DECLINES (master)George Joseph
Change-Id: Iac40ecb20e10513d67bf0eaf61807f306067b258
2017-04-13Merge "modules: change module LOAD_FAILUREs to LOAD_DECLINES (14)"Joshua Colp
2017-04-13Merge "modules: change module LOAD_FAILUREs to LOAD_DECLINES"zuul
2017-04-13res_pjsip_sdp_rtp: No rtpmap for static RTP payload IDs in SDP.Alexander Traud
This saves around 100 bytes when G.711, G.722, G.729, and GSM are advertised in SDP. This reduces the chance to hit the MTU bearer of 1300 bytes for SIP over UDP, if many codecs are allowed in Asterisk. This new feature is enabled together with the optional feature compact_headers=yes via the file pjsip.conf. ASTERISK-26932 #close Change-Id: Iaa556ab4c8325cd34c334387ab2847fab07b1689
2017-04-12Merge "strings.h: Avoid overflows in the string hash functions"Joshua Colp
2017-04-12modules: change module LOAD_FAILUREs to LOAD_DECLINES (14)George Joseph
Change-Id: If99e3b4fc2d7e86fc3e61182aa6c835b407ed49e
2017-04-12modules: change module LOAD_FAILUREs to LOAD_DECLINESGeorge Joseph
In all non-pbx modules, AST_MODULE_LOAD_FAILURE has been changed to AST_MODULE_LOAD_DECLINE. This prevents asterisk from exiting if a module can't be loaded. If the user wishes to retain the FAILURE behavior for a specific module, they can use the "require" or "preload-require" keyword in modules.conf. A new API was added to logger: ast_is_logger_initialized(). This allows asterisk.c/check_init() to print to the error log once the logger subsystem is ready instead of just to stdout. If something does fail before the logger is initialized, we now print to stderr instead of stdout. Change-Id: I5f4b50623d9b5a6cb7c5624a8c5c1274c13b2b25
2017-04-12Merge "bridging: Ensure successful T.38 negotation"zuul
2017-04-12Merge "res_rtp_asterisk.c: Add stun_blacklist option"zuul
2017-04-12bridging: Ensure successful T.38 negotationTorrey Searle
When a T.38 happens immediatly after call establishment, the control frame can be lost because the other leg is not yet in the bridge. This patch detects this case an makes sure T.38 negotation happens when the 2nd leg is being made compatible with the negotating first leg ASTERISK-26923 #close Change-Id: If334125ee61ed63550d242fc9efe7987e37e1d94
2017-04-12Merge "stun.c: Fix ast_stun_request() erratic timeout."Joshua Colp