Browse code

rtpengine : crash is fixed and codec flags added to doc (#1742)

* rtpengine : add information to doc about transcode

rtpengine : add information to doc about transcode parameter

* rtpengine : codec flag crash is fixed
codec-transcode , codec-strip , codec-mask , codec-offer gives crash without codec value.It is fixed and some logs are added for help.

* rtpengine : codec-transcode and other flags are added to doc

codec-transcode , codec-strip , codec-mask , codec-strip are added to doc with example.

* rtpengine : str_key_val_prefix is fixed for null values
str_key_val_prefix is fixed for null values

* rtpengine : b parameter is changed with via-branch in document
b parameter is changed with via-branch in document

Yasin CANER authored on 04/12/2018 08:37:04 • Richard Fuchs committed on 04/12/2018 08:37:04
Showing 2 changed files
... ...
@@ -281,7 +281,7 @@ modparam("rtpengine", "rtpengine_allow_op", 1)
281 281
 	<section id="rtpengine.p.queried_nodes_limit">
282 282
 		<title><varname>queried_nodes_limit</varname> (integer)</title>
283 283
 		<para>
284
-		The total number of nodes inside a set (sets are configurable via rtpengine_sock function) to be queried 
284
+		The total number of nodes inside a set (sets are configurable via rtpengine_sock function) to be queried
285 285
 		before giving up establishing a session. This brings more flexibility in case checking all rtpengines
286 286
 		would take too long. Max limit is 30.
287 287
 		</para>
... ...
@@ -334,11 +334,11 @@ modparam("rtpengine", "rtpengine_retr", 2)
334 334
 	<section id="rtpengine.p.extra_id_pv">
335 335
 		<title><varname>extra_id_pv</varname> (string)</title>
336 336
 		<para>
337
-			The parameter sets the PV definition to use when the <quote>b</quote>
337
+			The parameter sets the PV definition to use when the <quote>via-branch</quote>
338 338
 			parameter is used on rtpengine_delete(), rtpengine_offer(),
339 339
 			rtpengine_answer() or rtpengine_manage() command.
340 340
 		</para><para>
341
-			Default is empty, the <quote>b</quote> parameter may not be used then.
341
+			Default is empty, the <quote>via-branch</quote> parameter may not be used then.
342 342
 		</para>
343 343
 		<example>
344 344
 		<title>Set <varname>extra_id_pv</varname> parameter</title>
... ...
@@ -2217,7 +2217,7 @@ 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, UDP/TLS/RTP/SAVP, RTP/AVPF, RTP/SAVPF, UDP/TLS/RTP/SAVPF</emphasis> - these 
2220
+				<emphasis>RTP/AVP, RTP/SAVP, UDP/TLS/RTP/SAVP, RTP/AVPF, RTP/SAVPF, UDP/TLS/RTP/SAVPF</emphasis> - these
2221 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
... ...
@@ -2331,6 +2331,26 @@ rtpengine_offer();
2331 2331
                                 recording calls to provide custom additional information. More details about this are found
2332 2332
                                 in the rtpengine README.
2333 2333
 				</para></listitem>
2334
+				<listitem><para>
2335
+				<emphasis>codec-transcode=...</emphasis> - allows codecs to be added to the list of offered codecs even
2336
+				if they were not present in the original list of codecs. In this case, the transcoding engine
2337
+				will be engaged. Only codecs that are supported for both decoding and encoding can be added in
2338
+				this manner. More details about this are found in the rtpengine README.
2339
+				</para></listitem>
2340
+
2341
+				<listitem><para>
2342
+				<emphasis>codec-strip=...</emphasis> - strips given codec from sdp
2343
+				</para></listitem>
2344
+
2345
+				<listitem><para>
2346
+				<emphasis>codec-offer=...</emphasis> - offer given codec from sdp.More details about this are found in the rtpengine README.
2347
+				</para></listitem>
2348
+
2349
+				<listitem><para>
2350
+				<emphasis>codec-mask=...</emphasis> - Similar to strip except that codecs listed here will still be accepted
2351
+				and used for transcoding on the offering side.Useful only in combination with codec-transcode. <emphasis>all</emphasis> keyword
2352
+				can be used to mask all offered codecs
2353
+				</para></listitem>
2334 2354
 			</itemizedlist>
2335 2355
 			<para>
2336 2356
 			 Check also the documentation of RTPEngine, these flags are documented there as well:
... ...
@@ -2374,6 +2394,13 @@ onreply_route[2]
2374 2394
         rtpengine_offer();
2375 2395
 ...
2376 2396
 }
2397
+...
2398
+if (has_body("application/sdp")) {
2399
+		if (rtpengine_offer("codec-mask=all codec-transcode=PCMU codec-transcode=PCMA"))
2400
+				t_on_reply("1");
2401
+}
2402
+
2403
+...
2377 2404
 </programlisting>
2378 2405
                 </example>
2379 2406
 	</section>
... ...
@@ -2857,4 +2884,3 @@ $ &kamcmd; rtpengine.get_hash_total
2857 2884
 	</section>
2858 2885
 
2859 2886
 </chapter>
2860
-
... ...
@@ -218,7 +218,7 @@ static int pv_parse_var(str *inp, pv_elem_t **outp, int *got_any);
218 218
 static int mos_label_stats_parse(struct minmax_mos_label_stats *mmls);
219 219
 static void parse_call_stats(bencode_item_t *, struct sip_msg *);
220 220
 
221
-static int control_cmd_tos = -1; 
221
+static int control_cmd_tos = -1;
222 222
 static int rtpengine_allow_op = 0;
223 223
 static struct rtpp_node **queried_nodes_ptr = NULL;
224 224
 static pid_t mypid;
... ...
@@ -375,7 +375,7 @@ static param_export_t params[] = {
375 375
 	{"queried_nodes_limit",   INT_PARAM, &default_rtpengine_cfg.queried_nodes_limit    },
376 376
 	{"rtpengine_tout_ms",     INT_PARAM, &default_rtpengine_cfg.rtpengine_tout_ms      },
377 377
 	{"rtpengine_allow_op",    INT_PARAM, &rtpengine_allow_op     },
378
-	{"control_cmd_tos",       INT_PARAM, &control_cmd_tos        }, 
378
+	{"control_cmd_tos",       INT_PARAM, &control_cmd_tos        },
379 379
 	{"db_url",                PARAM_STR, &rtpp_db_url            },
380 380
 	{"table_name",            PARAM_STR, &rtpp_table_name        },
381 381
 	{"setid_col",             PARAM_STR, &rtpp_setid_col         },
... ...
@@ -699,6 +699,9 @@ static inline int str_prefix(const str *p, const char *q, str *out) {
699 699
 /* handle either "foo-bar" or "foo=bar" from flags */
700 700
 static inline int str_key_val_prefix(const str *p, const char *q, const str *v, str *out) {
701 701
 	if (str_eq(p, q)) {
702
+		if(!v->s || !v->len)
703
+			return 0;
704
+
702 705
 		*out = *v;
703 706
 		return 1;
704 707
 	}