]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res/ari: Fix model validation for ChannelHold event
authorMatthew Jordan <mjordan@digium.com>
Fri, 10 Apr 2015 14:55:54 +0000 (14:55 +0000)
committerMatthew Jordan <mjordan@digium.com>
Fri, 10 Apr 2015 14:55:54 +0000 (14:55 +0000)
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.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@434597 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/ari/ari_model_validators.c
res/ari/ari_model_validators.h
rest-api/api-docs/events.json

index 007d7657fdf74a1a4488e449e75735bfbde9069d..97435d0252d93df9ed20cde4a4b4d831fcf166f6 100644 (file)
@@ -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",
index 9cb1bc32cb39262501bef27792c753f207dd7dff..1fafba3b5d9ecbb4bf6218c5e94f90fa58c26047 100644 (file)
@@ -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)
index f5e61f9ad9f3acb790e474189b2eff92b45373d8..35c9377e50a74a9886143e5b081534dacd75c98a 100644 (file)
                                        "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."
                                }
                        }
                },