diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index 069abca62..c094445d0 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -853,6 +853,10 @@ static void call_ng_flags_replace(sdp_ng_flags *out, str *s, helper_arg arg) { case CSH_LOOKUP("origin"): out->replace_origin = 1; break; + case CSH_LOOKUP("origin-full"): + case CSH_LOOKUP("origin_full"): + out->replace_origin_full = 1; + break; case CSH_LOOKUP("sdp-version"): case CSH_LOOKUP("SDP-version"): out->replace_sdp_version = 1; diff --git a/daemon/janus.c b/daemon/janus.c index 335f38411..cc310c070 100644 --- a/daemon/janus.c +++ b/daemon/janus.c @@ -630,7 +630,7 @@ static const char *janus_videoroom_join(struct websocket_message *wm, struct jan flags.generate_mid = 1; flags.rtcp_mirror = 1; - flags.replace_origin = 1; + flags.replace_origin_full = 1; if (!plain_offer) ng_flags_webrtc(&flags); @@ -867,7 +867,7 @@ static const char *janus_videoroom_configure(struct websocket_message *wm, struc // accept unsupported codecs if necessary flags.accept_any = 1; - flags.replace_origin = 1; + flags.replace_origin_full = 1; int ret = monologue_publish(ml, &streams, &flags); if (ret) diff --git a/daemon/sdp.c b/daemon/sdp.c index 714d27009..9d3f2c415 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -3473,8 +3473,20 @@ static void sdp_out_add_origin(GString *out, struct call_monologue *monologue, if (ms && ms->monologue) { ml = ms->monologue; + /* replace origin address only + * rest of the values are taken from the monologue (so parsed origin) */ + if (flags->replace_origin) { + g_string_append_printf(out, + "o="STR_FORMAT" "STR_FORMAT" %llu IN %s %s\r\n", + STR_FMT(&ml->session_sdp_orig->username), + STR_FMT(&ml->session_sdp_orig->session_id), + ml->session_sdp_orig->version_num, + first_ps->selected_sfd->local_intf->advertised_address.addr.family->rfc_name, + sockaddr_print_buf(&first_ps->selected_sfd->local_intf->advertised_address.addr)); + return; + } /* values taken from the monologue (so parsed origin) */ - if (!flags->replace_origin && ml->session_sdp_orig->parsed) { + else if (!flags->replace_origin_full && ml->session_sdp_orig->parsed) { g_string_append_printf(out, "o="STR_FORMAT" "STR_FORMAT" %llu IN "STR_FORMAT" "STR_FORMAT"\r\n", STR_FMT(&ml->session_sdp_orig->username), @@ -3486,9 +3498,9 @@ static void sdp_out_add_origin(GString *out, struct call_monologue *monologue, } } - /* default values otherwise for cases like: + /* replace everything, default values for cases like: * - publish - * - replace_origin flag */ + * - replace_origin_full flag */ unsigned long long id = (unsigned long long) rtpe_now.tv_sec << 32 | rtpe_now.tv_usec; g_string_append_printf(out, "o=- %llu %llu IN %s %s\r\n", id, id, diff --git a/docs/ng_control_protocol.md b/docs/ng_control_protocol.md index f0979a612..5bc0f2ede 100644 --- a/docs/ng_control_protocol.md +++ b/docs/ng_control_protocol.md @@ -1161,8 +1161,11 @@ Contains zero or more of: * `origin` - Replace the address found in the *origin* (o=) line of the SDP body. Corresponds - to *rtpproxy* `o` flag. + Replace the address found in the *origin* (o=) line of the SDP body. + +* `origin-full` + + Replace whole *origin* (o=) line of the SDP body. * `session name` or `session-name` diff --git a/include/call_interfaces.h b/include/call_interfaces.h index e56c20dca..64195413a 100644 --- a/include/call_interfaces.h +++ b/include/call_interfaces.h @@ -149,6 +149,7 @@ struct sdp_ng_flags { port_latching:1, no_port_latching:1, replace_origin:1, + replace_origin_full:1, replace_sdp_version:1, force_inc_sdp_ver:1, replace_username:1, diff --git a/t/auto-daemon-tests-pubsub.pl b/t/auto-daemon-tests-pubsub.pl index 04a4fd5d9..d91c9f8b1 100755 --- a/t/auto-daemon-tests-pubsub.pl +++ b/t/auto-daemon-tests-pubsub.pl @@ -105,9 +105,9 @@ snd($sock_a, $port_b, rtp(0, 4000, 7000, 0x6543, "\x00" x 160)); rcv_no($sock_c); (undef, $ttr, undef, undef, undef, $port_c) = subscribe_request('SIPREC pause/resume', - { 'from-tag' => ft(), flags => ['SIPREC'] }, <<SDP); + { 'from-tag' => ft(), flags => ['SIPREC', 'replace-origin'] }, <<SDP); v=0 -o=- 1545997027 1 IN IP4 198.51.100.1 +o=- 1545997027 1 IN IP4 203.0.113.1 s=tester t=0 0 a=s-dummy