summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2014-03-06 18:20:37 +0000
committerJoshua Colp <jcolp@digium.com>2014-03-06 18:20:37 +0000
commit3f730662f7906027c302896abd549a32123ec848 (patch)
treeaf8cebbb9e464be139a2580f248f53c03f91ce68 /res
parent59ff66ef0275ff9985a3cd3168fc797cf152b38e (diff)
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 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410027 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r--res/ari/ari_model_validators.c16
-rw-r--r--res/ari/ari_model_validators.h1
-rw-r--r--res/ari/resource_bridges.c1
-rw-r--r--res/ari/resource_channels.c1
-rw-r--r--res/res_stasis_recording.c5
5 files changed, 22 insertions, 2 deletions
diff --git a/res/ari/ari_model_validators.c b/res/ari/ari_model_validators.c
index 88cfc2697..5c24b9c41 100644
--- a/res/ari/ari_model_validators.c
+++ b/res/ari/ari_model_validators.c
@@ -1026,6 +1026,7 @@ int ast_ari_validate_live_recording(struct ast_json *json)
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) {
@@ -1067,6 +1068,16 @@ int ast_ari_validate_live_recording(struct ast_json *json)
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
{
ast_log(LOG_ERROR,
"ARI LiveRecording has undocumented field %s\n",
@@ -1090,6 +1101,11 @@ int ast_ari_validate_live_recording(struct ast_json *json)
res = 0;
}
+ if (!has_target_uri) {
+ ast_log(LOG_ERROR, "ARI LiveRecording missing required field target_uri\n");
+ res = 0;
+ }
+
return res;
}
diff --git a/res/ari/ari_model_validators.h b/res/ari/ari_model_validators.h
index c299724eb..7214a5875 100644
--- a/res/ari/ari_model_validators.h
+++ b/res/ari/ari_model_validators.h
@@ -1146,6 +1146,7 @@ ari_validator ast_ari_validate_application_fn(void);
* - format: string (required)
* - name: string (required)
* - state: string (required)
+ * - target_uri: string (required)
* StoredRecording
* - format: string (required)
* - name: string (required)
diff --git a/res/ari/resource_bridges.c b/res/ari/resource_bridges.c
index 9f6562b50..a8f2c3c04 100644
--- a/res/ari/resource_bridges.c
+++ b/res/ari/resource_bridges.c
@@ -462,6 +462,7 @@ void ast_ari_bridges_record(struct ast_variable *headers,
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 =
diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c
index 97d9bb3cf..35520702a 100644
--- a/res/ari/resource_channels.c
+++ b/res/ari/resource_channels.c
@@ -468,6 +468,7 @@ void ast_ari_channels_record(struct ast_variable *headers,
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 =
diff --git a/res/res_stasis_recording.c b/res/res_stasis_recording.c
index 70536dcb1..080ee7b81 100644
--- a/res/res_stasis_recording.c
+++ b/res/res_stasis_recording.c
@@ -476,10 +476,11 @@ struct ast_json *stasis_app_recording_to_json(
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);
}