diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index 8b3669555..1f25dc61a 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -1287,6 +1287,14 @@ static void call_ng_dict_iter(sdp_ng_flags *out, bencode_item_t *input, } } +void call_ng_direction_flag(sdp_ng_flags *out, bencode_item_t *value) +{ + if (value->type != BENCODE_LIST) + return; + int diridx = 0; + for (bencode_item_t *cit = value->child; cit && diridx < 2; cit = cit->sibling) + bencode_get_str(cit, &out->direction[diridx++]); +} void call_ng_codec_flags(sdp_ng_flags *out, str *key, bencode_item_t *value, enum call_opmode opmode) { @@ -1488,11 +1496,7 @@ void call_ng_main_flags(sdp_ng_flags *out, str *key, bencode_item_t *value, out->db_id = bencode_get_integer_str(value, out->db_id); break; case CSH_LOOKUP("direction"): - if (value->type != BENCODE_LIST) - break; - int diridx = 0; - for (bencode_item_t *cit = value->child; cit && diridx < 2; cit = cit->sibling) - bencode_get_str(cit, &out->direction[diridx++]); + call_ng_direction_flag(out, value); break; case CSH_LOOKUP("drop-traffic"): case CSH_LOOKUP("drop traffic"): diff --git a/daemon/control_ng_flags_parser.c b/daemon/control_ng_flags_parser.c index 61b928175..5de19a244 100644 --- a/daemon/control_ng_flags_parser.c +++ b/daemon/control_ng_flags_parser.c @@ -473,7 +473,7 @@ next: /* add directions to the root dict */ if (direction && direction->child) - bencode_dictionary_add(root_dict, "direction", direction); + call_ng_direction_flag(out, direction); rtpp_flags->s[rtpp_flags->len] = c; } diff --git a/include/call_interfaces.h b/include/call_interfaces.h index 586e36792..2e8e14d9b 100644 --- a/include/call_interfaces.h +++ b/include/call_interfaces.h @@ -291,6 +291,7 @@ void call_ng_main_flags(sdp_ng_flags *out, str *key, bencode_item_t *value, enum call_opmode opmode); void call_ng_codec_flags(sdp_ng_flags *out, str *key, bencode_item_t *value, enum call_opmode opmode); +void call_ng_direction_flag(sdp_ng_flags *out, bencode_item_t *value); INLINE struct sdp_manipulations *sdp_manipulations_get_by_id(const sdp_ng_flags *f, enum media_type id) { if (id < 0 || id >= G_N_ELEMENTS(f->sdp_manipulations))