mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	Merge "core: Remove 'Data Retrieval API'"
This commit is contained in:
		| @@ -4560,7 +4560,6 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou | ||||
| 	check_init(app_init(), "App Core"); | ||||
| 	check_init(devstate_init(), "Device State Core"); | ||||
| 	check_init(ast_msg_init(), "Messaging API"); | ||||
| 	check_init(ast_data_init(), "Data Retrieval API"); | ||||
| 	check_init(ast_channels_init(), "Channel"); | ||||
| 	check_init(ast_endpoint_init(), "Endpoints"); | ||||
| 	check_init(ast_pickup_init(), "Call Pickup"); | ||||
|   | ||||
| @@ -60,7 +60,6 @@ | ||||
| #include "asterisk/config.h" | ||||
| #include "asterisk/cli.h" | ||||
| #include "asterisk/stringfields.h" | ||||
| #include "asterisk/data.h" | ||||
| #include "asterisk/config_options.h" | ||||
| #include "asterisk/json.h" | ||||
| #include "asterisk/parking.h" | ||||
|   | ||||
							
								
								
									
										120
									
								
								main/channel.c
									
									
									
									
									
								
							
							
						
						
									
										120
									
								
								main/channel.c
									
									
									
									
									
								
							| @@ -66,7 +66,6 @@ | ||||
| #include "asterisk/autochan.h" | ||||
| #include "asterisk/stringfields.h" | ||||
| #include "asterisk/global_datastores.h" | ||||
| #include "asterisk/data.h" | ||||
| #include "asterisk/channel_internal.h" | ||||
| #include "asterisk/features.h" | ||||
| #include "asterisk/bridge.h" | ||||
| @@ -7568,122 +7567,6 @@ int ast_plc_reload(void) | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| /*! | ||||
|  * \internal | ||||
|  * \brief Implements the channels provider. | ||||
|  */ | ||||
| static int data_channels_provider_handler(const struct ast_data_search *search, | ||||
| 	struct ast_data *root) | ||||
| { | ||||
| 	struct ast_channel *c; | ||||
| 	struct ast_channel_iterator *iter = NULL; | ||||
| 	struct ast_data *data_channel; | ||||
|  | ||||
| 	for (iter = ast_channel_iterator_all_new(); | ||||
| 		iter && (c = ast_channel_iterator_next(iter)); ast_channel_unref(c)) { | ||||
| 		ast_channel_lock(c); | ||||
|  | ||||
| 		data_channel = ast_data_add_node(root, "channel"); | ||||
| 		if (!data_channel) { | ||||
| 			ast_channel_unlock(c); | ||||
| 			continue; | ||||
| 		} | ||||
|  | ||||
| 		if (ast_channel_data_add_structure(data_channel, c, 1) < 0) { | ||||
| 			ast_log(LOG_ERROR, "Unable to add channel structure for channel: %s\n", ast_channel_name(c)); | ||||
| 		} | ||||
|  | ||||
| 		ast_channel_unlock(c); | ||||
|  | ||||
| 		if (!ast_data_search_match(search, data_channel)) { | ||||
| 			ast_data_remove_node(root, data_channel); | ||||
| 		} | ||||
| 	} | ||||
| 	if (iter) { | ||||
| 		ast_channel_iterator_destroy(iter); | ||||
| 	} | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| /*! | ||||
|  * \internal | ||||
|  * \brief Implements the channeltypes provider. | ||||
|  */ | ||||
| static int data_channeltypes_provider_handler(const struct ast_data_search *search, | ||||
| 	struct ast_data *data_root) | ||||
| { | ||||
| 	struct chanlist *cl; | ||||
| 	struct ast_data *data_type; | ||||
|  | ||||
| 	AST_RWLIST_RDLOCK(&backends); | ||||
| 	AST_RWLIST_TRAVERSE(&backends, cl, list) { | ||||
| 		data_type = ast_data_add_node(data_root, "type"); | ||||
| 		if (!data_type) { | ||||
| 			continue; | ||||
| 		} | ||||
| 		ast_data_add_str(data_type, "name", cl->tech->type); | ||||
| 		ast_data_add_str(data_type, "description", cl->tech->description); | ||||
| 		ast_data_add_bool(data_type, "devicestate", cl->tech->devicestate ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "presencestate", cl->tech->presencestate ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "indications", cl->tech->indicate ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "transfer", cl->tech->transfer ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "send_digit_begin", cl->tech->send_digit_begin ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "send_digit_end", cl->tech->send_digit_end ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "call", cl->tech->call ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "hangup", cl->tech->hangup ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "answer", cl->tech->answer ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "read", cl->tech->read ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "write", cl->tech->write ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "send_text", cl->tech->send_text ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "send_image", cl->tech->send_image ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "send_html", cl->tech->send_html ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "exception", cl->tech->exception ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "early_bridge", cl->tech->early_bridge ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "fixup", cl->tech->fixup ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "setoption", cl->tech->setoption ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "queryoption", cl->tech->queryoption ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "write_video", cl->tech->write_video ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "write_text", cl->tech->write_text ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "func_channel_read", cl->tech->func_channel_read ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "func_channel_write", cl->tech->func_channel_write ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "get_pvt_uniqueid", cl->tech->get_pvt_uniqueid ? 1 : 0); | ||||
| 		ast_data_add_bool(data_type, "cc_callback", cl->tech->cc_callback ? 1 : 0); | ||||
|  | ||||
| 		ast_data_add_codecs(data_type, "capabilities", cl->tech->capabilities); | ||||
|  | ||||
| 		if (!ast_data_search_match(search, data_type)) { | ||||
| 			ast_data_remove_node(data_root, data_type); | ||||
| 		} | ||||
| 	} | ||||
| 	AST_RWLIST_UNLOCK(&backends); | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| /*! | ||||
|  * \internal | ||||
|  * \brief /asterisk/core/channels provider. | ||||
|  */ | ||||
| static const struct ast_data_handler channels_provider = { | ||||
| 	.version = AST_DATA_HANDLER_VERSION, | ||||
| 	.get = data_channels_provider_handler | ||||
| }; | ||||
|  | ||||
| /*! | ||||
|  * \internal | ||||
|  * \brief /asterisk/core/channeltypes provider. | ||||
|  */ | ||||
| static const struct ast_data_handler channeltypes_provider = { | ||||
| 	.version = AST_DATA_HANDLER_VERSION, | ||||
| 	.get = data_channeltypes_provider_handler | ||||
| }; | ||||
|  | ||||
| static const struct ast_data_entry channel_providers[] = { | ||||
| 	AST_DATA_ENTRY("/asterisk/core/channels", &channels_provider), | ||||
| 	AST_DATA_ENTRY("/asterisk/core/channeltypes", &channeltypes_provider), | ||||
| }; | ||||
|  | ||||
| /*! | ||||
|  * \internal | ||||
|  * \brief Print channel object key (name). | ||||
| @@ -7883,7 +7766,6 @@ static void channels_shutdown(void) | ||||
| 	free_external_channelvars(&ami_vars); | ||||
| 	free_external_channelvars(&ari_vars); | ||||
|  | ||||
| 	ast_data_unregister(NULL); | ||||
| 	ast_cli_unregister_multiple(cli_channel, ARRAY_LEN(cli_channel)); | ||||
| 	if (channels) { | ||||
| 		ao2_container_unregister("channels"); | ||||
| @@ -7908,8 +7790,6 @@ int ast_channels_init(void) | ||||
|  | ||||
| 	ast_cli_register_multiple(cli_channel, ARRAY_LEN(cli_channel)); | ||||
|  | ||||
| 	ast_data_register_multiple_core(channel_providers, ARRAY_LEN(channel_providers)); | ||||
|  | ||||
| 	ast_plc_reload(); | ||||
|  | ||||
| 	ast_register_cleanup(channels_shutdown); | ||||
|   | ||||
| @@ -40,7 +40,6 @@ | ||||
| #include "asterisk/paths.h" | ||||
| #include "asterisk/channel.h" | ||||
| #include "asterisk/channel_internal.h" | ||||
| #include "asterisk/data.h" | ||||
| #include "asterisk/endpoints.h" | ||||
| #include "asterisk/indications.h" | ||||
| #include "asterisk/stasis_cache_pattern.h" | ||||
| @@ -226,211 +225,6 @@ struct ast_channel { | ||||
| /*! \brief The monotonically increasing integer counter for channel uniqueids */ | ||||
| static int uniqueint; | ||||
|  | ||||
| /* AST_DATA definitions, which will probably have to be re-thought since the channel will be opaque */ | ||||
|  | ||||
| #if 0	/* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */ | ||||
| #define DATA_EXPORT_CALLERID(MEMBER)				\ | ||||
| 	MEMBER(ast_callerid, cid_dnid, AST_DATA_STRING)		\ | ||||
| 	MEMBER(ast_callerid, cid_num, AST_DATA_STRING)		\ | ||||
| 	MEMBER(ast_callerid, cid_name, AST_DATA_STRING)		\ | ||||
| 	MEMBER(ast_callerid, cid_ani, AST_DATA_STRING)		\ | ||||
| 	MEMBER(ast_callerid, cid_pres, AST_DATA_INTEGER)	\ | ||||
| 	MEMBER(ast_callerid, cid_ani2, AST_DATA_INTEGER)	\ | ||||
| 	MEMBER(ast_callerid, cid_tag, AST_DATA_STRING) | ||||
|  | ||||
| AST_DATA_STRUCTURE(ast_callerid, DATA_EXPORT_CALLERID); | ||||
| #endif | ||||
|  | ||||
| #define DATA_EXPORT_CHANNEL(MEMBER)						\ | ||||
| 	MEMBER(ast_channel, blockproc, AST_DATA_STRING)				\ | ||||
| 	MEMBER(ast_channel, appl, AST_DATA_STRING)				\ | ||||
| 	MEMBER(ast_channel, data, AST_DATA_STRING)				\ | ||||
| 	MEMBER(ast_channel, name, AST_DATA_STRING) \ | ||||
| 	MEMBER(ast_channel, language, AST_DATA_STRING)				\ | ||||
| 	MEMBER(ast_channel, musicclass, AST_DATA_STRING)			\ | ||||
| 	MEMBER(ast_channel, accountcode, AST_DATA_STRING)			\ | ||||
| 	MEMBER(ast_channel, peeraccount, AST_DATA_STRING)			\ | ||||
| 	MEMBER(ast_channel, userfield, AST_DATA_STRING)				\ | ||||
| 	MEMBER(ast_channel, call_forward, AST_DATA_STRING)			\ | ||||
| 	MEMBER(ast_channel, parkinglot, AST_DATA_STRING)			\ | ||||
| 	MEMBER(ast_channel, hangupsource, AST_DATA_STRING)			\ | ||||
| 	MEMBER(ast_channel, dialcontext, AST_DATA_STRING)			\ | ||||
| 	MEMBER(ast_channel, rings, AST_DATA_INTEGER)				\ | ||||
| 	MEMBER(ast_channel, priority, AST_DATA_INTEGER)				\ | ||||
| 	MEMBER(ast_channel, macropriority, AST_DATA_INTEGER)			\ | ||||
| 	MEMBER(ast_channel, adsicpe, AST_DATA_INTEGER)				\ | ||||
| 	MEMBER(ast_channel, fin, AST_DATA_UNSIGNED_INTEGER)			\ | ||||
| 	MEMBER(ast_channel, fout, AST_DATA_UNSIGNED_INTEGER)			\ | ||||
| 	MEMBER(ast_channel, emulate_dtmf_duration, AST_DATA_UNSIGNED_INTEGER)	\ | ||||
| 	MEMBER(ast_channel, visible_indication, AST_DATA_INTEGER)		\ | ||||
| 	MEMBER(ast_channel, context, AST_DATA_STRING)				\ | ||||
| 	MEMBER(ast_channel, exten, AST_DATA_STRING)				\ | ||||
| 	MEMBER(ast_channel, macrocontext, AST_DATA_STRING)			\ | ||||
| 	MEMBER(ast_channel, macroexten, AST_DATA_STRING) | ||||
|  | ||||
| AST_DATA_STRUCTURE(ast_channel, DATA_EXPORT_CHANNEL); | ||||
|  | ||||
| static void channel_data_add_flags(struct ast_data *tree, | ||||
| 	struct ast_channel *chan) | ||||
| { | ||||
| 	ast_data_add_bool(tree, "DEFER_DTMF", ast_test_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF)); | ||||
| 	ast_data_add_bool(tree, "WRITE_INT", ast_test_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT)); | ||||
| 	ast_data_add_bool(tree, "BLOCKING", ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING)); | ||||
| 	ast_data_add_bool(tree, "ZOMBIE", ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE)); | ||||
| 	ast_data_add_bool(tree, "EXCEPTION", ast_test_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION)); | ||||
| 	ast_data_add_bool(tree, "MOH", ast_test_flag(ast_channel_flags(chan), AST_FLAG_MOH)); | ||||
| 	ast_data_add_bool(tree, "SPYING", ast_test_flag(ast_channel_flags(chan), AST_FLAG_SPYING)); | ||||
| 	ast_data_add_bool(tree, "IN_AUTOLOOP", ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP)); | ||||
| 	ast_data_add_bool(tree, "OUTGOING", ast_test_flag(ast_channel_flags(chan), AST_FLAG_OUTGOING)); | ||||
| 	ast_data_add_bool(tree, "IN_DTMF", ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_DTMF)); | ||||
| 	ast_data_add_bool(tree, "EMULATE_DTMF", ast_test_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF)); | ||||
| 	ast_data_add_bool(tree, "END_DTMF_ONLY", ast_test_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY)); | ||||
| 	ast_data_add_bool(tree, "MASQ_NOSTREAM", ast_test_flag(ast_channel_flags(chan), AST_FLAG_MASQ_NOSTREAM)); | ||||
| 	ast_data_add_bool(tree, "BRIDGE_HANGUP_RUN", ast_test_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_RUN)); | ||||
| 	ast_data_add_bool(tree, "DISABLE_WORKAROUNDS", ast_test_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS)); | ||||
| 	ast_data_add_bool(tree, "DISABLE_DEVSTATE_CACHE", ast_test_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_DEVSTATE_CACHE)); | ||||
| 	ast_data_add_bool(tree, "BRIDGE_DUAL_REDIRECT_WAIT", ast_test_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_DUAL_REDIRECT_WAIT)); | ||||
| 	ast_data_add_bool(tree, "ORIGINATED", ast_test_flag(ast_channel_flags(chan), AST_FLAG_ORIGINATED)); | ||||
| 	ast_data_add_bool(tree, "DEAD", ast_test_flag(ast_channel_flags(chan), AST_FLAG_DEAD)); | ||||
| } | ||||
|  | ||||
| int ast_channel_data_add_structure(struct ast_data *tree, | ||||
| 	struct ast_channel *chan, int add_bridged) | ||||
| { | ||||
| 	struct ast_data *data_bridged; | ||||
| 	struct ast_data *data_cdr; | ||||
| 	struct ast_data *data_flags; | ||||
| 	struct ast_data *data_zones; | ||||
| 	struct ast_data *enum_node; | ||||
| 	struct ast_data *data_softhangup; | ||||
| #if 0	/* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */ | ||||
| 	struct ast_data *data_callerid; | ||||
| 	char value_str[100]; | ||||
| #endif | ||||
|  | ||||
| 	if (!tree) { | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| 	ast_data_add_structure(ast_channel, tree, chan); | ||||
|  | ||||
| 	if (add_bridged) { | ||||
| 		RAII_VAR(struct ast_channel *, bc, ast_channel_bridge_peer(chan), ast_channel_cleanup); | ||||
| 		if (bc) { | ||||
| 			data_bridged = ast_data_add_node(tree, "bridged"); | ||||
| 			if (!data_bridged) { | ||||
| 				return -1; | ||||
| 			} | ||||
| 			ast_channel_data_add_structure(data_bridged, bc, 0); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	ast_data_add_str(tree, "uniqueid", ast_channel_uniqueid(chan)); | ||||
| 	ast_data_add_str(tree, "linkedid", ast_channel_linkedid(chan)); | ||||
|  | ||||
| 	ast_data_add_codec(tree, "oldwriteformat", ast_channel_oldwriteformat(chan)); | ||||
| 	ast_data_add_codec(tree, "readformat", ast_channel_readformat(chan)); | ||||
| 	ast_data_add_codec(tree, "writeformat", ast_channel_writeformat(chan)); | ||||
| 	ast_data_add_codec(tree, "rawreadformat", ast_channel_rawreadformat(chan)); | ||||
| 	ast_data_add_codec(tree, "rawwriteformat", ast_channel_rawwriteformat(chan)); | ||||
| 	ast_data_add_codecs(tree, "nativeformats", ast_channel_nativeformats(chan)); | ||||
|  | ||||
| 	/* state */ | ||||
| 	enum_node = ast_data_add_node(tree, "state"); | ||||
| 	if (!enum_node) { | ||||
| 		return -1; | ||||
| 	} | ||||
| 	ast_data_add_str(enum_node, "text", ast_state2str(ast_channel_state(chan))); | ||||
| 	ast_data_add_int(enum_node, "value", ast_channel_state(chan)); | ||||
|  | ||||
| 	/* hangupcause */ | ||||
| 	enum_node = ast_data_add_node(tree, "hangupcause"); | ||||
| 	if (!enum_node) { | ||||
| 		return -1; | ||||
| 	} | ||||
| 	ast_data_add_str(enum_node, "text", ast_cause2str(ast_channel_hangupcause(chan))); | ||||
| 	ast_data_add_int(enum_node, "value", ast_channel_hangupcause(chan)); | ||||
|  | ||||
| 	/* amaflags */ | ||||
| 	enum_node = ast_data_add_node(tree, "amaflags"); | ||||
| 	if (!enum_node) { | ||||
| 		return -1; | ||||
| 	} | ||||
| 	ast_data_add_str(enum_node, "text", ast_channel_amaflags2string(ast_channel_amaflags(chan))); | ||||
| 	ast_data_add_int(enum_node, "value", ast_channel_amaflags(chan)); | ||||
|  | ||||
| 	/* transfercapability */ | ||||
| 	enum_node = ast_data_add_node(tree, "transfercapability"); | ||||
| 	if (!enum_node) { | ||||
| 		return -1; | ||||
| 	} | ||||
| 	ast_data_add_str(enum_node, "text", ast_transfercapability2str(ast_channel_transfercapability(chan))); | ||||
| 	ast_data_add_int(enum_node, "value", ast_channel_transfercapability(chan)); | ||||
|  | ||||
| 	/* _softphangup */ | ||||
| 	data_softhangup = ast_data_add_node(tree, "softhangup"); | ||||
| 	if (!data_softhangup) { | ||||
| 		return -1; | ||||
| 	} | ||||
| 	ast_data_add_bool(data_softhangup, "dev", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_DEV); | ||||
| 	ast_data_add_bool(data_softhangup, "asyncgoto", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_ASYNCGOTO); | ||||
| 	ast_data_add_bool(data_softhangup, "shutdown", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_SHUTDOWN); | ||||
| 	ast_data_add_bool(data_softhangup, "timeout", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_TIMEOUT); | ||||
| 	ast_data_add_bool(data_softhangup, "appunload", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_APPUNLOAD); | ||||
| 	ast_data_add_bool(data_softhangup, "explicit", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_EXPLICIT); | ||||
|  | ||||
| 	/* channel flags */ | ||||
| 	data_flags = ast_data_add_node(tree, "flags"); | ||||
| 	if (!data_flags) { | ||||
| 		return -1; | ||||
| 	} | ||||
| 	channel_data_add_flags(data_flags, chan); | ||||
|  | ||||
| 	ast_data_add_uint(tree, "timetohangup", ast_channel_whentohangup(chan)->tv_sec); | ||||
|  | ||||
| #if 0	/* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */ | ||||
| 	/* callerid */ | ||||
| 	data_callerid = ast_data_add_node(tree, "callerid"); | ||||
| 	if (!data_callerid) { | ||||
| 		return -1; | ||||
| 	} | ||||
| 	ast_data_add_structure(ast_callerid, data_callerid, &(chan->cid)); | ||||
| 	/* insert the callerid ton */ | ||||
| 	enum_node = ast_data_add_node(data_callerid, "cid_ton"); | ||||
| 	if (!enum_node) { | ||||
| 		return -1; | ||||
| 	} | ||||
| 	ast_data_add_int(enum_node, "value", chan->cid.cid_ton); | ||||
| 	snprintf(value_str, sizeof(value_str), "TON: %s/Plan: %s", | ||||
| 		party_number_ton2str(chan->cid.cid_ton), | ||||
| 		party_number_plan2str(chan->cid.cid_ton)); | ||||
| 	ast_data_add_str(enum_node, "text", value_str); | ||||
| #endif | ||||
|  | ||||
| 	/* tone zone */ | ||||
| 	if (ast_channel_zone(chan)) { | ||||
| 		data_zones = ast_data_add_node(tree, "zone"); | ||||
| 		if (!data_zones) { | ||||
| 			return -1; | ||||
| 		} | ||||
| 		ast_tone_zone_data_add_structure(data_zones, ast_channel_zone(chan)); | ||||
| 	} | ||||
|  | ||||
| 	/* insert cdr */ | ||||
| 	data_cdr = ast_data_add_node(tree, "cdr"); | ||||
| 	if (!data_cdr) { | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| int ast_channel_data_cmp_structure(const struct ast_data_search *tree, | ||||
| 	struct ast_channel *chan, const char *structure_name) | ||||
| { | ||||
| 	return ast_data_search_cmp_structure(tree, ast_channel, chan, structure_name); | ||||
| } | ||||
|  | ||||
| /* ACCESSORS */ | ||||
|  | ||||
| #define DEFINE_STRINGFIELD_SETTERS_FOR(field, publish, assert_on_null) \ | ||||
|   | ||||
							
								
								
									
										3346
									
								
								main/data.c
									
									
									
									
									
								
							
							
						
						
									
										3346
									
								
								main/data.c
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -41,23 +41,9 @@ | ||||
| #include "asterisk/cli.h" | ||||
| #include "asterisk/module.h" | ||||
| #include "asterisk/astobj2.h" | ||||
| #include "asterisk/data.h" | ||||
|  | ||||
| #include "asterisk/_private.h" /* _init(), _reload() */ | ||||
|  | ||||
| #define DATA_EXPORT_TONE_ZONE(MEMBER)					\ | ||||
| 	MEMBER(ast_tone_zone, country, AST_DATA_STRING)			\ | ||||
| 	MEMBER(ast_tone_zone, description, AST_DATA_STRING)		\ | ||||
| 	MEMBER(ast_tone_zone, nrringcadence, AST_DATA_UNSIGNED_INTEGER) | ||||
|  | ||||
| AST_DATA_STRUCTURE(ast_tone_zone, DATA_EXPORT_TONE_ZONE); | ||||
|  | ||||
| #define DATA_EXPORT_TONE_ZONE_SOUND(MEMBER)			\ | ||||
| 	MEMBER(ast_tone_zone_sound, name, AST_DATA_STRING)	\ | ||||
| 	MEMBER(ast_tone_zone_sound, data, AST_DATA_STRING) | ||||
|  | ||||
| AST_DATA_STRUCTURE(ast_tone_zone_sound, DATA_EXPORT_TONE_ZONE_SOUND); | ||||
|  | ||||
| /* Globals */ | ||||
| static const char config[] = "indications.conf"; | ||||
|  | ||||
| @@ -1124,33 +1110,6 @@ static int ast_tone_zone_cmp(void *obj, void *arg, int flags) | ||||
| 			CMP_MATCH | CMP_STOP : 0; | ||||
| } | ||||
|  | ||||
| int ast_tone_zone_data_add_structure(struct ast_data *tree, struct ast_tone_zone *zone) | ||||
| { | ||||
| 	struct ast_data *data_zone_sound; | ||||
| 	struct ast_tone_zone_sound *s; | ||||
|  | ||||
| 	ast_data_add_structure(ast_tone_zone, tree, zone); | ||||
|  | ||||
| 	if (AST_LIST_EMPTY(&zone->tones)) { | ||||
| 		return 0; | ||||
| 	} | ||||
|  | ||||
| 	data_zone_sound = ast_data_add_node(tree, "tones"); | ||||
| 	if (!data_zone_sound) { | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| 	ast_tone_zone_lock(zone); | ||||
|  | ||||
| 	AST_LIST_TRAVERSE(&zone->tones, s, entry) { | ||||
| 		ast_data_add_structure(ast_tone_zone_sound, data_zone_sound, s); | ||||
| 	} | ||||
|  | ||||
| 	ast_tone_zone_unlock(zone); | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| /*! | ||||
|  * \internal | ||||
|  * \brief Clean up resources on Asterisk shutdown | ||||
|   | ||||
							
								
								
									
										52
									
								
								main/pbx.c
									
									
									
									
									
								
							
							
						
						
									
										52
									
								
								main/pbx.c
									
									
									
									
									
								
							| @@ -8306,56 +8306,6 @@ static void presence_state_cb(void *unused, struct stasis_subscription *sub, str | ||||
| 	ast_free(hint_app); | ||||
| } | ||||
|  | ||||
| /*! | ||||
|  * \internal | ||||
|  * \brief Implements the hints data provider. | ||||
|  */ | ||||
| static int hints_data_provider_get(const struct ast_data_search *search, | ||||
| 	struct ast_data *data_root) | ||||
| { | ||||
| 	struct ast_data *data_hint; | ||||
| 	struct ast_hint *hint; | ||||
| 	int watchers; | ||||
| 	struct ao2_iterator i; | ||||
|  | ||||
| 	if (ao2_container_count(hints) == 0) { | ||||
| 		return 0; | ||||
| 	} | ||||
|  | ||||
| 	i = ao2_iterator_init(hints, 0); | ||||
| 	for (; (hint = ao2_iterator_next(&i)); ao2_ref(hint, -1)) { | ||||
| 		watchers = ao2_container_count(hint->callbacks); | ||||
| 		data_hint = ast_data_add_node(data_root, "hint"); | ||||
| 		if (!data_hint) { | ||||
| 			continue; | ||||
| 		} | ||||
| 		ast_data_add_str(data_hint, "extension", ast_get_extension_name(hint->exten)); | ||||
| 		ast_data_add_str(data_hint, "context", ast_get_context_name(ast_get_extension_context(hint->exten))); | ||||
| 		ast_data_add_str(data_hint, "application", ast_get_extension_app(hint->exten)); | ||||
| 		ast_data_add_str(data_hint, "state", ast_extension_state2str(hint->laststate)); | ||||
| 		ast_data_add_str(data_hint, "presence_state", ast_presence_state2str(hint->last_presence_state)); | ||||
| 		ast_data_add_str(data_hint, "presence_subtype", S_OR(hint->last_presence_subtype, "")); | ||||
| 		ast_data_add_str(data_hint, "presence_subtype", S_OR(hint->last_presence_message, "")); | ||||
| 		ast_data_add_int(data_hint, "watchers", watchers); | ||||
|  | ||||
| 		if (!ast_data_search_match(search, data_hint)) { | ||||
| 			ast_data_remove_node(data_root, data_hint); | ||||
| 		} | ||||
| 	} | ||||
| 	ao2_iterator_destroy(&i); | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| static const struct ast_data_handler hints_data_provider = { | ||||
| 	.version = AST_DATA_HANDLER_VERSION, | ||||
| 	.get = hints_data_provider_get | ||||
| }; | ||||
|  | ||||
| static const struct ast_data_entry pbx_data_providers[] = { | ||||
| 	AST_DATA_ENTRY("asterisk/core/hints", &hints_data_provider), | ||||
| }; | ||||
|  | ||||
| static int action_extensionstatelist(struct mansession *s, const struct message *m) | ||||
| { | ||||
| 	const char *action_id = astman_get_header(m, "ActionID"); | ||||
| @@ -8431,7 +8381,6 @@ static void unload_pbx(void) | ||||
| 	ast_cli_unregister_multiple(pbx_cli, ARRAY_LEN(pbx_cli)); | ||||
| 	ast_custom_function_unregister(&exception_function); | ||||
| 	ast_custom_function_unregister(&testtime_function); | ||||
| 	ast_data_unregister(NULL); | ||||
| } | ||||
|  | ||||
| int load_pbx(void) | ||||
| @@ -8445,7 +8394,6 @@ int load_pbx(void) | ||||
|  | ||||
| 	ast_verb(2, "Registering builtin functions:\n"); | ||||
| 	ast_cli_register_multiple(pbx_cli, ARRAY_LEN(pbx_cli)); | ||||
| 	ast_data_register_multiple_core(pbx_data_providers, ARRAY_LEN(pbx_data_providers)); | ||||
| 	__ast_custom_function_register(&exception_function, NULL); | ||||
| 	__ast_custom_function_register(&testtime_function, NULL); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user