mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 18:55:19 +00:00 
			
		
		
		
	Remove required type field from channel blobs
When we first introduced the channel blob types, the JSON blobs were self identifying by a required "type" field in the JSON object itself. This, as it turns out, was a bad idea. When we introduced the message router, it was useless for routing based on the JSON type. And messages had two type fields to check: the stasis_message_type() of the message itself, plus the type field in the JSON blob (but only if it was a blob message). This patch corrects that mistake by removing the required type field from JSON blobs, and introducing first class stasis_message_type objects for the actual message type. Since we now will have a proliferation of message types, I introduced a few macros to help reduce the amount of boilerplate necessary to set them up. Review: https://reviewboard.asterisk.org/r/2509 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@388005 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		| @@ -93,7 +93,6 @@ static int userevent_exec(struct ast_channel *chan, const char *data) | ||||
| 	} | ||||
|  | ||||
| 	blob = ast_json_pack("{s: s, s: s, s: s}", | ||||
| 			     "type", "userevent", | ||||
| 			     "eventname", args.eventname, | ||||
| 			     "body", ast_str_buffer(body)); | ||||
| 	if (!blob) { | ||||
| @@ -101,7 +100,8 @@ static int userevent_exec(struct ast_channel *chan, const char *data) | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| 	msg = ast_channel_blob_create(chan, blob); | ||||
| 	msg = ast_channel_blob_create( | ||||
| 		chan, ast_channel_user_event_type(), blob); | ||||
| 	if (!msg) { | ||||
| 		return -1; | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user