mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 18:55:19 +00:00 
			
		
		
		
	ARI event type filtering
Event type filtering is now enabled, and configurable per application. An app is
now able to specify which events are sent to the application by configuring an
allowed and/or disallowed list(s). This can be done by issuing the following:
PUT /applications/{applicationName}/eventFilter
And then enumerating the allowed/disallowed event types as a body parameter.
ASTERISK-28106
Change-Id: I9671ba1fcdb3b6c830b553d4c5365aed5d588d5b
			
			
This commit is contained in:
		
				
					committed by
					
						 George Joseph
						George Joseph
					
				
			
			
				
	
			
			
			
						parent
						
							0eb27e1970
						
					
				
				
					commit
					8681fc9db7
				
			| @@ -6534,6 +6534,8 @@ int ast_ari_validate_application(struct ast_json *json) | ||||
| 	int has_channel_ids = 0; | ||||
| 	int has_device_names = 0; | ||||
| 	int has_endpoint_ids = 0; | ||||
| 	int has_events_allowed = 0; | ||||
| 	int has_events_disallowed = 0; | ||||
| 	int has_name = 0; | ||||
|  | ||||
| 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) { | ||||
| @@ -6581,6 +6583,28 @@ int ast_ari_validate_application(struct ast_json *json) | ||||
| 				res = 0; | ||||
| 			} | ||||
| 		} else | ||||
| 		if (strcmp("events_allowed", ast_json_object_iter_key(iter)) == 0) { | ||||
| 			int prop_is_valid; | ||||
| 			has_events_allowed = 1; | ||||
| 			prop_is_valid = ast_ari_validate_list( | ||||
| 				ast_json_object_iter_value(iter), | ||||
| 				ast_ari_validate_object); | ||||
| 			if (!prop_is_valid) { | ||||
| 				ast_log(LOG_ERROR, "ARI Application field events_allowed failed validation\n"); | ||||
| 				res = 0; | ||||
| 			} | ||||
| 		} else | ||||
| 		if (strcmp("events_disallowed", ast_json_object_iter_key(iter)) == 0) { | ||||
| 			int prop_is_valid; | ||||
| 			has_events_disallowed = 1; | ||||
| 			prop_is_valid = ast_ari_validate_list( | ||||
| 				ast_json_object_iter_value(iter), | ||||
| 				ast_ari_validate_object); | ||||
| 			if (!prop_is_valid) { | ||||
| 				ast_log(LOG_ERROR, "ARI Application field events_disallowed failed validation\n"); | ||||
| 				res = 0; | ||||
| 			} | ||||
| 		} else | ||||
| 		if (strcmp("name", ast_json_object_iter_key(iter)) == 0) { | ||||
| 			int prop_is_valid; | ||||
| 			has_name = 1; | ||||
| @@ -6619,6 +6643,16 @@ int ast_ari_validate_application(struct ast_json *json) | ||||
| 		res = 0; | ||||
| 	} | ||||
|  | ||||
| 	if (!has_events_allowed) { | ||||
| 		ast_log(LOG_ERROR, "ARI Application missing required field events_allowed\n"); | ||||
| 		res = 0; | ||||
| 	} | ||||
|  | ||||
| 	if (!has_events_disallowed) { | ||||
| 		ast_log(LOG_ERROR, "ARI Application missing required field events_disallowed\n"); | ||||
| 		res = 0; | ||||
| 	} | ||||
|  | ||||
| 	if (!has_name) { | ||||
| 		ast_log(LOG_ERROR, "ARI Application missing required field name\n"); | ||||
| 		res = 0; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user