Commit Graph

29608 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther b54eb167b4 app_playback.c: Use the timezonename parameter
In say_date_generic the timezonename parameter is passed but never
used. Fix it by passing it to the ast_localtime function.

ASTERISK-27124

Change-Id: I63106b8db10426d417d7275f22554a616e92fae4
2017-07-12 23:22:56 +02:00
Joshua Colp 27aeca3594 Merge "app_stream_echo: misc bug fixes" 2017-07-12 06:13:34 -05:00
Joshua Colp 8082f6cf7e Merge "res_rtp_asterisk: trigger source change control frame when dtls is established" 2017-07-12 06:13:25 -05:00
Joshua Colp 8b27bb100b Merge "res_musiconhold: Add kill_escalation_delay, kill_method to class" 2017-07-12 05:48:01 -05:00
Joshua Colp 767a163fea Merge "manager: Remove AMI "Queues" action." 2017-07-12 04:25:45 -05:00
Joshua Colp 95b35cb1cb Merge "Avoid setting maxfiles for a remote asterisk" 2017-07-12 04:24:43 -05:00
Jenkins2 fbcfa6b4b2 Merge "http.c: Reduce log spam" 2017-07-11 19:42:10 -05:00
George Joseph b7a875778a res_musiconhold: Add kill_escalation_delay, kill_method to class
By default, when res_musiconhold reloads or unloads, it sends a HUP
signal to custom applications (and all descendants), waits 100ms,
then sends a TERM signal, waits 100ms, then finally sends a KILL
signal.  An application which is interacting with an external
device and/or spawns children of its own may not be able to exit
cleanly in the default times, expecially if sent a KILL signal, or
if it's children are getting signals directly from
res_musiconhoild.

* To allow extra time, the 'kill_escalation_delay'
  class option can be used to set the number of milliseconds
  res_musiconhold waits before escalating kill signals, with the
  default being the current 100ms.

* To control to whom the signals are sent, the "kill_method" class
  option can be set to "process_group" (the default, existing
  behavior), which sends signals to the application and its
  descendants directly, or "process" which sends signals only to the
  application itself.

Change-Id: Iff70a1a9405685a9021a68416830c0db5158603b
2017-07-11 14:43:41 -06:00
Benjamin Keith Ford 5d86da61a6 manager: Remove AMI "Queues" action.
When performing the "Queues" action via AMI, it outputs the same
text that the Asterisk CLI outputs when running a "queue show"
command, which does not conform with the AMI spec. "QueueStatus"
already does what the "Queues" action should do, so instead of
correcting the output, the "Queues" action will be removed and
"QueueStatus" should be used instead.

ASTERISK-27073 #close
Reported by: Brian

Change-Id: Id11743859758255b69cc3a557750d7a56c6d16f8
2017-07-11 15:16:32 -05:00
Tzafrir Cohen d58ef31acd Avoid setting maxfiles for a remote asterisk
Setting maxfiles (maximum number of open files) has no practical
effect on a remote asterisk (rasterisk, rasterisk -x).

It has an ill effect of printing an extra message, which
may be annoying in case of -x.

ASTERISK-27105 #close

Change-Id: Iaf9eb344e4b4b517df91b736b27ec55f6a6921a2
2017-07-11 20:46:42 +03:00
George Joseph 303f935a50 http.c: Reduce log spam
Messages like "fwrite() failed: Connection reset by peer" are no
help whatsoever, especially since they can be caused simply by a
client disconnecting.

* Make those WARNINGs DEBUGs.
* Check the return from ast_iostream_printf of headers.

Change-Id: I17bd5f3621514152a7b2b263c801324c5e96568b
2017-07-11 09:29:51 -05:00
Jenkins2 3e7cfe3a92 Merge "res_pjsip: Fix crash with from_user containing invalid characters." 2017-07-11 07:08:39 -05:00
Jenkins2 b0e184f0a7 Merge "json.c: Add backtrace log to find 'Invalid UTF-8 string' errors" 2017-07-10 11:41:17 -05:00
Jenkins2 f878ac2d07 Merge "res_rtp_asterisk.c: Fix TURN deadlock by using ICE session group lock." 2017-07-10 11:19:16 -05:00
Jenkins2 789475336b Merge "bridge_native_rtp.c: Fix direct media video RTP instance ACL check." 2017-07-10 10:53:11 -05:00
Benjamin Keith Ford 8f72128e66 res_pjsip: Fix crash with from_user containing invalid characters.
If the from_user field contains certain characters (like @, {, ^, etc.),
PJSIP will return a null value for the URI when attempting to parse it.
This causes a crash when trying to dial out through a trunk that contains
these invalid characters in its from_user field.

This change checks the configuration and ensures that an endpoint will
not be created if the from_user contains an invalid character. It also
adds a null check to the PJSIP URI parsing as a backup.

ASTERISK-27036 #close
Reported by: Maxim Vasilev

Change-Id: I0396fdb5080604e0bdf1277464d5c8a85db913d0
2017-07-10 09:55:05 -05:00
George Joseph 17103ca898 Merge "app_queue: Add priority to AMI QueueStatus" 2017-07-10 09:50:37 -05:00
Richard Mudgett 03ae8b0105 json.c: Add backtrace log to find 'Invalid UTF-8 string' errors
Change-Id: I9020ff9f2b3749904317c0c173f47a1bbed6f929
2017-07-07 18:26:25 -05:00
Joshua Colp 6f35428c87 Merge "app_voicemail: Cleanup ODBC connection handling" 2017-07-07 16:38:21 -05:00
Jenkins2 d6c08cc559 Merge "core: Remove 'Data Retrieval API'" 2017-07-07 15:42:56 -05:00
Richard Mudgett 9cd8a1df79 res_rtp_asterisk.c: Fix TURN deadlock by using ICE session group lock.
When a message is received on the TURN socket, the code processing the
message needs to call into the ICE/STUN session for further processing.
This code path locks the TURN group lock then the ICE/STUN group lock.  In
another thread an ICE/STUN timer can fire off to send a keep alive message
over the TURN socket.  In this code path, the ICE/STUN group lock is
obtained then the TURN group lock is obtained to send the packet.  A
classic deadlock case if the group locks are not the same.

* Made TURN get created using the ICE/STUN session's group lock.

NOTE: I was originally concerned that the ICE/STUN session can get
recreated by ice_reset_session() for an event like RTCP multiplexing
causing a change during SDP negotiation.  In this case the TURN group lock
would become different.  However, TURN is also recreated as part of the
ICE/STUN recreation in ice_create() when all known ICE candidates are
added to the new ICE session.  While the ICE/STUN and TURN sessions are
being recreated there is a period where the group locks could be
different.

ASTERISK-27023 #close
Patches:
    res_rtp_asterisk-turn-deadlock-fix.patch (license #6502)
        patch uploaded by Michael Walton (modified)

Change-Id: Ic870edb99ce4988a8c8eb6e678ca7f19da1432b9
2017-07-06 16:14:48 -05:00
George Joseph 7a4f577eb7 Fix alembic branches
Change-Id: I04f607f084bda9b1b7f626e8e9735c37dc751187
2017-07-06 05:00:49 -06:00
Joshua Colp b104e484b6 Merge "channel: Clear channel flag in error branch." 2017-07-05 18:46:10 -05:00
Jenkins2 33aa3907eb Merge "pjproject_bundled: Allow passing configure options to bundled" 2017-07-05 17:59:39 -05:00
Richard Mudgett 1028f64be4 bridge_native_rtp.c: Fix direct media video RTP instance ACL check.
The video stream was using the audio stream RTP instance addresses to
check if the video RTP gets directed to an allowed direct media Access
Control List (ACL) address.  There is no guarantee that the video RTP
instance uses the same addresses as the audio RTP instance.

This looks like it has been a bug since v11 when direct media ACL was
first added to chan_sip and then faithfully reproduced through a couple
code refactorings into the new bridging architecture.

Change-Id: I8ddd56320e0eea769f3ceed3fa5b6bdfb51d681a
2017-07-05 17:10:07 -05:00
George Joseph 7a306468f4 Merge "bridge_native_rtp: Keep rtp instance refs on bridge_channel" 2017-07-05 17:03:28 -05:00
Jenkins2 75022f6b11 Merge "chan_sip: Fix a typo for tlsbindaddr in autodomain (SIP Domain Support)." 2017-07-05 16:37:39 -05:00
Jenkins2 2ec388680b Merge "chan_sip: Only when different, add TCP|TLS in autodomain (SIP Domain Support)." 2017-07-05 16:29:45 -05:00
George Joseph a10bc3e23f Merge "pjsip_distributor.c: Fix deadlock with TCP type transports." 2017-07-05 16:08:46 -05:00
Jenkins2 16f0fa52c0 Merge "pjsip_distributor.c: Fix unidentified_requests hash functions." 2017-07-05 15:32:40 -05:00
Jenkins2 d2b32cd009 Merge "chan_pjsip: Fix ability to send UPDATE on COLP" 2017-07-05 14:17:23 -05:00
Sean Bright 325eeced6a core: Remove 'Data Retrieval API'
This API was not actively maintained, was not added to new modules
(such as res_pjsip), and there exist better alternatives to acquire the
same information, such as the ARI.

Change-Id: I4b2185a83aeb74798b4ad43ff8f89f971096aa83
2017-07-05 11:25:58 -05:00
Alexander Traud 910c05455d chan_sip: Only when different, add TCP|TLS in autodomain (SIP Domain Support).
When sip.conf contained tcpenable=yes and autodomain=yes, the TCP domain was
added in any case, because of a local Boolean-negation error of the return value
of ast_sockaddr_cmp. After fixing this error for TCP and TLS, the TLS domain was
still always added with tlsenable=yes, because the domains were not compared
just on the address but also on the port – and TLS is always on a different port
than UDP/TCP.

ASTERISK-27106

Change-Id: I14fe9e319e238320b094016980445ef3a5b3337c
2017-07-03 17:59:43 +02:00
Alexander Traud 4398aa8fa4 chan_sip: Fix a typo for tlsbindaddr in autodomain (SIP Domain Support).
Because of a copy-and-paste error when the struct ast_sockaddr changed,
tlsbindaddr was not added, when sip.conf contained autodomain=yes; see
"show sip domains" on the command-line interface (CLI) of Asterisk.

ASTERISK-27106

Change-Id: I3d0957150017c223136968ef1266f275d0d6695e
2017-07-03 17:38:32 +02:00
Sean Bright 950b39a4f5 app_voicemail: Cleanup ODBC connection handling
The primary focus of this patch is adding a missing call to
ast_odbc_release_obj(), but is also a general cleanup of the ODBC
related code in app_voicemail.

ASTERISK-27093 #close

Change-Id: I8e285142eaeb3146b4287a928276b70db76c902b
2017-07-01 07:11:58 -05:00
Corey Farrell 50ddb56dad channel: Clear channel flag in error branch.
Clear channel flag AST_FLAG_END_DTMF_ONLY in ast_waitfordigit_full when
ast_read returns NULL.

ASTERISK-27100 #close

Change-Id: Id3039e9a4e74e0cb359f636c9fd0c9740ebf7d9d
2017-07-01 00:05:42 -05:00
Jenkins2 b62a3f0a67 Merge "app_queue: Fix returning to dialplan when a queue is empty" 2017-06-30 15:52:38 -05:00
Richard Mudgett b485f6c59c pjsip_distributor.c: Fix deadlock with TCP type transports.
When a SIP message comes in on a transport, pjproject obtains the lock on
the transport and pulls the data out of the socket.  Unlike UDP, the TCP
transport does not allow concurrent access.  Without concurrency the
transport lock is not released when the transport's message complete
callback is called.  The processing continues and eventually Asterisk
starts processing the SIP message.  The first thing Asterisk tries to do
is determine the associated dialog of the message to determine the
associated serializer.  To get the associated serializer safely requires
us to get the dialog lock.

To send a request or response message for a dialog, pjproject obtains the
dialog lock and then obtains the transport lock.  Deadlock can result
because of the opposite order the locks are obtained.

* Fix the deadlock by obtaining the serializer associated with the dialog
another way that doesn't involve obtaining the dialog lock.  In this case,
we use an ao2 container to hold the associated endpoint and serializer.
The new locks are held a brief time and won't overlap other existing lock
times.

ASTERISK-27090 #close

Change-Id: I9ed63f4da9649e9db6ed4be29c360968917a89bd
2017-06-30 13:04:37 -05:00
Richard Mudgett 65a5ac0168 pjsip_distributor.c: Fix unidentified_requests hash functions.
The OBJ_SEARCH_xxx defines should not be used as if they were individual
bits.  They represent a multi-bit enumeration value field.

Change-Id: I32abc9a475396dab02402a7014357dd94284e17b
2017-06-30 12:01:21 -05:00
Jenkins2 e1c0e14fac Merge "res_pjsip: Add DTMF INFO Failback mode" 2017-06-30 11:57:00 -05:00
Joshua Colp 16e43ef701 Merge "res_rtp_asterisk: Fix issues with ICE renegotiation." 2017-06-30 11:47:42 -05:00
Kevin Harwell e7d41050e0 app_stream_echo: misc bug fixes
Fixed the following bugs:

* calls to stream_echo_write had the last two parameters swapped
* ast_read should have been ast_read_stream
* added a null check on the frame's subclass format

This also resets the update_sent flag upon receiving SRRCHANGE control frame.
This will then force a video update.

ASTERISK-26997

Change-Id: I6ad7c8253559b800800433c52339e7f5aa583566
2017-06-30 10:57:34 -05:00
Kevin Harwell 7df7b8a90c res_rtp_asterisk: trigger source change control frame when dtls is established
There needed to be a way to notify handlers upstream that DTLS had been
established. This patch makes it so once DTLS has been estalished a source
change control frame is put into the read queue. Any handlers can then watch
for that frame and trigger off of it.

ASTERISK-27096 #close

Change-Id: I27ff344f5a8c691a1890dfe3254a4b1a49e7f4a0
2017-06-30 10:57:33 -05:00
George Joseph f573e599c0 pjproject_bundled: Allow passing configure options to bundled
There wasn't any good way to pass options like --host or --build
down to the pjproject configure which makes cross-compiling difficult.

* Added a new PJPROJECT_CONFIGURE_OPTS environment variable which
  can be used to pass arbitrary options to pjproject configure.
* Automatically set the pjproject configure --host and --build
  options to match those supplied for the asterisk configure.

ASTERISK-27097 #close
Reported-by: Kinsey Moore

Change-Id: I5fa776e110262851173002a26ffe1172e4c35b2e
2017-06-30 09:00:40 -05:00
George Joseph c0c99c7618 chan_pjsip: Fix ability to send UPDATE on COLP
When connected_line_method is "invite", we're supposed to determine
if the client can support UPDATE and if it can, send UPDATE instead
of INVITE to avoid the SDP renegotiation.  Not only was pjproject
not setting the PJSIP_INV_SUPPORT_UPDATE flag, we were testing
that invite_tsx wasn't NULL which isn't always the case.

* Updated chan_pjsip/update_connected_line_information to drop the
  requirement that invite_tsx isn't NULL.
* Submitted patch to pjproject sip_inv.c that sets the
  PJSIP_INV_SUPPORT_UPDATE flag correctly.
* Updated pjsip.conf.sample to clarify what happens when "invite"
  is specified.

ASTERISK-27095

Change-Id: Ic2381b3567b8052c616d96fbe79564c530e81560
2017-06-29 15:45:58 -05:00
Jenkins2 366971827a Merge "app_voicemail: IMAP connection control" 2017-06-29 09:51:54 -05:00
Torrey Searle fb7247c57c res_pjsip: Add DTMF INFO Failback mode
The existing auto dtmf mode reverts to inband if 4733 fails to be
negotiated.  This patch adds a new mode auto_info which will
switch to INFO instead of inband if 4733 is not available.

ASTERISK-27066 #close

Change-Id: Id185b11e84afd9191a2f269e8443019047765e91
2017-06-29 07:57:01 -06:00
Niklas Larsson ab7d99e62d app_queue: Add priority to AMI QueueStatus
Add priority to callers in AMI QueueStatus response

ASTERISK-27092 #close

Change-Id: I8d1f737a72c7c38f4cfe1a4ee3ecc0a4f85bd199
2017-06-29 03:55:02 -05:00
Mark Michelson 45df25a579 chan_pjsip: Add support for multiple streams of the same type.
The stream topology (list of streams and order) is now stored with the
configured PJSIP endpoints and used during the negotiation process.

Media negotiation state information has been changed to be stored
in a separate object. Two of these objects exist at any one time
on a session. The active media state information is what was previously
negotiated and the pending media state information is what the
media state will become if negotiation succeeds. Streams and other
state information is stored in this object using the index (or
position) of each individual stream for easy lookup.

The ability for a media type handler to specify a callback for
writing has been added as well as the ability to add file
descriptors with a callback which is invoked when data is available
to be read on them. This allows media logic to live outside of
the chan_pjsip module.

Direct media has been changed so that only the first audio and
video stream are directly connected. In the future once the RTP
engine glue API has been updated to know about streams each individual
stream can be directly connected as appropriate.

Media negotiation itself will currently answer all the provided streams
on an offer within configured limits and on an offer will use the
topology created as a result of the disallow/allow codec lines.

If a stream has been removed or declined we will now mark it as such
within the resulting SDP.

Applications can now also request that the stream topology change.
If we are told to do so we will limit any provided formats to the ones
configured on the endpoint and send a re-invite with the new topology.

Two new configuration options have also been added to PJSIP endpoints:

max_audio_streams: determines the maximum number of audio streams to
offer/accept from an endpoint. Defaults to 1.

max_video_streams: determines the maximum number of video streams to
offer/accept from an endpoint. Defaults to 1.

ASTERISK-27076

Change-Id: I8afd8dd2eb538806a39b887af0abd046266e14c7
2017-06-28 18:36:29 +00:00
Joshua Colp 642f8356ab res_rtp_asterisk: Fix issues with ICE renegotiation.
When re-inviting to add more streams it is possible for
the role of existing ICE sessions to be changed to the
incorrect value. This results in subsequent refreshes
within the sessions getting a role conflict and the ICE
session breaking down. This change only sets the role to
be the new value if an ICE renegotiation is actually
going to happen, otherwise the existing role is preserved.

As well if we encounter a situation where a unidirectional
ICE negotiation happens and the other side does not send us
candidates we will not store any information for sending
traffic, even though we know where they are reachable. This
change fixes this by using the source of the ICE traffic
itself as the target if no candidates are known and we
receive some ICE traffic.

ASTERISK-27088

Change-Id: I71228181e358917fcefc3100fad21b2fc02a59a9
2017-06-28 09:14:21 -05:00