Пример #1
0
static struct ast_json *channel_dialplan(
	struct ast_channel_snapshot *old_snapshot,
	struct ast_channel_snapshot *new_snapshot,
	const struct timeval *tv)
{
	struct ast_json *json_channel;

	/* No Newexten event on first channel snapshot */
	if (!old_snapshot) {
		return NULL;
	}

	/* Empty application is not valid for a Newexten event */
	if (ast_strlen_zero(new_snapshot->dialplan->appl)) {
		return NULL;
	}

	if (ast_channel_snapshot_cep_equal(old_snapshot, new_snapshot)) {
		return NULL;
	}

	json_channel = ast_channel_snapshot_to_json(new_snapshot, stasis_app_get_sanitizer());
	if (!json_channel) {
		return NULL;
	}

	return ast_json_pack("{s: s, s: o, s: s, s: s, s: o}",
		"type", "ChannelDialplan",
		"timestamp", ast_json_timeval(*tv, NULL),
		"dialplan_app", new_snapshot->dialplan->appl,
		"dialplan_app_data", AST_JSON_UTF8_VALIDATE(new_snapshot->dialplan->data),
		"channel", json_channel);
}
Пример #2
0
static struct ast_json *json_party_subaddress(struct ast_party_subaddress *subaddress)
{
	if (!subaddress->valid) {
		return NULL;
	}
	return ast_json_pack("{s: s, s: i, s: b}",
		"subaddress", AST_JSON_UTF8_VALIDATE(subaddress->str),
		"type", subaddress->type,
		"odd", subaddress->odd_even_indicator);
}
Пример #3
0
static struct ast_json *json_party_number(struct ast_party_number *number)
{
	if (!number->valid) {
		return NULL;
	}
	return ast_json_pack("{s: s, s: i, s: i, s: s}",
		"number", AST_JSON_UTF8_VALIDATE(number->str),
		"plan", number->plan,
		"presentation", number->presentation,
		"presentation_txt", ast_describe_caller_presentation(number->presentation));
}
Пример #4
0
static struct ast_json *json_party_name(struct ast_party_name *name)
{
	if (!name->valid) {
		return NULL;
	}
	return ast_json_pack("{s: s, s: s, s: i, s: s}",
		"name", AST_JSON_UTF8_VALIDATE(name->str),
		"character_set", ast_party_name_charset_describe(name->char_set),
		"presentation", name->presentation,
		"presentation_txt", ast_describe_caller_presentation(name->presentation));
}
Пример #5
0
struct ast_json *ast_json_name_number(const char *name, const char *number)
{
	return ast_json_pack("{s: s, s: s}",
		"name", AST_JSON_UTF8_VALIDATE(name),
		"number", AST_JSON_UTF8_VALIDATE(number));
}