summaryrefslogtreecommitdiff
path: root/res/res_rtp_asterisk.c
AgeCommit message (Collapse)Author
2017-12-19res_rtp_asterisk: Avoid close the rtp/rtcp fd twice.Aaron An
When RTCP-MUX enabled. rtp->s is the same as rtcp->s, check this before close the file descriptor. Close the FD twice will hangs the asterisk under heavy load. ASTERISK-27299 #close Reported-by: Aaron An Tested-by: AaronAn Change-Id: I870a072d73fd207463ac116ef97100addbc0820a
2017-12-14res_rtp_asterisk.c: Disable packet flood detection for video streams.Richard Mudgett
We should not do flood detection on video RTP streams. Video RTP streams are very bursty by nature. They send out a burst of packets to update the video frame then wait for the next video frame update. Really only audio streams can be checked for flooding. The others are either bursty or don't have a set rate. * Added code to selectively disable packet flood detection for video RTP streams. ASTERISK-27440 Change-Id: I78031491a6e75c2d4b1e9c2462dc498fe9880a70
2017-12-13AST-2017-012: Place single RTCP report block at beginning of report.Joshua Colp
When the RTCP code was transitioned over to Stasis a code change was made to keep track of how many reports are present. This count controlled where report blocks were placed in the RTCP report. If a compound RTCP packet was received this logic would incorrectly place a report block in the wrong location resulting in a write to an invalid location. This change removes this counting logic and always places the report block at the first position. If in the future multiple reports are supported the logic can be extended but for now keeping a count serves no purpose. ASTERISK-27382 ASTERISK-27429 Change-Id: Iad6c8a9985c4b608ef493e19c421211615485116
2017-12-08utils: Add convenience function for setting fd flagsSean Bright
There are many places in the code base where we ignore the return value of fcntl() when getting/setting file descriptior flags. This patch introduces a convenience function that allows setting or clearing file descriptor flags and will also log an error on failure for later analysis. Change-Id: I8b81901e1b1bd537ca632567cdb408931c6eded7
2017-12-04res_rtp_asterisk.c: Increase strictrtp learning timeout time.Richard Mudgett
More complicated direct media reinvite negotiations can result in longer delays before direct media flows. The strictrtp learning timeout time was too short. One log showed that the first RTP packet came in just after three seconds. * Increase the strictrtp learning timeout time from 1.5 to 5 seconds. ASTERISK-27453 Change-Id: Ic5e711164cbb91b4d1c1e40c83697755640f138c
2017-11-27Merge "res_rtp_asterisk.c: Fix rtp source address learning for broken ↵Jenkins2
clients" into 13
2017-11-22res_rtp_asterisk: ICE server-reflexive candidates (srflx) with Dual-Stack.Alexander Traud
Previously, Asterisk sent srflx only when configured exclusively for IPv4. Now, srflx is gathered and sent via SDP, even when Asterisk is enabled for Dual Stack (IPv4+IPv6) and an IPv4 interface is available/used. ASTERISK-27437 Change-Id: Ie07d8e2bfa7b6fe06fcdc73d390a7a9a4d8c0bc1
2017-11-18res_rtp_asterisk.c: Fix rtp source address learning for broken clientsPirmin Walthert
Some clients do not send rtp packets every ptime ms. This can lead to situations in which the rtp source learning algorithm will never learn the address of the client. This has been discovered on a Mac mini with a pjsip based softphone after updating to Sierra: as soon as USB headsets are involved, the softphone will send the second packet 30ms after the first, the third 30ms after the second and the fourth 1ms after the third. So in the old implmentation the rtp source learning algorithm was repeatedly reset on the fourth packet. The patch changes the algorithm in a way that doesn't take the arrival time between two consecutive packets into account but the time between the first and the last packet of a learning sequence. The patch also fixes a second problem: when a user was using a wrong value for the probation setting there was a LOG_WARNING output stating that the value had been set to the default value instead. However the code for setting the value back to defaults was missing. ASTERISK-27421 #close Change-Id: If778fe07678a6fd2041eaca7cd78267d0ef4fc6c
2017-10-16declare optional openssl dependencies in moduleinfoTzafrir Cohen
Declare optional openssl dependencies in: * res_rtp_asterisk.c * tcptls.c ASTERISK-27328 #close Change-Id: I2636f1c05b8104b4fe6f36cce0ebd9a98b9c78ab
2017-09-26res_rtp_asterisk.c: Fix bridge_p2p_rtp_write() reentrancy potential.Richard Mudgett
The bridge_p2p_rtp_write() has potential reentrancy problems. * Accessing the bridged RTP members must be done with the instance1 lock held. The DTMF and asymmetric codec checks must be split to be done with the correct RTP instance struct locked. i.e., They must be done when working on the appropriate side of the point to point bridge. * Forcing the RTP mark bit was referencing the wrong side of the point to point bridge. The set mark bit is used everywhere else to set the mark bit when sending not receiving. The patches for ASTERISK_26745 and ASTERISK_27158 did not take into account that not everything carried by RTP uses a codec. The telephony DTMF events are not exchanged with a codec. As a result when RFC2833/RFC4733 sent digits you would crash if "core set debug 1" is enabled, the DTMF digits would always get passed to the core even though the local native RTP bridge is active, and the DTMF digits would go out using the wrong SSRC id. * Add protection for non-format payload types like DTMF when updating the lastrxformat and lasttxformat. Also protect against non-format payload types when checking for asymmetric codecs. ASTERISK-27292 Change-Id: I6344ab7de21e26f84503c4d1fca1a41579364186
2017-09-15AST-2017-008: Improve RTP and RTCP packet processing.Richard Mudgett
Validate RTCP packets before processing them. * Validate that the received packet is of a minimum length and apply the RFC3550 RTCP packet validation checks. * Fixed potentially reading garbage beyond the received RTCP record data. * Fixed rtp->themssrc only being set once when the remote could change the SSRC. We would effectively stop handling the RTCP statistic records. * Fixed rtp->themssrc to not treat a zero value as special by adding rtp->themssrc_valid to indicate if rtp->themssrc is available. ASTERISK-27274 Make strict RTP learning more flexible. Direct media can cause strict RTP to attempt to learn a remote address again before it has had a chance to learn the remote address the first time. Because of the rapid relearn requests, strict RTP could latch onto the first remote address and fail to latch onto the direct media remote address. As a result, you have one way audio until the call is placed on and off hold. The new algorithm learns remote addresses for a set time (1.5 seconds) before locking the remote address. In addition, we must see a configured number of remote packets from the same address in a row before switching. * Fixed strict RTP learning from always accepting the first new address packet as the new stream. * Fixed strict RTP to initialize the expected sequence number with the last received sequence number instead of the last transmitted sequence number. * Fixed the predicted next sequence number calculation in rtp_learning_rtp_seq_update() to handle overflow. ASTERISK-27252 Change-Id: Ia2d3aa6e0f22906c25971e74f10027d96525f31c
2017-09-11res_rtp_asterisk.c: Add doxygen to RTCP payload types.Richard Mudgett
Change-Id: I3f20ce428777cc4ce9c13b2f808d29ff8c873998
2017-09-05res_rtp_asterisk.c: Check RTP packet version earlier.Richard Mudgett
Change-Id: Ic6493a7d79683f3e5845dff1cee49445fd5a0adf
2017-08-30res_rtp_asterisk: Only learn a new source in learn state.Joshua Colp
This change moves the logic which learns a new source address for RTP so it only occurs in the learning state. The learning state is entered on initial allocation of RTP or if we are told that the remote address for the media has changed. While in the learning state if we continue to receive media from the original source we restart the learning process. It is only once we receive a sufficient number of RTP packets from the new source that we will switch to it. Once this is done the closed state is entered where all packets that do not originate from the expected source are dropped. The learning process has also been improved to take into account the time between received packets so a flood of them while in the learning state does not cause media to be switched. Finally RTCP now drops packets which are not for the learned SSRC if strict RTP is enabled. ASTERISK-27013 Change-Id: I56a96e993700906355e79bc880ad9d4ad3ab129c
2017-08-09Merge "res_rtp_asterisk: enable rtcp & QOS stats on native bridge" into 13Jenkins2
2017-08-07res_rtp_asterisk: enable rtcp & QOS stats on native bridgeTorrey Searle
Asterisk wasn't generating or forwarding RTCP packets when native bridge was activated. Also the stats weren't available via CHANNEL(qos). Now the RTCP stats are always calculated. ASTERISK-27158 #close Change-Id: I46fb8f61c95e836b9d2dda6054b0cf205c16037b
2017-08-04res_rtp_asterisk: Make P2P bridge Asymmetric codec awareTorrey Searle
Introduce a new property to rtp-engine to make it aware of the desire for assymetric codecs or not. If asymmetric codecs is not allowed, the bridge will compare read/write formats and shut down the p2p bridge if needed ASTERISK-26745 #close Change-Id: I0d9c83e5356df81661e58d40a8db565833501a6f
2017-07-26res_rtp_asterisk: Fix mapping of pjsip's ICE roles to oursSean Bright
Change-Id: Ia578ede1a55b21014581793992a429441903278b
2017-07-16res_rtp_asterisk: Use RTP component for ICE if RTCP-MUX is in use.Joshua Colp
This change makes it so that if an RTCP packet is being sent the RTP ICE component is used for sending if RTCP-MUX is in use. ASTERISK-27133 Change-Id: I6200f611ede709602ee9b89501720c29545ed68b
2017-07-06res_rtp_asterisk.c: Fix TURN deadlock by using ICE session group lock.Richard Mudgett
When a message is received on the TURN socket, the code processing the message needs to call into the ICE/STUN session for further processing. This code path locks the TURN group lock then the ICE/STUN group lock. In another thread an ICE/STUN timer can fire off to send a keep alive message over the TURN socket. In this code path, the ICE/STUN group lock is obtained then the TURN group lock is obtained to send the packet. A classic deadlock case if the group locks are not the same. * Made TURN get created using the ICE/STUN session's group lock. NOTE: I was originally concerned that the ICE/STUN session can get recreated by ice_reset_session() for an event like RTCP multiplexing causing a change during SDP negotiation. In this case the TURN group lock would become different. However, TURN is also recreated as part of the ICE/STUN recreation in ice_create() when all known ICE candidates are added to the new ICE session. While the ICE/STUN and TURN sessions are being recreated there is a period where the group locks could be different. ASTERISK-27023 #close Patches: res_rtp_asterisk-turn-deadlock-fix.patch (license #6502) patch uploaded by Michael Walton (modified) Change-Id: Ic870edb99ce4988a8c8eb6e678ca7f19da1432b9
2017-06-28res_rtp_asterisk: Fix issues with ICE renegotiation.Joshua Colp
When re-inviting to add more streams it is possible for the role of existing ICE sessions to be changed to the incorrect value. This results in subsequent refreshes within the sessions getting a role conflict and the ICE session breaking down. This change only sets the role to be the new value if an ICE renegotiation is actually going to happen, otherwise the existing role is preserved. As well if we encounter a situation where a unidirectional ICE negotiation happens and the other side does not send us candidates we will not store any information for sending traffic, even though we know where they are reachable. This change fixes this by using the source of the ICE traffic itself as the target if no candidates are known and we receive some ICE traffic. ASTERISK-27088 Change-Id: I71228181e358917fcefc3100fad21b2fc02a59a9
2017-06-14res_rtp_asterisk: Fix ssrc change for rtcp srtpGeorge Joseph
It looks like there was a copy/paste error in ast_rtp_change_source where if there was a rtcp srtp instance, instead of updating its ssrc we were updating the srtp instance ssrc twice. ASTERISK-27022 #close Reported-by: Michael Walton Change-Id: Ic88f3aee7227b401c58745ac265ff92c19620095
2017-05-30format: Reintroduce smoother flagsSean Bright
In review 4843 (ASTERISK-24858), we added a hack that forced a smoother creation when sending signed linear so that the byte order was adjusted during transmission. This was needed because smoother flags were lost during the new format work that was done in Asterisk 13. Rather than rolling that same hack into res_rtp_multicast, re-introduce smoother flags so that formats can dictate their own options. Change-Id: I77b835fba0e539c6ce50014a984766f63cab2c16
2017-05-22res_rtp_asterisk: rtcp mux using the wrong srtp unprotecting algorithmKevin Harwell
When using rtcp mux if an rtcp payload came in it would still use the srtp unprotect algorithm instead of the srtp unprotect rtcp method. Since rtcp data was being passed to the rtp unprotect method this would result in an error. This patch ensures that the correct unprotect method is chosen by making sure the passed in rtcp flag is appropriately set when rtcp mux is enabled and an rtcp payload is received. ASTERISK-26979 #close Change-Id: Ic5409f9d1a267f1d4785fc5aed867daaecca6241
2017-05-04Merge "res_rtp_asterisk: Clearing the remote RTCP address causes RTCP ↵Joshua Colp
failures" into 13
2017-05-03res_rtp_asterisk: Clearing the remote RTCP address causes RTCP failuresKevin Harwell
When a call gets put on hold RTP is temporarily stopped and Asterisk was setting the remote RTCP address to NULL. Then when RTCP data was received from the remote endpoint, Asterisk would be missing this information when publishing the rtcp_message stasis event. Consequently, message subscribers (in this case res_hep_rtcp) trying to parse the "from" field output the following error: "ast_sockaddr_split_hostport: Port missing in (null)" This patch makes it so the remote RTCP address is no longer set to NULL when stopping RTP. There was only one place that appeared to check if the remote RTCP address was NULL as a way to tell if RTCP was running. This patch added an additional check on the RTCP schedid for that case to make sure RTCP was truly not running. ASTERISK-26860 #close Change-Id: I6be200fb20db647e48b5138ea4b81dfa7962974b
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-11res_rtp_asterisk.c: Add stun_blacklist optionRichard Mudgett
Added the stun_blacklist option to rtp.conf. Some multihomed servers have IP interfaces that cannot reach the STUN server specified by stunaddr. Blacklist those interface subnets from trying to send a STUN packet to find the external IP address. Attempting to send the STUN packet needlessly delays processing incoming and outgoing SIP INVITEs because we will wait for a response that can never come until we give up on the response. Multiple subnets may be listed. ASTERISK-26890 #close Change-Id: I3ff4f729e787f00c3e6e670fe6435acce38be342
2017-03-19res_rtp_asterisk: Pass correct data length to ast_rtcp_interpretSean Bright
We are currently passing in the capacity of the read buffer instead of the number of bytes that we actually read off the wire. Change-Id: I60465049727d955c7f9a5e529e6f2aaff04cda36
2017-03-18Merge "res_rtp_asterisk: Fix crash when RTCP is not present when DTLS is ↵Joshua Colp
stopped." into 13
2017-03-16res_pjsip_asterisk.c: Fix compile error if libsrtp is not installed.Richard Mudgett
struct ast_rtcp does not define the dtls member if SRTP is not enabled. ASTERISK-26732 Change-Id: Id15ea212e04490e012f2cf4a56818b4dd948875e
2017-03-16res_rtp_asterisk: Fix crash when RTCP is not present when DTLS is stopped.Joshua Colp
This change removes an assumption that when DTLS is stopped an RTCP session will be present on the RTP session. This is not always the case. ASTERISK-26732 Change-Id: Ib9f7c09ce0b005efe362dbcc8795202b18f94611
2017-03-15Add rtcp-mux supportMark Michelson
This commit adds support for RFC 5761: Multiplexing RTP Data and Control Packets on a Single Port. Specifically, it enables the feature when using chan_pjsip. A new option, "rtcp_mux" has been added to endpoint configuration in pjsip.conf. If set, then Asterisk will attempt to use rtcp-mux with whatever it communicates with. Asterisk follows the rules set forth in RFC 5761 with regards to falling back to standard RTCP behavior if the far end does not indicate support for rtcp-mux. The lion's share of the changes in this commit are in res_rtp_asterisk.c. This is because it was pretty much hard wired to have an RTP and an RTCP transport. The strategy used here is that when rtcp-mux is enabled, the current RTCP transport and its trappings (such as DTLS SSL session) are freed, and the RTCP session instead just mooches off the RTP session. This leads to a lot of specialized if statements throughout. ASTERISK-26732 #close Reported by Dan Jenkins Change-Id: If46a93ba1282418d2803e3fd7869374da8b77ab5
2017-02-23pjproject_bundled: Update for pjproject 2.6George Joseph
* Removed all 2.5.5 functional patches. * Updated usages of pj_release_pool to be "safe". * Updated configure options to disable webrtc. * Updated config_site.h to disable webrtc in pjmedia. * Added Richard Mudgett's recent resolver patches. Change-Id: Ib400cc4dfca68b3d07ce14d314e829bfddc252c7
2017-02-15res_rtp_asterisk: Use PJ_ICE_MAX_CAND instead of hard-coding 16Sean Bright
pjsip limits the total number of ICE candidates to PJ_ICE_MAX_CAND, which is a compile-time constant. Instead of hard-coding 16 when we enumerate local interfaces, use PJ_ICE_MAX_CAND so that we can potentially collect more interfaces if the compile time options are changed. Tangentially related to ASTERISK~24464 Change-Id: I1b85509e39e33b1fed63c86261fc229ba14bbabd
2017-02-01res_rtp_asterisk: Swap byte-order when sending signed linearSean Bright
Before Asterisk 13, signed linear was converted into network byte order by a smoother before being sent over the network. We restore this behavior by forcing the creation of a smoother when slinear is in use and setting the appropriate flags so that the byte order conversion is always done. ASTERISK-24858 #close Reported-by: Frankie Chin Change-Id: I868449617d1a7819578f218c8c6b2111ad84f5a9
2017-01-26Merge "PJPROJECT logging: Fix detection of max supported log level." into 13George Joseph
2017-01-25T.140: Fix format ref and memory leaks.Richard Mudgett
* channel.c:ast_sendtext(): Fix T.140 SendText memory leak. * format_compatibility.c: T.140 RED and T.140 were swapped. * res_rtp_asterisk.c:rtp_red_init(): Fix ast_format_t140_red ref leak. * res_rtp_asterisk.c:rtp_red_init(): Fix data race after starting periodic scheduled red_write(). * res_rtp_asterisk.c: Some other minor misc tweaks. Change-Id: Ifa27a2e0f8a966b1cf628607c86fc4374b0b88cb
2017-01-24PJPROJECT logging: Fix detection of max supported log level.Richard Mudgett
The mechanism used for detecting the maximum log level compiled into the linked pjproject did not work. The API call simply stores the requested level into an integer and does no range checking. Asterisk was assuming that there was range checking and limited the new value to the allowable range. To get the actual maximum log level compiled into the linked pjproject we need to get and save off the initial set log level from pjproject. This is the maximum log level supported. * Get and save off the initial log level setting before altering it to the desired level on startup. This has to be done by a macro rather than calling a core function to avoid incorrectly linking pjproject. * Split the initial log level warning messages to warn if the linked pjproject cannot support the requested startup level and if it is too low to get the pjproject buildopts for "pjproject show buildopts". * Adjust the CLI "pjproject set log level" to check the saved max log level and to generate normal output messages instead of a warning message. ASTERISK-26743 #close Change-Id: I40aa76653e2a1dece66c3f8734594b4f0471cfb4
2016-12-22res_rtp_asterisk.c: Fix uninitialized memory crash.Richard Mudgett
ast_rtp_remote_address_set() could pass an uninitialized 'us' parameter to ast_ouraddrfor(). If ast_ouraddrfor() returns an error then the 'us' parameter may not get initialized. Thus when the code tries to save the 'us' parameter to the local address we could try to copy a ridiculous sized memory buffer and segfault. * Made pass an initialized 'us' parameter to ast_ouraddrfor(). * Optimized out the 'us' struct variable. ASTERISK-26672 #close Change-Id: I4acea5dcdf0813da2c7d3e11c2d6067d160d17dc
2016-12-22res_rtp_asterisk.c: Initialize ourip passed to ast_find_ourip().Richard Mudgett
We access uninitialized memory when the 'ourip' parameter does not have an initial guess to our IP address. ASTERISK-26672 Change-Id: I35507ea1ad7455d2be188f6ccdd4add7bd150e15
2016-12-21res_rtp_asterisk.c: Fix off nominal memory leak.Richard Mudgett
Change-Id: I95b1088d11244a2edae6607c12fbf33b38658a75
2016-11-30PJPROJECT logging: Made easier to get available logging levels.Richard Mudgett
Use of the new logging is as simple as issuing the new CLI command or setting the new pjproject.conf option. Other options that can affect the logging are how you have the pjproject log levels mapped to Asterisk log types in pjproject.conf and if you have configured Asterisk to log the DEBUG type messages. Altering the pjproject.conf level mapping shouldn't be necessary for most installations as the default mapping is sensible. Configuring Asterisk to log the DEBUG message type is standard practice for collecting debug information. * Added CLI "pjproject set log level" command to dynamically adjust the maximum pjproject log message level. * Added CLI "pjproject show log level" command to see the currently set maximum pjproject log message level. * Added pjproject.conf startup section "log_level" option to set the initial maximum pjproject log message level so all messages could be captured from initialization. * Set PJ_LOG_MAX_LEVEL to 6 to compile in all defined logging levels into bundled pjproject. Pjproject will use the currently set run time log level to determine if a log message is generated just like Asterisk verbose and debug logging levels. * In log_forwarder(), made always log enabled and mapped pjproject log messages. DEBUG mapped log messages are no longer gated by the current Asterisk debug logging level. * Removed RAII_VAR() from res_pjproject.c:get_log_level(). ASTERISK-26630 #close Change-Id: I6dca12979f482ffb0450aaf58db0fe0f6d2e5389
2016-11-22res_rtp_asterisk: RTT miscalculation in RTCPgestoip2
When retrieving RTCP stats for PJSIP channels, RTT values are unreliable. RTT calculation is correct, but the data representation isn't. RTT is represented by a 32-bit fixed-point number with the integer part in the first 16 bits and the fractional part in the last 16 bits. In order to get the RTT value, the fractional part is miscalculated, there is an unnecessary 16 bit shift that causes overflow. Besides this there is another mistake, when transforming the integer value to the fixed point fractional part via bitwise operation, that loses precision. * RTT fractional part is no longer shifted, avoiding overflow. * RTT fractional part is transformed to its fixed-point value more precisely. * Fixed timeval2ntp() and ntp2timeval() second fraction conversions. * Fixed NTP timestamp report logging. The usec was inexplicably multiplied by 4096. ASTERISK-26566 #close Reported by Hector Royo Concepcion Change-Id: Ie09bdabfee75afb3f1b8ddfd963e5219ada3b96f
2016-11-16build: Various OpenBSD issuesGeorge Joseph
OpenBSD's 'find' doesn't take the -delete argument so you have to pipe through 'xargs rm -rf'. 'echo -e' doesn't like \t starting a line. It just prints 't' which causes the libasteriskpj.exports file to be garbage. They were just cosmetic so they were removed. librt doesn't exist so the link of libasteriskpj.so fails. It's not actually needed for linux anyway so -lrt was removed from the link. res_rtp_asterisk was failing to load because of an undefined DTLS_method. '|| defined(LIBRESSL_VERSION_NUMBER)' was added to the #if so DTLSv1_method is used instead. ASTERISK-26608 Change-Id: I926ec95b0b69633231e3ad1d6e803b977272c49c
2016-10-23pjsip: Support dual stack automatically.Joshua Colp
This change adds support for dual stack automatically. No configuration is required and the IP address and version in the SIP messages and SDP will be automatically changed based on the transport over which the message is being sent. RTP usage has also been changed to listen on both IPv4 and IPv6 simultaneously to allow media to flow, and to allow ICE support on both simultaneously. This also allows failover between IPv6 and IPv4 to work as expected. ASTERISK-26309 #close Change-Id: I235a421d8f9a326606d861b449fa6fe3a030572d
2016-10-19res_rtp_asterisk: Add ice_blacklist optionMichael Walton
Introduces ice_blacklist configuration in rtp.conf. Subnets listed in the form ice_blacklist = <subnet spec>, e.g. ice_blacklist = 192.168.1.0/255.255.255.0, are excluded from ICE host, srflx and relay discovery. This is useful for optimizing the ICE process where a system has multiple host address ranges and/or physical interfaces and certain of them are not expected to be used for RTP. Multiple ice_blacklist configuration lines may be used. If left unconfigured, all discovered host addresses are used, as per previous behavior. Documention in rtp.conf.sample. ASTERISK-26418 #close Change-Id: Ibee88f80d7693874fda1cceaef94a03bd86012c9
2016-10-10res_rtp_asterisk: Fix infinite DTMF issue when switching to P2P bridgeTorrey Searle
If a bridge switched to P2P when a DTMF was in progress it was possible for the DTMF to continue being sent indefinitely. Change-Id: I7e2a3efe0d59d4b214ed50cd0b5d0317e2d92e29
2016-09-14rtp: Preserve timestamps on video frames.Joshua Colp
Currently when receiving video over RTP we store only a calculated samples on the frame. When starting the video it can take some time for this calculation to actually yield a value as it requires constant changing timestamps. As well if a video frame passes over multiple RTP packets this calculation will fail as the timestamp is the same as the previous RTP packet and the number of samples calculated will be 0. This change preserves the timestamp on the frame and allows it to pass through the core. When sending the video this timestamp is used instead of a new one being calculated. ASTERISK-26367 #close Change-Id: Iba8179fb5c14c9443aee4baf670d2185da3ecfbd