[svn-commits] dlee: branch dlee/record r389722 - /team/dlee/record/res/stasis_http/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri May 24 08:39:18 CDT 2013


Author: dlee
Date: Fri May 24 08:39:14 2013
New Revision: 389722

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389722
Log:
GET for live recordings works

Modified:
    team/dlee/record/res/stasis_http/resource_recordings.c

Modified: team/dlee/record/res/stasis_http/resource_recordings.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/res/stasis_http/resource_recordings.c?view=diff&rev=389722&r1=389721&r2=389722
==============================================================================
--- team/dlee/record/res/stasis_http/resource_recordings.c (original)
+++ team/dlee/record/res/stasis_http/resource_recordings.c Fri May 24 08:39:14 2013
@@ -27,6 +27,7 @@
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
+#include "asterisk/stasis_app_recording.h"
 #include "resource_recordings.h"
 
 void stasis_http_get_recordings(struct ast_variable *headers, struct ast_get_recordings_args *args, struct stasis_http_response *response)
@@ -49,10 +50,31 @@
 {
 	ast_log(LOG_ERROR, "TODO: stasis_http_get_live_recordings\n");
 }
-void stasis_http_get_live_recording(struct ast_variable *headers, struct ast_get_live_recording_args *args, struct stasis_http_response *response)
+
+void stasis_http_get_live_recording(struct ast_variable *headers,
+	struct ast_get_live_recording_args *args,
+	struct stasis_http_response *response)
 {
-	ast_log(LOG_ERROR, "TODO: stasis_http_get_live_recording\n");
+	RAII_VAR(struct stasis_app_recording *, recording, NULL, ao2_cleanup);
+	RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
+
+	recording = stasis_app_recording_find_by_id(args->recording_id);
+	if (recording == NULL) {
+		stasis_http_response_error(response, 404, "Not Found",
+			"Recording not found");
+		return;
+	}
+
+	json = stasis_app_recording_to_json(recording);
+	if (json == NULL) {
+		stasis_http_response_error(response, 500,
+			"Internal Server Error", "Error building response");
+		return;
+	}
+
+	stasis_http_response_ok(response, ast_json_ref(json));
 }
+
 void stasis_http_cancel_recording(struct ast_variable *headers, struct ast_cancel_recording_args *args, struct stasis_http_response *response)
 {
 	ast_log(LOG_ERROR, "TODO: stasis_http_cancel_recording\n");




More information about the svn-commits mailing list