mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	Add vtable and methods for to_json and to_ami for Stasis messages
When a Stasis message type is defined in a loadable module, handling those messages for AMI and res_stasis events can be cumbersome. This patch adds a vtable to stasis_message_type, with to_ami and to_json virtual functions. These allow messages to be handled abstractly without putting module-specific code in core. As an example, the VarSet AMI event was refactored to use the to_ami virtual function. (closes issue ASTERISK-21817) Review: https://reviewboard.asterisk.org/r/2579/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391403 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		| @@ -71,7 +71,7 @@ AST_TEST_DEFINE(channel_blob_create) | ||||
| 		break; | ||||
| 	} | ||||
|  | ||||
| 	type = stasis_message_type_create("test-type"); | ||||
| 	type = stasis_message_type_create("test-type", NULL); | ||||
| 	chan = ast_channel_alloc(0, AST_STATE_DOWN, "100", "Alice", "100", "100", "default", NULL, 0, "TEST/Alice"); | ||||
| 	json = ast_json_pack("{s: s}", | ||||
| 		     "foo", "bar"); | ||||
| @@ -123,7 +123,7 @@ AST_TEST_DEFINE(null_blob) | ||||
| 		break; | ||||
| 	} | ||||
|  | ||||
| 	type = stasis_message_type_create("test-type"); | ||||
| 	type = stasis_message_type_create("test-type", NULL); | ||||
| 	chan = ast_channel_alloc(0, AST_STATE_DOWN, "100", "Alice", "100", "100", "default", NULL, 0, "TEST/Alice"); | ||||
| 	json = ast_json_pack("{s: s}", | ||||
| 		     "foo", "bar"); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user