summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-04-27Merge "channel: Add ability to request an outgoing channel with stream ↵Jenkins2
topology."
2017-04-27Merge "frame: Better handle interpolated frames."Jenkins2
2017-04-27Merge "res_pjsip_session: Add cleanup to ast_sip_session_terminate"Jenkins2
2017-04-27Merge "res_pjsip/res_pjsip_callerid: NULL check on caller id name string"Jenkins2
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-27res_pjsip_session: Add cleanup to ast_sip_session_terminateGeorge Joseph
If you use ast_request to create a PJSIP channel but then hang it up without causing a transaction to be sent, the session will never be destroyed. This is due ot the fact that it's pjproject that triggers the session cleanup when the transaction ends. app_chanisavail was doing this to get more granular channel state and it's also possible for this to happen via ARI. * ast_sip_session_terminate was modified to explicitly call the cleanup tasks and unreference session if the invite state is NULL AND invite_tsx is NULL (meaning we never sent a transaction). * chan_pjsip/hangup was modified to bump session before it calls ast_sip_session_terminate to insure that session stays valid while it does its own cleanup. * Added test events to session_destructor for a future testsuite test. ASTERISK-26908 #close Reported-by: Richard Mudgett Change-Id: I52daf6f757184e5544c261f64f6fe9602c4680a9
2017-04-27Merge "res_rtp_asterisk.c: Fix crash in RTCP DTLS operation."Jenkins2
2017-04-27channel: Add ability to request an outgoing channel with stream topology.Joshua Colp
This change extends the ast_request functionality by adding another function and callback to create an outgoing channel with a requested stream topology. Fallback is provided by either converting the requested stream topology into a format capabilities structure if the channel driver does not support streams or by converting the requested format capabilities into a stream topology if the channel driver does support streams. The Dial application has also been updated to request an outgoing channel with the stream topology of the calling channel. ASTERISK-26959 Change-Id: Ifa9037a672ac21d42dd7125aa09816dc879a70e6
2017-04-27Merge "sdp: Add support for T.38"Joshua Colp
2017-04-27Merge "SDP: Ensure SDPs "merge" properly."Joshua Colp
2017-04-26res_pjsip/res_pjsip_callerid: NULL check on caller id name stringKevin Harwell
It's possible for a name in a party id structure to be marked as valid, but the name string itself be NULL (for instance this is possible to do by using the dialplan CALLERID function). There were a couple of places where the name was validated, but the string itself was not checked before passing it to functions like 'strlen'. This of course caused a crashed. This patch adds in a NULL check before attempting to pass it into a function that is not NULL tolerant. ASTERISK-25823 #close Change-Id: Iaa6ffe9d92f598fe9e3c8ae373fadbe3dfbf1d4a
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-26frame: Better handle interpolated frames.Joshua Colp
Interpolated frames are frames which contain a number of samples but have no actual data. Audiohooks did not handle this case when translating an incoming frame into signed linear. It assumed that a frame would always contain media when it may not. If this occurs audiohooks will now immediately return and not act on the frame. As well for users of ast_trans_frameout the function has been changed to be a bit more sane and ensure that the data pointer on a frame is set to NULL if no data is actually on the frame. This allows the various spots in Asterisk that check for an interpolated frame based on the presence of a data pointer to work as expected. ASTERISK-26926 Change-Id: I7fa22f631fa28d540722ed789ce28e84c7f8662b
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