mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 18:55:19 +00:00 
			
		
		
		
	res_pjsip: Fix empty ActiveChannels property in AMI responses.
				
					
				
			The logic appears to have been reversed since it was introduced in
05cbf8df.
Resolves: #1254
			
			
This commit is contained in:
		
				
					committed by
					
						![github-actions[bot]](/avatar/af2ab225b7c0eec44a8d0eba6b5c869a?size=40) github-actions[bot]
						github-actions[bot]
					
				
			
			
				
	
			
			
			
						parent
						
							c873f2ae7e
						
					
				
				
					commit
					c7a82711f6
				
			| @@ -1710,14 +1710,6 @@ int ast_sip_for_each_channel( | |||||||
| 	return ast_sip_for_each_channel_snapshot(endpoint_snapshot, on_channel_snapshot, arg); | 	return ast_sip_for_each_channel_snapshot(endpoint_snapshot, on_channel_snapshot, arg); | ||||||
| } | } | ||||||
|  |  | ||||||
| static int active_channels_to_str_cb(void *object, void *arg, int flags) |  | ||||||
| { |  | ||||||
| 	const struct ast_channel_snapshot *snapshot = object; |  | ||||||
| 	struct ast_str **buf = arg; |  | ||||||
| 	ast_str_append(buf, 0, "%s,", snapshot->base->name); |  | ||||||
| 	return 0; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void active_channels_to_str(const struct ast_sip_endpoint *endpoint, | static void active_channels_to_str(const struct ast_sip_endpoint *endpoint, | ||||||
| 				   struct ast_str **str) | 				   struct ast_str **str) | ||||||
| { | { | ||||||
| @@ -1725,13 +1717,8 @@ static void active_channels_to_str(const struct ast_sip_endpoint *endpoint, | |||||||
| 	RAII_VAR(struct ast_endpoint_snapshot *, endpoint_snapshot, | 	RAII_VAR(struct ast_endpoint_snapshot *, endpoint_snapshot, | ||||||
| 		 ast_sip_get_endpoint_snapshot(endpoint), ao2_cleanup); | 		 ast_sip_get_endpoint_snapshot(endpoint), ao2_cleanup); | ||||||
|  |  | ||||||
| 	if (endpoint_snapshot) { | 	ast_str_append(str, 0, "%d", | ||||||
| 		return; | 		endpoint_snapshot ? endpoint_snapshot->num_channels : 0); | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	ast_sip_for_each_channel_snapshot(endpoint_snapshot, |  | ||||||
| 					  active_channels_to_str_cb, str); |  | ||||||
| 	ast_str_truncate(*str, -1); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| #define AMI_DEFAULT_STR_SIZE 512 | #define AMI_DEFAULT_STR_SIZE 512 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user