Commit Graph

28105 Commits

Author SHA1 Message Date
Corey Farrell ad30d60c69 chan_sip: Fix reference leaks in error paths.
* get_sip_pvt_from_replaces leaks sip_pvt_ptr on any error.
* build_peer leaks peer on failure to allocate the endpoint.

This patch fixes get_sip_pvt by using an RAII_VAR, build_peer is fixed
with an unref in the appropriate place.

ASTERISK-26184 #close

Change-Id: I728b424648ad041409f7d90880f4c28b3ce2ca12
2016-07-09 13:39:01 -05:00
Joshua Colp e0f27ecabb Merge "chan_sip/res_pjsip_t38: Handle a request to negotiate T.38 after it is enabled." 2016-07-08 15:21:35 -05:00
Joshua Colp 99cbecd270 Merge "REF_DEBUG: Prevent logging of container node objects." 2016-07-08 07:09:25 -05:00
Corey Farrell 7408c51a48 REF_DEBUG: Prevent logging of container node objects.
Using AO2_CONTAINER_ALLOC_OPT_DUPS_REPLACE can result in an unref being
recorded to the refs log for the node being replaced.  This prevents
logging of those unrefs since they would produce errors in
refcounter.py.

ASTERISK-26181 #close

Change-Id: Ie4fded84e8a1a58b3a59ce59dfd7eb0da3ddc5d4
2016-07-07 13:44:39 -04:00
Joshua Colp 302be4809a chan_sip/res_pjsip_t38: Handle a request to negotiate T.38 after it is enabled.
Some T.38 implementations may send another re-invite after the initial
one which adds additional negotiation details (such as the max bitrate).
Currently this will fail when passthrough is being done in chan_sip as we
do nothing if T.38 is already active.

Other handlers of T.38 inside of Asterisk (such as res_fax) handle this
scenario so this change adds support for it to chan_sip and res_pjsip_t38.
If a request to negotiate is received while T.38 is already enabled a
new re-INVITE is sent and negotiation is done again.

ASTERISK-26179 #close

Change-Id: I0298494d3da6df3219bbfa4be9aa04015043145c
2016-07-07 11:46:18 -05:00
Scott Griepentrog fb96492ec4 PJSIP: provide valid tcp nodelay option for reuse
When using TCP transport with chan_pjsip, the TCP_NODELAY
option value was allocated on the stack, then passed as a
pointer to the tcp transport configuration structure, and
later re-used on subsequently created sockets when it was
no longer valid.  This patch changes the allocation to be
a static.

ASTERISK-26180 #close
Reported by: Scott Griepentrog

Change-Id: I3251164c7f710dbdab031282f00e30a9770626a0
2016-07-07 11:32:58 -05:00
Joshua Colp 9e10aa8496 Merge "res_pjsip_session.c: Don't send extra BYE if SDP invalid." 2016-07-01 11:37:03 -05:00
Joshua Colp 764a009fbe Merge "res_pjsip_session.c: End call on initial invalid SDP negotiation." 2016-07-01 11:36:58 -05:00
Joshua Colp 01a8d9844b Merge "res_pjsip.c: Register PJMEDIA error code decoder." 2016-07-01 11:36:53 -05:00
Joshua Colp 4ad22164fe Merge "res_pjsip_session.c: Remove unused parameter from handle_incoming()." 2016-07-01 11:36:48 -05:00
Joshua Colp 082f3d123c Merge "res_pjsip: Add missing NULL checks when using pjsip_inv_end_session()." 2016-07-01 11:36:42 -05:00
zuul 0bfa3f0141 Merge "features: Fix channel datastore access." 2016-07-01 11:12:48 -05:00
Joshua Colp 040a11cecd Merge "res_pjsip: improve realtime performance #2" 2016-06-30 15:53:24 -05:00
Richard Mudgett 9f2c007254 res_pjsip_session.c: Don't send extra BYE if SDP invalid.
When an answer SDP is invalid we were disconnecting the outgoing call and
sending two BYE requests.  The first BYE was sent by PJPROJECT because of
the invalid SDP answer.  The second BYE was sent by Asterisk because it
thought the canceled call was the result of the RFC5407 section 3.1.2 race
condition.

* Made not send the BYE on a canceled session if the SDP negotiation is
incomplete because PJPROJECT has already sent a BYE for the failed
negotiation.

ASTERISK-25772 #close
Reported by:  Dmitriy Serov

Change-Id: I44ad0bd0605e8eeb7035c890d6f97a1331f1a836
2016-06-30 15:40:39 -05:00
Richard Mudgett 08d3b9a89e res_pjsip_session.c: End call on initial invalid SDP negotiation.
When an incoming call defers SDP negotiation and then sends us an invalid
SDP in the ACK, we need to send a BYE to disconnect the call.  In this
case SDP negotiation has failed and we don't have valid media streams
negotiated.

ASTERISK-25772

Change-Id: Ia358516b0fc1e6c4c139b78246f10b9da7a2dfb8
2016-06-30 15:40:39 -05:00
Richard Mudgett e6e12c752c res_pjsip.c: Register PJMEDIA error code decoder.
Registering the PJMEDIA error codes allows errors found when parsing an
incoming SDP to be easier to figure out.

"Missing SDP rtpmap for dynamic payload type (PJMEDIA_SDP_EMISSINGRTPMAP)"
is much easier to understand than "Unknown error 220030".

ASTERISK-25772

Change-Id: I44b2dcea656fedd7593171be9e845880a2c70ca0
2016-06-30 15:40:39 -05:00
Richard Mudgett 5d2fc6bab7 res_pjsip_session.c: Remove unused parameter from handle_incoming().
Change-Id: Iedd182d189ec947c42edc2c66c4bda3c22060daa
2016-06-30 15:40:38 -05:00
Richard Mudgett 656ed73ac6 res_pjsip: Add missing NULL checks when using pjsip_inv_end_session().
pjsip_inv_end_session() is documented as being able to return the
passed in tdata parameter set to NULL on success.

Change-Id: I09d53725c49b7183c41bfa1be3ff225f3a8d3047
2016-06-30 15:40:38 -05:00
Richard Mudgett 4f7b859726 features: Fix channel datastore access.
Found as a result of the testsuite tests/callparking test crashing.

Several calls to ast_get_chan_featuremap_config() and
ast_get_chan_features_xfer_config() did not lock the channel before
calling so the channel's datastore list was accessed without the lock's
protection.  Apparently another thread deleted a datastore on the
channel's list while the crashing thread was walking the list.  Crash at
0xdeaddead due to MALLOC_DEBUG's memory filler value as a result.

* Add missing channel locks to calls that were not already protected
as the doxygen for those calls indicates.

Change-Id: Id273b3d305cc616406c353cbc841b2b7655efaa1
2016-06-30 15:38:11 -05:00
George Joseph 5ad7e1c09a configure: Fix HAVE_PJSIP_EVSUB_GRP_LOCK not set with external pjproject
There was a typo in configure.ac preventing HAVE_PJSIP_EVSUB_GRP_LOCK
from getting set when using an external pjproject.

ASTERISK-26099 #close
Reported-by: Ross Beer

Change-Id: I709af70428e125fb5ccd44b171d25dd29141f0ae
2016-06-30 08:29:21 -05:00
Joshua Colp 5a1b3861ce Merge "pjproject/patches/config_site: Increase the max number of ICE candidates" 2016-06-29 18:49:38 -05:00
Matt Jordan dab2a6b689 hep.conf.sample: Default 'enabled' to 'no'
Following the principle of least surprise, we should not be sending
massive numbers of PJSIP and RTCP HEP packets out into the ether to some
only-slightly-random IP address. Having 'enabled' set to 'no' in the
sample configuration file should prevent this from happening for those
who run 'make samples'.

ASTERISK-26159 #close

Change-Id: I1753a64ca83a3442a6ebdc31061f8185c062d9b1
2016-06-29 16:18:53 -05:00
Matt Jordan 9129ac8e73 pjproject/patches/config_site: Increase the max number of ICE candidates
When negotiating ICE candidates with WebRTC capable endpoints, many
networks will result in a browser offering ICE candidates that exceeds
the default number of max candidates, 16. This patch bumps the max
candidates to 32, with the max checks at twice the number of candidates.
In practice, this has shown to be sufficient for browser/WebRTC
negotiation.

Change-Id: Ifd8da8b315f5ae14814d4ce20e10d2e6355020e5
2016-06-29 15:11:26 -05:00
zuul fab67b8b4d Merge "codecs: Fix ABI incompatibility created by adding format_name to ast_codec" 2016-06-29 12:24:14 -05:00
zuul ba872766fa Merge "siren: Add format attribute modules for Siren7 and Siren14." 2016-06-29 11:30:53 -05:00
zuul 6aaba96aca Merge "BuildSystem: Avoid obsolete warning with AC_TYPE_SIGNAL on autoconf." 2016-06-29 11:16:05 -05:00
George Joseph 4045e6d8ba codecs: Fix ABI incompatibility created by adding format_name to ast_codec
Adding format_name even to the end of ast_codec caused issued with
binary codec modules because the pointer would be garbage in asterisk
when they registered.  So, the ast_codec structure was reverted and an
internal_ast_codec structure was created just for use in codec.c.  A new
internal-only API was also added (__ast_codec_register_with_format) so
that codec_builtin could register codecs with the format_name in a
separate parameter rather than in the ast_codec structure.

ASTERISK-26144 #close
Reported-by: Alexei Gradinari

Change-Id: I6df1b08f6a6ae089db23adfe1ebc8636330265ba
2016-06-29 09:01:51 -05:00
Joshua Colp 541f038694 Merge "BuildSystem: Fix a few issues hightlighted by gcc 6.x" 2016-06-28 14:57:06 -05:00
George Joseph 651290a809 BuildSystem: Fix a few issues hightlighted by gcc 6.x
gcc 6.1.1 caught a few more issues.
Made sure the unit tests still pass for the func_env and stdtime
issues.

ASTERISK-26157 #close

Change-Id: I6664d8f34a45bc1481d2a854481c7878b0c1cf8e
2016-06-28 12:40:49 -05:00
Matt Jordan 83f2c2573b configs/basic-pbx/modules.conf: Remove 'bad' modules
This patch removes the following modules:
 - pbx_functions: It never existed.
 - res_pjsip_log_forwarder: It no longer exists.
 - res_hep_pjsip: The base HEP module wasn't loaded, and most basic PBXs
                  aren't going to be installing HOMER
 - res_pjsip_phoneprov_provider: The basic res_phoneprov module isn't
                  loaded, and we aren't configured to make use of the
                  module

Change-Id: Id91f68cae7c9c8c3d370029fe1268cb51e4ff5a5
2016-06-28 10:36:05 -05:00
Joshua Colp 75818b4084 siren: Add format attribute modules for Siren7 and Siren14.
This change removes hardcoded SDP parsing and generation for
Siren7 and Siren14 from chan_sip and moves it to format attribute
modules so it can also be used by chan_pjsip.

With this the fmtp lines for both are added with the bitrate
information.

ASTERISK-26021

Change-Id: Ibb004eda37a14c0a35ef0613f6237977fc800037
2016-06-23 10:23:05 -03:00
Alexander Traud 6e87bf746a BuildSystem: Avoid obsolete warning with AC_TYPE_SIGNAL on autoconf.
Removed the obsolete macro AC_TYPE_SIGNAL because Asterisk does not use K&R C
but requires ANSI C anyway.

ASTERISK-26046

Change-Id: I914c014385e1862102d90fe7650621def78db02e
2016-06-23 11:33:06 +02:00
zuul 46cc7f114d Merge "res_fax: Fix reference leak in fax_v21_session_new." 2016-06-22 21:50:22 -05:00
Joshua Colp 7a2daafa59 Merge "res_rtp_asterisk: Fix a self-comparison identified by gcc 6" 2016-06-22 20:16:03 -05:00
zuul 1afb0c98a9 Merge "chan_unistim: Fix memcpy in get_to_address" 2016-06-22 18:50:57 -05:00
zuul 0da2e6525b Merge "BuildSystem: Avoid obsolete warning with AC_FUNC_SETVBUF_REVERSED on autoconf." 2016-06-22 18:50:48 -05:00
Joshua Colp 8b85b05092 Merge "Fix Alembic upgrades." 2016-06-22 16:06:06 -05:00
Corey Farrell 8c7017f76e res_fax: Fix reference leak in fax_v21_session_new.
fax_v21_session_new created a session details object but only released
the allocation reference during error conditions.  fax_session_new adds
it's own reference to details if needed so the caller is always
responsible for cleaning it's own reference.

ASTERISK-26141 #close

Change-Id: Ie7fc52a83b6596ce9ce2d5a2bd9f3e204f48fc88
2016-06-22 15:11:57 -05:00
zuul df6f69ceb6 Merge "res_pjproject.c: Replace inlined DEBUG_ATLEAST() with macro." 2016-06-22 14:36:46 -05:00
Alexei Gradinari 6fa3ed0679 res_pjsip: improve realtime performance #2
The patch removes updating all Endpoints' status on startup.
Instead, only non-qualified aors with static contact
and non-qualified non-expired contacts are retrieved from the realtime to
update the endpoint status to ONLINE.
The endpoint name was added to the contact object to simply find the endpoint
that created this contact.

The status of endpoints with qualified aors will be updated by 'qualify'
functions.

ASTERISK-26061 #close

Change-Id: Id324c1776fa55d3741e0c5457ecac0304cb1a0df
2016-06-22 15:29:50 -04:00
George Joseph d293ead077 res_rtp_asterisk: Fix a self-comparison identified by gcc 6
gcc 6 caught a previously unidentified self-comparison in
ice_candidate_cmp.  Fixed it and re-ordered the predicates for better
short-circuiting.

ASTERISK-26140 #close

Change-Id: I3da713c568e24064430257b3502fbdafd35af7a7
2016-06-22 13:46:41 -05:00
George Joseph c7309a5254 chan_unistim: Fix memcpy in get_to_address
A code block only enabled when HAVE_PKTINFO is not defined (FreeBSD)
was using a pointer to a pointer as the destination of a memcpy and a
'&' instead of '*' in the sizeof.

ASTERISK-26138 #close

Change-Id: Id4927ff256c0e470bdf7bcfc025146a2f656e708
2016-06-22 13:31:58 -05:00
Mark Michelson b6bd97eea2 Fix Alembic upgrades.
A non-existent constraint was being referenced in the upgrade script.
This patch corrects the problem by removing the reference.

In addition, the head of the alembic branch referred to a non-existent
revision. This has been fixed by referring to the proper revision.

This patch fixes another realtime problem as well. Our Alembic scripts
store booleans as yes or no values. However, Sorcery tries to insert
"true" or "false" instead. This patch introduces a new boolean type that
translates to "yes" or "no" instead.

ASTERISK-26128 #close

Change-Id: I51574736a881189de695a824883a18d66a52dcef
2016-06-22 12:23:44 -05:00
George Joseph 3b4f5d1345 test_res_pjsip_scheduler: Add 'depends' on pjproject in MODULEINFO
Since the file was missing the depends on pjproject, it wasn't
picking up the pjproject related include path.  If there was no
system installed pjproject and pjproject-bundled was used, a compile
would fail because pjsip.h wasn't found.

ASTERISK-26139 #close

Change-Id: I2ee64a999051452bc198c4e2c168c70769cd3757
2016-06-22 10:55:58 -05:00
Alexander Traud 5f23aacda4 BuildSystem: Avoid obsolete warning with AC_FUNC_SETVBUF_REVERSED on autoconf.
Removed the obsolete macro AC_FUNC_SETVBUF_REVERSED because Asterisk does not
support the platform SVR2 from the year 1987 anymore.

ASTERISK-26046

Change-Id: I28161b037feb2d29ab46ed20e785928460226c22
2016-06-22 17:55:05 +02:00
Joshua Colp aec09d9c09 Merge "res_rtp_asterisk: fix memory leak in dtls" 2016-06-22 10:52:54 -05:00
Joshua Colp f88571822c Merge "res_pjsip_pubsub: Address SEGV when attempting to terminate a subscription" 2016-06-22 05:11:54 -05:00
Torrey Searle 804005d251 res_rtp_asterisk: fix memory leak in dtls
ensure that cert bios get freed after creating the fingerprint

ASTERISK-26129 #close

Change-Id: I44d23aea07dce80176ca1ff877c5ace9452ef451
2016-06-22 02:29:21 -05:00
Joshua Colp eb08734a94 Merge "res_rtp_asterisk: Use latest DTLS version available by underlying platform." 2016-06-21 19:39:51 -05:00
Joshua Colp eaaab8f55f Merge "res_pjsip_session: Handle race condition at shutdown with timer." 2016-06-21 18:53:33 -05:00