diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index a3e7f9d9a..a143d7ab2 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -2353,7 +2353,7 @@ static void ng_stats_endpoint(const ng_parser_t *parser, bencode_item_t *dict, c if (!ep->address.family) return; parser->dict_add_string(dict, "family", ep->address.family->name); - bencode_dictionary_add_str_dup(dict, "address", &STR(sockaddr_print_buf(&ep->address))); + parser->dict_add_str_dup(dict, "address", &STR(sockaddr_print_buf(&ep->address))); parser->dict_add_int(dict, "port", ep->port); } @@ -2393,7 +2393,7 @@ static void ng_stats_stream(const ng_parser_t *parser, bencode_item_t *list, con if (ps->selected_sfd) { parser->dict_add_int(dict, "local port", ps->selected_sfd->socket.local.port); - bencode_dictionary_add_str_dup(dict, "local address", + parser->dict_add_str_dup(dict, "local address", &STR(sockaddr_print_buf(&ps->selected_sfd->socket.local.address))); parser->dict_add_string(dict, "family", ps->selected_sfd->socket.local.address.family->name); } @@ -2457,7 +2457,7 @@ static void ng_stats_media(const ng_parser_t *parser, bencode_item_t *list, cons if (m->protocol) parser->dict_add_string(dict, "protocol", m->protocol->name); if (rtp_pt) - bencode_dictionary_add_str_dup(dict, "codec", &rtp_pt->encoding_with_params); + parser->dict_add_str_dup(dict, "codec", &rtp_pt->encoding_with_params); streams = parser->dict_add_list(dict, "streams"); @@ -3754,7 +3754,7 @@ const char *call_subscribe_request_ng(ng_parser_ctx_t *ctx) { if (srms.length == 1) { struct media_subscription *ms = srms.head->data; struct call_monologue *source_ml = ms->monologue; - bencode_dictionary_add_str_dup(output, "from-tag", &source_ml->tag); + ctx->parser->dict_add_str_dup(output, "from-tag", &source_ml->tag); } bencode_item_t *tag_medias = NULL, *media_labels = NULL; if (flags.siprec) { @@ -3796,7 +3796,7 @@ const char *call_subscribe_request_ng(ng_parser_ctx_t *ctx) { } } - bencode_dictionary_add_str_dup(output, "to-tag", &dest_ml->tag); + ctx->parser->dict_add_str_dup(output, "to-tag", &dest_ml->tag); dequeue_sdp_fragments(dest_ml); diff --git a/daemon/control_ng.c b/daemon/control_ng.c index 1752428e9..ca97107de 100644 --- a/daemon/control_ng.c +++ b/daemon/control_ng.c @@ -148,6 +148,7 @@ const ng_parser_t ng_parser_native = { .dict_add = bencode_dictionary_add, .dict_add_string = bencode_dictionary_add_string, .dict_add_str = bencode_dictionary_add_str, + .dict_add_str_dup = bencode_dictionary_add_str_dup, .dict_add_int = bencode_dictionary_add_integer, .dict_add_dict = bencode_dictionary_add_dictionary, .dict_add_list = bencode_dictionary_add_list, @@ -170,6 +171,7 @@ const ng_parser_t ng_parser_json = { .dict_add = bencode_dictionary_add, .dict_add_string = bencode_dictionary_add_string, .dict_add_str = bencode_dictionary_add_str, + .dict_add_str_dup = bencode_dictionary_add_str_dup, .dict_add_int = bencode_dictionary_add_integer, .dict_add_dict = bencode_dictionary_add_dictionary, .dict_add_list = bencode_dictionary_add_list, diff --git a/daemon/statistics.c b/daemon/statistics.c index dd6d81f37..6890e07aa 100644 --- a/daemon/statistics.c +++ b/daemon/statistics.c @@ -971,10 +971,10 @@ const char *statistics_ng(ng_parser_ctx_t *ctx) { ctx->parser->dict_add_int(dict, bencode_strdup(buf, m->label), m->int_value); else if (m->value_raw) - bencode_dictionary_add_str_dup(dict, bencode_strdup(buf, m->label), + ctx->parser->dict_add_str_dup(dict, bencode_strdup(buf, m->label), &STR(m->value_raw)); else - bencode_dictionary_add_str_dup(dict, bencode_strdup(buf, m->label), + ctx->parser->dict_add_str_dup(dict, bencode_strdup(buf, m->label), &STR(m->value_short)); continue; } diff --git a/include/control_ng.h b/include/control_ng.h index b814a097f..54997d9e2 100644 --- a/include/control_ng.h +++ b/include/control_ng.h @@ -126,6 +126,7 @@ struct ng_parser { bencode_item_t *(*dict_add)(bencode_item_t *, const char *, bencode_item_t *); void (*dict_add_string)(bencode_item_t *, const char *, const char *); void (*dict_add_str)(bencode_item_t *, const char *, const str *); + void (*dict_add_str_dup)(bencode_item_t *, const char *, const str *); void (*dict_add_int)(bencode_item_t *, const char *, long long); bencode_item_t *(*dict_add_dict)(bencode_item_t *, const char *); bencode_item_t *(*dict_add_list)(bencode_item_t *, const char *);