[asterisk-commits] mjordan: branch 13 r434597 - in /branches/13: res/ari/ rest-api/api-docs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 10 09:55:56 CDT 2015


Author: mjordan
Date: Fri Apr 10 09:55:54 2015
New Revision: 434597

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=434597
Log:
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.

Modified:
    branches/13/res/ari/ari_model_validators.c
    branches/13/res/ari/ari_model_validators.h
    branches/13/rest-api/api-docs/events.json

Modified: branches/13/res/ari/ari_model_validators.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/res/ari/ari_model_validators.c?view=diff&rev=434597&r1=434596&r2=434597
==============================================================================
--- branches/13/res/ari/ari_model_validators.c (original)
+++ branches/13/res/ari/ari_model_validators.c Fri Apr 10 09:55:54 2015
@@ -3245,6 +3245,15 @@
 				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",

Modified: branches/13/res/ari/ari_model_validators.h
URL: http://svnview.digium.com/svn/asterisk/branches/13/res/ari/ari_model_validators.h?view=diff&rev=434597&r1=434596&r2=434597
==============================================================================
--- branches/13/res/ari/ari_model_validators.h (original)
+++ branches/13/res/ari/ari_model_validators.h Fri Apr 10 09:55:54 2015
@@ -1434,6 +1434,7 @@
  * - application: string (required)
  * - timestamp: Date
  * - channel: Channel (required)
+ * - musicclass: string
  * ChannelLeftBridge
  * - type: string (required)
  * - application: string (required)

Modified: branches/13/rest-api/api-docs/events.json
URL: http://svnview.digium.com/svn/asterisk/branches/13/rest-api/api-docs/events.json?view=diff&rev=434597&r1=434596&r2=434597
==============================================================================
--- branches/13/rest-api/api-docs/events.json (original)
+++ branches/13/rest-api/api-docs/events.json Fri Apr 10 09:55:54 2015
@@ -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."
 				}
 			}
 		},




More information about the asterisk-commits mailing list