MT#60476 origin-replace: introduce full and limited replace

Two version of the origin replace exist from now on:
- `origin-replace` - replaces only the origin address
- `origin-replace-full` - replaces all the values,
  so name, id, version and IP family with address.

Values for replacing are taken from the rtpengine instance,
so local values provided by the daemon.

Additionally: documentation updated accordingly.

Additionally: revert changes in pub-sub test.

Change-Id: I4d068944726d1ab82683ca5aa641a954890aefcf
rfuchs/gh1842
Donat Zenichev 9 months ago
parent 9a75c37437
commit c98c98374a

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

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

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

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

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

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

Loading…
Cancel
Save