diff --git a/README.md b/README.md index 575123352..3b536ca71 100644 --- a/README.md +++ b/README.md @@ -873,6 +873,10 @@ Optionally included keys are: the `o=` line always remains the same in all SDPs going to a particular RTP endpoint. + - `session name` or `session-name` + + Same as `username` but for the entire contents of the `s=` line. + - `zero address` Using a zero endpoint address is an obsolete way to signal a diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index 34ac9c14c..aca727499 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -713,6 +713,9 @@ static void call_ng_flags_replace(struct sdp_ng_flags *out, str *s, void *dummy) case CSH_LOOKUP("session-connection"): out->replace_sess_conn = 1; break; + case CSH_LOOKUP("session-name"): + out->replace_sess_name = 1; + break; case CSH_LOOKUP("sdp-version"): out->replace_sdp_version = 1; break; diff --git a/daemon/sdp.c b/daemon/sdp.c index 0017f4780..29b50a976 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -53,6 +53,7 @@ struct sdp_attributes { struct sdp_session { str s; struct sdp_origin origin; + str session_name; struct sdp_connection connection; int rr, rs; struct sdp_attributes attributes; @@ -1204,6 +1205,12 @@ new_session: break; case 's': + errstr = "s= line found within media section"; + if (media) + goto error; + session->session_name = value_str; + break; + case 'i': case 'u': case 'e': @@ -2477,6 +2484,18 @@ int sdp_replace(struct sdp_chopper *chop, GQueue *sessions, struct call_monologu monologue->sdp_version = ssl_random(); } + err = "error while processing s= line"; + if (!monologue->sdp_session_name) + monologue->sdp_session_name = call_strdup_len(monologue->call, session->session_name.s, + session->session_name.len); + else if (flags->replace_sess_name) { + if (copy_up_to(chop, &session->session_name)) + goto error; + chopper_append_c(chop, monologue->sdp_session_name); + if (skip_over(chop, &session->session_name)) + goto error; + } + sess_conn = 0; if (flags->replace_sess_conn) sess_conn = 1; diff --git a/include/call.h b/include/call.h index 58d075951..8534e4f85 100644 --- a/include/call.h +++ b/include/call.h @@ -375,6 +375,7 @@ struct call_monologue { unsigned long long sdp_version; GString *last_sdp; char *sdp_username; + char *sdp_session_name; unsigned int block_dtmf:1; unsigned int block_media:1; diff --git a/include/call_interfaces.h b/include/call_interfaces.h index 4baecfa2d..499aa3dde 100644 --- a/include/call_interfaces.h +++ b/include/call_interfaces.h @@ -75,6 +75,7 @@ struct sdp_ng_flags { replace_sess_conn:1, replace_sdp_version:1, replace_username:1, + replace_sess_name:1, replace_zero_address:1, rtcp_mux_offer:1, rtcp_mux_require:1, diff --git a/utils/rtpengine-ng-client b/utils/rtpengine-ng-client index 073b03be6..fccfc676a 100755 --- a/utils/rtpengine-ng-client +++ b/utils/rtpengine-ng-client @@ -30,6 +30,7 @@ GetOptions( 'replace-session-connection' => \$options{'replace-session connection'}, 'replace-sdp-version' => \$options{'replace-sdp version'}, 'replace-username' => \$options{'replace-username'}, + 'replace-session-name' => \$options{'replace-session-name'}, 'client-address=s' => \$options{'client-address'}, 'sdp=s' => \$options{'sdp'}, 'sdp-file=s' => \$options{'sdp-file'}, @@ -102,7 +103,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,username')) { +for my $x (split(/,/, 'origin,session connection,sdp version,username,session-name')) { defined($options{'replace-' . $x}) and push(@{$packet{replace}}, $x); } for my $x (split(/,/, 'rtcp-mux,SDES,supports,T.38,OSRTP')) {