|
|
@ -2040,31 +2040,11 @@ const char *call_stop_recording_ng(bencode_item_t *input, bencode_item_t *output |
|
|
return NULL; |
|
|
return NULL; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static const char *media_block_match(struct call **call, struct call_monologue **monologue, |
|
|
|
|
|
struct sdp_ng_flags *flags, bencode_item_t *input, enum call_opmode opmode) |
|
|
|
|
|
|
|
|
static const char *media_block_match1(struct call *call, struct call_monologue **monologue, |
|
|
|
|
|
struct sdp_ng_flags *flags) |
|
|
{ |
|
|
{ |
|
|
struct sdp_ng_flags flags_store; |
|
|
|
|
|
|
|
|
|
|
|
if (!flags) |
|
|
|
|
|
flags = &flags_store; |
|
|
|
|
|
|
|
|
|
|
|
*call = NULL; |
|
|
|
|
|
*monologue = NULL; |
|
|
|
|
|
|
|
|
|
|
|
call_ng_process_flags(flags, input, opmode); |
|
|
|
|
|
|
|
|
|
|
|
if (!flags->call_id.s) |
|
|
|
|
|
return "No call-id in message"; |
|
|
|
|
|
*call = call_get_opmode(&flags->call_id, opmode); |
|
|
|
|
|
if (!*call) |
|
|
|
|
|
return "Unknown call-ID"; |
|
|
|
|
|
|
|
|
|
|
|
// directional? |
|
|
|
|
|
if (flags->all) // explicitly non-directional, so skip the rest |
|
|
|
|
|
return NULL; |
|
|
|
|
|
|
|
|
|
|
|
if (flags->label.s) { |
|
|
if (flags->label.s) { |
|
|
*monologue = g_hash_table_lookup((*call)->labels, &flags->label); |
|
|
|
|
|
|
|
|
*monologue = g_hash_table_lookup(call->labels, &flags->label); |
|
|
if (!*monologue) |
|
|
if (!*monologue) |
|
|
return "No monologue matching the given label"; |
|
|
return "No monologue matching the given label"; |
|
|
} |
|
|
} |
|
|
@ -2073,7 +2053,7 @@ static const char *media_block_match(struct call **call, struct call_monologue * |
|
|
if (sockaddr_parse_any_str(&addr, &flags->address)) |
|
|
if (sockaddr_parse_any_str(&addr, &flags->address)) |
|
|
return "Failed to parse network address"; |
|
|
return "Failed to parse network address"; |
|
|
// walk our structures to find a matching stream |
|
|
// walk our structures to find a matching stream |
|
|
for (GList *l = (*call)->monologues.head; l; l = l->next) { |
|
|
|
|
|
|
|
|
for (GList *l = call->monologues.head; l; l = l->next) { |
|
|
*monologue = l->data; |
|
|
*monologue = l->data; |
|
|
for (GList *k = (*monologue)->medias.head; k; k = k->next) { |
|
|
for (GList *k = (*monologue)->medias.head; k; k = k->next) { |
|
|
struct call_media *media = k->data; |
|
|
struct call_media *media = k->data; |
|
|
@ -2092,11 +2072,40 @@ found: |
|
|
; |
|
|
; |
|
|
} |
|
|
} |
|
|
else if (flags->from_tag.s) { |
|
|
else if (flags->from_tag.s) { |
|
|
*monologue = call_get_monologue(*call, &flags->from_tag); |
|
|
|
|
|
|
|
|
*monologue = call_get_monologue(call, &flags->from_tag); |
|
|
if (!*monologue) |
|
|
if (!*monologue) |
|
|
return "From-tag given, but no such tag exists"; |
|
|
return "From-tag given, but no such tag exists"; |
|
|
__monologue_unkernelize(*monologue); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
if (*monologue) |
|
|
|
|
|
__monologue_unkernelize(*monologue); |
|
|
|
|
|
return NULL; |
|
|
|
|
|
} |
|
|
|
|
|
static const char *media_block_match(struct call **call, struct call_monologue **monologue, |
|
|
|
|
|
struct sdp_ng_flags *flags, bencode_item_t *input, enum call_opmode opmode) |
|
|
|
|
|
{ |
|
|
|
|
|
struct sdp_ng_flags flags_store; |
|
|
|
|
|
|
|
|
|
|
|
if (!flags) |
|
|
|
|
|
flags = &flags_store; |
|
|
|
|
|
|
|
|
|
|
|
*call = NULL; |
|
|
|
|
|
*monologue = NULL; |
|
|
|
|
|
|
|
|
|
|
|
call_ng_process_flags(flags, input, opmode); |
|
|
|
|
|
|
|
|
|
|
|
if (!flags->call_id.s) |
|
|
|
|
|
return "No call-id in message"; |
|
|
|
|
|
*call = call_get_opmode(&flags->call_id, opmode); |
|
|
|
|
|
if (!*call) |
|
|
|
|
|
return "Unknown call-ID"; |
|
|
|
|
|
|
|
|
|
|
|
// directional? |
|
|
|
|
|
if (flags->all) // explicitly non-directional, so skip the rest |
|
|
|
|
|
return NULL; |
|
|
|
|
|
|
|
|
|
|
|
const char *err = media_block_match1(*call, monologue, flags); |
|
|
|
|
|
if (err) |
|
|
|
|
|
return err; |
|
|
|
|
|
|
|
|
// for generic ops, handle set-label here if given |
|
|
// for generic ops, handle set-label here if given |
|
|
if (opmode == OP_OTHER && flags->set_label.len && *monologue) { |
|
|
if (opmode == OP_OTHER && flags->set_label.len && *monologue) { |
|
|
|