diff options
author | Matt Jordan <mjordan@digium.com> | 2015-12-26 15:29:04 -0600 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2016-03-23 13:53:31 -0300 |
commit | ca14b99e6e7a80f648521ec81512cbadab2ed6cd (patch) | |
tree | 71707b033e1a594e14ce526266bfe2ebc487f4e2 /main/file.c | |
parent | 01962a393250125bb86c638b1786fbcc18a246cc (diff) |
main/file: Add the ability to play media in the media cache
This patch allows applications/APIs that access media through the core file
APIs to play media in the media cache. Prior to determining if a 'filename'
exists, the filename is passed to the media cache's retrieve API call. If
that call succeeds, the local file specified passed back by the API is
opened for streaming. When used in this fashion, the 'filename' is actually
a URI that the media cache process and understand.
ASTERISK-25654 #close
Change-Id: I73b6e2e90c3e91b8500581c45cdf9c0dc785f5f0
Diffstat (limited to 'main/file.c')
-rw-r--r-- | main/file.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/main/file.c b/main/file.c index f0f826a4f..654937a58 100644 --- a/main/file.c +++ b/main/file.c @@ -54,6 +54,7 @@ ASTERISK_REGISTER_FILE() #include "asterisk/stasis.h" #include "asterisk/json.h" #include "asterisk/stasis_system.h" +#include "asterisk/media_cache.h" /*! \brief * The following variable controls the layout of localized sound files. @@ -644,6 +645,10 @@ static int fileexists_test(const char *filename, const char *fmt, const char *la return 0; } + if (!ast_media_cache_retrieve(filename, NULL, buf, buflen)) { + return filehelper(buf, result_cap, NULL, ACTION_EXISTS); + } + if (ast_language_is_prefix && !is_absolute_path(filename)) { /* new layout */ if (lang) { snprintf(buf, buflen, "%s/%s", lang, filename); |