Commit graph

29876 commits

Author SHA1 Message Date
Joshua Colp
a78ffe96a8 Merge "res_rtp_asterisk.c: Fix bridge_p2p_rtp_write() reentrancy potential." 2017-09-28 07:08:33 -05:00
Joshua Colp
4ea4364eef Merge "res_rtp_asterisk: Trim trailing byte off of SDES packet" 2017-09-28 06:45:28 -05:00
Richard Mudgett
a6dc0527a2 res_pjsip_outbound_publish.c: Fix misplaced parenthesis.
The pjsip_publishc_init() call was referenced with a misplaced
parentheses.  As a result, outbound publication messages went out with an
expiration of 1 second.

ASTERISK-27298

Change-Id: I93622eabc8ee83e7a22e98c107f921284c605a08
2017-09-27 11:25:46 -05:00
Richard Mudgett
9d65057cdf res_rtp_asterisk.c: Fix bridge_p2p_rtp_write() reentrancy potential.
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-26 11:19:17 -05:00
Sean Bright
c9e972a26a res_rtp_asterisk: Trim trailing byte off of SDES packet
This could have been fixed by subtracting 1 from the final value of
'len' but the way the packet was being constructed was confusing so I
took the opportunity to (I think) make it more clear.

We were sending 1 extra byte at the end of the SDES RTCP packet which
caused Chrome to complain (in its debug log):

    Too little data (1 byte) remaining in buffer to parse
    RTCP header (4 bytes).

We now send the correct number of bytes.

Change-Id: I9dcf087cdaf97da0374ae0acb7d379746a71e81b
2017-09-26 11:14:07 -05:00
Joshua Colp
c8a8933558 Merge "webrtc: Allow 'webrtc' to be set on endpoints without dtls_ca_file" 2017-09-26 07:37:22 -05:00
Joshua Colp
f9bcd3287d Merge "channel.c: Fix invalid reference in conditionaled out code." 2017-09-26 07:29:02 -05:00
Joshua Colp
2a09b3b76a Merge "app_queue: Only do announcement logic between ringing cycles" 2017-09-26 06:36:47 -05:00
Joshua Colp
87c4a72f16 Merge "res_pjsip_session: Reduce (and improve) SDP renegotiation." 2017-09-25 15:35:11 -05:00
Sean Bright
721947ebae webrtc: Allow 'webrtc' to be set on endpoints without dtls_ca_file
If using a legitimate certificate from a trusted certificate authority,
you don't need to provide CA file.

Change-Id: I8623973b4209b44889243716d7880274caed8a6d
2017-09-25 13:11:47 -05:00
Joshua Colp
0133d29c83 Merge "build: A few gcc 7 error fixes" 2017-09-25 13:04:22 -05:00
Joshua Colp
360bd11c30 Merge "res_pjsip_session: Don't end session when receiving a 500 on a reinvite" 2017-09-25 12:23:53 -05:00
Richard Mudgett
08e67f814b channel.c: Fix invalid reference in conditionaled out code.
ASTERISK-27289

Change-Id: I7a415948116493050614d9f4fa91ffbe0c21ec4c
2017-09-25 11:22:16 -05:00
Joshua Colp
9cb5899781 Merge "app_stream_echo: Don't echo declined streams" 2017-09-25 08:00:58 -05:00
George Joseph
4275ca16a1 build: A few gcc 7 error fixes
Change-Id: I7b5300fbf1af7d88d47129db13ad6dbdc9b553ec
2017-09-25 07:32:14 -05:00
Joshua Colp
1b468b543d Merge "res_pjsip: Use ast_sip_is_content_type() where appropriate" 2017-09-25 07:28:41 -05:00
StefanEng86
c3c73b3511 app_queue: Only do announcement logic between ringing cycles
This patch reverts the change by patch 2263 from old reviewboard.
Note that reverting that 2263-patch still preserves the behaviour that
the commit log of the 2263-patch claimed to add. The reason for this is:

The function wait_for_answer is only called from try_calling which
in turn is only called from the main for loop in queue_exec, and
earlier in that loop we already check the things that's removed by
this patch. There's no need to check those things twice each loop
iteration, and I think the proper place to check it is before each
ringing cycle. By checking it in wait_for_answer, you allow the issue
explained in the jira - that the head caller hears announcements while
the agents' sip phones are actively ringing.

Reported-by: Stefan Engström
Tested-by: Stefan Engström
ASTERISK-27216 #close

Change-Id: Ic4290dc75256f9743900c6762ee1bb915f672db0
2017-09-25 07:02:37 -05:00
Sean Bright
0fad11f21c app_stream_echo: Don't echo declined streams
Discovered while experimenting with Cyber Mega Phone 2K Ultimate Dynamic
Edition after accepting the audio request but declining the video one.

Change-Id: Iaa86d41fccfbc1b559a30ccf740d78a3b5f8a98c
2017-09-23 12:33:54 -05:00
Joshua Colp
601e0c563f res_pjsip_session: Reduce (and improve) SDP renegotiation.
When pruning a request to change the topology of a channel be
more intelligent about the resulting topology that is actually
used for SDP renegotiation.

In a case where a stream has not already been negotiated we
don't need to renegotiate and offer a declined stream. This can
occur if something in Asterisk (such as ConfBridge) requests
to add video to a PJSIP channel that has no video codecs configured.
In this case since the stream did not already exist we can safely
remove the stream from the requested topology, resulting in no
renegotiation occurring.

In a case where a renegotiation is requested with a codec that is
not supported we can reuse the formats of the existing stream if
it exists to ensure that the stream continues to flow, instead of
removing it.

Change-Id: I636540798d55922377318fe619c510fb6ed125fb
2017-09-22 17:54:53 -05:00
Kevin Harwell
36690c26f8 res_pjsip_session: Don't end session when receiving a 500 on a reinvite
During a reinvite, if a remote endpoint error occurs and it returns a 500 the
session would end. This patch makes it so the session is not terminated, but
continues as it was.

The reason for this is because some endpoints may send non session terminating
"server errors" like a failed codec negotiation. So in this case instead of
ending the call it can hopefully continue. In the case of a real server error
the session is already "doomed", will be known soon enough and appropriately
ended by Asterisk later.

Change-Id: Ifeedae86b8cb44b92d52c79046522ec5f0aff1d5
2017-09-22 16:36:09 -05:00
Joshua Colp
f91a905003 Merge "res_pjsip_session/BUNDLE: Handle no audio codecs on endpoint" 2017-09-22 15:35:29 -05:00
Joshua Colp
feadd654af Merge "res_pjsip_session: Change some asserts to warning/debug messages" 2017-09-22 11:10:11 -05:00
Sean Bright
ebd0a4bebf res_pjsip: Use ast_sip_is_content_type() where appropriate
Change-Id: If3ab0d73d79ac4623308bd48508af2bfd554937d
2017-09-22 10:05:23 -05:00
George Joseph
6c0e13da22 res_pjsip_session/BUNDLE: Handle no audio codecs on endpoint
When an INVITE came in with both audio and video streams but there
were no audio codecs defined for the endpoint, we weren't declining
the audio stream.  Since it's usually the first/transport stream,
when the video stream was processed and tried to use the transport,
it was empty and caused a crash.  We now decline the the stream if
there are no matching codecs so when the video stream is processed,
it's now the first/transport stream and processes normally.

Change-Id: Ic854eda54c95031e66b076ecfae3041d34daa692
2017-09-22 07:02:47 -05:00
Joshua Colp
63a3d17f0b Merge "res_rtp_asterisk.c: Fix bundled SSRC handling." 2017-09-22 06:42:30 -05:00
Joshua Colp
8b7aed0025 Merge "res_config_pgsql: Fix removed support to previous for versions PostgreSQL 9.1" 2017-09-22 05:42:43 -05:00
Joshua Colp
f77a2367e7 Merge "bridge: Change participant SFU streams when source streams change." 2017-09-21 15:56:47 -05:00
Richard Mudgett
7c93982e9d res_rtp_asterisk.c: Fix bundled SSRC handling.
Assertions in the v15+ AST-2017-008 patches found that we were not
handling the case if the incoming SDP did not specify the required SSRC
attributes for bundled to work.

* Be strict on matching SSRC for bundled instances including the parent
instance.  If the SSRC doesn't match then discard the packet.  Bundled has
to tell us in the SDP signaling what SSRC to expect.  Otherwise, we will
not know how to find the bundled instance structure.

Change-Id: I152830bbff71c662408909042068fada39e617f9
2017-09-21 15:02:27 -05:00
Joshua Colp
b9f7b03c0b Merge "AST-2017-008: Improve RTP and RTCP packet processing." 2017-09-21 14:48:17 -05:00
Jenkins2
f01cd0b409 Merge "res_config_pgsql: Add missing \n in debug log and update copyright year" 2017-09-21 13:06:18 -05:00
Joshua Colp
357a2f353b Merge "res_pjsip_session: Check for removed stream state." 2017-09-21 12:30:18 -05:00
Joshua Colp
f2985e3106 bridge: Change participant SFU streams when source streams change.
Some endpoints do not like a stream being reused for a new
media stream. The frame/jitterbuffer can rely on underlying
attributes of the media stream in order to order the packets.
When a new stream takes its place without any notice the
buffer can get confused and the media ends up getting dropped.

This change uses the SSRC change to determine that a new source
is reusing an existing stream and then bridge_softmix renegotiates
each participant such that they see a new media stream. This
causes the frame/jitterbuffer to start fresh and work as expected.

ASTERISK-27277

Change-Id: I30ccbdba16ca073d7f31e0e59ab778c153afae07
2017-09-21 12:20:02 -05:00
Jenkins2
5ff46578aa Merge "res_srtp: lower log level of auth failures" 2017-09-21 12:07:57 -05:00
Jenkins2
b9da3d643c Merge "chan_sip: Expose read-only access to the full SIP INVITE Request-URI" 2017-09-21 11:11:15 -05:00
Joshua Colp
7ff464bc0a Merge "bridge : Fix one-way direct-media when early bridging with native_rtp" 2017-09-21 10:57:56 -05:00
George Joseph
971548405b res_pjsip_session: Change some asserts to warning/debug messages
There was an issue reported where an SDP received on a 183 Session
Progress message caused a crash because the pending streams had
already been processed when the OK was received.  In that case the
pending topology was legitimately NULL.  There was an assert for an
incorrect number of streams in the topology but not one for
topology being NULL.  In any case, if you're not in dev-mode the
asserts don't do anything and since the scenario is legit, the
asserts weren't appropriate anyway.

* Changed several asserts to warning or debug messages and return
codes as appropriate.

ASTERISK-27264
Reported by: Daniel Heckl

Change-Id: I58daaa9d2938fa980857ab3ec41925ab5ff9c848
2017-09-21 10:40:24 -05:00
Rodrigo Ramírez Norambuena
cad68137a7 res_config_pgsql: Fix removed support to previous for versions PostgreSQL 9.1
In PostgreSQL 9.1 the backslash are string literals and not the escape
of characters.

In previous issue ASTERISK_26057 was fixed the use of escape LIKE but the
support for old version of Postgresql than 9.1 was dropped. The sentence
before make was "ESCAPE '\'" but in version before than 9.1  need it to be
as follow "ESCAPE '\\'".

ASTERISK-27283

Change-Id: I96d9ee1ed7693ab17503cb36a9cd72847165f949
2017-09-21 06:52:41 -05:00
Ben Ford
e666051d79 res_pjsip_session: Check for removed stream state.
When a sip session is refreshed, the stream topology is looped
through, checking each stream for compatible formats. This would
cause a crash if the stream state was AST_STREAM_STATE_REMOVED,
since the formats would never be set for this stream, causing
a NULL value to be returned from ast_stream_get_formats. This
commit adds a check for streams with removed states.

Also removed a stray semicolon.

Change-Id: Ic86f8b65a4a26a60885b28b8b1a0b22e1b471d42
2017-09-20 12:14:45 -05:00
George Joseph
b6aa728a58 chan_pjsip: Ignore AST_CONTROL_STREAM_TOPOLOGY_CHANGED for now
chan_pjsip_indicate was missing a case for the recently added
AST_CONTROL_STREAM_TOPOLOGY_CHANGED condition and was returning an
error and causing the call to be hung up instead of just ignoring
it.

ASTERISK-27260
Reported by: Daniel Heckl

Change-Id: I4fecbb00a0b8a853da85155065c1a6bddf235e80
2017-09-20 11:13:47 -05:00
Jean Aunis
6b7d5671d1 bridge : Fix one-way direct-media when early bridging with native_rtp
When two channels were early bridged in a native_rtp bridge, the RTP description
on one side was not updated when the other side answered.
This patch forbids non-answered channels to enter a native_rtp bridge, and
triggers a bridge reconfiguration when an ANSWER frame is received.

ASTERISK-27257

Change-Id: If1aaee1b4ed9658a1aa91ab715ee0a6413b878df
2017-09-20 10:19:37 -05:00
Joshua Colp
8830cc0541 Merge "res_calendar: Plug memory leak and micro-optimization" 2017-09-20 09:44:53 -05:00
Jenkins2
f2fe5bb3d1 Merge "res_pjsip_pubsub: Check for Content-Type header in rx_notify_request" 2017-09-20 09:14:12 -05:00
Alexander Traud
1e4c1cec7f res_srtp: lower log level of auth failures
Previously, sRTP authentication failures were reported on log level WARNING.
When such failures happen, each RT(C)P packet is affected, spamming the log.
Now, those failures are reported at log level VERBOSE 2. Furthermore, the
amount is further reduced (previously all two seconds, now all three seconds).
Additionally, the new log entry informs whether media (RTP) or statistics (RTCP)
are affected.

ASTERISK-16898 #close

Change-Id: I6c98d46b711f56e08655abeb01c951ab8e8d7fa0
2017-09-20 15:36:00 +02:00
George Joseph
b748038230 res_pjsip_pubsub: Check for Content-Type header in rx_notify_request
pubsub_on_rx_notify_request wasn't checking for a null
Content-Type header before checking that it was
application/simple-message-summary.

ASTERISK-27279
Reported by: Ross Beer

Change-Id: Iec2a6c4d2e74af37ff779ecc9fd35644c5c4ea52
2017-09-19 13:52:17 -05:00
David J. Pryke
a5f1d58fe1 chan_sip: Expose read-only access to the full SIP INVITE Request-URI
Provide a way to get the contents of the the Request URI from the initial SIP
INVITE in dial plan function call. (In this case "${CHANNEL(ruri)}")

ASTERISK-27278
Reported by: David J. Pryke
Tested by: David J. Pryke

Change-Id: I1dd4d6988eed1b6c98a9701e0e833a15ef0dac3e
2017-09-19 12:24:33 -05:00
Joshua Colp
6fd3db51e8 app_confbridge: Only create a channel that records audio.
This change makes it so that the conference recorder channel
that is created only contains audio formats and an audio stream.
This is because the underlying application used by ConfBridge to
record, MixMonitor, only allows recording audio.

Having additional streams (and in particular a video stream) can
result in clients needlessly renegotiating to add a video stream
that will never receive video.

Change-Id: I89d38aedc9205eca7741d5435e73e73bb9de97a0
2017-09-19 07:56:00 -05:00
Rodrigo Ramírez Norambuena
56f0d5fc0f res_config_pgsql: Add missing \n in debug log and update copyright year
Change-Id: I4ba338ecbdecc6a814a902eddc4121c8ef3cda58
2017-09-19 08:34:28 -03:00
Sean Bright
55567ee1d8 res_calendar: Plug memory leak and micro-optimization
ast_variables_destroy is NULL safe, so there is no need to check its
argument before passing it.

ASTERISK-25524 #close
Reported by: Jesper

Change-Id: Ib0f8057642e9d471960f1a79fd42e5a3ce587d3b
2017-09-19 07:09:52 -04:00
alex
1199927fc0 cdr_mysql.c: Apply cdrzone to start and answer
Change-Id: I7de0a5adc89824a5f2b696fc22c80fc22dff36b0
2017-09-18 07:03:20 -05:00
Richard Mudgett
087f667ab1 AST-2017-008: Improve RTP and RTCP packet processing.
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-15 15:50:43 -05:00