summaryrefslogtreecommitdiff
path: root/res/res_rtp_asterisk.c
AgeCommit message (Collapse)Author
2016-03-28res_rtp_asterisk: Fix packet stats on bridged connectionGeorge Joseph
rxcount, txcount, rxoctetcount and txoctetcount weren't being calculated for bridged streams because the calulations were being done after the bridged short-circuit. Actually, rxoctetcount wasn't ever being calculated. Moved the calculations so they occur for all valid received packets and all transmitted packets. Also added rxoctetcount and txoctetcount to ast_rtp_instance_stat. Change-Id: I08fb06011a82d38c3b4068867a615068fbe59cbb
2016-02-03res_rtp_asterisk: Allow ICE host candidates to be overridenSean Bright
During ICE negotiation the IPs of the local interfaces are sent to the remote peer as host candidates. In many cases Asterisk is behind a static one-to-one NAT, so these host addresses will be internal IP addresses. To help in hiding the topology of the internal network, this patch adds the ability to override the host candidates by matching them against a user-defined list of replacements. Change-Id: I1c9541af97b83a4c690c8150d19bf7202c8bff1f
2016-01-09res_rtp_asterisk: Revert DTLS negotiation changes.Joshua Colp
Due to locking issues within pjnath these changes are being reverted until pjnath can be changed. ASTERISK-25645 Revert "res_rtp_asterisk.c: Fix DTLS negotiation delays." This reverts commit 24ae124e4f7310cfa64c187b944b2ffc060da28d. Change-Id: I2986cfb2c43dc14455c1bcaf92c3804f9da49705 Revert "res_rtp_asterisk: Resolve further timing issues with DTLS negotiation" This reverts commit 965a0eee46d24321f74c244e23c5a5f45e67e12b. Change-Id: Ie68fafde27dad4b03cb7a1e27ce2a8502c3f7bbe
2015-12-24res_rtp_asterisk: rtp->ice check not wrapped in HAVE_PJPROJECT ifdefKevin Harwell
Change-Id: I19b49112e1b630bd04e859f14ccf96f8ebd6b151
2015-12-21res_rtp_asterisk: Resolve further timing issues with DTLS negotiationDade Brandon
Resolves an edge case dtls negotiation delay for certain networks which somehow manage to drop the rtcp side's packet when these are both sent ast_rtp_remote_address_set, causing it to have to time-out and restart the handshake. Move dtls pending bio flush in to it's own function, and call it from ast_rtp_on_ice_complete, when we're rtp->ice, rather than when ast_rtp_remote_address_set. Keep the existing flush from the recent change to res_rtp_remote_address_set if ice is not being used. ASTERISK-25614 #close Reported-by: XenCALL Tested by: XenCALL Change-Id: Ie2caedbdee1783159f375589b6fd3845c8577ba5
2015-12-15res_rtp_asterisk.c: Fix DTLS negotiation delays.server-pandora
- Trigger pending DTLS packets to send out, once the RTP instance's remote address is set. - Avoids locking the DTLS structure unnecessarily by only doing this if DTLS is passive. - Add DTLS locks around the structurally sensitive calls in the SSL portion of __rtp_recvfrom, since dtls_srtp_check_pending does not lock inside of itself, and we're dealing with the SSL BIO in at least two threads. WebRTC channels may receive a DTLS handshake before ast_rtp_remote_address_set is called, which causes there to be a pending response to send out. Previous to 1ad827, this was handled by calling dtls_srtp_check_pending on receipt of any RTP packet - a STUN or RTP packet could trigger the pending handshake response. Since that was rightfully removed, whenever the DTLS handshake is received before the remote address is set, we would have to wait until another SSL packet arrives. As of Chrome M47's optimizations to their handshake process, WebRTC conversations between Chrome M47+ and Asterisk, where Asterisk is passive, experience a 1 second delay without this patch, because the SSL handshake is received before ICE negotation stores the remote_address, and the next SSL packet isn't received until after a 1 second timeout in Chrome, which causes a new handshake request. ASTERISK-25614 #close Change-Id: I547f1be7e302dbf71f6553dd8cbc0657b1d0b908
2015-11-12Further fixes to improper usage of schedulerSteve Davies
When ASTERISK-25449 was closed, a number of scheduler issues mentioned in the comments were missed. These have since beed raised in ASTERISK-25476 and elsewhere. This patch attempts to collect all of the scheduler issues discovered so far and address them sensibly. ASTERISK-25476 #close Change-Id: I87a77d581e2e0d91d33b4b2fbff80f64a566d05b
2015-10-07Merge "res/res_rtp_asterisk.c: Fix incorrect assignment of ↵Joshua Colp
frame->subclass.frame_ending"
2015-10-07res/res_rtp_asterisk.c: Fix incorrect assignment of frame->subclass.frame_endingStefanEng86
In ast_rtp_read, the value of the variable 'mark' which we try to assign to a frame->subclass.frame_ending may be 0, 1 or (1<<23), but we should translate it to 0 or 1. ASTERISK-25451 #close Change-Id: I53bdf5c026041730184a6a809009c028549ce626
2015-10-06res/res_rtp_asterisk: Fix assignment after ao2 decrementMatt Jordan
When we decide we will no longer schedule an RTCP write, we remove the reference to the RTP instance, then assign -1 to the stored scheduler ID in case something else comes along and wants to see if anything is scheduled. That scheduler ID is on the RTP instance. After 60a9172d7ef2 was merged to fix the regression introduced by 3cf0f29310, this improper assignment on a potentially destroyed object started getting tripped on the build agents. Frankly, this should have been crashing a lot more often earlier. I can only assume that the timing was changed just enough by both changes to start actually hitting this problem. As it is, simply moving the assignment prior to the ao2 deference is sufficient to keep the RTP instance from being referenced when it is very, truly, aboslutely dead. (Note that it is still good practice to assign -1 to the scheduler ID when we know we won't be scheduling it again, as the ao2 deref *may* not always destroy the ao2 object.) ASTERISK-25449 Change-Id: Ie6d3cb4adc7b1a6c078b1c38c19fc84cf787cda7
2015-10-06Fix improper usage of scheduler exposed by 5c713fdf18fMatt Jordan
When 5c713fdf18f was merged, it allowed for scheduled items to have an ID of '0' returned. While this was valid per the documentation for the API, it was apparently never returned previously. As a result, several users of the scheduler API viewed the result as being invalid, causing them to reschedule already scheduled items or otherwise fail in interesting ways. This patch corrects the users such that they view '0' as valid, and a returned ID of -1 as being invalid. Note that the failing HEP RTCP tests now pass with this patch. These tests failed due to a duplicate scheduling of the RTCP transmissions. ASTERISK-25449 #close Change-Id: I019a9aa8b6997584f66876331675981ac9e07e39
2015-09-30res_rtp_asterisk: Move "Set role" warning to be debug.Joshua Colp
In practice the set_role API callback can be invoked even when no ICE is present on an RTP instance. This can occur if ICE has not been enabled on it. ASTERISK-25438 #close Change-Id: I0e17e4316f0f0d7f095c78c3d4fd73a913b6ba69
2015-09-08res_rtp_asterisk: Add more ICE debuggingDavid M. Lee
In working through a recent ICE negotiation bug, I found the debug logging in res_rtp_asterisk to be lacking. This patch adds a number of debug and warning statements that were helpful. Change-Id: I950c6d8f13a41f14b3d6334b4cafe7d4e997be80
2015-09-04Fix when remote candidates exceed PJ_ICE_MAX_CANDDavid M. Lee
We were passing the wrong count into pj_ice_sess_create_check_list(), causing the create to fail if we ever received more than PJ_ICE_MAX_CAND candidates. Change-Id: I0303d8e1ecb20a8de9fe629a3209d216c4028378
2015-08-19rtp_engine.c: Initial split of payload types into rx and tx mappings.Richard Mudgett
There are numerous problems with the current implementation of the RTP payload type mapping in Asterisk. It uses only one mapping structure to associate payload types to codecs. The single mapping is overkill if all of the payload type values are well known values. Dynamic payload type mappings do not work as well with the single mapping because RFC3264 allows each side of the link to negotiate different dynamic mappings for what they want to receive. Not only could you have the same codec mapped for sending and receiving on different payload types you could wind up with the same payload type mapped to different codecs for each direction. 1) An independent payload type mapping is needed for sending and receiving. 2) The receive mapping needs to keep track of previous mappings because of the slack to when negotiation happens and current packets in flight using the old mapping arrive. 3) The transmit mapping only needs to keep track of the current negotiated values since we are sending the packets and know when the switchover takes place. * Needed to create ast_rtp_codecs_payload_code_tx() and make some callers use the new function because ast_rtp_codecs_payload_code() was used for mappings in both directions. * Needed to create ast_rtp_codecs_payloads_xover() for cases where we need to pass preferred codec mappings to the peer channel for early media bridging or when we need to prefer the offered mapping that RFC3264 says we SHOULD use. * ast_rtp_codecs_payloads_xover() and ast_rtp_codecs_payload_code_tx() are the only new public functions created. All the others were only used for the tx or rx mapping direction so the function doxygen now reflects which direction the function operates. * chan_mgcp.c: Removed call to ast_rtp_codecs_payloads_clear() as doing that makes no sense when processing an incoming SDP. We would be wiping out any mappings that we set for the possible outgoing SDP we sent earlier. ASTERISK-25166 Reported by: Kevin Harwell ASTERISK-17410 Reported by: Boris Fox Change-Id: Iaf6c227bca68cb7c414cf2fd4108a8ac98bd45ac
2015-08-07Merge "res_rtp_asterisk.c: Fix off-nominal crash potential."Joshua Colp
2015-08-05res_rtp_asterisk: Don't leak temporary key when enabling PFS.Joshua Colp
A change recently went in which enabled perfect forward secrecy for DTLS in res_rtp_asterisk. This was accomplished two different ways depending on the availability of a feature in OpenSSL. The fallback method created a temporary instance of a key but did not free it. This change fixes that. ASTERISK-25265 Change-Id: Iadc031b67a91410bbefb17ffb4218d615d051396
2015-07-30res_rtp_asterisk.c: Fix off-nominal crash potential.Richard Mudgett
ASTERISK-25296 Reported by: Richard Mudgett Change-Id: I08549fb7c3ab40a559f41a3940f3732a4059b55b
2015-07-29res/res_rtp_asterisk: Add ECDH supportMark Duncan
This will add ECDH support to Asterisk. It will detect auto ECDH support in OpenSSL (1.0.2b and above) during ./configure. If this is available, it will use it, otherwise it will fall back to prime256v1 (this behavior is consistent with other projects such as Apache and nginx). This fixes WebRTC being broken in Firefox 38+ due to Firefox now only supporting ciphers with perfect forward secrecy. ASTERISK-25265 #close Change-Id: I8c13b33a2a79c0bde2e69e4ba6afa5ab9351465b
2015-07-20res_pjsip: Add rtp_keepalive endpoint option.Mark Michelson
This adds an "rtp_keepalive" option for PJSIP endpoints. Similar to the chan_sip option, this specifies an interval, in seconds, at which we will send RTP comfort noise frames. This can be useful for keeping RTP sessions alive as well as keeping NAT associations alive during lulls. ASTERISK-25242 #close Reported by Mark Michelson Change-Id: I3b9903d99e35fe5d0b53ecc46df82c750776bc8d
2015-07-08res_rtp_asterisk: Ensure DTLS timeout timer is -1 if DTLS is not used.Joshua Colp
This change fixes a bug where the DTLS timeout timer would be initialized to 0 if DTLS was not used for an RTP session. ASTERISK-25103 Change-Id: If8d26bb054f1d300838850da5b8db9044c2fe2ac
2015-07-07res_rtp_asterisk: Prevent simultaneous access to DTLS SSL context.Joshua Colp
This change moves logic for setting up the DTLS SSL contexts to when the SDP is done being processed instead of when ICE negotiation completes. It also stops handshakes from being initiated when we are acting as a server. Manipulating the SSL context when ICE negotiation has completed is problematic as the SSL context is not protected and if acting as a client the remote side may have started DTLS negotiation already. The retransmission timeout timer code has also been split up and simplified some. Both RTP and RTCP now have their own timers and the points at which the timer is stopped and started is now more specific. When a packet is sent the timer is started. When a response is received but before it is processed the timer is stopped. This provides a guarantee that the timeout is not occurring while the response is processed. ASTERISK-22805 #close ASTERISK-24550 #close ASTERISK-24651 #close ASTERISK-24832 #close ASTERISK-25103 #close ASTERISK-25127 #close Change-Id: Ib75ea2546f29d6efc3d2d37c58df6986c7bd9b91
2015-05-14Merge "AST_MODULE_INFO: Format corrections to the usages of AST_MODULE_INFO ↵Joshua Colp
macro."
2015-05-13AST_MODULE_INFO: Format corrections to the usages of AST_MODULE_INFO macro.Rodrigo Ramírez Norambuena
Change-Id: Icf88f9f861c6b2a16e5f626ff25795218a6f2723
2015-05-10res_rtp_asterisk: Correction for the limit which detects that a packet is DTLS.Yousf Ateya
First byte of DTLS packet shall be in range 20-63, not 20-64. Refer to RFC https://tools.ietf.org/html/rfc5764#section-5.1.2 for correct values. Change-Id: Iae6fa0d72b37c36a27fe40686e0ae6fba3afec31
2015-05-08res_rtp_asterisk: Issue ERROR if res_srtp is not found.Sean Bright
While trying to get WebRTC working with chan_pjsip, I was running into the following error: Attempted to set an invalid DTLS-SRTP configuration on RTP instance... Josh helpfully pointed out that res_srtp.so might not be loaded, and sure enough, it wasn't. This patch adds a ERROR indiciating as much to hopefully help others having a similar problem. Change-Id: I13aa477b47b299876728a21b130998a0ea6cd19f
2015-04-28res_rtp_asterisk: Resolve 2 discrete memory leaks in DTLSSteve Davies
ao2 ref leak in res_rtp_asterisk.c when a DTLS policy is created. The resources are linked into a table, but the original alloc refs are never released. ast_strdup leak in rtp_engine.c. If ast_rtp_dtls_cfg_copy() is called twice on the same destination struct, a pointer to an alloc'd string is overwritten before the string is free'd. ASTERISK-25022 Reported by: one47 Change-Id: I62a8ceb8679709f6c3769136dc6aa9a68202ff9b
2015-04-13git migration: Refactor the ASTERISK_FILE_VERSION macroMatt Jordan
Git does not support the ability to replace a token with a version string during check-in. While it does have support for replacing a token on clone, this is somewhat sub-optimal: the token is replaced with the object hash, which is not particularly easy for human consumption. What's more, in practice, the source file version was often not terribly useful. Generally, when triaging bugs, the overall version of Asterisk is far more useful than an individual SVN version of a file. As a result, this patch removes Asterisk's support for showing source file versions. Specifically, it does the following: * Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and remove passing the version in with the macro. Other facilities than 'core show file version' make use of the file names, such as setting a debug level only on a specific file. As such, the act of registering source files with the Asterisk core still has use. The macro rename now reflects the new macro purpose. * main/asterisk: - Refactor the file_version structure to reflect that it no longer tracks a version field. - Remove the "core show file version" CLI command. Without the file version, it is no longer useful. - Remove the ast_file_version_find function. The file version is no longer tracked. - Rename ast_register_file_version/ast_unregister_file_version to ast_register_file/ast_unregister_file, respectively. * main/manager: Remove value from the Version key of the ModuleCheck Action. The actual key itself has not been removed, as doing so would absolutely constitute a backwards incompatible change. However, since the file version is no longer tracked, there is no need to attempt to include it in the Version key. * UPGRADE: Add notes for: - Modification to the ModuleCheck AMI Action - Removal of the "core show file version" CLI command Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
2015-03-30clang compiler warnings: Fix -Wabsolute-value warningsMatthew Jordan
This patch fixes several warnings caught by clang - in this case, usage of the abs function on non-integer values. This patch uses labs and fabs, as appropriate, in the various affected files. Review: https://reviewboard.asterisk.org/r/4525 ASTERISK-24917 Reported by: dkdegroot patches: rb4525.patch submitted by dkdegroot (License 6600) ........ Merged revisions 433749 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 433750 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433751 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-08res_rtp_asterisk: Fix wrongful use of USE_PJPROJECT define.Joshua Colp
As pjproject is now used as a shared library a different define, HAVE_PJPROJECT, is used to specify if pjproject is present. ASTERISK-24830 #close Reported by: Stefan Engström ........ Merged revisions 432614 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432615 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-16res/res_rtp_asterisk: Fix crash in debug from RTCP reports without report blockMatthew Jordan
When RTCP debugging was enabled, an RTCP report without a report block would cause a crash. This was due to the verbose output not checking to see if the report_block pointer was NULl before dereferencing it. This patch adds the necessary check to prevent printing any verbose output if the far side hasn't provided us the information they should have. ASTERISK-24791 #close Reported by: JoshE Tested by: JoshE ........ Merged revisions 431879 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431880 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-29res_rtp_asterisk: Fix DTLS when used with OpenSSL 1.0.1kJoshua Colp
A recent security fix for OpenSSL broke DTLS negotiation for many applications. This was caused by read ahead not being enabled when it should be. While a commit has gone into OpenSSL to force read ahead on for DTLS it may take some time for a release to be made and the change to be present in distributions (if at all). As enabling read ahead is a simple one line change this commit does that and fixes the issue. ASTERISK-24711 #close Reported by: Jared Biel ........ Merged revisions 431384 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 431385 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431386 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-18chan_dahdi.c, res_rtp_asterisk.c: Change some spammy debug messages to level 5.Richard Mudgett
ASTERISK-24337 #close Reported by: Rusty Newton ........ Merged revisions 429804 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 429805 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429806 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-17Fix printf problems with high ascii characters after r413586 (1.8).Walter Doekes
In r413586 (1.8) various casts were added to silence gcc 4.10 warnings. Those fixes included things like: -out += sprintf(out, "%%%02X", (unsigned char) *ptr); +out += sprintf(out, "%%%02X", (unsigned) *ptr); That works for low ascii characters, but for the high range that yields e.g. FFFFFFC3 when C3 is expected. This changeset: - fixes those casts to use the 'hh' unsigned char modifier instead - consistently uses %02x instead of %2.2x (or other non-standard usage) - adds a few 'h' modifiers in various places - fixes a 'replcaes' typo - dev/urandon typo (in 13+ patch) Review: https://reviewboard.asterisk.org/r/4263/ ASTERISK-24619 #close Reported by: Stefan27 (on IRC) ........ Merged revisions 429673 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 429674 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 429675 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429683 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-09Direct Media calls within private network sometimes get one way audioKevin Harwell
When endpoints with direct_media enabled, behind a firewall (Asterisk on a separate network) and were bridged sometimes Asterisk would send the ip address of the firewall in the sdp to one of the phones in the reinvite resulting in one way audio. When sending the reinvite Asterisk will retrieve the media address from the associated rtp instance, but if frames were being read this can be overwritten with another address (in this case the firewall's). This patch ensures that Asterisk uses the original device address when using direct media. ASTERISK-24563 Reported by: Steve Pitts Review: https://reviewboard.asterisk.org/r/4216/ ........ Merged revisions 429195 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 429196 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429197 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-16res_rtp_asterisk: Fix a bug where ICE state would get reset when it shouldn't.Joshua Colp
In the case where the ICE negotiation had not yet started current state would get wiped when it shouldn't. This also removes channel binding as in practice this does not work well with other implementations. ........ Merged revisions 425644 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 425645 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 425646 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@425647 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-12res_rtp_asterisk: Make the ICE transport check case insensitive as some ↵Joshua Colp
implementations use 'udp'. ........ Merged revisions 425360 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 425361 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 425362 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@425363 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-09res_rtp_asterisk: Crash if no candidates received for componentKevin Harwell
When starting ice if there is not at least one remote ice candidate with an RTP component asterisk will crash. This is due to an assertion in pjnath as it expects at least one candidate with an RTP component. Added a check to make sure at least one candidate contains an RTP component and at least one candidate has an RTCP component. ASTERISK-24383 #close Review: https://reviewboard.asterisk.org/r/4039/ ........ Merged revisions 425031 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@425032 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-08res_rtp_asterisk: Allow only UDP ICE candidates.Joshua Colp
The underlying library, pjnath, that res_rtp_asterisk uses for ICE support does not have support for ICE-TCP. As candidates are passed through directly to it this can cause error messages to occur when it receives something unexpected (such as a TCP candidate). This change merely ignores all non-UDP candidates so they never reach pjnath. ASTERISK-24326 #close Reported by: Joshua Colp ........ Merged revisions 424852 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 424853 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 424854 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424855 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-30res_rtp_asterisk: Ensure that the base and mapped address for candidates is ↵Joshua Colp
present in SDP. This change fixes an issue where ICE candidates put into the SDP did not contain the 'raddr' and 'rport' information for server reflexive and relay candidates. #SIPit31 ........ Merged revisions 424151 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 424152 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 424153 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424154 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-26core: Don't allow free to mean ast_free (and malloc, etc..).Walter Doekes
This gets rid of most old libc free/malloc/realloc and replaces them with ast_free and friends. When compiling with MALLOC_DEBUG you'll notice it when you're mistakenly using one of the libc variants. For the legacy cases you can define WRAP_LIBC_MALLOC before including asterisk.h. Even better would be if the errors were also enabled when compiling without MALLOC_DEBUG, but that's a slightly more invasive header file change. Those compiling addons/format_mp3 will need to rerun ./contrib/scripts/get_mp3_source.sh. ASTERISK-24348 #related Review: https://reviewboard.asterisk.org/r/4015/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423978 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-17res_rtp_asterisk: Ensure that the thread terminating pj stuff is registered.Joshua Colp
........ Merged revisions 423253 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 423254 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 423255 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423256 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-16Multiple revisions 423209,423212Joshua Colp
........ r423209 | file | 2014-09-16 17:35:34 -0300 (Tue, 16 Sep 2014) | 8 lines res_rtp_asterisk: Fix building when pjproject is not used. ........ Merged revisions 423207 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 423208 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ r423212 | file | 2014-09-16 18:03:59 -0300 (Tue, 16 Sep 2014) | 10 lines res_rtp_asterisk: Fix 100% CPU usage due to timer heap thread spinning. Side note: I need a vacation. ........ Merged revisions 423210 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 423211 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 423209,423212 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423213 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-16res_rtp_asterisk: Fix a myriad of TURN client issues.Joshua Colp
1. The number of file descriptors an ioqueue instance can handle is fixed, so we now spawn the required number to handle the load. 2. Our transport identifiers were exceeding the range supported by pjnath. 3. The TURN client did not set up client binding causing needless bandwidth usage. 4. The code no longer updates address information on each packet. 5. STUN traffic was getting looped back to Asterisk instead of going through the TURN server. 6. Synchronization now ensures things are completely setup or destroyed. 7. Logging now reflects the target the TURN server is sending to/receiving from on our behalf. ASTERISK-23577 #close Reported by: Jay Jideliov ASTERISK-23634 #close Reported by: Roman Skvirsky Review: https://reviewboard.asterisk.org/r/3982/ ........ Merged revisions 423150 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 423151 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 423152 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423153 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-31res_hep_rtcp: Add module that sends RTCP information to a Homer ServerMatthew Jordan
This patch adds a new module to Asterisk, res_hep_rtcp. The module subscribes to the RTCP topics in Stasis and receives RTCP information back from the message bus. It encodes into HEPv3 packets and sends the information to the res_hep module for transmission. Using this, someone with a Homer server can get live call quality monitoring for all RTP-based channels in their Asterisk 12+ systems. In addition, there were a few bugs in the RTP engine, res_rtp_asterisk, and chan_pjsip that were uncovered by the tests written for the Asterisk Test Suite. This patch fixes the following: 1) chan_pjsip failed to set its channel unique ids on its RTP instance on outbound calls. It now does this in the appropriate location, in the serialized call callback. 2) The rtp_engine was overflowing some values when packed into JSON. Specifically, some longs and unsigned ints can't be be packed into integer values, for obvious reasons. Since libjansson only supports integers, floats, strings, booleans, and objects, we print these values into strings. 3) res_rtp_asterisk had a few problems: (a) it would emit a source IP address of 0.0.0.0 if bound to that IP address. We now use ast_find_ourip to get a better IP address, and properly marshal the result into an ast_strdupa'd string. (b) Reports can be generated with no report bodies. In particular, this occurs when a sender is transmitting information to a receiver (who will send no RTP back to the sender). As such, the sender has no report body for what it received. We now properly handle this case, and the sender will emit SR reports with no body. Likewise, if we receive an RTCP packet with no report body, we will still generate the appropriate events. ASTERISK-24119 #close ........ Merged revisions 419823 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419825 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-25Add module support level to ast_module_info structure. Print it in CLI ↵Mark Michelson
"module show" . ASTERISK-23919 #close Reported by Malcolm Davenport Review: https://reviewboard.asterisk.org/r/3802 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419592 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-20media formats: re-architect handling of media for performance improvementsMatthew Jordan
In the old times media formats were represented using a bit field. This was fast but had a few limitations. 1. Asterisk was limited in how many formats it could handle. 2. Formats, being a bit field, could not include any attribute information. A format was strictly its type, e.g., "this is ulaw". This was changed in Asterisk 10 (see https://wiki.asterisk.org/wiki/display/AST/Media+Architecture+Proposal for notes on that work) which led to the creation of the ast_format structure. This structure allowed Asterisk to handle attributes and bundle information with a format. Additionally, ast_format_cap was created to act as a container for multiple formats that, together, formed the capability of some entity. Another mechanism was added to allow logic to be registered which performed format attribute negotiation. Everywhere throughout the codebase Asterisk was changed to use this strategy. Unfortunately, in software, there is no free lunch. These new capabilities came at a cost. Performance analysis and profiling showed that we spend an inordinate amount of time comparing, copying, and generally manipulating formats and their related structures. Basic prototyping has shown that a reasonably large performance improvement could be made in this area. This patch is the result of that project, which overhauled the media format architecture and its usage in Asterisk to improve performance. Generally, the new philosophy for handling formats is as follows: * The ast_format structure is reference counted. This removed a large amount of the memory allocations and copying that was done in prior versions. * In order to prevent race conditions while keeping things performant, the ast_format structure is immutable by convention and lock-free. Violate this tenet at your peril! * Because formats are reference counted, codecs are also reference counted. The Asterisk core generally provides built-in codecs and caches the ast_format structures created to represent them. Generally, to prevent inordinate amounts of module reference bumping, codecs and formats can be added at run-time but cannot be removed. * All compatibility with the bit field representation of codecs/formats has been moved to a compatibility API. The primary user of this representation is chan_iax2, which must continue to maintain its bit-field usage of formats for interoperability concerns. * When a format is negotiated with attributes, or when a format cannot be represented by one of the cached formats, a new format object is created or cloned from an existing format. That format may have the same codec underlying it, but is a different format than a version of the format with different attributes or without attributes. * While formats are reference counted objects, the reference count maintained on the format should be manipulated with care. Formats are generally cached and will persist for the lifetime of Asterisk and do not explicitly need to have their lifetime modified. An exception to this is when the user of a format does not know where the format came from *and* the user may outlive the provider of the format. This occurs, for example, when a format is read from a channel: the channel may have a format with attributes (hence, non-cached) and the user of the format may last longer than the channel (if the reference to the channel is released prior to the format's reference). For more information on this work, see the API design notes: https://wiki.asterisk.org/wiki/display/AST/Media+Format+Rewrite Finally, this work was the culmination of a large number of developer's efforts. Extra thanks goes to Corey Farrell, who took on a large amount of the work in the Asterisk core, chan_sip, and was an invaluable resource in peer reviews throughout this project. There were a substantial number of patches contributed during this work; the following issues/patch names simply reflect some of the work (and will cause the release scripts to give attribution to the individuals who work on them). Reviews: https://reviewboard.asterisk.org/r/3814 https://reviewboard.asterisk.org/r/3808 https://reviewboard.asterisk.org/r/3805 https://reviewboard.asterisk.org/r/3803 https://reviewboard.asterisk.org/r/3801 https://reviewboard.asterisk.org/r/3798 https://reviewboard.asterisk.org/r/3800 https://reviewboard.asterisk.org/r/3794 https://reviewboard.asterisk.org/r/3793 https://reviewboard.asterisk.org/r/3792 https://reviewboard.asterisk.org/r/3791 https://reviewboard.asterisk.org/r/3790 https://reviewboard.asterisk.org/r/3789 https://reviewboard.asterisk.org/r/3788 https://reviewboard.asterisk.org/r/3787 https://reviewboard.asterisk.org/r/3786 https://reviewboard.asterisk.org/r/3784 https://reviewboard.asterisk.org/r/3783 https://reviewboard.asterisk.org/r/3778 https://reviewboard.asterisk.org/r/3774 https://reviewboard.asterisk.org/r/3775 https://reviewboard.asterisk.org/r/3772 https://reviewboard.asterisk.org/r/3761 https://reviewboard.asterisk.org/r/3754 https://reviewboard.asterisk.org/r/3753 https://reviewboard.asterisk.org/r/3751 https://reviewboard.asterisk.org/r/3750 https://reviewboard.asterisk.org/r/3748 https://reviewboard.asterisk.org/r/3747 https://reviewboard.asterisk.org/r/3746 https://reviewboard.asterisk.org/r/3742 https://reviewboard.asterisk.org/r/3740 https://reviewboard.asterisk.org/r/3739 https://reviewboard.asterisk.org/r/3738 https://reviewboard.asterisk.org/r/3737 https://reviewboard.asterisk.org/r/3736 https://reviewboard.asterisk.org/r/3734 https://reviewboard.asterisk.org/r/3722 https://reviewboard.asterisk.org/r/3713 https://reviewboard.asterisk.org/r/3703 https://reviewboard.asterisk.org/r/3689 https://reviewboard.asterisk.org/r/3687 https://reviewboard.asterisk.org/r/3674 https://reviewboard.asterisk.org/r/3671 https://reviewboard.asterisk.org/r/3667 https://reviewboard.asterisk.org/r/3665 https://reviewboard.asterisk.org/r/3625 https://reviewboard.asterisk.org/r/3602 https://reviewboard.asterisk.org/r/3519 https://reviewboard.asterisk.org/r/3518 https://reviewboard.asterisk.org/r/3516 https://reviewboard.asterisk.org/r/3515 https://reviewboard.asterisk.org/r/3512 https://reviewboard.asterisk.org/r/3506 https://reviewboard.asterisk.org/r/3413 https://reviewboard.asterisk.org/r/3410 https://reviewboard.asterisk.org/r/3387 https://reviewboard.asterisk.org/r/3388 https://reviewboard.asterisk.org/r/3389 https://reviewboard.asterisk.org/r/3390 https://reviewboard.asterisk.org/r/3321 https://reviewboard.asterisk.org/r/3320 https://reviewboard.asterisk.org/r/3319 https://reviewboard.asterisk.org/r/3318 https://reviewboard.asterisk.org/r/3266 https://reviewboard.asterisk.org/r/3265 https://reviewboard.asterisk.org/r/3234 https://reviewboard.asterisk.org/r/3178 ASTERISK-23114 #close Reported by: mjordan media_formats_translation_core.diff uploaded by kharwell (License 6464) rb3506.diff uploaded by mjordan (License 6283) media_format_app_file.diff uploaded by kharwell (License 6464) misc-2.diff uploaded by file (License 5000) chan_mild-3.diff uploaded by file (License 5000) chan_obscure.diff uploaded by file (License 5000) jingle.diff uploaded by file (License 5000) funcs.diff uploaded by file (License 5000) formats.diff uploaded by file (License 5000) core.diff uploaded by file (License 5000) bridges.diff uploaded by file (License 5000) mf-codecs-2.diff uploaded by file (License 5000) mf-app_fax.diff uploaded by file (License 5000) mf-apps-3.diff uploaded by file (License 5000) media-formats-3.diff uploaded by file (License 5000) ASTERISK-23715 rb3713.patch uploaded by coreyfarrell (License 5909) rb3689.patch uploaded by mjordan (License 6283) ASTERISK-23957 rb3722.patch uploaded by mjordan (License 6283) mf-attributes-3.diff uploaded by file (License 5000) ASTERISK-23958 Tested by: jrose rb3822.patch uploaded by coreyfarrell (License 5909) rb3800.patch uploaded by jrose (License 6182) chan_sip.diff uploaded by mjordan (License 6283) rb3747.patch uploaded by jrose (License 6182) ASTERISK-23959 #close Tested by: sgriepentrog, mjordan, coreyfarrell sip_cleanup.diff uploaded by opticron (License 6273) chan_sip_caps.diff uploaded by mjordan (License 6283) rb3751.patch uploaded by coreyfarrell (License 5909) chan_sip-3.diff uploaded by file (License 5000) ASTERISK-23960 #close Tested by: opticron direct_media.diff uploaded by opticron (License 6273) pjsip-direct-media.diff uploaded by file (License 5000) format_cap_remove.diff uploaded by opticron (License 6273) media_format_fixes.diff uploaded by opticron (License 6273) chan_pjsip-2.diff uploaded by file (License 5000) ASTERISK-23966 #close Tested by: rmudgett rb3803.patch uploaded by rmudgetti (License 5621) chan_dahdi.diff uploaded by file (License 5000) ASTERISK-24064 #close Tested by: coreyfarrell, mjordan, opticron, file, rmudgett, sgriepentrog, jrose rb3814.patch uploaded by rmudgett (License 5621) moh_cleanup.diff uploaded by opticron (License 6273) bridge_leak.diff uploaded by opticron (License 6273) translate.diff uploaded by file (License 5000) rb3795.patch uploaded by rmudgett (License 5621) tls_fix.diff uploaded by mjordan (License 6283) fax-mf-fix-2.diff uploaded by file (License 5000) rtp_transfer_stuff uploaded by mjordan (License 6283) rb3787.patch uploaded by rmudgett (License 5621) media-formats-explicit-translate-format-3.diff uploaded by file (License 5000) format_cache_case_fix.diff uploaded by opticron (License 6273) rb3774.patch uploaded by rmudgett (License 5621) rb3775.patch uploaded by rmudgett (License 5621) rtp_engine_fix.diff uploaded by opticron (License 6273) rtp_crash_fix.diff uploaded by opticron (License 6273) rb3753.patch uploaded by mjordan (License 6283) rb3750.patch uploaded by mjordan (License 6283) rb3748.patch uploaded by rmudgett (License 5621) media_format_fixes.diff uploaded by opticron (License 6273) rb3740.patch uploaded by mjordan (License 6283) rb3739.patch uploaded by mjordan (License 6283) rb3734.patch uploaded by mjordan (License 6283) rb3689.patch uploaded by mjordan (License 6283) rb3674.patch uploaded by coreyfarrell (License 5909) rb3671.patch uploaded by coreyfarrell (License 5909) rb3667.patch uploaded by coreyfarrell (License 5909) rb3665.patch uploaded by mjordan (License 6283) rb3625.patch uploaded by coreyfarrell (License 5909) rb3602.patch uploaded by coreyfarrell (License 5909) format_compatibility-2.diff uploaded by file (License 5000) core.diff uploaded by file (License 5000) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419044 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-08res_rtp_asterisk: Fix undefined function when PJPROJECT is not installedMatthew Jordan
The dtls_perform_handshake function was mistakenly placed under the guards for USE_PJPROJECT. If PJPROJECT was not installed, the function would not be defined, while other functions would attempt to still use it. This prevented res_rtp_asterisk from being loaded. ASTERISK-24001 #close Reported by: Don Fanning ........ Merged revisions 418172 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@418174 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-01res_rtp_asterisk: Don't leak memory or reset state if DTLS configuration is ↵Joshua Colp
set multiple times. ........ Merged revisions 417705 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417706 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-30Recorded merge of revisions 417677 from ↵Joshua Colp
http://svn.asterisk.org/svn/asterisk/branches/11 ........ res_rtp_asterisk: Add SHA-256 support for DTLS and perform DTLS negotiation on RTCP. This change fixes up DTLS support in res_rtp_asterisk so it can accept and provide a SHA-256 fingerprint, so it occurs on RTCP, and so it occurs after ICE negotiation completes. Configuration options to chan_sip and chan_pjsip have also been added to allow behavior to be tweaked (such as forcing the AVP type media transports in SDP). ASTERISK-22961 #close Reported by: Jay Jideliov Review: https://reviewboard.asterisk.org/r/3679/ Review: https://reviewboard.asterisk.org/r/3686/ ........ Merged revisions 417678 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417679 65c4cc65-6c06-0410-ace0-fbb531ad65f3