MT#55283 iqueue for ml and media

Change-Id: Icbf773ac99e097b4c3034847538b463726448209
master
Richard Fuchs 4 days ago
parent 5a5342fea7
commit 1442eb4f9b

@ -75,7 +75,6 @@ static void call_stream_crypto_reset(struct packet_stream *ps);
/* called with call->master_lock held in R */
static void call_timer_delete_monologues(call_t *c) {
struct call_monologue *ml;
int64_t min_deleted = 0;
bool update = false;
@ -83,9 +82,7 @@ static void call_timer_delete_monologues(call_t *c) {
rwlock_unlock_r(&c->master_lock);
rwlock_lock_w(&c->master_lock);
for (__auto_type i = c->monologues.head; i; i = i->next) {
ml = i->data;
IQUEUE_FOREACH(&c->monologues, ml) {
if (!ml->deleted_us)
continue;
if (ml->deleted_us > rtpe_now) {
@ -140,8 +137,7 @@ static void call_timer_iterator(call_t *c, struct iterator_helper *hlp) {
if (final_timeout && rtpe_now >= (c->created + final_timeout)) {
ilog(LOG_INFO, "Closing call due to final timeout");
tmp_t_reason = FINAL_TIMEOUT;
for (__auto_type it = c->monologues.head; it; it = it->next) {
__auto_type ml = it->data;
IQUEUE_FOREACH(&c->monologues, ml) {
ml->terminated = rtpe_now;
ml->term_reason = tmp_t_reason;
}
@ -239,8 +235,7 @@ no_sfd:
if (!recv_checked && !recv_good)
recv_good = silent_good;
for (__auto_type it = c->medias.head; it; it = it->next) {
struct call_media *media = it->data;
IQUEUE_FOREACH(&c->medias, media) {
if (media->protocol && media->protocol->srtp)
has_srtp = true;
@ -280,8 +275,7 @@ no_sfd:
if (c->ml_deleted_us)
goto out;
for (__auto_type it = c->monologues.head; it; it = it->next) {
__auto_type ml = it->data;
IQUEUE_FOREACH(&c->monologues, ml) {
ml->terminated = rtpe_now;
ml->term_reason = tmp_t_reason;
}
@ -436,7 +430,6 @@ fault:
void kill_calls_timer(GSList *list, const char *url) {
call_t *ca;
struct call_monologue *cm;
char *url_prefix = NULL, *url_suffix = NULL;
const char *needle;
struct xmlrpc_helper *xh = NULL;
@ -493,8 +486,7 @@ void kill_calls_timer(GSList *list, const char *url) {
switch (rtpe_config.fmt) {
case XF_SEMS:
for (__auto_type csl = ca->monologues.head; csl; csl = csl->next) {
cm = csl->data;
IQUEUE_FOREACH(&ca->monologues, cm) {
if (!cm->tag.s || !cm->tag.len)
continue;
g_queue_push_tail(&xh->strings, strdup(url_buf));
@ -507,8 +499,7 @@ void kill_calls_timer(GSList *list, const char *url) {
g_queue_push_tail(&xh->strings, str_dup(&ca->callid));
break;
case XF_KAMAILIO:
for (__auto_type csl = ca->monologues.head; csl; csl = csl->next) {
cm = csl->data;
IQUEUE_FOREACH(&ca->monologues, cm) {
if (!cm->tag.s || !cm->tag.len)
continue;
@ -688,7 +679,7 @@ const struct extmap_ops extmap_ops_long = {
struct call_media *call_media_new(call_t *call) {
struct call_media *med;
med = uid_alloc(&call->medias);
med = iuid_alloc(&call->medias);
med->call = call;
codec_store_init(&med->codecs, med);
codec_store_init(&med->offered_codecs, med);
@ -5129,7 +5120,7 @@ static int64_t add_ongoing_calls_dur_in_interval(int64_t interval_start,
if (!call->monologues.head || IS_FOREIGN_CALL(call))
goto next;
ml = call->monologues.head->data;
ml = call->monologues.head;
if (interval_start > ml->started) {
res += interval_duration;
} else {
@ -5159,8 +5150,7 @@ static void __call_cleanup(call_t *c) {
t_queue_clear_full(&ps->rtp_mirrors, free_sink_handler);
}
for (__auto_type l = c->medias.head; l; l = l->next) {
struct call_media *md = l->data;
IQUEUE_FOREACH(&c->medias, md) {
ice_shutdown(&md->ice_agent);
call_media_stop(md);
t38_gateway_put(&md->t38_gateway);
@ -5171,8 +5161,7 @@ static void __call_cleanup(call_t *c) {
sdp_sp_clear(&md->sp);
}
for (__auto_type l = c->monologues.head; l; l = l->next) {
struct call_monologue *ml = l->data;
IQUEUE_FOREACH(&c->monologues, ml) {
if (ml->tone_freqs)
g_array_free(ml->tone_freqs, true);
obj_release(ml->janus_session);
@ -5203,7 +5192,6 @@ static bool __remove_call_id_from_hash(str *callid, call_t *c) {
/* called lock-free, but must hold a reference to the call */
void call_destroy(call_t *c) {
struct call_monologue *ml;
struct call_media *md;
GList *k;
const rtp_payload_type *rtp_pt;
@ -5248,9 +5236,7 @@ void call_destroy(call_t *c) {
ilog(LOG_INFO, "Final packet stats:");
for (__auto_type l = c->monologues.head; l; l = l->next) {
ml = l->data;
IQUEUE_FOREACH(&c->monologues, ml) {
// stats output only - no cleanups
ilog(LOG_INFO, "--- Tag '" STR_FORMAT_M "'%s" STR_FORMAT "%s, created "
@ -5486,12 +5472,12 @@ static void __call_free(call_t *c) {
mqtt_timer_stop(&c->mqtt_timer);
while (c->monologues.head) {
m = t_queue_pop_head(&c->monologues);
m = i_queue_pop_head(&c->monologues);
__monologue_free(m);
}
while (c->medias.head) {
md = t_queue_pop_head(&c->medias);
md = i_queue_pop_head(&c->medias);
call_media_free(md);
}
@ -5720,8 +5706,8 @@ static bool call_merge(call_t *call, call_t *call2) {
}
// chcek for tag collisions: duplicate tags are a failure
for (auto_iter(l, call2->monologues.head); l; l = l->next) {
if (t_hash_table_lookup(call->tags, &l->data->tag))
IQUEUE_FOREACH(&call2->monologues, ml) {
if (t_hash_table_lookup(call->tags, &ml->tag))
return false;
}
@ -5739,12 +5725,12 @@ static bool call_merge(call_t *call, call_t *call2) {
// move all contained objects: we have to renumber all unique IDs, and redirect any
// `call` pointers
unsigned int last_id = call->monologues.head->data->unique_id;
unsigned int last_id = call->monologues.head->unique_id;
while (call2->monologues.head) {
__auto_type ml = t_queue_pop_head(&call2->monologues);
__auto_type ml = i_queue_pop_head(&call2->monologues);
ml->unique_id = ++last_id;
ml->call = call;
t_queue_push_tail(&call->monologues, ml);
i_queue_push_tail(&call->monologues, ml);
t_hash_table_insert(call->tags, &ml->tag, ml);
for (auto_iter(l, ml->tag_aliases.head); l; l = l->next)
t_hash_table_insert(call->tags, l->data, ml);
@ -5754,12 +5740,12 @@ static bool call_merge(call_t *call, call_t *call2) {
t_hash_table_insert(call->labels, &ml->label, ml);
}
last_id = call->medias.head->data->unique_id;
last_id = call->medias.head->unique_id;
while (call2->medias.head) {
__auto_type media = t_queue_pop_head(&call2->medias);
__auto_type media = i_queue_pop_head(&call2->medias);
media->unique_id = ++last_id;
media->call = call;
t_queue_push_tail(&call->medias, media);
i_queue_push_tail(&call->medias, media);
}
t_hash_table_foreach_remove(call2->sdp_fragments, fragment_move, call);
@ -5880,7 +5866,7 @@ struct call_monologue *__monologue_create(call_t *call, const str *callid) {
struct call_monologue *ret;
dbg_int("creating new monologue");
ret = uid_alloc(&call->monologues);
ret = iuid_alloc(&call->monologues);
ret->call = call;
ret->call_id = call_str_cpy(callid);
@ -6161,9 +6147,7 @@ static void __tags_associate(struct call_monologue *a, struct call_monologue *b)
* Check whether the call object contains some other monologues, which can have own associations.
*/
static bool call_monologues_associations_left(call_t * c) {
for (__auto_type l = c->monologues.head; l; l = l->next)
{
struct call_monologue *ml = l->data;
IQUEUE_FOREACH(&c->monologues, ml) {
if (g_hash_table_size(ml->associated_tags) > 0)
return true;
}
@ -6480,10 +6464,8 @@ static int call_delete_full(call_t *c, const str *callid, ng_command_ctx_t *ctx,
if (c->callid_aliases.length != 0)
return call_delete_by_id(c, callid, ctx, delete_delay, stats);
for (__auto_type i = c->monologues.head; i; i = i->next) {
__auto_type ml = i->data;
IQUEUE_FOREACH(&c->monologues, ml)
monologue_stop(ml, false);
}
return call_do_delete_full(c, delete_delay);
}
@ -6531,8 +6513,7 @@ static int call_delete_monologue(call_t *c, const str *callid, struct call_monol
static int call_delete_by_id(call_t *c, const str *callid, ng_command_ctx_t *ctx, int64_t delete_delay,
bool stats)
{
for (__auto_type i = c->monologues.head; i; i = i->next) {
__auto_type ml = i->data;
IQUEUE_FOREACH(&c->monologues, ml) {
if (str_cmp_str(&ml->call_id, callid))
continue;
@ -6558,7 +6539,6 @@ int call_delete_branch(call_t *c, const str *callid, const str *branch,
const str *fromtag, const str *totag, ng_command_ctx_t *ctx, int64_t delete_delay,
bool stats)
{
struct call_monologue *ml;
const str *match_tag;
if (delete_delay < 0)
@ -6566,8 +6546,7 @@ int call_delete_branch(call_t *c, const str *callid, const str *branch,
else
delete_delay *= 1000000L;
for (__auto_type i = c->monologues.head; i; i = i->next) {
ml = i->data;
IQUEUE_FOREACH(&c->monologues, ml) {
ml->terminated = rtpe_now;
ml->term_reason = REGULAR;
}
@ -6577,14 +6556,14 @@ int call_delete_branch(call_t *c, const str *callid, const str *branch,
if ((!totag || !totag->len) && branch && branch->len) {
// try a via-branch match
ml = t_hash_table_lookup(c->viabranches, branch);
__auto_type ml = t_hash_table_lookup(c->viabranches, branch);
if (ml)
return call_delete_monologue(c, callid, ml, fromtag, totag, ctx, delete_delay, stats);
}
match_tag = (totag && totag->len) ? totag : fromtag;
ml = call_get_monologue(c, match_tag);
__auto_type ml = call_get_monologue(c, match_tag);
if (ml)
return call_delete_monologue(c, callid, ml, fromtag, totag, ctx, delete_delay, stats);
@ -6902,8 +6881,7 @@ int call_checkpoint_rollback(call_t *call, struct call_monologue *a, struct call
}
void call_checkpoint_free_all(call_t *call) {
for (__auto_type l = call->monologues.head; l; l = l->next) {
struct call_monologue *ml = l->data;
IQUEUE_FOREACH(&call->monologues, ml) {
if (!ml->checkpoint)
continue;
redis_snapshot_free(&ml->checkpoint->snapshot);

@ -1183,7 +1183,6 @@ void ng_call_stats(ng_command_ctx_t *ctx, call_t *call, const str *fromtag, cons
{
parser_arg tags = {0}, dict;
const str *match_tag;
struct call_monologue *ml;
struct call_stats t_b;
parser_arg ssrc = {0};
const ng_parser_t *parser = NULL;
@ -1216,13 +1215,11 @@ stats:
match_tag = (totag && totag->s && totag->len) ? totag : fromtag;
if (!match_tag || !match_tag->len) {
for (__auto_type l = call->monologues.head; l; l = l->next) {
ml = l->data;
IQUEUE_FOREACH(&call->monologues, ml)
ng_stats_monologue(ctx, tags, ml, totals, ssrc);
}
}
else {
ml = call_get_monologue(call, match_tag);
__auto_type ml = call_get_monologue(call, match_tag);
if (ml) {
ng_stats_monologue(ctx, tags, ml, totals, ssrc);
g_auto(GQueue) mls = G_QUEUE_INIT; /* to avoid duplications */
@ -1408,10 +1405,10 @@ static const char *media_match(call_t *call, struct call_monologue **monologue,
if (!sockaddr_parse_any_str(&addr, &flags->address))
return "Failed to parse network address";
// walk our structures to find a matching stream
for (__auto_type l = call->monologues.head; l; l = l->next) {
*monologue = l->data;
for (unsigned int k = 0; k < (*monologue)->medias->len; k++) {
struct call_media *media = (*monologue)->medias->pdata[k];
IQUEUE_FOREACH(&call->monologues, ml) {
*monologue = ml;
for (unsigned int k = 0; k < ml->medias->len; k++) {
struct call_media *media = ml->medias->pdata[k];
if (!media)
continue;
if (!media->streams.head)
@ -1420,7 +1417,7 @@ static const char *media_match(call_t *call, struct call_monologue **monologue,
if (!sockaddr_eq(&addr, &ps->advertised_endpoint.address))
continue;
ilog(LOG_DEBUG, "Matched address %s%s%s to tag '" STR_FORMAT_M "'",
FMT_M(sockaddr_print_buf(&addr)), STR_FMT_M(&(*monologue)->tag));
FMT_M(sockaddr_print_buf(&addr)), STR_FMT_M(&ml->tag));
goto found;
}
}
@ -1493,8 +1490,7 @@ static const char *medias_match(call_q *calls, medias_q *medias,
call_t *call = calls->head->data;
if (flags->all == ALL_ALL) {
for (__auto_type l = call->medias.head; l; l = l->next) {
struct call_media *media = l->data;
IQUEUE_FOREACH(&call->medias, media) {
if (!media || (media->monologue->tagtype != FROM_TAG &&
media->monologue->tagtype != TO_TAG))
{
@ -1596,8 +1592,8 @@ const char *call_stop_forwarding_ng(ng_command_ctx_t *ctx) {
ilog(LOG_INFO, "Stop forwarding (entire call)");
CALL_CLEAR(call, REC_FORWARDING);
if (flags.all == ALL_ALL) {
for (__auto_type l = call->monologues.head; l; l = l->next)
ML_CLEAR(l->data, REC_FORWARDING);
IQUEUE_FOREACH(&call->monologues, ml)
ML_CLEAR(ml, REC_FORWARDING);
}
}
@ -1677,10 +1673,8 @@ static void call_set_dtmf_block(call_t *call, struct call_monologue *monologue,
if (monologue)
call_monologue_set_block_mode(monologue, flags);
else {
for (__auto_type l = call->monologues.head; l; l = l->next) {
struct call_monologue *ml = l->data;
IQUEUE_FOREACH(&call->monologues, ml)
call_monologue_set_block_mode(ml, flags);
}
}
}
@ -1733,25 +1727,24 @@ const char *call_unblock_dtmf_ng(ng_command_ctx_t *ctx) {
enum block_dtmf_mode prev_mode = call->block_dtmf;
call->block_dtmf = BLOCK_DTMF_OFF;
if (flags.all == ALL_ALL || is_dtmf_replace_mode(prev_mode) || flags.delay_buffer >= 0) {
for (__auto_type l = call->monologues.head; l; l = l->next) {
monologue = l->data;
IQUEUE_FOREACH(&call->monologues, ml) {
enum block_dtmf_mode prev_ml_mode = BLOCK_DTMF_OFF;
if (flags.all == ALL_ALL) {
prev_ml_mode = monologue->block_dtmf;
monologue->block_dtmf = BLOCK_DTMF_OFF;
prev_ml_mode = ml->block_dtmf;
ml->block_dtmf = BLOCK_DTMF_OFF;
}
if (flags.delay_buffer >= 0) {
for (unsigned int i = 0; i < monologue->medias->len; i++) {
struct call_media *media = monologue->medias->pdata[i];
for (unsigned int i = 0; i < ml->medias->len; i++) {
struct call_media *media = ml->medias->pdata[i];
if (!media)
continue;
media->buffer_delay = flags.delay_buffer;
}
}
bf_set_clear(&monologue->ml_flags, ML_FLAG_DETECT_DTMF, flags.detect_dtmf);
bf_set_clear(&ml->ml_flags, ML_FLAG_DETECT_DTMF, flags.detect_dtmf);
if (is_dtmf_replace_mode(prev_ml_mode) || is_dtmf_replace_mode(prev_mode)
|| flags.delay_buffer >= 0)
codec_update_all_handlers(monologue);
codec_update_all_handlers(ml);
}
}
}
@ -1902,10 +1895,8 @@ static const char *call_block_silence_media(ng_command_ctx_t *ctx, bool on_off,
if (!on_off) {
ilog(LOG_INFO, "%s media (entire call and participants)", ucase_verb);
if (flags.all == ALL_ALL) {
for (__auto_type l = call->monologues.head; l; l = l->next) {
monologue = l->data;
bf_set_clear(&monologue->ml_flags, ml_flag, on_off);
}
IQUEUE_FOREACH(&call->monologues, ml)
bf_set_clear(&ml->ml_flags, ml_flag, on_off);
}
} else {
ilog(LOG_INFO, "%s media (entire call)", ucase_verb);
@ -1949,7 +1940,8 @@ static const char *play_media_select_party(call_t **call, monologues_q *monologu
if (err)
return err;
if (flags->all == ALL_ALL)
t_queue_append(monologues, &(*call)->monologues);
IQUEUE_FOREACH(&(*call)->monologues, ml)
t_queue_push_tail(monologues, ml);
else if (!monologue)
return "No participant party specified";
else

@ -33,7 +33,6 @@ static const char * get_term_reason_text(enum termination_reason t) {
}
void cdr_update_entry(call_t * c) {
struct call_monologue *ml;
int64_t tim_result_duration;
int cdrlinecnt = 0;
g_autoptr(GString) cdr = g_string_new("");
@ -51,9 +50,7 @@ void cdr_update_entry(call_t * c) {
g_string_append_printf(cdr, "tos=%u, ", (unsigned int)c->tos);
}
for (__auto_type l = c->monologues.head; l; l = l->next) {
ml = l->data;
IQUEUE_FOREACH(&c->monologues, ml) {
if (!ml->terminated) {
ml->terminated = rtpe_now;
ml->term_reason = UNKNOWN;

@ -337,7 +337,6 @@ static void cli_handler_do(const cli_handler_t *handler, str *instr,
}
static void destroy_own_foreign_calls(bool foreign_call, unsigned int uint_keyspace_db) {
struct call_monologue *ml = NULL;
call_q calls = TYPED_GQUEUE_INIT;
ITERATE_CALL_LIST_START(CALL_ITERATOR_MAIN, c);
@ -363,8 +362,7 @@ next:;
call_t *c = NULL;
while ((c = t_queue_pop_head(&calls))) {
if (!c->ml_deleted_us) {
for (__auto_type i = c->monologues.head; i; i = i->next) {
ml = i->data;
IQUEUE_FOREACH(&c->monologues, ml) {
ml->terminated = rtpe_now;
ml->term_reason = FORCED;
}
@ -687,8 +685,6 @@ static void cli_incoming_list_callid(str *instr, struct cli_writer *cw) {
static void cli_list_call_info(struct cli_writer *cw, call_t *c) {
struct call_monologue *ml;
cw->cw_printf(cw,
"\n"
"callid: " STR_FORMAT "\n",
@ -714,10 +710,9 @@ static void cli_list_call_info(struct cli_writer *cw, call_t *c) {
atomic64_get_na(&c->last_redis_update_us),
IS_FOREIGN_CALL(c) ? "yes" : "no", c->recording ? "yes" : "no");
for (__auto_type l = c->monologues.head; l; l = l->next) {
ml = l->data;
IQUEUE_FOREACH(&c->monologues, ml)
cli_list_tag_info(cw, ml);
}
cw->cw_printf(cw, "\n");
}
@ -1079,7 +1074,6 @@ static void cli_generic_handler(str *instr, struct cli_writer *cw, const cli_han
static void cli_incoming_terminate(str *instr, struct cli_writer *cw, const cli_handler_t *handler) {
call_t * c=0;
struct call_monologue *ml;
if (instr->len == 0) {
cw->cw_printf(cw, "More parameters required.\n");
@ -1132,8 +1126,7 @@ static void cli_incoming_terminate(str *instr, struct cli_writer *cw, const cli_
}
if (!c->ml_deleted_us) {
for (__auto_type i = c->monologues.head; i; i = i->next) {
ml = i->data;
IQUEUE_FOREACH(&c->monologues, ml) {
ml->terminated = rtpe_now;
ml->term_reason = FORCED;
}

@ -479,9 +479,7 @@ static void mqtt_full_call(call_t *call, JsonBuilder *json) {
json_builder_set_member_name(json, "legs");
json_builder_begin_array(json);
for (__auto_type l = call->monologues.head; l; l = l->next) {
struct call_monologue *ml = l->data;
IQUEUE_FOREACH(&call->monologues, ml) {
json_builder_begin_object(json);
mqtt_monologue_stats(ml, json);

@ -389,14 +389,10 @@ void recording_start_daemon(call_t *call) {
// through all related objects and initialize the recording stuff. if this
// function is called right at the start of the call, all of the following
// is essentially a no-op
for (__auto_type l = call->monologues.head; l; l = l->next) {
struct call_monologue *ml = l->data;
IQUEUE_FOREACH(&call->monologues, ml)
rec_setup_monologue(ml);
}
for (__auto_type l = call->medias.head; l; l = l->next) {
struct call_media *m = l->data;
IQUEUE_FOREACH(&call->medias, m)
recording_setup_media(m);
}
IQUEUE_FOREACH(&call->streams, ps) {
recording_setup_stream(ps);
__unkernelize(ps, "recording start");
@ -436,8 +432,7 @@ void recording_stop_daemon(call_t *call) {
return;
}
for (__auto_type l = call->monologues.head; l; l = l->next) {
struct call_monologue *ml = l->data;
IQUEUE_FOREACH(&call->monologues, ml) {
if (ML_ISSET(ml, REC_FORWARDING)) {
recording_update_flags(call, true);
return;
@ -612,7 +607,7 @@ static void rec_pcap_meta_finish_file(call_t *call) {
char timebuffer[20];
struct tm timeinfo;
int64_t terminate;
terminate = (((struct call_monologue *)call->monologues.head->data)->terminated);
terminate = call->monologues.head->terminated;
fprintf(recording->pcap.meta_fp, "\nTimestamp terminated ms(first monologue): %.3lf", terminate / 1000.);
if (localtime_r(&start, &timeinfo) == NULL) {
ilog(LOG_ERROR, "Cannot get start local time, while cleaning up recording meta file: %s", strerror(errno));

@ -2173,8 +2173,7 @@ static int checkpoint_get_int(int64_t *out, const struct redis_hash *h, const ch
}
static int redis_restore_checkpoints(call_t *c, parser_arg root) {
for (__auto_type l = c->monologues.head; l; l = l->next) {
struct call_monologue *ml = l->data;
IQUEUE_FOREACH(&c->monologues, ml) {
struct redis_hash rh;
// absent for a call written by a version that had no checkpoints
if (json_get_hash(&rh, "checkpoint", ml->unique_id, root))
@ -2989,8 +2988,7 @@ static str redis_encode_json(ng_parser_ctx_t *ctx, call_t *c, void **to_free)
if (c->recording_random_tag.len)
JSON_SET_SIMPLE_STR("recording_random_tag", &c->recording_random_tag);
for (__auto_type l = c->monologues.head; l; l = l->next) {
const struct call_monologue *ml = l->data;
IQUEUE_FOREACH(&c->monologues, ml) {
if (!ml->checkpoint)
continue;
snprintf(tmp, sizeof(tmp), "checkpoint-%u", ml->unique_id);
@ -3049,9 +3047,7 @@ static str redis_encode_json(ng_parser_ctx_t *ctx, call_t *c, void **to_free)
}
} // --- for streams.head
for (__auto_type l = c->monologues.head; l; l = l->next) {
struct call_monologue *ml = l->data;
IQUEUE_FOREACH(&c->monologues, ml) {
redis_encode_ml_basic(ml, parser, root);
GList *k = g_hash_table_get_values(ml->associated_tags);
@ -3069,12 +3065,7 @@ static str redis_encode_json(ng_parser_ctx_t *ctx, call_t *c, void **to_free)
JSON_ADD_LIST_STRING(STR_FORMAT, STR_FMT(alias->data));
} // --- for monologues.head
for (__auto_type l = c->medias.head; l; l = l->next) {
struct call_media *media = l->data;
if (!media)
continue;
IQUEUE_FOREACH(&c->medias, media) {
/* store media subscriptions */
snprintf(tmp, sizeof(tmp), "media-subscriptions-%u", media->unique_id);
inner = parser->dict_add_list_dup(root, tmp);

@ -121,7 +121,6 @@ void statistics_update_foreignown_inc(call_t * c) {
}
void statistics_update_oneway(call_t * c) {
struct call_monologue *ml;
struct call_media *md;
if (IS_OWN_CALL(c)) {
@ -129,9 +128,7 @@ void statistics_update_oneway(call_t * c) {
unsigned int total_nopacket_relayed_sess = 0;
struct packet_stream *ps, *ps2;
for (__auto_type l = c->monologues.head; l; l = l->next) {
ml = l->data;
IQUEUE_FOREACH(&c->monologues, ml) {
// --- go through partner ml and search the RTP
for (unsigned int i = 0; i < ml->medias->len; i++) {
md = ml->medias->pdata[i];
@ -167,7 +164,7 @@ found:;
}
if (c->monologues.head) {
ml = c->monologues.head->data;
__auto_type ml = c->monologues.head;
if (IS_OWN_CALL(c)) {
if (ml->term_reason==TIMEOUT)

@ -524,6 +524,7 @@ enum {
struct call_media {
struct call_monologue *monologue; /* RO */
call_t *call; /* RO */
IQUEUE_LINK link;
unsigned int index; /* RO */
unsigned int unique_id; /* RO */
@ -611,6 +612,7 @@ struct call_media {
unsigned int update_iter;
};
typedef IQUEUE(struct call_media, link) medias_in_call_q;
TYPED_GPTRARRAY(medias_arr, struct call_media)
@ -628,6 +630,7 @@ struct call_monologue {
call_t *call; /* RO */
str call_id; // RO - in case of merged calls with ID aliases
unsigned int unique_id; /* RO */
IQUEUE_LINK link;
str tag;
str viabranch;
@ -695,6 +698,8 @@ struct call_monologue {
struct call_checkpoint *checkpoint;
};
typedef IQUEUE(struct call_monologue, link) monologues_in_call_q;
TYPED_GHASHTABLE(str_ml_ht, str, struct call_monologue, str_hash, str_equal, NULL, NULL)
struct sdp_fragment;
@ -801,8 +806,8 @@ struct call {
rwlock_t master_lock;
/* everything below is protected by the master_lock */
monologues_q monologues; /* call_monologue */
medias_q medias; /* call_media */
monologues_in_call_q monologues;
medias_in_call_q medias;
str_ml_ht tags;
str_ml_ht viabranches;
str_ml_ht labels;
@ -1043,10 +1048,8 @@ G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(call_q, call_q_unlock_release);
#define call_str_dup memory_arena_str_dup
INLINE void __call_unkernelize(call_t *call, const char *reason) {
for (__auto_type l = call->monologues.head; l; l = l->next) {
struct call_monologue *ml = l->data;
IQUEUE_FOREACH(&call->monologues, ml)
__monologue_unconfirm(ml, reason);
}
}
INLINE endpoint_t *packet_stream_local_addr(struct packet_stream *ps) {
if (ps->selected_sfd)

@ -65,7 +65,7 @@ static void __cleanup(void) {
t_queue_clear_full(&flags.codec_accept, str_free);
t_queue_clear_full(&flags.codec_consume, str_free);
t_queue_clear_full(&flags.codec_mask, str_free);
t_queue_clear(&call.monologues);
i_queue_init(&call.monologues);
codec_store_cleanup(&rtp_types_sp.codecs);
memset(&flags, 0, sizeof(flags));
@ -387,7 +387,7 @@ static void end(void) {
call_media_free(media_A);
call_media_free(media_B);
t_hash_table_destroy(call.tags);
t_queue_clear(&call.medias);
i_queue_init(&call.medias);
if (ml_A)
__monologue_free(ml_A);
if (ml_B)

Loading…
Cancel
Save