Commit Graph

4566 Commits

Author SHA1 Message Date
Jenkins2 57ad488451 Merge "res_ari: Remove requirement that body exists when debug is on." 2018-05-04 06:32:38 -05:00
Jenkins2 8e228fc138 Merge "res_pjsip/pjsip_distributor.c: Add missing off-nominal request response." 2018-05-03 11:32:08 -05:00
Jenkins2 0565a6c909 Merge "Add the ability to read the media file type from HTTP header for playback" 2018-05-03 10:50:51 -05:00
Jenkins2 e538fc8e86 Merge "res_rtp_asterisk: Always update SRTP on local SSRC change." 2018-05-03 10:29:38 -05:00
Jenkins2 706b899358 Merge "pjsip: Increase maximum number of usable ciphers & other cleanups" 2018-05-03 07:41:33 -05:00
Joshua Colp de3ca9bada res_ari: Remove requirement that body exists when debug is on.
The "ari set debug" code for incoming requests incorrectly assumed
that all requests would contain a body. If one did not exist the
request would be incorrectly rejected. The response that was sent
was also incomplete as an incorrect function was used to construct
the response.

The code has now been changed to no longer require a request to have
a body and the response updated to use the correct function.

ASTERISK-27801

Change-Id: I4eef036ad54550a4368118cc348765ecac25e0f8
2018-05-03 05:37:01 -06:00
Sean Bright 239074c759 pjsip: Increase maximum number of usable ciphers & other cleanups
* Increase maximum number of ciphers from 100 to 256 (or whatever
  PJ_SSL_SOCK_MAX_CIPHERS is #define'd to)

* Simplify logic in cipher_name_to_id()

* Make signed/unsigned comparison consistent

Re: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=897412

Reported by: Ondřej Holas

Change-Id: Iea620f03915a1b873e79743154255c3148a514e7
2018-05-02 07:06:07 -06:00
Richard Mudgett 11b7de82c5 res_pjsip/pjsip_distributor.c: Add missing off-nominal request response.
Change-Id: I389579b39c523d1d1e8ce020ef549a8bb5781c9b
2018-05-01 16:23:33 -06:00
Richard Mudgett 6cab3c836a res_pjsip/pjsip_distributor.c: Pull some assignments out of if tests.
Change-Id: I3d30d638b53a4bbe9bf9aad853c649d583894112
2018-05-01 16:17:20 -06:00
Joshua Colp afdca5c68c res_rtp_asterisk: Always update SRTP on local SSRC change.
When the local SSRC changes we need to update the SRTP information
so that the proper key is used. This is commonly done as a result
of bridging two channels together. Previously we only updated
the SRTP information if media had already flowed, but in practice
the channel driver may have already performed SRTP negotiation and
set up the previous SSRC. We now always do it on a local SSRC
change.

ASTERISK-27795
ASTERISK-27800

Change-Id: Ia7c8e74c28841388b5244ac0b8fd6c1dc6ee4c10
2018-05-01 10:52:34 -06:00
Gaurav Khurana 0827d5cc53 Add the ability to read the media file type from HTTP header for playback
How it works today:
media_cache tries to parse out the extension of the media file to be played
from the URI provided to Asterisk while caching the file.

What's expected:
Better will be to have Asterisk get extension from other ways too. One of the
common ways is to get the type of content from the CONTENT-TYPE header in the
HTTP response for fetching the media file using the URI provided.

Steps to Reproduce:
Provide a URL of the form: http://host/media/1234 to Asterisk for media
playback. It fails to play and logs show the following error line:

[Sep 15 15:48:05] WARNING [29148] [C-00000092] file.c:
File http://host/media/1234 does not exist in any format

Scenario this issue is blocking:
In the case where the media files are stored in some cloud object store,
following can block the media being played via Asterisk:

Cloud storage generally needs authenticated access to the storage. The way
to do that is by using signed URIs. With the signed URIs there's no way to
preserve the name of the file.
In most cases Cloud storage returns a key to access the object and preserving
file name is also not a thing there

ASTERISK-27286

 Reporter: Gaurav Khurana

Change-Id: I1b14692a49b2c1ac67688f58757184122e92ba89
2018-04-30 16:30:44 -04:00
George Joseph 3bad41257b Merge "BuildSystem: Add DragonFly BSD." 2018-04-30 09:07:30 -05:00
Jenkins2 9c430569d4 Merge "bridge_softmix: Forward TEXT frames" 2018-04-27 10:06:30 -05:00
Richard Mudgett 661fec4b59 core: Remove unused/incomplete SDP modules.
Change-Id: Icc28fbdc46f58e54a21554e6fe8b078f841b1f86
2018-04-25 15:58:24 -03:00
Jenkins2 56a9338fc1 Merge "Build System: Add missing ASTMM_LIBC to flex output." 2018-04-25 10:02:13 -05:00
Alexander Traud efe40ff671 BuildSystem: Add DragonFly BSD.
ASTERISK-27820

Change-Id: I310896143e94d65da1c2be3bb448204a8b86d557
2018-04-20 12:50:03 +02:00
Jenkins2 6ccf08c543 Merge "stringfields: Collect extended stringfields into the stringfield section." 2018-04-18 17:43:02 -05:00
Joshua Colp 7b59cfc777 Merge "res_pjsip: Fix deadlock on reliable transport shutdown." 2018-04-18 17:32:33 -05:00
Corey Farrell 179ae87cf4 Build System: Add missing ASTMM_LIBC to flex output.
Redirect libc allocation functions to use Asterisk functions for
main/ast_expr2f.c and res/ael/ael_lex.c.  This will resolve errors
produced by astmm.h when these files are regenerated, though other
issues still remain.

ASTERISK~27813

Change-Id: I7263e9e4217a17bde4ffaa2087a8f8aeb2a8588c
2018-04-18 14:50:53 -06:00
Jenkins2 3255a286b3 Merge "res_musiconhold: Don't restart MOH from beginning after announcement." 2018-04-17 12:21:37 -05:00
George Joseph 4fb7967c73 bridge_softmix: Forward TEXT frames
Core bridging and, more specifically, bridge_softmix have been
enhanced to relay received frames of type TEXT or TEXT_DATA to all
participants in a softmix bridge.  res_pjsip_messaging and
chan_pjsip have been enhanced to take advantage of this so when
res_pjsip_messaging receives an in-dialog MESSAGE message from a
user in a conference call, it's relayed to all other participants
in the call.

res_pjsip_messaging already queues TEXT frames to the channel when
it receives an in-dialog MESSAGE from an endpoint and chan_pjsip
will send an MESSAGE when it gets a TEXT frame.  On a normal
point-to-point call, the frames are forwarded between the two
correctly.  bridge_softmix was not though so messages weren't
getting forwarded to conference bridge participants.  Even if they
were, the bridging code had no way to tell the participants who
sent the message so it would look like it came from the bridge
itself.

* The TEXT frame type doesn't allow storage of any meta data, such
as sender, on the frame so a new TEXT_DATA frame type was added that
uses the new ast_msg_data structure as its payload.  A channel
driver can queue a frame of that type when it receives a message
from outside.  A channel driver can use it for sending messages
by implementing the new send_text_data channel tech callback and
setting the new AST_CHAN_TP_SEND_TEXT_DATA flag in its tech
properties.  If set, the bridging/channel core will use it instead
of the original send_text callback and it will get the ast_msg_data
structure. Channel drivers aren't required to implement this.  Even
if a TEXT_DATA enabled driver uses it for incoming messages, an
outgoing channel driver that doesn't will still have it's send_text
callback called with only the message text just as before.

* res_pjsip_messaging now creates a TEXT_DATA frame for incoming
in-dialog messages and sets the "from" to the display name in the
"From" header, or if that's empty, the caller id name from the
channel.  This allows the chat client user to set a friendly name
for the chat.

* bridge_softmix now forwards TEXT and TEXT_DATA frames to all
participants (except the sender).

* A new function "ast_sendtext_data" was added to channel which
takes an ast_msg_data structure and calls a channel's
send_text_data callback, or if that's not defined, the original
send_text callback.

* bridge_channel now calls ast_sendtext_data for TEXT_DATA frame
types and ast_sendtext for TEXT frame types.

* chan_pjsip now uses the "from" name in the ast_msg_data structure
(if it exists) to set the "From" header display name on outgoing text
messages.

Change-Id: Idacf5900bfd5f22ab8cd235aa56dfad090d18489
2018-04-17 10:30:23 -06:00
Ben Ford f5d5083ea7 res_rtp_asterisk: Add support for receiving and handling NACK requests.
Adds the ability to receive and handle incoming NACK requests if
retransmissions are enabled. If retransmissions are enabled, a data
buffer is allocated that stores packets being sent. If a NACK request
is received, the packet requested for retransmission is sent if it is
still in the buffer. In the same request, if any of the following 16
packets are marked as not received, those will be sent as well if
available, as outlined in RFC4585.

Also changes RTCP RR and SR to use media source SSRC instead of packet
source SSRC when determining which instance to use for RTCP reports.

For more information, refer to the wiki page:
https://wiki.asterisk.org/wiki/display/AST/WebRTC+User+Experience+Improvements

ASTERISK-27806 #close

Change-Id: I7f7f124af3b9d5d2fd9cffc6ba8cb48a6fff06ec
2018-04-16 17:21:18 -06:00
Richard Mudgett d50d637764 stringfields: Collect extended stringfields into the stringfield section.
Use of extended stringfields is a temporary mechanism to avoid ABI
breakage in released branches without resorting to more inconvienient
methods.

* Collect existing extended stringfields into the parent stringfield
section of the struct.

Change-Id: I8d46d037801b4518837c3ea4b6df95ceadc9436b
2018-04-16 16:43:20 -05:00
George Joseph 38dae51b78 Merge "res_pjsip.c: Split ast_sip_push_task_synchronous() to fit expectations." 2018-04-16 11:12:30 -05:00
Jenkins2 267e007c28 Merge "pjsip_scheduler.c: Add ability to trace scheduled tasks." 2018-04-16 07:11:26 -05:00
Jenkins2 1f6fc78a2e Merge "pjsip_scheduler.c: Fix some corner cases." 2018-04-16 06:49:14 -05:00
Ben Ford 4aeec6100f res_musiconhold: Don't restart MOH from beginning after announcement.
This reverts a problem introduced by the fix for ASTERISK_24329.
Now, when an announcement is played while waiting in a queue, music on
hold will not restart from the beginning of the sound file and will
instead pick up where it left off. However, the incorrect behavior in
ASTERISK_24329 is now present again; if an announcement X seconds
long is played when music on hold starts, music on hold will start X
seconds into the file.

ASTERISK-27774 #close
Reported by: lvl

Change-Id: I86b2885ee7063268f9b9747eddb788336ade989b
2018-04-13 15:30:02 -06:00
Richard Mudgett 3bb6cf43b5 pjsip_scheduler.c: Add ability to trace scheduled tasks.
When a scheduled task is created you can pass in the
AST_SIP_SCHED_TASK_TRACK flag.  This new flag causes scheduling events to
be logged.

Change-Id: I91967eb3d5a220915ce86881a28af772f9a7f56b
2018-04-12 17:35:19 -05:00
Richard Mudgett 237d341bbd res_pjsip.c: Split ast_sip_push_task_synchronous() to fit expectations.
ast_sip_push_task_synchronous() did not necessarily execute the passed in
task under the specified serializer.  If the current thread is any
registered pjsip thread then it would execute the task immediately instead
of under the specified serializer.  Reentrancy issues could result if the
task does not execute with the right serializer.

The original reason ast_sip_push_task_synchronous() checked to see if the
current thread was a registered pjsip thread was because of a deadlock
with masquerades and the channel technology's fixup callback
(ASTERISK_22936).  A subsequent masquerade deadlock fix (ASTERISK_24356)
involving call pickups avoided the original deadlock situation entirely.
The PJSIP channel technology's fixup callback no longer needed to call
ast_sip_push_task_synchronous().

However, there are a few places where this unexpected behavior is still
required to avoid deadlocks.  The pjsip monitor thread executes callbacks
that do calls to ast_sip_push_task_synchronous() that would deadlock if
the task were actually pushed to the specified serializer.  I ran into one
dealing with the pubsub subscriptions where an ao2 destructor called
ast_sip_push_task_synchronous().

* Split ast_sip_push_task_synchronous() into
ast_sip_push_task_wait_servant() and ast_sip_push_task_wait_serializer().
ast_sip_push_task_wait_servant() has the old behavior of
ast_sip_push_task_synchronous().  ast_sip_push_task_wait_serializer() has
the new behavior where the task is always executed by the specified
serializer or a picked serializer if one is not passed in.  Both functions
behave the same if the current thread is not a SIP servant.

* Redirected ast_sip_push_task_synchronous() to
ast_sip_push_task_wait_servant() to preserve API for released branches.

ASTERISK_26806

Change-Id: Id040fa42c0e5972f4c8deef380921461d213b9f3
2018-04-12 17:34:16 -05:00
Richard Mudgett c2f85e881d pjsip_scheduler.c: Fix some corner cases.
* Fix the periodic interval wander because it may take significant time
between the sched thread queueing the task in the serializer and the
serializer actually executing the task.  The time it takes to actually
execute the task was already taken into account.

* Pass a schtd ref to the serializer when we queue a scheduled task on
the serializer.  We don't want it going away on us while it is in the
serializer queue.

* Skip the scheduled task if the task was canceled between queueing the
task to the serializer and the serializer actually executing the task.

* Reorder struct ast_sip_sched_task to avoid unnecessary padding.  Removed
task_id and added next_periodic.

* Hold a ref to the passed in serializer so the serializer cannot go away
on the scheduled task.

ASTERISK_26806

Change-Id: I6c8046b75f6953792c8c30e55b836a4291143f24
2018-04-12 17:34:16 -05:00
Richard Mudgett 96c4a57edf pjsip_scheduler.c: Sort "pjsip show scheduled_tasks" output.
* A side benefit is that the scheduled tasks are not completely blocked
while the CLI command executes.

* Adjusted the "Task Name" column width to have more room for longer
names.

Change-Id: Iec64aa463ee8b10eef90120e00c38b1fb444087e
2018-04-12 16:46:50 -05:00
Jenkins2 3c5d76863b Merge "res_pjsip_notify.c: enable in-dialog NOTIFY" 2018-04-12 15:03:54 -05:00
Jenkins2 7777326244 Merge "pjsip_scheduler.c: Fix ao2 usage errors." 2018-04-12 10:25:18 -05:00
Chris-Savinovich 0747ac893b res_pjsip_session: Rewrite o= with external_media_address.
It now appends the external IP address on the
o= line of the SDP packet.  The decision was made to write
the numeric IP address as opposed to the RFC that states
the FQDN should be used if and when available.  We believe
the usage of literal IP address will help avoid
potential problems.

ASTERISK-27614 #close

Change-Id: I84f3360f3606b8c4e8d161edb228799ec0b8a302
2018-04-11 11:17:33 -06:00
Nathan Bruning 1cd704de36 res_pjsip_notify.c: enable in-dialog NOTIFY
This patch adds support to send in-dialog SIP NOTIFY commands on
chan_pjsip channels, similar to the functionality recently added
for chan_sip (ASTERISK_27461).

This extends res_pjsip_notify to allow for in-dialog messages.

ASTERISK-27697

Change-Id: If7f3151a6d633e414d5dc319d5efc1443c43dd29
2018-04-11 10:31:44 -06:00
Jenkins2 fabfe701bb Merge "res_pjsip_refer/chan_sip: Fix INVITE with replaces transfer to ConfBridge" 2018-04-11 07:11:16 -05:00
Richard Mudgett 7157dcf83b pjsip_scheduler.c: Fix ao2 usage errors.
* Removed several invalid uses of OBJ_NOLOCK.  These uses resulted in the
'tasks' container being accessed without a lock in a multi-threaded
environment.  A recipe for crashes.

* Removed needlessly obtaining schtd object references.  If the caller
providing you a pointer to an object doesn't have a valid reference then
you cannot safely get one from it.

* Getting a ref to 'tasks' when you aren't copying the pointer into
another location is useless.  The 'tasks' container pointer is global.

* Removed many unnecessary uses of RAII_VAR.

* Make ast_sip_schedule_task() name parameter const.

ASTERISK_26806

Change-Id: I5c62488e651314e2a1dbc01f5b078a15512d73db
2018-04-09 17:12:53 -05:00
Jenkins2 2a6072a9c4 Merge "pjsip / res_rtp_asterisk: Add support for sending REMB" 2018-04-09 11:14:16 -05:00
Joshua Colp 2e60196265 Merge "res_rtp_asterisk: Fix minimum block word length for REMB." 2018-04-09 10:58:00 -05:00
Jenkins2 070428415a Merge "res_rtp_asterisk: Queue video update on picture loss indication." 2018-04-09 10:27:26 -05:00
Richard Mudgett 0c03eab962 res_pjsip_refer/chan_sip: Fix INVITE with replaces transfer to ConfBridge
There is a problem when an INVITE-with-Replaces transfer targets a channel
in a ConfBridge.  The transfer will unconditionally swap out the
ConfBridge channel.  Unfortunately, the ConfBridge state will not be aware
of this change.  Unexpected behavior will happen as a result since
ConfBridge channels currently can only be replaced by a masquerade and not
normal bridge channel moves.

* We just need to pretend that the channel isn't in a bridge (like other
transfer methods already do) so the transfer channel will masquerade into
the ConfBridge channel.

Change-Id: I209beb0e748fa4f4b92a576f36afa8f495ba4c82
2018-04-06 16:12:57 -06:00
Joshua Colp c7bd554094 pjsip / res_rtp_asterisk: Add support for sending REMB
This change allows chan_pjsip to be given an AST_FRAME_RTCP
containing REMB feedback and pass it to res_rtp_asterisk.
Once res_rtp_asterisk receives the frame a REMB RTCP feedback
packet is constructed with the appropriate contents and sent
to the remote endpoint.

ASTERISK-27776

Change-Id: Ic53f821c1560d8924907ad82c4d9c0bc322b38cd
2018-04-06 08:36:54 -06:00
Joshua Colp 39016e3582 res_rtp_asterisk: Fix minimum block word length for REMB.
The minimum block word length is actually 4, not 5.

Change-Id: I878542218225aed72c72bdf1b856fc822cd2d649
2018-04-05 19:02:40 -06:00
Joshua Colp 8a602f18db res_rtp_asterisk: Queue video update on picture loss indication.
The previous payload specific feedback handling was very single
minded in that it just assumed everything should trigger a video
update. This was changed but the handling of picture loss indication
was not added. The result was that video may not flow. This change
adds it explicitly in.

Change-Id: I1894be02e39ee10a0af841b5a1dca5f0ec7d60b6
2018-04-05 17:49:29 -06:00
Richard Mudgett 71a67a98c4 res_pjsip: Update authenticate_qualify documentation.
Change-Id: I3811de0014b1ffe96d4a3b49cddd5d4ca02ee5d4
2018-04-04 17:28:42 -06:00
George Joseph f91263cf46 res_pjsip: Correct usages of pjproject's timer heap
Fix some timer heap initializations and cancels to try and prevent
crashes and timer heap issues.

Change-Id: I64885d190fa22097d1b55987091375541e57a7ee
2018-04-02 10:17:27 -05:00
Richard Mudgett 97cc67b12f res_pjsip: Fix deadlock on reliable transport shutdown.
A deadlock can happen when the PJSIP monitor thread is shutting down a
connection oriented transport (TCP/TLS) used by a subscription at the same
time as another thread tries to send something for that subscription.  The
deadlock is between the pjsip monitor thread attempting to get the dialog
lock and another thread sending something for that dialog when it tries to
get the transport manager lock.

* res_pjsip_pubsub.c: Avoid the deadlock by pushing the subscription
removal to the subscription serializer.

* res_pjsip_registrar.c: Pushed off incoming registration contact removals
to a default serializer as a precaution.  Removing the contacts involves
sorcery access which in this case will involve database access.  Depending
upon the setup, the database may not be on the same machine and could take
awhile.  We don't want to hold up the pjsip monitor thread with
potentially long access times.

ASTERISK-27706

Change-Id: I56b647aea565f24dba33e9e5ebeed4cd3f31f8c4
2018-03-29 16:22:25 -06:00
Kevin Harwell 48ef239a01 Merge "res_rtp_asterisk: Add support for raising additional RTCP messages." 2018-03-29 15:19:17 -05:00
Ross Beer f65488f546 pjsip_transport_events.c: Fix crash using stale transport pointer.
Apparently it is possible for the transport to be destroyed without
triggering the transport callback logic.  As a result the transport gets
destroyed and we have a stale pointer in the active_transports container.

* Invoke the transport monitor callback checks when the transport is
destroyed in addition to when it is disconnected and shutdown.

ASTERISK-27688

Change-Id: Ia9b5469fea8f2b3f2d8476fae6b748a4d23e7261
2018-03-28 16:20:11 -06:00
Joshua Colp e14b0e960d res_rtp_asterisk: Add support for raising additional RTCP messages.
This change extends the existing AST_FRAME_RTCP frame type to be
able to contain additional RTCP message types, such as feedback
messages. The payload type is contained in the subclass which allows
knowing what is in the frame itself.

The RTCP feedback message type is now handled and REMB[1] messages
are raised with their containing information.

This also fixes a bug where all feedback messages were triggering
video updates instead of just FIR and FUR.

Finally RTCP frames are now passed up through the Asterisk core to
what is handling the channel, mapped appropriately in the case of
bridging, and written to an outgoing stream. Since RTCP frames are
on a per-stream basis this is only done on multistream capable
channels.

[1] https://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03

ASTERISK-27758
ASTERISK-26366

Change-Id: I680da0ad8d5059d5e9655d896fb9d92e9da8491e
2018-03-27 08:39:00 -06:00