Commit Graph

29377 Commits

Author SHA1 Message Date
Joshua Colp bdec0852b9 Merge "channels/chan_sip.c: use binding IP address for outgoing TCP SIP connections" 2017-05-03 11:05:35 -05:00
Sean Bright 675e058e77 cleanup: Change severity of fread short-read warning
Many sound files don't have a full frame's worth of data at EOF, so the
warning messages were a bit too noisy. So we demote them to debug
messages.

Change-Id: I6b617467d687658adca39170a81797a11cc766f6
2017-05-02 11:36:20 -05:00
Jenkins2 dc948163ca Merge "res_pjsip_t38.c: Fix deadlock in T.38 framehook." 2017-05-02 09:22:24 -05:00
Joshua Colp d1944c1892 Merge "res_sdp_translator_pjmedia.c: Add TODO notes." 2017-05-02 05:20:03 -05:00
Joshua Colp 1d6429b269 Merge "SDP: Make SDP translation to/from internal representation more const." 2017-05-02 05:19:59 -05:00
Joshua Colp 090c6b702e Merge "stream: Make ast_stream_topology_create_from_format_cap() allow NULL cap." 2017-05-02 05:19:12 -05:00
Jenkins2 9af53d3563 Merge "SDP: Make ast_sdp_state_set_remote_sdp() return error." 2017-05-01 17:01:20 -05:00
Jenkins2 b67423c8a3 Merge "res_pjsip_outbound_authenticator_digest: Add context to log messages" 2017-05-01 15:08:21 -05:00
Jenkins2 74134a03bc Merge "SDP: Misc cleanups (Mostly memory leaks)" 2017-05-01 14:19:34 -05:00
Jenkins2 94b97e0835 Merge "SDP API: Add SSRC-level attributes" 2017-05-01 14:16:55 -05:00
Richard Mudgett 52e4f02b1a res_pjsip_t38.c: Fix deadlock in T.38 framehook.
A deadlock can happen between a channel lock and a pjsip session media
container lock.  One thread is processing a reINVITE's SDP and walking
through the session's media container when it waits for the channel lock
to put the determined format capabilities onto the channel.  The other
thread is writing a frame to the channel and processing the T.38 frame
hook.  The T.38 frame hook then waits for the pjsip session's media
container lock.  The two threads are now deadlocked.

* Made the T.38 frame hook release the channel lock before searching the
session's media container.  This fix has been done to several other
frame hooks to fix deadlocks.

ASTERISK-26974 #close

Change-Id: Ie984a76ce00bef6ec9aa239010e51e8dd74c8186
2017-04-29 18:15:32 -05:00
George Joseph 8170793be6 res_pjsip_outbound_authenticator_digest: Add context to log messages
There was no context info in this module's log messages so it was
impossible to toubleshoot.

Added endpoint or host to all messages and added the realms in the
challenge for the "No auth credentials for any realm" message.

Change-Id: Ifeed2786f35fbea7d141237ae15625e472acff9b
2017-04-28 11:04:57 -05:00
Jenkins2 09cde039a3 Merge "chan_vpb.cc: Fix compile error." 2017-04-28 10:38:22 -05:00
George Joseph 07164d04a6 Merge "chan_sip: Trigger reinvite if the SDP answer is included in the SIP ACK" 2017-04-27 19:17:09 -05:00
Richard Mudgett 48566b8c66 res_sdp_translator_pjmedia.c: Add TODO notes.
Change-Id: If27ca61f79accc882c3376d2e876d2b44aa1347b
2017-04-27 19:08:05 -05:00
Richard Mudgett ede90e4aa5 SDP: Make SDP translation to/from internal representation more const.
Change-Id: I473a174b869728604b37c60853896b0c458bc504
2017-04-27 19:08:05 -05:00
Richard Mudgett 5c1851cbc0 stream: Make ast_stream_topology_create_from_format_cap() allow NULL cap.
Change-Id: Ie29760c49c25d7022ba2124698283181a0dd5d08
2017-04-27 19:08:05 -05:00
Richard Mudgett d71c6e3bfd SDP: Make ast_sdp_state_set_remote_sdp() return error.
Change-Id: I7707c9d872c476d897ff459008652b35142a35e1
2017-04-27 19:08:05 -05:00
Richard Mudgett 176123e76c SDP: Misc cleanups (Mostly memory leaks)
Change-Id: I74431b385da333f2c5f5a6d7c55e70b69a4f05d2
2017-04-27 19:08:05 -05:00
Richard Mudgett bad091b317 chan_vpb.cc: Fix compile error.
Change-Id: I6d9edd34d8b2474222c86f44e379ead61e57a54f
2017-04-27 19:08:05 -05:00
Jenkins2 528e238447 Merge "channel: Add ability to request an outgoing channel with stream topology." 2017-04-27 17:53:53 -05:00
Jenkins2 16089ae1c9 Merge "frame: Better handle interpolated frames." 2017-04-27 17:29:02 -05:00
Jenkins2 066659a383 Merge "res_pjsip_session: Add cleanup to ast_sip_session_terminate" 2017-04-27 17:14:48 -05:00
Jenkins2 175297fe34 Merge "res_pjsip/res_pjsip_callerid: NULL check on caller id name string" 2017-04-27 16:47:34 -05:00
Jenkins2 49b2d1bde5 Merge "vector: defaults and indexes" 2017-04-27 15:44:45 -05:00
Mark Michelson d6535c0080 SDP API: Add SSRC-level attributes
RFC 5576 defines how SSRC-level attributes may be added to SDP media
descriptions. In general, this is useful for grouping related SSRCes,
indicating SSRC-level format attributes, and resolving collisions in RTP
SSRC values. These attributes are used widely by browsers during WebRTC
communications, including attributes defined by documents outside of RFC
5576.

This commit introduces the addition of SSRC-level attributes into SDPs
generated by Asterisk. Since Asterisk does not tend to use multiple
SSRCs on a media stream, the initial support is minimal. Asterisk
includes an SSRC-level CNAME attribute if configured to do so. This at
least gives browsers (and possibly others) the ability to resolve SSRC
collisions at offer-answer time.

In order to facilitate this, the RTP engine API has been enhanced to be
able to retrieve the SSRC and CNAME on a given RTP instance.

res_rtp_asterisk currently does not provide meaningful CNAME values in
its RTCP SDES items, and therefore it currently will always return an
empty string as the CNAME value. A task in the near future will result
in res_rtp_asterisk generating more meaningful CNAMEs.

Change-Id: I29e7f23e7db77524f82a3b6e8531b1195ff57789
2017-04-27 15:03:51 -05:00
Joshua Colp 413de95ab2 Merge "cleanup: Fix fread() and fwrite() error handling" 2017-04-27 13:59:02 -05:00
Jenkins2 623bbcbed2 Merge "pjproject_bundled: Add --disable-libwebrtc to configure" 2017-04-27 11:57:33 -05:00
George Joseph d6b2a58736 res_pjsip_session: Add cleanup to ast_sip_session_terminate
If you use ast_request to create a PJSIP channel but then hang it
up without causing a transaction to be sent, the session will
never be destroyed.  This is due ot the fact that it's pjproject
that triggers the session cleanup when the transaction ends.
app_chanisavail was doing this to get more granular channel state
and it's also possible for this to happen via ARI.

* ast_sip_session_terminate was modified to explicitly call the
  cleanup tasks and unreference session if the invite state is NULL
  AND invite_tsx is NULL (meaning we never sent a transaction).

* chan_pjsip/hangup was modified to bump session before it calls
  ast_sip_session_terminate to insure that session stays valid
  while it does its own cleanup.

* Added test events to session_destructor for a future testsuite
  test.

ASTERISK-26908 #close
Reported-by: Richard Mudgett

Change-Id: I52daf6f757184e5544c261f64f6fe9602c4680a9
2017-04-27 10:43:32 -05:00
Jenkins2 54e27cad3c Merge "res_rtp_asterisk.c: Fix crash in RTCP DTLS operation." 2017-04-27 10:05:16 -05:00
Joshua Colp 2b22c3c84b channel: Add ability to request an outgoing channel with stream topology.
This change extends the ast_request functionality by adding another
function and callback to create an outgoing channel with a requested
stream topology. Fallback is provided by either converting the
requested stream topology into a format capabilities structure if
the channel driver does not support streams or by converting the
requested format capabilities into a stream topology if the channel
driver does support streams.

The Dial application has also been updated to request an outgoing
channel with the stream topology of the calling channel.

ASTERISK-26959

Change-Id: Ifa9037a672ac21d42dd7125aa09816dc879a70e6
2017-04-27 10:39:46 +00:00
Joshua Colp 78eb08e7ba Merge "sdp: Add support for T.38" 2017-04-27 05:38:14 -05:00
Joshua Colp ed69471f94 Merge "SDP: Ensure SDPs "merge" properly." 2017-04-27 05:38:07 -05:00
Kevin Harwell c6b757fa05 res_pjsip/res_pjsip_callerid: NULL check on caller id name string
It's possible for a name in a party id structure to be marked as valid, but the
name string itself be NULL (for instance this is possible to do by using the
dialplan CALLERID function). There were a couple of places where the name was
validated, but the string itself was not checked before passing it to functions
like 'strlen'. This of course caused a crashed.

This patch adds in a NULL check before attempting to pass it into a function
that is not NULL tolerant.

ASTERISK-25823 #close

Change-Id: Iaa6ffe9d92f598fe9e3c8ae373fadbe3dfbf1d4a
2017-04-26 15:32:11 -05:00
Kevin Harwell cf3429b934 vector: defaults and indexes
Added an pre-defined integer vector declaration. This makes integer vectors
easier to declare and pass around. Also, added the ability to default a vector
up to a given size with a default value. Lastly, added functionality that
returns the "nth" index of a matching value.

Also, updated a unit test to test these changes.

Change-Id: Iaf4b51b2540eda57cb43f67aa59cf1d96cdbcaa5
2017-04-26 13:23:39 -05:00
Joshua Colp 985a5fd7aa frame: Better handle interpolated frames.
Interpolated frames are frames which contain a number of
samples but have no actual data. Audiohooks did not
handle this case when translating an incoming frame into
signed linear. It assumed that a frame would always contain
media when it may not. If this occurs audiohooks will now
immediately return and not act on the frame.

As well for users of ast_trans_frameout the function has
been changed to be a bit more sane and ensure that the data
pointer on a frame is set to NULL if no data is actually
on the frame. This allows the various spots in Asterisk that
check for an interpolated frame based on the presence of a
data pointer to work as expected.

ASTERISK-26926

Change-Id: I7fa22f631fa28d540722ed789ce28e84c7f8662b
2017-04-26 11:34:59 -05:00
Jenkins2 e478d2eb94 Merge "res_pjsip_sdp_rtp: No rtpmap for static RTP payload IDs in SDP." 2017-04-26 10:44:00 -05:00
George Joseph 858ed60446 pjproject_bundled: Add --disable-libwebrtc to configure
Without the disable, pjproject tries to build it's internal
webrtc implementation which requires sse2.  This fails on
platforms without sse2.

ASTERISK-26930 #close
Reported-by: abelbeck

Change-Id: I07231f9160c35cfa42b194d3aad4e7d51fd9a410
2017-04-26 09:07:24 -05:00
George Joseph b382919017 Merge "alembic: Add table for 'resource_list' PJSIP RLS type." 2017-04-26 09:02:17 -05:00
Thierry Magnien 585f9405b1 channels/chan_sip.c: use binding IP address for outgoing TCP SIP connections
For outgoing TCP connections, Asterisk uses the first IP address of the
interface instead of the IP address we asked him to bind to.

ASTERISK-26922 #close
Reported-by: Ksenia

Change-Id: I43c71ca89211dbf1838e5bcdb9be8d06d98e54eb
2017-04-26 14:58:44 +02:00
Jenkins2 5a987fc5e9 Merge "res_pjsip_session.c: Send 100 Trying out earlier to prevent retransmissions." 2017-04-25 17:04:47 -05:00
George Joseph a3a77890dc Merge "res_hep: Add additional config initialization and validation" 2017-04-25 16:39:04 -05:00
Sean Bright f5b67871df cleanup: Fix fread() and fwrite() error handling
Cleaned up some of the incorrect uses of fread() and fwrite(), mostly in
the format modules. Neither of these functions will ever return a value
less than 0, which we were checking for in some cases.

I've introduced a fair amount of duplication in the format modules, but
I plan to change how format modules work internally in a subsequent
patch set, so this is simply a stop-gap.

Change-Id: I8ca1cd47c20b2c0b72088bd13b9046f6977aa872
2017-04-25 16:24:15 -05:00
George Joseph 8df729517e Merge "res_pjsip_session.c: Restructure ast_sip_session_alloc()" 2017-04-25 15:37:15 -05:00
Joshua Colp 199d4776c0 alembic: Add table for 'resource_list' PJSIP RLS type.
This change adds an Alembic migration which adds a
ps_resource_list table that can contain resource_list
RLS configuration objects.

ASTERISK-26929

Change-Id: I7c888fafc67b3e87012de974f71ca7a5b8b1ec05
2017-04-25 14:37:58 -05:00
Joshua Colp 19a79ae12c sdp: Add support for T.38
This change adds a T.38 format which can be used in a stream
topology to specify that a UDPTL stream needs to be created.
The SDP API has been changed to understand T.38 and create
the UDPTL session, add the attributes, and parse the attributes.

This change does not change the boundary of the T.38 state
machine. It is still up to the channel driver to implement and
act on it (such as queueing control frames or reacting to them).

ASTERISK-26949

Change-Id: If28956762ccb8ead562ac6c03d162d3d6014f2c7
2017-04-25 13:03:33 -05:00
Mark Michelson 32b3e36c68 SDP: Ensure SDPs "merge" properly.
The gist of this work ensures that when a remote SDP is received, it is
merged properly with the local capabilities. The remote SDP is converted
into a stream topology. That topology is then merged with the current
local topology on the SDP state. That new merged topology is then used
to create an SDP. Finally, adjustments are made to RTP instances based
on knowledge gained from the remote SDP.

There are also a battery of tests in this commit that ensure that some
basic SDP merges work as expected.

While this may not sound like a big change, it has the property that it
caused lots of ancillary changes.

* The remote SDP is no longer stored on the SDP state. Biggest reason:
  there's no need for it. The remote SDP is used at the time it is being
  set and nowhere else.

* Some new SDP APIs were added in order to find attributes and convert
  generic SDP attributes into rtpmap structures.

* Writing tests made me realize that retrieving a value from an SDP
  options structure, the SDP options needs to be made const.

* The SDP state machine was essentially gutted by a previous commit.
  Initially, I attempted to reinstate it, but I found that as it had
  been defined, it was not all that useful. What was more useful was
  knowing the role we play in SDP negotiation, so the SDP state machine
  has been transformed into an indicator of role.

* Rather than storing separate local and joint stream state
  capabilities, it makes more sense to keep track of current stream
  state and update it as things change.

Change-Id: I5938c2be3c6f0a003aa88a39a59e0880f8b2df3d
2017-04-25 13:03:33 -05:00
Sean Bright 0611f2ca17 res_hep: Add additional config initialization and validation
* Initialize hepv3_runtime_data.sockfd to -1 so that our ao2 destructor
  does not close fd 0

* Add logging output when the required option - capture_address - is not
  specified.

* Remove a no longer relevant #define and correct related documentation

* Pass appropriate flags to aco_option_register so that capture_address
  cannot be the empty string.

ASTERISK-26953 #close

Change-Id: Ief08441bc6596d6f1718fa810e54a5048124f076
2017-04-24 13:22:48 -05:00
Sean Bright 59203c51cc core: Use eventfd for alert pipes on Linux when possible
The primary win of switching to eventfd when possible is that it only
uses a single file descriptor while pipe() will use two. This means for
each bridge channel we're reducing the number of required file
descriptors by 1, and - if you're using timerfd - we also now have 1
less file descriptor per Asterisk channel.

The API is not ideal (passing int arrays), but this is the cleanest
approach I could come up with to maintain API/ABI.

I've also removed what I believe to be an erroneous code block that
checked the non-blocking flag on the pipe ends for each read. If the
file descriptor is 'losing' its non-blocking mode, it is because of a
bug somewhere else in our code.

In my testing I haven't seen any measurable difference in performance.

Change-Id: Iff0fb1573e7f7a187d5211ddc60aa8f3da3edb1d
2017-04-24 11:50:09 -05:00
George Joseph dc6654d969 Merge "pbx: Use same thread if AST_OUTGOING_WAIT_COMPLETE specified" 2017-04-21 15:47:36 -05:00