TT#45472 support generating a=mid lines if not present

closes #641

Change-Id: I849f0c73c5fdd575417a37a41d6701ea4454374b
changes/43/25343/3
Richard Fuchs 7 years ago
parent 3c50130c7b
commit a1efdf6b20

@ -1247,6 +1247,10 @@ Optionally included keys are:
`=` characters used for padding should be omitted. With this flag set, these padding
characters will be left in place.
- `generate mid`
Add `a=mid` attributes to the outgoing SDP if they were not already present.
* `replace`
Similar to the `flags` list. Controls which parts of the SDP body should be rewritten.

@ -1674,15 +1674,23 @@ static void __update_media_id(struct call_media *media, struct call_media *other
{
struct call *call = media->call;
if (!other_media->media_id.s) {
// incoming side: we copy what we received
if (sp->media_id.s)
call_str_cpy(call, &other_media->media_id, &sp->media_id);
}
if (!media->media_id.s) {
// outgoing side: we copy from the other side
if (other_media->media_id.s)
call_str_cpy(call, &media->media_id, &other_media->media_id);
if (flags && flags->opmode == OP_OFFER) {
if (!other_media->media_id.s) {
// incoming side: we copy what we received
if (sp->media_id.s)
call_str_cpy(call, &other_media->media_id, &sp->media_id);
}
if (!media->media_id.s) {
// outgoing side: we copy from the other side
if (other_media->media_id.s)
call_str_cpy(call, &media->media_id, &other_media->media_id);
else if (flags->generate_mid) {
// or generate one
char buf[64];
snprintf(buf, sizeof(buf), "%u", other_media->index);
call_str_cpy_c(call, &media->media_id, buf);
}
}
}
}

@ -611,6 +611,8 @@ static void call_ng_flags_flags(struct sdp_ng_flags *out, str *s, void *dummy) {
out->all = 1;
else if (!str_cmp(s, "port-latching"))
out->port_latching = 1;
else if (!str_cmp(s, "generate-mid"))
out->generate_mid = 1;
else if (!str_cmp(s, "record-call"))
out->record_call = 1;
else if (!str_cmp(s, "no-rtcp-attribute"))

@ -53,6 +53,7 @@ struct sdp_ng_flags {
rtcp_mux_accept:1,
rtcp_mux_reject:1,
no_rtcp_attr:1,
generate_mid:1,
strict_source:1,
media_handover:1,
dtls_passive:1,

@ -61,6 +61,7 @@ GetOptions(
'all' => \$options{'all'},
'address=s' => \$options{'address'},
'pad-crypto' => \$options{'pad crypto'},
'generate-mid' => \$options{'generate mid'},
) or die;
my $cmd = shift(@ARGV) or die;
@ -73,7 +74,7 @@ for my $x (split(/,/, 'from-tag,to-tag,call-id,transport protocol,media address,
for my $x (split(/,/, 'TOS,delete-delay')) {
defined($options{$x}) and $packet{$x} = $options{$x};
}
for my $x (split(/,/, 'trust address,symmetric,asymmetric,force,strict source,media handover,sip source address,reset,port latching,no rtcp attribute,loop protect,record call,always transcode,all,pad crypto')) {
for my $x (split(/,/, 'trust address,symmetric,asymmetric,force,strict source,media handover,sip source address,reset,port latching,no rtcp attribute,loop protect,record call,always transcode,all,pad crypto,generate mid')) {
defined($options{$x}) and push(@{$packet{flags}}, $x);
}
for my $x (split(/,/, 'origin,session connection')) {

Loading…
Cancel
Save