Commit Graph

4695 Commits

Author SHA1 Message Date
George Joseph e145b460bb Merge "res_rtp_asterisk: Raise event when RTP port is allocated" 2018-09-27 09:20:24 -05:00
Joshua Colp 8bb264841a res_rtp_asterisk: Raise event when RTP port is allocated
This change raises a testsuite event to provide what port
Asterisk has actually allocated for RTP. This ensures that
testsuite tests can remove any assumption of ports and instead
use the actual port in use.

ASTERISK-28070

Change-Id: I91bd45782e84284e01c89acf4b2da352e14ae044
2018-09-25 05:35:26 -05:00
Corey Farrell 93777faf36
json: Take advantage of new API's.
* Use "o*" format specifier for optional fields in ast_json_party_id.
* Stop using ast_json_deep_copy on immutable objects, it is now thread
  safe to just use ast_json_ref.

Additional changes to ast_json_pack calls in the vicinity:
* Use "O" when an object needs to be bumped.  This was previously
  avoided as it was not thread safe.
* Use "o?" and "O?" to replace NULL with ast_json_null().  The
  "?" is a new feature of ast_json_pack starting with Asterisk 16.

Change-Id: I8382d28d7d83ee0ce13334e51ae45dbc0bdaef48
2018-09-24 15:47:37 -04:00
George Joseph 6658b70ba8 Merge "res_remb_modifier: Add module for controlling REMB from CLI." 2018-09-24 10:11:54 -05:00
George Joseph ffcccd5e2f Merge "res_rtp_asterisk: Fix crash on ast_rtp_new failure." 2018-09-24 09:27:01 -05:00
Corey Farrell bdc8159799
res_rtp_asterisk: Fix crash on ast_rtp_new failure.
ast_rtp_new free'd rtp upon failure, but rtp_engine.c would also call
the destroy callback.  Remove call to ast_free from ast_rtp_new, leave
it to rtp_engine.c to initiate the full cleanup.  Add error detection
for the ssrc_mapping vector initialization.  In rtp_allocate_transport
set rtp->s = -1 in the failure path where we close that FD to ensure we
don't try closing it twice.

ASTERISK-27854 #close

Change-Id: Ie02aecbb46228ca804e24b19cec2bb6f7b94e451
2018-09-21 11:25:49 -04:00
Sean Bright ad4a6bc27a res_rtp_asterisk: Reset all settings on module reload
'rtpchecksums' and 'rtcpinterval' are not being reset to their defaults
if they are not present in the updated configuration file.

Change-Id: I1162e40199314d46cf3225d5e1271c4c81176670
2018-09-20 15:29:01 -05:00
Sean Bright a801543f79 AST-2018-009: Fix crash processing websocket HTTP Upgrade requests
The HTTP request processing in res_http_websocket allocates additional
space on the stack for various headers received during an Upgrade request.
An attacker could send a specially crafted request that causes this code
to overflow the stack, resulting in a crash.

* No longer allocate memory from the stack in a loop to parse the header
values.  NOTE: There is a slight API change when using the passed in
strings as is.  We now require the passed in strings to no longer have
leading or trailing whitespace.  This isn't a problem as the only callers
have already done this before passing the strings to the affected
function.

ASTERISK-28013 #close

Change-Id: Ia564825a8a95e085fd17e658cb777fe1afa8091a
2018-09-20 11:19:03 -05:00
Joshua Colp b9874da790 res_remb_modifier: Add module for controlling REMB from CLI.
This adds a module which registers a CLI command that can set the
REMB bitrate value for REMB as it enters or exits Asterisk. This
allows you to ignore what Asterisk or a client produces and is
useful for demonstrations.

This does not generate REMB frames, however, but just modifies
them as they flow to or from a channel.

Change-Id: Ib089427c46a4a36d645cecfe02406adb38c17bec
2018-09-20 04:55:32 -05:00
Joshua Colp e6dcb926fa Merge "res_pjsip_session: Don't add declined stream if one does not exist." 2018-09-19 08:42:37 -05:00
Joshua Colp ce9a980be6 pjproject: Upgrade to 2.8.
This change brings in PJSIP 2.8, removes all the patches
that were merged upstream, and makes a minor change to
support a breaking change that was done.

ASTERISK-28059

Change-Id: I5097772b11b0f95c3c1f52df6400158666f0a189
2018-09-18 11:32:18 -05:00
Joshua Colp 32a7b9f4b3 res_pjsip_session: Don't add declined stream if one does not exist.
Given a scenario where a session refresh was done with a removed
stream we would always add a removed stream to the outgoing SDP
even if one did not already exist.

This change makes it so that a removed stream is only placed into
the SDP if one already exists.

ASTERISK-28047

Change-Id: Ibb97d21cdeb87a8acae0c720861b0ff255708442
2018-09-18 06:11:23 -05:00
Sean Bright 3d9deb35f0 autoconf: Check for srtp_get_version_string() before using it
Change-Id: Id2a916ff9448706090e72ff2c7fb3f5ba24a05df
2018-09-17 10:48:03 -05:00
George Joseph ad602bb2a8 Merge "res_srtp.c: Show linked version of libsrtp on module init" 2018-09-17 09:23:52 -05:00
Sean Bright b68617ac2c res_srtp.c: Show linked version of libsrtp on module init
Change-Id: Ib0a645d6985de5757cc4399ed2524b2d02c4f342
2018-09-16 06:11:52 -05:00
Sean Bright 07cb13f75f res_pjsip: Log IPv6 addresses correctly
Both pjsip_tx_data.tp_info.dst_name and pjsip_rx_data.pkt_info.src_name
store IPv6 addresses without enclosing brackets. This causes some log
output to be confusing because it is difficult to separate the IPv6
address from a port specification.

* Use pj_sockaddr_print() along with pjsip_tx_data.tp_info.dst_addr and
  pjsip_rx_data.pkt_info.src_addr where possible for consistent IPv6
  output.

* When a pj_sockaddr is not available, explicitly wrap IPv6 addresses
  in brackets.

* When assigning pjsip_rx_data.pkt_info.src_name ourselves, make sure
  to also set pjsip_rx_data.pkt_info.src_addr.

Change-Id: I5cfe997ced7883862a12b9c7d8551d76ae02fcf8
2018-09-14 14:59:23 -05:00
George Joseph b7834eca59 Merge "res_musiconhold.c: Restart MOH if previous hold just reached end-of-file" 2018-09-14 11:11:47 -05:00
Jenkins2 9c070f7202 Merge "optional_api: Remove unused nonoptreq fields" 2018-09-13 13:08:10 -05:00
Walter Doekes bc8cdcefa8 optional_api: Remove unused nonoptreq fields
As they're not actively used, they only grow stale. The moduleinfo field itself
is kept in Asterisk 13/15 for ABI compatibility.

ASTERISK-28046 #close

Change-Id: I8df66a7007f807840414bb348511a8c14c05a9fc
2018-09-12 12:34:54 -05:00
Sean Bright 65e0eb8fc6 res_pjproject: Fix sockaddr conversion routines for non-bundled PJSIP
The bundled version of pjproject has a patch for Solaris compatability
that changes the definition of various socket structures which we need
to account for when compiling against a non-bundled version.

ASTERISK-28049 #close

Change-Id: Ia1ea47c433fc2d915115193ee889a752373925f0
2018-09-12 07:26:33 -05:00
Frederic LE FOLL 35e02d6f17 res_musiconhold.c: Restart MOH if previous hold just reached end-of-file
On MOH activation, moh_files_readframe() is called while the current
stream attached to the channel is NULL and it calls ast_moh_files_next()
immediately.  However, it won't call ast_moh_files_next() again if sample
reading fails.  The failure may occur because res_musiconhold retains the
last sample reading position in the channel data and MOH during the
previous hold/retrieve just reached EOF.  Obviously, a bit of bad luck is
required here.

* Restructured moh_files_readframe() to try a second time to start MOH if
there was no stream setup and the saved position was at EOF.  Also added
comments describing what is going on for each step.

ASTERISK-28029

Change-Id: I1508cf2c094f8feca22d6f76deaa9fdfa9944860
2018-09-07 07:58:46 -05:00
Sean Bright 600c5d79fd res_pjproject: Add utility functions to convert between socket structures
Currently, to convert from a pj_sockaddr to an ast_sockaddr, the address
needs to be rendered to a string and then parsed into the correct
structure. This also involves a call to getaddrinfo(3). The same is true
for the inverse operation.

Instead, because we know the internal structure of both ast_sockaddr and
pj_sockaddr, we can translate directly between the two without the
need for an intermediate string.

Change-Id: If0fc4bba9643f755604c6ffbb0d7cc46020bc761
2018-09-06 13:30:12 -05:00
George Joseph 743452a119 Merge "res_pjsip: Fix mwi_subscribe_replaces_unsolicited type mismatch" 2018-09-05 09:56:21 -05:00
Joshua Colp b07da4b472 Merge "res_fax: Handle fax gateway being started more than once." 2018-08-30 05:44:02 -05:00
Joshua Colp 58e8f8149d Merge "res_pjsip_transport_websocket: Properly set src_name for IPv6" 2018-08-30 05:08:34 -05:00
Richard Mudgett d60411a2b4 res_pjsip: Fix mwi_subscribe_replaces_unsolicited type mismatch
ASTERISK-27988

Change-Id: Iccafdd0552ea8aaed647620fb14499f1bf341843
2018-08-29 09:47:59 -05:00
George Joseph 50ec5a6945 Merge "Create --disable-binary-modules option." 2018-08-29 06:31:54 -05:00
Joshua Colp 40def05949 res_fax: Handle fax gateway being started more than once.
The T.38 fax gateway state machine can cause the fax gateway
to be started more than once on a channel depending on the
responses of the remote endpoint. This would previously leak
the channel name, channel unique id, and underlying fax engine
state. This change instead makes it so that if the fax gateway
session is already present and not reserved the fax gateway
is not started again.

ASTERISK-27981

Change-Id: I552d95086860cb18f2522ee40ef47b13b6da2e0e
2018-08-29 05:20:33 -05:00
Sean Bright 39459b1ee4 res_pjsip_transport_websocket: Properly set src_name for IPv6
SIP responses over WebSockets when the client is using IPv6 have invalid
Via headers according to RFC 3261. The 'received' header parameter
should not be wrapped in brackets if it is an IPv6 address.

When src_name is populated by the built-in PJSIP transports, the code
uses pj_sockaddr_print() with 'flags' set to 0, meaning that the
brackets are not rendered around IPv6 addresses.

This may be related to ASTERISK~27101.

See also: https://github.com/onsip/SIP.js/pull/594

ASTERISK-28020 #close

Change-Id: I8ea9d289901b837512bee2ca2535e3dc14f04d77
2018-08-28 08:02:43 -05:00
Corey Farrell a2001c00e6 Create --disable-binary-modules option.
This new option can be passed for ./configure or
./tests/CI/buildAsterisk.sh to prevent download/install of binary
modules.

Normally enabling the categories MENUSELECT_CODECS or MENUSELECT_RES
will result in binary modules being enabled even if the build target is
incompatible with those modules.  This includes CI scripts which enable
categories before disabling specific modules.

If more binary modules are offered in the future this will help avoid
accidentally downloading them if unwanted or incompatible.  Adding a
binary module will only require creating a new menuselect entry similar
to the existing ones, it will not be necessary to modify the CI scripts.

Change-Id: I6b1bd1c75a2e48f05b8b8a45b7a7a2d00a079166
2018-08-27 13:22:31 -04:00
neutrino88 289016239d res/res_rtp_asterisk: remove debug traces generated by an empty frame
The realtime text timer pops regularly and sends text frames even if
the buffer is empty. This causes a lot of unecessary debug logging.

* Made red_write() test if we need to send a frame before calling
ast_rtp_write()

ASTERISK-28002
Reported by: Emmanuel BUU
Tested by: Emmanuel BUU

Change-Id: Icf81310c3b8080b615a42060afc02ab41f9523dd
2018-08-27 12:03:03 -05:00
Joshua Colp 5320b18bfe Merge "res_pjsip: Reduce processing when a Contact is updated." 2018-08-22 12:42:46 -05:00
George Joseph 96363e542b Merge "res_rtp_asterisk.c: Fix unused variable warnings" 2018-08-20 11:31:20 -05:00
George Joseph 27d94dc70d Merge "res_sorcery_realtime.c: Fix unqualified fetch warning." 2018-08-20 10:57:05 -05:00
Joshua Colp 457ba355aa res_pjsip: Reduce processing when a Contact is updated.
When a Contact is updated the only material change that qualify
support cares about is the underlying configuration for the AOR.
In this case we will update things with the new AOR information but
otherwise the callback to indicate the Contact has changed can be
ignored.

This is because it is only when a Contact is added or deleted that
material changes occur within the qualify support. An update can't
change the URI since it would result in a new Contact so it can be
ignored.

Change-Id: I2f97ebfa79969a36a97bb7b9afd5b6268cf1a07d
2018-08-18 18:09:25 -03:00
Richard Mudgett 40f1604e2f res_pjsip_t38.c: Fix crash if already saw a final T.38 reINVITE response.
We were still getting crashes after the first fix.  Somehow we receive a
non-2xx final response before we get a 200 final response.  With the
failure response we had already cleaned up and destroyed some data
structures.  When the unexpected 200 response comes in we crash.

* Add protection code to prevent processing another final T.38 reINVITE
response.

ASTERISK-27944

Change-Id: I8b5baba8d07fe4d63f0d7d05d3eb9a3d27d40a74
2018-08-17 18:56:24 -05:00
Richard Mudgett 8cd36ab9b6 res_sorcery_realtime.c: Fix unqualified fetch warning.
The allow_unqualified_fetch option for the sorcery realtime backend
blocked actually fetching all rows when the option is set to warn.

* Made issue a warning and actually do the request when
allow_unqualified_fetch=warn is set.

Change-Id: I74456c80a03a62dce66fc3dc3cb0cf2351ac4312
2018-08-17 16:33:24 -05:00
Richard Mudgett aee5f7c1b6 res_rtp_asterisk.c: Fix unused variable warnings
Compiling without SRTP support installed resulted in some unused variable
warnings.  These warnings also showed that the srtp variable was obtained
and passed around some functions but not really used even when a system
has SRTP installed.

Change-Id: I6daad34be3e89b19adef6e2fbe738018975155fc
2018-08-17 14:03:28 -05:00
Joshua Colp 5cd416f354 Merge "res_resolver_unbound: Fix leak of config nameserver strings." 2018-08-17 05:40:01 -05:00
Joshua Colp a88cec6334 Merge "res_pjsip: Resolve transport management leak at shutdown." 2018-08-17 05:38:56 -05:00
Kevin Harwell b400d50b1e Merge "res_odbc: Allow unload at shutdown." 2018-08-16 17:48:01 -05:00
George Joseph c2f81cf446 Merge "res/res_pjsip_sdp_rtp: put rtcp-mux in answer only if offered" 2018-08-16 09:45:33 -05:00
Torrey Searle 926d647def res/res_pjsip_sdp_rtp: put rtcp-mux in answer only if offered
If in the initial sdp the caller doesn't include the line
a=rtcp-mux

Then asterisk shoud not include rtcp-mux in the response regardless
of rtcp-mux being enabled on the endpoint

ASTERISK-28007 #close

Change-Id: I58e9b9f40a139afc0da5de41906cc608fb62adc7
2018-08-16 02:06:43 -05:00
Corey Farrell a83c464d9d res_resolver_unbound: Fix leak of config nameserver strings.
Change-Id: I3f396316bb40d1ae6e91f5f688042420f1a540ed
2018-08-15 15:32:25 -05:00
Corey Farrell 24302bda21 res_pjsip: Resolve transport management leak at shutdown.
Cleanup idle check scheduled events at shutdown.

Change-Id: I61bfbb56bac69fe840c3242927d31ff3593be461
2018-08-15 13:55:41 -05:00
Corey Farrell eb34b881a4 res_odbc: Allow unload at shutdown.
This makes it possible for REF_DEBUG to report no leaks when loading
res_odbc.

Change-Id: I1a3dea786bd6e7f4820a6dd5cbaa197fa783ce93
2018-08-15 11:33:37 -05:00
Corey Farrell 52fe5fe2c8 res_pjsip: Fix leak in pjsip_options.
sip_options_get_endpoint_state_compositor_state leaked a reference to
the first available endpoint state compositor that was found.

Change-Id: Idb6be19f7219b6eed1dfb19c1e740dd40cb3fdc7
2018-08-15 11:33:21 -05:00
George Joseph 61b6d9efa4 Merge "res_pjsip_caller_id: Add "party" parameter to RPID header." 2018-08-15 09:44:43 -05:00
Joshua Colp fca3d4fe5f res_pjsip_caller_id: Add "party" parameter to RPID header.
This change adds the "party" parameter to the Remote-Party-ID header
which indicates which party the header information is applicable
to. In Asterisk this is determined on whether we are the calling
or called party. This is added to improve interoperability with some
implementations.

ASTERISK-28006

Change-Id: I1eec3e377ffff8633b5c1dd59a05e9533122cfca
2018-08-14 08:55:38 -05:00
Ben Ford c31a01bd75 res_pjsip/rtp: No joint capabilities between streams.
When a conference contained a mixture of audio/video and audio-only
users, a NOTICE message would pop up stating there are no joint
capabilities between streams. This happens because streams can never be
removed, but they can be in a REMOVED state. If we have the scenario
where user A joins with audio/video, user B joins with audio-only, and
user C joins with audio/video, then user A leaves, the message would
be triggered. That removed stream is still in the SDP, but Asterisk
would pass it through, causing it to be seen as a ulaw stream. A check
has been added for removed streams, setting their status to REMOVED when
handling negotiated SDPs.

Also addressed an issue where user A joins, then user B joins but does
not receive video until much later. Full frames were not being sent,
causing some PLI from the browser. Because the video was flowing in one
direction, the browser sets the SSRC to 1, but Asterisk was dropping the
PLI because of that. Added a check to see if the SSRC is 1 or not, which
sends full frames and allows video to flow between user A and user B.
This should only happen when dealing with PSFB or FUR, and in the case
of PSFB, only for PLI.

ASTERISK-27398

Change-Id: I26e7c6f101bc119549eeca406b5bcd25ad8ebc5e
2018-08-13 14:01:53 -05:00