Browse Source

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
commit
a1efdf6b20
5 changed files with 26 additions and 10 deletions
  1. +4
    -0
      README.md
  2. +17
    -9
      daemon/call.c
  3. +2
    -0
      daemon/call_interfaces.c
  4. +1
    -0
      include/call_interfaces.h
  5. +2
    -1
      utils/rtpengine-ng-client

+ 4
- 0
README.md View File

@ -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.


+ 17
- 9
daemon/call.c View File

@ -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);
}
}
}
}


+ 2
- 0
daemon/call_interfaces.c View File

@ -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"))


+ 1
- 0
include/call_interfaces.h View File

@ -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,


+ 2
- 1
utils/rtpengine-ng-client View File

@ -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