summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2015-04-10 14:56:05 +0000
committerMatthew Jordan <mjordan@digium.com>2015-04-10 14:56:05 +0000
commit894153b8b1557903c1d512994aecedb326dc0951 (patch)
tree2289d2ea42cf16a6e8181eb7c2bf3efa969a7a39
parent02a0a4d65f9962c210e9407c34c9cb6192f22b5e (diff)
res/ari: Fix model validation for ChannelHold event
When the ChannelHold event was added, the 'musicclass' parameter was erroneously removed. This caused the ChannelHold events to be rejected as they failed model validation. This patch updates the Swagger schema such that it now properly reflects the event that is being created. Hooray for tests that catch things like this. ........ Merged revisions 434597 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434598 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--res/ari/ari_model_validators.c9
-rw-r--r--res/ari/ari_model_validators.h1
-rw-r--r--rest-api/api-docs/events.json5
3 files changed, 15 insertions, 0 deletions
diff --git a/res/ari/ari_model_validators.c b/res/ari/ari_model_validators.c
index 007d7657f..97435d025 100644
--- a/res/ari/ari_model_validators.c
+++ b/res/ari/ari_model_validators.c
@@ -3245,6 +3245,15 @@ int ast_ari_validate_channel_hold(struct ast_json *json)
res = 0;
}
} else
+ if (strcmp("musicclass", ast_json_object_iter_key(iter)) == 0) {
+ int prop_is_valid;
+ prop_is_valid = ast_ari_validate_string(
+ ast_json_object_iter_value(iter));
+ if (!prop_is_valid) {
+ ast_log(LOG_ERROR, "ARI ChannelHold field musicclass failed validation\n");
+ res = 0;
+ }
+ } else
{
ast_log(LOG_ERROR,
"ARI ChannelHold has undocumented field %s\n",
diff --git a/res/ari/ari_model_validators.h b/res/ari/ari_model_validators.h
index 9cb1bc32c..1fafba3b5 100644
--- a/res/ari/ari_model_validators.h
+++ b/res/ari/ari_model_validators.h
@@ -1434,6 +1434,7 @@ ari_validator ast_ari_validate_application_fn(void);
* - application: string (required)
* - timestamp: Date
* - channel: Channel (required)
+ * - musicclass: string
* ChannelLeftBridge
* - type: string (required)
* - application: string (required)
diff --git a/rest-api/api-docs/events.json b/rest-api/api-docs/events.json
index f5e61f9ad..35c9377e5 100644
--- a/rest-api/api-docs/events.json
+++ b/rest-api/api-docs/events.json
@@ -608,6 +608,11 @@
"required": true,
"type": "Channel",
"description": "The channel that initiated the hold event."
+ },
+ "musicclass": {
+ "required": false,
+ "type": "string",
+ "description": "The music on hold class that the initiator requested."
}
}
},