TT#14008 associate interface with call_monologue

This makes it possible to add new streams without specifying the
direction/interface again.

Reported in #1366

Change-Id: I8f320ecbe72f123d755ba80370de9c40960eb0f0
pull/1373/head
Richard Fuchs 4 years ago
parent 77317a1723
commit 41966c9648

@ -1916,9 +1916,8 @@ static void __tos_change(struct call *call, const struct sdp_ng_flags *flags) {
}
static void __init_interface(struct call_media *media, const str *ifname, int num_ports) {
/* we're holding master_lock in W mode here, so we can safely ignore the
* atomic ops */
if (!media->logical_intf && media->monologue)
media->logical_intf = media->monologue->logical_intf;
if (!media->logical_intf)
goto get;
if (media->logical_intf->preferred_family != media->desired_family)
@ -1946,13 +1945,8 @@ get:
media->logical_intf = get_logical_interface(NULL, NULL, 0);
}
}
// media->local_intf = ifa = get_interface_address(media->logical_intf, media->desired_family);
// if (!ifa) {
// ilog(LOG_WARNING, "No usable address in interface '"STR_FORMAT"' found, using default",
// STR_FMT(ifname));
// media->local_intf = ifa = get_any_interface_address(media->logical_intf, media->desired_family);
// media->desired_family = ifa->spec->address.addr.family;
// }
if (media->monologue)
media->monologue->logical_intf = media->logical_intf;
}

@ -1426,6 +1426,13 @@ static int redis_tags(struct call *c, struct redis_list *tags, JsonReader *root_
if (!redis_hash_get_int(&ii, rh, "block_media"))
ml->block_media = ii ? 1 : 0;
if (redis_hash_get_str(&s, rh, "logical_intf")
|| !(ml->logical_intf = get_logical_interface(&s, NULL, 0)))
{
rlog(LOG_ERR, "unable to find specified local interface");
ml->logical_intf = get_logical_interface(NULL, NULL, 0);
}
if (json_build_ssrc(ml, root_reader))
return -1;
@ -2329,6 +2336,8 @@ char* redis_encode_json(struct call *c) {
JSON_SET_SIMPLE("deleted","%llu",(long long unsigned) ml->deleted);
JSON_SET_SIMPLE("block_dtmf","%i",ml->block_dtmf ? 1 : 0);
JSON_SET_SIMPLE("block_media","%i",ml->block_media ? 1 : 0);
if (ml->logical_intf)
JSON_SET_SIMPLE_STR("logical_intf", &ml->logical_intf->name);
if (ml->tag.s)
JSON_SET_SIMPLE_STR("tag",&ml->tag);

@ -413,6 +413,7 @@ struct call_monologue {
struct timeval started; /* for CDR */
struct timeval terminated; /* for CDR */
enum termination_reason term_reason;
const struct logical_intf *logical_intf;
GHashTable *other_tags;
GHashTable *branches;
GQueue subscriptions; // who am I subscribed to (sources)

Loading…
Cancel
Save