[asterisk-commits] main/file: Add the ability to play media in the media cache (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 23 16:51:59 CDT 2016


Joshua Colp has submitted this change and it was merged.

Change subject: main/file: Add the ability to play media in the media cache
......................................................................


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
---
M CHANGES
M main/file.c
2 files changed, 31 insertions(+), 0 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, approved; Verified
  George Joseph: Looks good to me, but someone else must approve



diff --git a/CHANGES b/CHANGES
index f19704d..da516ef 100644
--- a/CHANGES
+++ b/CHANGES
@@ -31,6 +31,21 @@
    - record_command: a command to execute when recording is finished
    Note that these options may also be with the CONFBRIDGE function.
 
+ControlPlayback
+------------------
+ * Remote files can now be retrieved and played back. See the Playback
+   dialplan application for more details.
+
+Playback
+------------------
+ * Remote files can now be retrieved and played back via the Playback and other
+   media playback dialplan applications. This is done by directly providing
+   the URL to play to the dialplan application:
+     same => n,Playback(http://1.1.1.1/howler-monkeys-fl.wav)
+   Note that unlike 'normal' media files, the entire URI to the file must be
+   provided, including the file extension. Currently, on HTTP and HTTPS URI
+   schemes are supported.
+
 SMS
 ------------------
  * Added the 'n' option, which prevents the SMS from being written to the log
@@ -132,6 +147,17 @@
    of '[json]' can be set, e.g.,
       full => [json]debug,verbose,notice,warning,error
 
+ * The core now supports a 'media cache', which stores temporary media files
+   retrieved from external sources. CLI commands have been added to manipulate
+   and display the cached files, including:
+   - 'media cache show <all>' - show all cached media files, or details about
+     one particular cached media file
+   - 'media cache refresh <item>' - force a refresh of a particular media file
+     in the cache
+   - 'media cache delete <item>' - remove an item from the cache
+   - 'media cache create <uri>' - retrieve a URI and store it in the cache
+
+
 Functions
 ------------------
 
diff --git a/main/file.c b/main/file.c
index f0f826a..654937a 100644
--- a/main/file.c
+++ b/main/file.c
@@ -54,6 +54,7 @@
 #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 @@
 		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);

-- 
To view, visit https://gerrit.asterisk.org/1892
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I73b6e2e90c3e91b8500581c45cdf9c0dc785f5f0
Gerrit-PatchSet: 7
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Matthew Fredrickson <creslin at digium.com>



More information about the asterisk-commits mailing list