TT#107565 add `replace-username` option

Change-Id: I89dd560789adde4d96fa6a6f314b1c3c81a5a47b
pull/1218/head
Richard Fuchs 5 years ago
parent f650f95111
commit fc83f64575

@ -861,11 +861,18 @@ Optionally included keys are:
Replace the address found in the *session-level connection* (c=) line of the SDP body.
Corresponds to *rtpproxy* `c` flag.
- `SDP version`
- `SDP version` or `SDP-version`
Take control of the version field in the SDP and make sure it's increased every
time the SDP changes, and left unchanged if the SDP is the same.
- `username`
Take control of the origin username field in the SDP. With this
option in use, *rtpengine* will make sure the username field in
the `o=` line always remains the same in all SDPs going to a
particular RTP endpoint.
- `zero address`
Using a zero endpoint address is an obsolete way to signal a

@ -719,6 +719,9 @@ static void call_ng_flags_replace(struct sdp_ng_flags *out, str *s, void *dummy)
case CSH_LOOKUP("SDP-version"):
out->replace_sdp_version = 1;
break;
case CSH_LOOKUP("username"):
out->replace_username = 1;
break;
case CSH_LOOKUP("zero-address"):
out->replace_zero_address = 1;
break;

@ -2455,8 +2455,21 @@ int sdp_replace(struct sdp_chopper *chop, GQueue *sessions, struct call_monologu
goto error;
ps = j->data;
err = "error while processing o= line";
if (!monologue->sdp_username)
monologue->sdp_username = call_strdup_len(monologue->call, session->origin.username.s,
session->origin.username.len);
else if (flags->replace_username) {
if (copy_up_to(chop, &session->origin.username))
goto error;
chopper_append_c(chop, monologue->sdp_username);
if (skip_over(chop, &session->origin.username))
goto error;
}
// record position of o= line and init SDP version
copy_up_to(chop, &session->origin.version_str);
if (copy_up_to(chop, &session->origin.version_str))
goto error;
session->origin.version_output_pos = chop->output->len;
if (!monologue->sdp_version) {
monologue->sdp_version = session->origin.version_num;

@ -374,6 +374,7 @@ struct call_monologue {
struct media_player *player;
unsigned long long sdp_version;
GString *last_sdp;
char *sdp_username;
unsigned int block_dtmf:1;
unsigned int block_media:1;

@ -74,6 +74,7 @@ struct sdp_ng_flags {
replace_origin:1,
replace_sess_conn:1,
replace_sdp_version:1,
replace_username:1,
replace_zero_address:1,
rtcp_mux_offer:1,
rtcp_mux_require:1,

@ -29,6 +29,7 @@ GetOptions(
'replace-origin' => \$options{'replace-origin'},
'replace-session-connection' => \$options{'replace-session connection'},
'replace-sdp-version' => \$options{'replace-sdp version'},
'replace-username' => \$options{'replace-username'},
'client-address=s' => \$options{'client-address'},
'sdp=s' => \$options{'sdp'},
'sdp-file=s' => \$options{'sdp-file'},
@ -101,7 +102,7 @@ for my $x (split(/,/, 'TOS,delete-delay')) {
for my $x (split(/,/, 'trust address,symmetric,asymmetric,unidirectional,force,strict source,media handover,sip source address,reset,port latching,no rtcp attribute,full rtcp attribute,loop protect,record call,always transcode,all,pad crypto,generate mid,fragment,original sendrecv,symmetric codecs,asymmetric codecs,inject DTMF,generate RTCP,single codec,reorder codecs')) {
defined($options{$x}) and push(@{$packet{flags}}, $x);
}
for my $x (split(/,/, 'origin,session connection,sdp version')) {
for my $x (split(/,/, 'origin,session connection,sdp version,username')) {
defined($options{'replace-' . $x}) and push(@{$packet{replace}}, $x);
}
for my $x (split(/,/, 'rtcp-mux,SDES,supports,T.38,OSRTP')) {

Loading…
Cancel
Save