Browse code

rtpengine: added support for DTLS transports

- added ability to explicitly request DTLS transports:
UDP/TLS/RTP/SAVP and UDP/TLS/RTP/SAVPF

Jerzy Ptak authored on 28/02/2018 12:29:45
Showing 2 changed files
... ...
@@ -2207,7 +2207,7 @@ rtpengine_offer();
2207 2207
 				&sdp; substitutions (c=, m=, etc) are unaffected by this flag.
2208 2208
 				</para></listitem>
2209 2209
 				<listitem><para>
2210
-				<emphasis>RTP, SRTP, AVP, AVPF</emphasis> - These flags control the &rtp;
2210
+				<emphasis>RTP, SRTP, DTLS, AVP, AVPF</emphasis> - These flags control the &rtp;
2211 2211
 				transport protocol that should be used towards the recipient of
2212 2212
 				the &sdp;. If none of them are specified, the protocol given in
2213 2213
 				the &sdp; is left untouched. Otherwise, the <quote>SRTP</quote> flag indicates that
... ...
@@ -2217,8 +2217,8 @@ rtpengine_offer();
2217 2217
 				should be used. See also the next set of flags below.
2218 2218
 				</para></listitem>
2219 2219
 				<listitem><para>
2220
-				<emphasis>RTP/AVP, RTP/SAVP, RTP/AVPF, RTP/SAVPF</emphasis> - these serve as
2221
-				an alternative, more explicit way to select between the different &rtp; protocols
2220
+				<emphasis>RTP/AVP, RTP/SAVP, UDP/TLS/RTP/SAVP, RTP/AVPF, RTP/SAVPF, UDP/TLS/RTP/SAVPF</emphasis> - these 
2221
+				serve as an alternative, more explicit way to select between the different &rtp; protocols
2222 2222
 				and profiles supported by the &rtp; proxy. For example, giving the flag
2223 2223
 				<quote>RTP/SAVPF</quote> has the same effect as giving the two flags
2224 2224
 				<quote>SRTP AVPF</quote>.
... ...
@@ -1888,6 +1888,8 @@ static const char *transports[] = {
1888 1888
 	[0x01]	= "RTP/SAVP",
1889 1889
 	[0x02]	= "RTP/AVPF",
1890 1890
 	[0x03]	= "RTP/SAVPF",
1891
+	[0x04]	= "UDP/TLS/RTP/SAVP",
1892
+	[0x06]	= "UDP/TLS/RTP/SAVPF",
1891 1893
 };
1892 1894
 
1893 1895
 static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enum rtpe_operation *op,
... ...
@@ -1963,6 +1965,8 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu
1963 1965
 					ng_flags->transport |= 0x101;
1964 1966
 				else if (str_eq(&key, "AVPF"))
1965 1967
 					ng_flags->transport |= 0x102;
1968
+				else if (str_eq(&key, "DTLS"))
1969
+					ng_flags->transport |= 0x104;
1966 1970
 				else
1967 1971
 					goto generic;
1968 1972
 				goto next;
... ...
@@ -2065,6 +2069,23 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu
2065 2069
 					goto next;
2066 2070
 				}
2067 2071
 				break;
2072
+
2073
+			case 16:
2074
+				if (str_eq(&key, "UDP/TLS/RTP/SAVP"))
2075
+					ng_flags->transport = 0x104;
2076
+				else
2077
+					goto generic;
2078
+				goto next;
2079
+				break;
2080
+
2081
+			case 17:
2082
+				if (str_eq(&key, "UDP/TLS/RTP/SAVPF"))
2083
+					ng_flags->transport = 0x106;
2084
+				else
2085
+					goto generic;
2086
+				goto next;
2087
+				break;
2088
+
2068 2089
 		}
2069 2090
 
2070 2091
 generic:
... ...
@@ -2165,7 +2186,7 @@ static bencode_item_t *rtpp_function_call(bencode_buffer_t *bencbuf, struct sip_
2165 2186
 		bencode_dictionary_add(ng_flags.dict, "replace", ng_flags.replace);
2166 2187
 	if ((ng_flags.transport & 0x100))
2167 2188
 		bencode_dictionary_add_string(ng_flags.dict, "transport-protocol",
2168
-				transports[ng_flags.transport & 0x003]);
2189
+				transports[ng_flags.transport & 0x007]);
2169 2190
 	if (ng_flags.rtcp_mux && ng_flags.rtcp_mux->child)
2170 2191
 		bencode_dictionary_add(ng_flags.dict, "rtcp-mux", ng_flags.rtcp_mux);
2171 2192