[asterisk-commits] file: trunk r410027 - in /trunk: ./ include/asterisk/ res/ res/ari/ rest-api/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 6 12:20:40 CST 2014


Author: file
Date: Thu Mar  6 12:20:37 2014
New Revision: 410027

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=410027
Log:
res_stasis_recording: Add a "target_uri" field to recording events.

This change adds a target_uri field to the live recording object. It
contains the URI of what is being recorded.

(closes issue ASTERISK-23258)
Reported by: Ben Merrills

Review: https://reviewboard.asterisk.org/r/3299/
........

Merged revisions 410025 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/CHANGES
    trunk/include/asterisk/stasis_app_recording.h
    trunk/res/ari/ari_model_validators.c
    trunk/res/ari/ari_model_validators.h
    trunk/res/ari/resource_bridges.c
    trunk/res/ari/resource_channels.c
    trunk/res/res_stasis_recording.c
    trunk/rest-api/api-docs/recordings.json

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=410027&r1=410026&r2=410027
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Thu Mar  6 12:20:37 2014
@@ -88,6 +88,15 @@
    been added to allow creation and deletion of dynamic logger channels
    without configuration changes. These dynamic logger channels will only
    exist until the next restart of asterisk.
+
+------------------------------------------------------------------------------
+--- Functionality changes from Asterisk 12.1.0 to Asterisk 12.2.0 ------------
+------------------------------------------------------------------------------
+
+ARI
+------------------
+ * The live recording object on recording events now contains a target_uri
+   field which contains the URI of what is being recorded.
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 12.0.0 to Asterisk 12.1.0 ------------

Modified: trunk/include/asterisk/stasis_app_recording.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/stasis_app_recording.h?view=diff&rev=410027&r1=410026&r2=410027
==============================================================================
--- trunk/include/asterisk/stasis_app_recording.h (original)
+++ trunk/include/asterisk/stasis_app_recording.h Thu Mar  6 12:20:37 2014
@@ -140,6 +140,7 @@
 	AST_DECLARE_STRING_FIELDS(
 		AST_STRING_FIELD(name);	/*!< name Name of the recording. */
 		AST_STRING_FIELD(format);	/*!< Format to be recorded (wav, gsm, etc.) */
+		AST_STRING_FIELD(target); /*!< URI of what is being recorded */
 		);
 	/*! Number of seconds of silence before ending the recording. */
 	int max_silence_seconds;

Modified: trunk/res/ari/ari_model_validators.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/ari/ari_model_validators.c?view=diff&rev=410027&r1=410026&r2=410027
==============================================================================
--- trunk/res/ari/ari_model_validators.c (original)
+++ trunk/res/ari/ari_model_validators.c Thu Mar  6 12:20:37 2014
@@ -1026,6 +1026,7 @@
 	int has_format = 0;
 	int has_name = 0;
 	int has_state = 0;
+	int has_target_uri = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
 		if (strcmp("cause", ast_json_object_iter_key(iter)) == 0) {
@@ -1064,6 +1065,16 @@
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
 				ast_log(LOG_ERROR, "ARI LiveRecording field state failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("target_uri", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_target_uri = 1;
+			prop_is_valid = ast_ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI LiveRecording field target_uri failed validation\n");
 				res = 0;
 			}
 		} else
@@ -1087,6 +1098,11 @@
 
 	if (!has_state) {
 		ast_log(LOG_ERROR, "ARI LiveRecording missing required field state\n");
+		res = 0;
+	}
+
+	if (!has_target_uri) {
+		ast_log(LOG_ERROR, "ARI LiveRecording missing required field target_uri\n");
 		res = 0;
 	}
 

Modified: trunk/res/ari/ari_model_validators.h
URL: http://svnview.digium.com/svn/asterisk/trunk/res/ari/ari_model_validators.h?view=diff&rev=410027&r1=410026&r2=410027
==============================================================================
--- trunk/res/ari/ari_model_validators.h (original)
+++ trunk/res/ari/ari_model_validators.h Thu Mar  6 12:20:37 2014
@@ -1146,6 +1146,7 @@
  * - format: string (required)
  * - name: string (required)
  * - state: string (required)
+ * - target_uri: string (required)
  * StoredRecording
  * - format: string (required)
  * - name: string (required)

Modified: trunk/res/ari/resource_bridges.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/ari/resource_bridges.c?view=diff&rev=410027&r1=410026&r2=410027
==============================================================================
--- trunk/res/ari/resource_bridges.c (original)
+++ trunk/res/ari/resource_bridges.c Thu Mar  6 12:20:37 2014
@@ -462,6 +462,7 @@
 		return;
 	}
 
+	ast_string_field_build(options, target, "bridge:%s", args->bridge_id);
 	options->max_silence_seconds = args->max_silence_seconds;
 	options->max_duration_seconds = args->max_duration_seconds;
 	options->terminate_on =

Modified: trunk/res/ari/resource_channels.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/ari/resource_channels.c?view=diff&rev=410027&r1=410026&r2=410027
==============================================================================
--- trunk/res/ari/resource_channels.c (original)
+++ trunk/res/ari/resource_channels.c Thu Mar  6 12:20:37 2014
@@ -468,6 +468,7 @@
 			response, 500, "Internal Server Error",
 			"Out of memory");
 	}
+	ast_string_field_build(options, target, "channel:%s", args->channel_id);
 	options->max_silence_seconds = args->max_silence_seconds;
 	options->max_duration_seconds = args->max_duration_seconds;
 	options->terminate_on =

Modified: trunk/res/res_stasis_recording.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_stasis_recording.c?view=diff&rev=410027&r1=410026&r2=410027
==============================================================================
--- trunk/res/res_stasis_recording.c (original)
+++ trunk/res/res_stasis_recording.c Thu Mar  6 12:20:37 2014
@@ -476,10 +476,11 @@
 		return NULL;
 	}
 
-	json = ast_json_pack("{s: s, s: s, s: s}",
+	json = ast_json_pack("{s: s, s: s, s: s, s: s}",
 		"name", recording->options->name,
 		"format", recording->options->format,
-		"state", state_to_string(recording->state));
+		"state", state_to_string(recording->state),
+		"target_uri", recording->options->target);
 
 	return ast_json_ref(json);
 }

Modified: trunk/rest-api/api-docs/recordings.json
URL: http://svnview.digium.com/svn/asterisk/trunk/rest-api/api-docs/recordings.json?view=diff&rev=410027&r1=410026&r2=410027
==============================================================================
--- trunk/rest-api/api-docs/recordings.json (original)
+++ trunk/rest-api/api-docs/recordings.json Thu Mar  6 12:20:37 2014
@@ -291,6 +291,11 @@
 					"required": true,
 					"type": "string",
 					"description": "Recording format (wav, gsm, etc.)"
+				},
+				"target_uri": {
+					"required": true,
+					"type": "string",
+					"description": "URI for the channel or bridge being recorded"
 				},
 				"state": {
 					"required": false,




More information about the asterisk-commits mailing list