diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index 10fb70259..ef51779fc 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -1689,7 +1689,7 @@ stats: } static void ng_stats_monologue(bencode_item_t *dict, const struct call_monologue *ml, - struct call_stats *totals) + struct call_stats *totals, bencode_item_t *ssrc) { bencode_item_t *sub, *medias = NULL; GList *l; @@ -1723,7 +1723,7 @@ static void ng_stats_monologue(bencode_item_t *dict, const struct call_monologue bencode_dictionary_add_str(sub1, "tag", &cs->monologue->tag); bencode_dictionary_add_string(sub1, "type", cs->offer_answer ? "offer/answer" : "pub/sub"); } - ng_stats_ssrc(bencode_dictionary_add_dictionary(sub, "SSRC"), ml->ssrc_hash); + ng_stats_ssrc(ssrc, ml->ssrc_hash); medias = bencode_dictionary_add_list(sub, "medias"); @@ -1766,6 +1766,8 @@ static void ng_stats_ssrc(bencode_item_t *dict, struct ssrc_hash *ht) { struct ssrc_entry_call *se = l->data; char *tmp = bencode_buffer_alloc(dict->buffer, 12); snprintf(tmp, 12, "%" PRIu32, se->h.ssrc); + if (bencode_dictionary_get(dict, tmp)) + continue; bencode_item_t *ent = bencode_dictionary_add_dictionary(dict, tmp); if (!se->stats_blocks.length || !se->lowest_mos || !se->highest_mos) @@ -1826,6 +1828,7 @@ void ng_call_stats(struct call *call, const str *fromtag, const str *totag, benc bencode_dictionary_add_integer(output, "created", call->created.tv_sec); bencode_dictionary_add_integer(output, "created_us", call->created.tv_usec); bencode_dictionary_add_integer(output, "last signal", call->last_signal); + bencode_item_t *ssrc = bencode_dictionary_add_dictionary(output, "SSRC"); tags = bencode_dictionary_add_dictionary(output, "tags"); @@ -1835,16 +1838,16 @@ stats: if (!match_tag || !match_tag->len) { for (l = call->monologues.head; l; l = l->next) { ml = l->data; - ng_stats_monologue(tags, ml, totals); + ng_stats_monologue(tags, ml, totals, ssrc); } } else { ml = call_get_monologue(call, match_tag); if (ml) { - ng_stats_monologue(tags, ml, totals); + ng_stats_monologue(tags, ml, totals, ssrc); for (GList *l = ml->subscriptions.head; l; l = l->next) { struct call_subscription *cs = l->data; - ng_stats_monologue(tags, cs->monologue, totals); + ng_stats_monologue(tags, cs->monologue, totals, ssrc); } } }