summaryrefslogtreecommitdiff
path: root/res/res_rtp_asterisk.c
AgeCommit message (Collapse)Author
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
2014-06-23res_rtp_asterisk: Return the length of data written when sending via ICE ↵Joshua Colp
instead of 0. ASTERISK-23834 #close Reported by: Richard Kenner ........ Merged revisions 417141 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 417142 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417143 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-09Allow Asterisk to compile under GCC 4.10Kinsey Moore
This resolves a large number of compiler warnings from GCC 4.10 which cause the build to fail under dev mode. The vast majority are signed/unsigned mismatches in printf-style format strings. ........ Merged revisions 413586 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 413587 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 413588 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-25res_rtp_asterisk: Add support for DTLS handshake retransmissionsMatthew Jordan
On congested networks, it is possible for the DTLS handshake messages to get lost. This patch adds a timer to res_rtp_asterisk that will periodically check to see if the handshake has succeeded. If not, it will retransmit the DTLS handshake. Review: https://reviewboard.asterisk.org/r/3337 ASTERISK-23649 #close Reported by: Nitesh Bansal patches: dtls_retransmission.patch uploaded by Nitesh Bansal (License 6418) ........ Merged revisions 413008 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 413009 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413012 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-04res_rtp_asterisk: Fix one way audio problems with hold/unhold when using ICEJonathan Rose
ICE sessions will now be restarted if sessions are changed to use new sets of remote candidates. (closes issue ASTERISK-22911) Reported by: Vytis Valentinavičius Review: https://reviewboard.asterisk.org/r/3275/ ........ Merged revisions 409565 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 409570 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@409587 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-27Multiple revisions 409129-409130Jonathan Rose
........ r409129 | jrose | 2014-02-27 13:19:02 -0600 (Thu, 27 Feb 2014) | 15 lines res_rtp_asterisk: Fix checklist creating problems in ICE sessions Prior to this patch, local candidate lists including SRFLX would fail to start properly when building ICE candidate check lists. This patch fixes that problem by making sure that each SRFLX candidate is associated with the proper base address so that the check list can create matches properly. This patch was written by jcolp. The issue will be left open to await testing by the issue participants. (issue ASTERISK-23213) Reported by: Andrea Suisani Review: https://reviewboard.asterisk.org/r/3256/ ........ r409130 | jrose | 2014-02-27 13:38:10 -0600 (Thu, 27 Feb 2014) | 8 lines res_rtp_asterisk: correct build error from r409129 Accidentally placed a declaration below functional code (issue ASTERISK-23213) Reported by: Andrea Suisani Review: https://reviewboard.asterisk.org/r/3256/ ........ Merged revisions 409129-409130 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 409131 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@409132 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-30res_rtp_asterisk & udptl: fix port selection to work with SELinux restrictionsCorey Farrell
ast_bind to a port reserved for another program by SELinux causes errno == EACCES. This caused random failures when binding rtp or udptl sockets. Treat EACCES as a non-fatal error, try next port. (closes issue ASTERISK-23134) Reported by: Corey Farrell ........ Merged revisions 406933 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 406934 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 406935 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406936 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-09res_rtp_asterisk: Fails to resume WebRTC call from holdKevin Harwell
In ast_rtp_ice_start if the ice session create check list failed, start check was never initiated and ice_started was never set to true. Upon re-entering the function (for instance, [un]hold) it would try to create the check list again with duplicate remote candidates. Fixed so that if the create check list fails the necessary data structures are properly re-initialized for any subsequent retries. Note, it was decided to not stop ice support (by calling ast_rtp_ice_stop) on a check list failure because it possible things might still work. However, a debug message was added to help with any future troubleshooting. (closes issue ASTERISK-22911) Reported by: Vytis Valentinavičius Patches: works_on_my_machine.patch uploaded by xytis (license 6558) ........ Merged revisions 405234 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 405235 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405236 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-11-01chan_sip: Fix RTCP port for SRFLX ICE candidatesKinsey Moore
This corrects one-way audio between Asterisk and Chrome/jssip as a result of Asterisk inserting the incorrect RTCP port into RTCP SRFLX ICE candidates. This also exposes an ICE component enumeration to extract further details from candidates. (closes issue ASTERISK-21383) Reported by: Shaun Clark Review: https://reviewboard.asterisk.org/r/2967/ ........ Merged revisions 402345 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 402348 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402349 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-23res_rtp_asterisk: Address jittery DTMF events in RTP streamsJonathan Rose
(closes issue ASTERISK-21170) Reported by: NITESH BANSAL Patches: dtmf-timestamp.patch uploaded by NITESH BANSAL (license 6418) Review: https://reviewboard.asterisk.org/r/2938/ ........ Merged revisions 401619 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 401620 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 401621 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401622 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-22res_rtp_asterisk: Fix crash when RTCP is not available during SSRC changeMatthew Jordan
In r400089, a patch was put in to correct erroneous RTCP statistic resets. Unfortunately, ast_rtp_read can be called on an RTP instance that does not have RTCP information. This patch prevents that crash by only resetting the statistics if we do actually have an RTCP instance. (issue AST-1174) (closes issue ASTERISK-22667) Reported by: John Bigelow ........ Merged revisions 401445 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 401446 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 401447 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401450 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-08Fix STUN crash when using IPv6 any addressKinsey Moore
Ensure that when chan_sip binds to the IPv6 any address ([::]), IPv4 candidates are also added. (closes issue ASTERISK-21917) Reported by: Torrey Searle Patches: 0023_ipv6_stun_crash.patch uploaded by Torrey Searle (License 5334) ........ Merged revisions 400681 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 400682 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400684 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-28res_rtp_asterisk: Correct erroneous lost packet information in RTCP reportsMatthew Jordan
RTCP's calculation of the number of lost packets in an RTP stream is based on that stream's sequence number count, the number of received packets, and how many packets we expect to receive. When the SSRC for an RTP stream changes, there can - and almost always will be - a large jump in the next packet's timestamp and sequence number. If we don't reset the number of received packets, sequence number count, and other metrics used by RTCP, the next RR/SR report will use the previous SSRC's values to calculate the lost packet count for the new SSRC - resulting in a very large number of lost packets. This patch modifies res_rtp_asterisk such that, if it detects a SSRC change, it will reset the various values used by the RTCP calculations. From the perspective of RTCP, this appears as a new media stream - which is what it is. Review: https://reviewboard.asterisk.org/r/2886/ (closes issue AST-1174) Reported by: Thomas Arimont ........ Merged revisions 400089 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 400093 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 400108 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400117 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-21res_rtp_asterisk: Fix ref leaks in ast_rtcp_read().Richard Mudgett
Moved rtcp_report RAII_VAR declaration into the loop so it is unref'ed after every loop. Moved message_blob to loop and switched it to a regular variable. The regular variable was used since message_blob is used in a very contained way. (closes issue ASTERISK-22565) Reported by: Corey Farrell Patches: rtcp_report-leak.patch (license #5909) patch uploaded by Corey Farrell Tested by: Corey Farrell ........ Merged revisions 399607 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@399608 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-13res_pjsip: Forward PJSIP logging to Asterisk loggingDavid M. Lee
This patch uses PJSIP's pj_log_set_log_func() to forward PJSIP's log messages to Asterisk's logger. This is done in a new module: res_pjsip_log_forwarder.so. This patch sets defaultenabled on the existing res_pjsip_logger.so to no, since logging every SIP packet seems a bit odd to do by default, and is (hopefully) less necessary with regular PJSIP logging. It also removes res_rtp_asterisk's disabling of PJSIP logging. (closes issue ASTERISK-22360) Reported by: Joshua Colp Review: https://reviewboard.asterisk.org/r/2830/ ........ Merged revisions 399049 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@399051 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-23Add pass through support for Opus and VP8; Opus format attribute negotiationMatthew Jordan
This patch adds pass through support for Opus and VP8. That includes: * Format attribute negotiation for Opus. Note that unlike some other codecs, the draft RFC specifies having spaces delimiting the attributes in addition to ';', so you have "attra=X; attrb=Y". This broke the attribute parsing in chan_sip, so a small tweak was also included in this patch for that. * A format attribute negotiation module for Opus, res_format_attr_opus * Fast picture update for VP8. Since VP8 uses a different RTCP packet number than FIR, this really is specific to VP8 at this time. Note that the format attribute negotiation in res_pjsip_sdp_rtp was written by mjordan. The rest of this patch was written completely by Lorenzo Miniero. Review: https://reviewboard.asterisk.org/r/2723/ (closes issue ASTERISK-21981) Reported by: Tzafrir Cohen patches: asterisk_opus+vp8_passthrough_20130718.patch uploaded by lminiero (License 6518) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397526 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-16Doxygen comment tweaks.Richard Mudgett
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396857 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-05Refactor RTCP events over to Stasis; associate with channelsMatthew Jordan
This patch does the following: * It merges Jaco Kroon's patch from ASTERISK-20754, which provides channel information in the RTCP events. Because Stasis provides a cache, Jaco's patch was modified to pass the channel uniqueid to the RTP layer as opposed to a pointer to the channel. This has the following benefits: (1) It keeps the RTP engine 'clean' of references back to channels (2) It prevents circular dependencies and other potential ref counting issues * The RTP engine now allows any RTP implementation to raise RTCP messages. Potentially, other implementations (such as res_rtp_multicast) could also raise RTCP information. The engine provides structs to represent RTCP headers and RTCP SR/RR reports. * Some general refactoring in res_rtp_asterisk was done to try and tame the RTCP code. It isn't perfect - that's *way* beyond the scope of this work - but it does feel marginally better. * A few random bugs were fixed in the RTCP statistics. (Example: performing an assignment of a = a is probably not correct) * We now raise RTCP events for each SR/RR sent/received. Previously we wouldn't raise an event when we sent a RR report. Note that this work will be of use to others who want to monitor call quality or build modules that report call quality statistics. Since the events are now moving across the Stasis message bus, this is far easier to accomplish. It is also a first step (though by no means the last step) towards getting Olle's pinefrog work incorporated. Again: note that the patch by Jaco Kroon was modified slightly for this work; however, he did all of the hard work in finding the right places to set the channel in the RTP engine across the channel drivers. Much thanks goes to Jaco for his hard work here. Review: https://reviewboard.asterisk.org/r/2603/ (closes issue ASTERISK-20574) Reported by: Jaco Kroon patches: asterisk-rtcp-channel.patch uploaded by jkroon (License 5671) (closes issue ASTERISK-21471) Reported by: Matt Jordan git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393740 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-09Fix The Payload Being Set On CN Packets And Do Not Set Marker BitMichael L. Young
When we send out a CN packet (for instance, in the case of using rtpkeepalives), we are not setting the payload code properly. Also, we are setting the marker bit when we shouldn't be according to RFC 3389, section 4. AST_RTP_CN is not defined by AST_FORMAT codes. Therefore, we should be using ast_rtp_codecs_payload_code() rather than ast_rtp_codecs_payload_lookup(). 11 and trunk already use the appropriate function. * In 1.8, use ast_rtp_codecs_payload_code() * Remove the setting of the marker bit * Fix the debug message by incrementing the seqno after the debug message is set in order to display the correct seqno that was sent out (closes issue ASTERISK-21246) Reported by: Peter Katzmann Tested by: Peter Katzmann, Michael L. Young Patches: asterisk-21246-rtp-cng-payload-error_1.8_v2.diff uploaded by Michael L. Young (license 5026) Review: https://reviewboard.asterisk.org/r/2500/ ........ Merged revisions 388111 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 388112 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@388113 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-01Clear the DTMF sending digit tracking on off nominal pathsMatthew Jordan
In certain situations, when the RTP engine goes to send a DTMF end digit it may be in a situation where the remote address is no longer available, or the digit that was supposed to be sent is invalid. In such cases, we need to clear the RTP counters appropriately. Otherwise, when the RTP source is set again, we'll continue to think that we're in the middle of sending a DTMF digit, which can confuse the remote party (signficantly). (closes issue ASTERISK-21522) Reported by: Corey Farrell patches: rtp_dtmf_process_end.patch uploaded by Corey Farrell (License 5909) ........ Merged revisions 387213 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 387216 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@387220 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-27Fix white noise on SRTP decryptionKinsey Moore
When res_rtp_asterisk.c was altered to avoid attempting to apply unprotect algorithms to non-audio RTP packets, the test used was incorrect. This caused the audio packets to not be decrypted and resulted in loud white noise on the other endpoint (or both endpoints depending on the call legs involved). The test now properly checks the version field in the RTP header to ensure that RTP and RTCP are decrypted while other types of packets are not. (closes issue ASTERISK-21323) Reported by: andrea Tested by: Kinsey Moore, andrea, John Bigelow Patches: whitenoise_fix.diff uploaded by Kinsey Moore ........ Merged revisions 384048 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 384049 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384050 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-13Always set the RTP instance data in the RTP engineMatthew Jordan
Not informing the RTP engine of the instance data creates shrapnel. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383008 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-12Switch to using external pjproject libraries.Jason Parker
ICE/STUN/TURN support in res_rtp_asterisk is also now optional. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382900 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-07Add a 'secret' probation strictrtp mode to handle delayed changes in RTP sourceMatthew Jordan
Often, Asterisk may realize that a change in the source of an RTP stream is about to occur and ask that the RTP engine reset it's lock on the current RTP source. In certain scenarios, it may take awhile for the new remote system to send RTP packets, while the old remote system may continue providing RTP during that time period. This causes Asterisk to re-lock onto the old source, thereby rejecting the new source when the old source stops sending RTP and the new source begins. This patch prevents that by having a constant secondary, 'secret' probation mode enabled when an RTP source has been chosen. RTP packets from other sources are always considered, but never chosen unless the current RTP source stops sending RTP. Review: https://reviewboard.asterisk.org/r/2364 (closes issue AST-1124) Reported by: John Bigelow Tested by: John Bigelow (closes issue AST-1125) Reported by: John Bigelow Tested by: John Bigelow ........ Merged revisions 382573 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-28While the ICE negotiation is occurring leave strictrtp in an open state, ↵Joshua Colp
media can and will come from different places. ........ Merged revisions 382298 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382299 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-28Fix a bug with ICE and strictrtp where media could get dropped.Joshua Colp
If the end result of the ICE negotiation resulted in the path for media changing it was possible for the strictrtp code to discard the RTP packets. This change causes strictrtp to enter learning mode once again when the ICE negotiation has completed successfully. ........ Merged revisions 382296 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382297 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-28Don't undefine bzero()/bcopy().Jason Parker
This was causing build failures against external libraries that happened to use them, unless silly hacks were added to the modules that used those headers. Review: https://reviewboard.asterisk.org/r/2359/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382292 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-13Reset RTP timestamp; sequence number on SSRC changeMatthew Jordan
In r370252 for ASTERISK-18404, Asterisk's handling of RTP was modified to better account for out of order RTP packets. This was accomplished by using the RTP timestamp and sequence number to check for out of order packets. However, when a SSRC change occurs, the timestamp and sequence number will no longer have any relation to the previously received packets. The variables tracking the timestamp and sequence number therefore have to be reset. (closes issue ASTERISK-20906) Reported by: Eelco Brolman patches: dtmf_on_hold.patch uploaded by Eelco Brolman (license #6442) ........ Merged revisions 378967 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 378984 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@378985 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-04Don't pass STUN packets through the SRTP unprotect function.Joshua Colp
(closes issue AST-1036) Reported by: jbigelow ........ Merged revisions 378553 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 378555 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@378557 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-03Formatting fixesOlle Johansson
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@377035 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-03Formatting changesOlle Johansson
Found a large amount of missing {} in the code before patching in another branch git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376998 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-11Remove a fixed size limitation for producing SDP and change how ICE support ↵Joshua Colp
is disabled by default. With ICE support enabled in chan_sip and a large number of interfaces on the system it was possible for the produced SDP to be truncated due to some fixed size buffers. These buffers have now been changed so they will dynamically grow as needed. ICE support is now also enabled by default in res_rtp_asterisk to provide a smoother experience for chan_motif users where it is required. To maintain the previous behavior in chan_sip it is no longer enabled by default there. (closes issue ASTERISK-20643) Reported by: coopvr ........ Merged revisions 376130 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376131 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-17Change a few warnings to debug and the inverse.Walter Doekes
Remove the "RTP Read too short" warning for RTP keepalives. Remove the the warning about the application delimiter switch from pipe to comma. (You should've done this by now.) Make cdr_odbc report more when an insert fails. Make chan_sip warn less when the peer wants SRTP (and we don't) or sends a zero port to disable a media type. Review: https://reviewboard.asterisk.org/r/2167 (closes issue ASTERISK-20538) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375137 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08Disable ICE support by defaultMatthew Jordan
Since there are a number of legacy devices out there that fail to handle ICE candidates properly (which is a nice way of saying something much uglier), disable it by default. Support for ICE candidates can be enabled in rtp.conf using the icesupport setting. ........ Merged revisions 374676 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374677 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-24res_rtp_asterisk: Make TURN and STUN server configurations consistent.Brent Eagles
This patch removes the turnport configuration property and changes the turnaddr property to be a combined host[:port] configuration string. The patch also modifies the documentation in the example configuration to reflect the property changes and adds some additional text indicating how the STUN port is configured. (closes issue ASTERISK-20344) Reported by: beagles Tested by: beagles Review: https://reviewboard.asterisk.org/r/2111/ ........ Merged revisions 373403 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373404 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-20Add support for DTLS-SRTP to res_rtp_asterisk and chan_sip.Joshua Colp
As mentioned on the review for this, WebRTC has moved towards choosing DTLS-SRTP as the mechanism for key exchange for SRTP. This commit adds support for this but makes it available for normal SIP clients as well. Testing has been done to ensure that this introduces no regressions with existing behavior and also that it functions as expected. Review: https://reviewboard.asterisk.org/r/2113/ ........ Merged revisions 373229 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373234 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-10res_rtp_asterisk: Eliminate "type-punned pointer" build warning.David M. Lee
Removes "res_rtp_asterisk.c:706: warning: dereferencing type-punned pointer will break strict-aliasing rules" warning from the build on 32-bit platforms. The problem is that 'size' was referenced aliased to both (pj_size_t *) and (pj_ssize_t *). Now just make a copy of size that is the right type so there isn't any pointer aliasing happening. It also adds comments and asserts regarding what looks like an inappropriate use of pj_sock_sendto, but is actually totally fine. (closes issue ASTERISK-20368) Reported by: Shaun Ruffell Tested by: Michael L. Young Patches: 0001-res_rtp_asterisk-Eliminate-type-punned-pointer-build.patch uploaded by Shaun Ruffell (license 5417) slightly modified by David M. Lee. ........ Merged revisions 372777 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372787 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-05Multiple revisions 372327-372328Richard Mudgett
........ r372327 | rmudgett | 2012-09-05 12:33:11 -0500 (Wed, 05 Sep 2012) | 15 lines Fix RTP/RTCP read error message confusion. The RTP/RTCP read error message can report "fail: success" when the read failure is because of an ICE failure. * Changed __rtp_recvfrom() to generate a PJ ICE message when ICE fails. * Changed RTP/RTCP read error message to indicate an unspecified error when errno is zero. (closes issue ASTERISK-20288) Reported by: Joern Krebs Patches: jira_asterisk_20288_err_msg.patch (license #5621) patch uploaded by rmudgett (modified) ........ r372328 | rmudgett | 2012-09-05 12:35:20 -0500 (Wed, 05 Sep 2012) | 1 line Fix coding guidelines issue with a recent commit. ........ Merged revisions 372327-372328 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372329 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-05Re-fix sending unnegotiated payloads during a P2P RTP bridge.Mark Michelson
The previous fix still would look in the static_RTP_PT table, which is inappropriate since we specifically want to find a codec that has been negotiated. (closes issue ASTERISK-20296) reported by NITESH BANSAL Patches: codec_negotiation.patch Uploaded by NITESH BANSAL (License #6418) ........ Merged revisions 372311 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372319 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-05Fix breakage caused by last merge. Missing a variable for 11 and trunk.Michael L. Young
........ Merged revisions 372266 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372267 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-05Fix Incrementing Sequence Number For Retransmitted DTMF End PacketsMichael L. Young
In Asterisk 1.4+, a fix was put in place to increment the sequence number for retransmitted DTMF end packets. With the introduction of the RTP engine API in 1.8, the sequence number was no longer being incremented. This patch fixes this regression as well as cleans up a few lines that were not doing anything. (closes issue ASTERISK-20295) Reported by: Nitesh Bansal Tested by: Michael L. Young Patches: 01_rtp_event_seq_num.patch uploaded by Nitesh Bansal (license 6418) asterisk-20295-dtmf-fix-cleanup.diff uploaded by Michael L. Young (license 5026) Review: https://reviewboard.asterisk.org/r/2083/ ........ Merged revisions 372185 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 372198 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 372199 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372200 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-31Prevent local RTP bridges from sending inappropriate formats to participants.Mark Michelson
A change for Asterisk 11 caused a check for failure to incorrectly check the return value. This resulted in the possibility of transmitting media that a party had not negotiated. If this media happened to be G.729, then this could potentially result in one-way audio if no G.729 translators are installed. (closes issue ASTERISK-20296) reported by NITESH BANSAL ........ Merged revisions 372118 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372119 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-20Use thread-local storage to store pj_thread_descs.Mark Michelson
pj_thread_register() takes a parameter of type pj_thread_desc. It was assumed that pj_thread_register either used this item temporarily or made a copy of it. Unfortunately, all it does is keep a pointer to the structure in thread-local storage. This means that if our pj_thread_desc goes out of scope, then pjlib will be referencing bogus data quite often, most commonly on operations involving a pj_mutex_t. In our case, our pj_thread_desc was on the stack and went out of scope very shortly after registering our thread with pjlib. With this change, the pj_thread_desc is stored in thread-local storage so the pointer that pjlib keeps in thread-local storage will reference legitimate memory. (closes issue ASTERISK-20237) reported by Jeremy Pepper Patches: ASTERISK-20237.patch uploaded by Mark Michelson (license #5049) Tested by Jeremy Pepper ........ Merged revisions 371571 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371572 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-17rtp: Ensure defaults are set without rtp.conf.Russell Bryant
While building up a new install to test chan_motif, I ran into a failure due to icesupport being disabled. This was due to me not having an rtp.conf. It was intended in the code for it to be enabled by default, but it was only applied if rtp.conf existed. This patch updates res_rtp_asterisk to be consistent in how it handles defaults. A few options didn't have their default values set globally, including icesupport. They are now set and icesupport is enabled by default, even if you do not have an rtp.conf. ........ Merged revisions 371425 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371428 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-07Reduce memory consumption significantly for users of the RTP engine API by ↵Joshua Colp
storing only the payloads present and in use instead of every possible one. Review: https://reviewboard.asterisk.org/r/2052/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370832 65c4cc65-6c06-0410-ace0-fbb531ad65f3