Commit Graph

7 Commits

Author SHA1 Message Date
Sean Bright 90fd1fd96a res_http_media_cache.c: Set reasonable number of redirects
By default libcurl does not follow redirects, so we explicitly enable
it by setting CURLOPT_FOLLOWLOCATION. Once that is enabled, libcurl
will follow up to CURLOPT_MAXREDIRS redirects, which by default is
configured to be unlimited.

This patch sets CURLOPT_MAXREDIRS to a more reasonable default (8). If
we determine at some point that this needs to be increased on
configurable it is a trivial change.

ASTERISK-29173 #close

Change-Id: I4925ebbcf0c7d728bb9252b3795b3479ae225b30
2020-12-09 13:05:27 -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
Corey Farrell 527cf5a570 Remove redundant module checks and references.
This removes references that are no longer needed due to automatic
references created by module dependencies.

In addition this removes most calls to ast_module_check as they were
checking modules which are listed as dependencies.

Change-Id: I332a6e8383d4c72c8e89d988a184ab8320c4872e
2018-01-24 13:37:29 -05:00
Corey Farrell 58fa3885cc Loader: Remove unneeded load_pri declarations.
Instead of specifying AST_MODFLAG_LOAD_ORDER with load_pri
AST_MODPRI_DEFAULT just use AST_MODFLAG_DEFAULT.

Change-Id: I0123258eafce324249433a69df15a85cc16e509f
2017-11-20 13:17:55 -06:00
George Joseph 6db0939b96 modules: change module LOAD_FAILUREs to LOAD_DECLINES (14)
Change-Id: If99e3b4fc2d7e86fc3e61182aa6c835b407ed49e
2017-04-12 15:57:39 -06:00
Corey Farrell a6e5bae3ef Remove ASTERISK_REGISTER_FILE.
ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes
all traces of it.

Previously exported symbols removed:
* __ast_register_file
* __ast_unregister_file
* ast_complete_source_filename

This also removes the mtx_prof static variable that was declared when
MTX_PROFILE was enabled.  This variable was only used in lock.c so it
is now initialized in that file only.

ASTERISK-26480 #close

Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
2016-10-27 09:53:55 -04:00
Matthew Jordan 22e2340813 res/res_http_media_cache: Add an HTTP(S) backend for the core media cache
This patch adds a bucket backend for the core media cache that interfaces to a
remote HTTP server. When a media item is requested in the cache, the cache will
query its bucket backends to see if they can provide the media item. If that
media item has a scheme of HTTP or HTTPS, this backend will be invoked.

The backend provides callbacks for the following:
 * create - this will always retrieve the URI specified by the provided
            bucket_file, and store it in the file specified by the object.
 * retrieve - this will pull the URI specified and store it in a temporary
              file. It is then up to the media cache to move/rename this file
              if desired.
 * delete - destroys the file associated with the bucket_file.
 * stale - if the bucket_file has expired, based on received HTTP headers from
           the remote server, or if the ETag on the server no longer matches
           the ETag stored on the bucket_file, the resource is determined to be
           stale.

Note that the backend respects the ETag, Expires, and Cache-Control headers
provided by the HTTP server it is querying.

ASTERISK-25654

Change-Id: Ie201c2b34cafc0c90a7ee18d7c8359afaccc5250
2016-03-23 13:53:22 -03:00