From fe6f1c21d58110f10d389be54dfe53c59bfe1976 Mon Sep 17 00:00:00 2001 From: Yasin CANER <12412027+ycaner06@users.noreply.github.com> Date: Wed, 28 Nov 2018 17:31:39 +0300 Subject: [PATCH 1/5] rtpengine : add information to doc about transcode rtpengine : add information to doc about transcode parameter --- src/modules/rtpengine/doc/rtpengine_admin.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/rtpengine/doc/rtpengine_admin.xml b/src/modules/rtpengine/doc/rtpengine_admin.xml index 6bdf0e70ade..88af8a41809 100644 --- a/src/modules/rtpengine/doc/rtpengine_admin.xml +++ b/src/modules/rtpengine/doc/rtpengine_admin.xml @@ -2331,6 +2331,12 @@ rtpengine_offer(); recording calls to provide custom additional information. More details about this are found in the rtpengine README. + + transcode=... - allows codecs to be added to the list of offered codecs even + if they were not present in the original list of codecs. In this case, the transcoding engine + will be engaged. Only codecs that are supported for both decoding and encoding can be added in + this manner. More details about this are found in the rtpengine README. + Check also the documentation of RTPEngine, these flags are documented there as well: From 15884424c8c005fe362a18032b658343a2516afe Mon Sep 17 00:00:00 2001 From: Yasin CANER Date: Thu, 29 Nov 2018 09:52:54 +0300 Subject: [PATCH 2/5] 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. --- src/modules/rtpengine/rtpengine.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/modules/rtpengine/rtpengine.c b/src/modules/rtpengine/rtpengine.c index 4074385b1dc..06bb404b48f 100644 --- a/src/modules/rtpengine/rtpengine.c +++ b/src/modules/rtpengine/rtpengine.c @@ -218,7 +218,7 @@ static int pv_parse_var(str *inp, pv_elem_t **outp, int *got_any); static int mos_label_stats_parse(struct minmax_mos_label_stats *mmls); static void parse_call_stats(bencode_item_t *, struct sip_msg *); -static int control_cmd_tos = -1; +static int control_cmd_tos = -1; static int rtpengine_allow_op = 0; static struct rtpp_node **queried_nodes_ptr = NULL; static pid_t mypid; @@ -375,7 +375,7 @@ static param_export_t params[] = { {"queried_nodes_limit", INT_PARAM, &default_rtpengine_cfg.queried_nodes_limit }, {"rtpengine_tout_ms", INT_PARAM, &default_rtpengine_cfg.rtpengine_tout_ms }, {"rtpengine_allow_op", INT_PARAM, &rtpengine_allow_op }, - {"control_cmd_tos", INT_PARAM, &control_cmd_tos }, + {"control_cmd_tos", INT_PARAM, &control_cmd_tos }, {"db_url", PARAM_STR, &rtpp_db_url }, {"table_name", PARAM_STR, &rtpp_table_name }, {"setid_col", PARAM_STR, &rtpp_setid_col }, @@ -1992,6 +1992,10 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu if (str_key_val_prefix(&key, "transcode", &val, &s) || str_key_val_prefix(&key, "codec-transcode", &val, &s)) { + if(s.len<=0 && s.s==NULL){ + LM_ERR(" %.*s key needs codec value \n",key.len,key.s); + goto next; + } if (!ng_flags->codec_transcode) { ng_flags->codec_transcode = bencode_list(ng_flags->dict->buffer); bencode_dictionary_add(ng_flags->codec, "transcode", @@ -2002,6 +2006,10 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu } if (str_key_val_prefix(&key, "codec-strip", &val, &s)) { + if(s.len<=0 && s.s==NULL){ + LM_ERR(" %.*s key needs codec value \n",key.len,key.s); + goto next; + } if (!ng_flags->codec_strip) { ng_flags->codec_strip = bencode_list(ng_flags->dict->buffer); bencode_dictionary_add(ng_flags->codec, "strip", @@ -2012,6 +2020,10 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu } if (str_key_val_prefix(&key, "codec-offer", &val, &s)) { + if(s.len<=0 && s.s==NULL){ + LM_ERR(" %.*s key needs codec value \n",key.len,key.s); + goto next; + } if (!ng_flags->codec_offer) { ng_flags->codec_offer = bencode_list(ng_flags->dict->buffer); bencode_dictionary_add(ng_flags->codec, "offer", @@ -2022,6 +2034,10 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu } if (str_key_val_prefix(&key, "codec-mask", &val, &s)) { + if(s.len<=0 && s.s==NULL){ + LM_ERR(" %.*s key needs codec value \n",key.len,key.s); + goto next; + } if (!ng_flags->codec_mask) { ng_flags->codec_mask = bencode_list(ng_flags->dict->buffer); bencode_dictionary_add(ng_flags->codec, "mask", From 97eb8a61dd78b043c50bfd52b15a46fcf2f63e57 Mon Sep 17 00:00:00 2001 From: Yasin CANER Date: Thu, 29 Nov 2018 10:03:27 +0300 Subject: [PATCH 3/5] rtpengine : codec-transcode and other flags are added to doc codec-transcode , codec-strip , codec-mask , codec-strip are added to doc with example. --- src/modules/rtpengine/doc/rtpengine_admin.xml | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/src/modules/rtpengine/doc/rtpengine_admin.xml b/src/modules/rtpengine/doc/rtpengine_admin.xml index 88af8a41809..903e95ff1b3 100644 --- a/src/modules/rtpengine/doc/rtpengine_admin.xml +++ b/src/modules/rtpengine/doc/rtpengine_admin.xml @@ -281,7 +281,7 @@ modparam("rtpengine", "rtpengine_allow_op", 1)
<varname>queried_nodes_limit</varname> (integer) - The total number of nodes inside a set (sets are configurable via rtpengine_sock function) to be queried + The total number of nodes inside a set (sets are configurable via rtpengine_sock function) to be queried before giving up establishing a session. This brings more flexibility in case checking all rtpengines would take too long. Max limit is 30. @@ -2217,7 +2217,7 @@ rtpengine_offer(); should be used. See also the next set of flags below. - RTP/AVP, RTP/SAVP, UDP/TLS/RTP/SAVP, RTP/AVPF, RTP/SAVPF, UDP/TLS/RTP/SAVPF - these + RTP/AVP, RTP/SAVP, UDP/TLS/RTP/SAVP, RTP/AVPF, RTP/SAVPF, UDP/TLS/RTP/SAVPF - these serve as an alternative, more explicit way to select between the different &rtp; protocols and profiles supported by the &rtp; proxy. For example, giving the flag RTP/SAVPF has the same effect as giving the two flags @@ -2332,10 +2332,24 @@ rtpengine_offer(); in the rtpengine README. - transcode=... - allows codecs to be added to the list of offered codecs even - if they were not present in the original list of codecs. In this case, the transcoding engine - will be engaged. Only codecs that are supported for both decoding and encoding can be added in - this manner. More details about this are found in the rtpengine README. + codec-transcode=... - allows codecs to be added to the list of offered codecs even + if they were not present in the original list of codecs. In this case, the transcoding engine + will be engaged. Only codecs that are supported for both decoding and encoding can be added in + this manner. More details about this are found in the rtpengine README. + + + + codec-strip=... - strips given codec from sdp + + + + codec-offer=... - offer given codec from sdp.More details about this are found in the rtpengine README. + + + + codec-mask=... - Similar to strip except that codecs listed here will still be accepted + and used for transcoding on the offering side.Useful only in combination with codec-transcode. all keyword + can be used to mask all offered codecs @@ -2380,6 +2394,13 @@ onreply_route[2] rtpengine_offer(); ... } +... +if (has_body("application/sdp")) { + if (rtpengine_offer("codec-mask=all codec-transcode=PCMU codec-transcode=PCMA")) + t_on_reply("1"); +} + +...
@@ -2863,4 +2884,3 @@ $ &kamcmd; rtpengine.get_hash_total - From 13f565e72b811820766a218cbd7cbb715f215ffe Mon Sep 17 00:00:00 2001 From: Yasin CANER Date: Mon, 3 Dec 2018 09:15:06 +0300 Subject: [PATCH 4/5] rtpengine : str_key_val_prefix is fixed for null values str_key_val_prefix is fixed for null values --- src/modules/rtpengine/rtpengine.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/modules/rtpengine/rtpengine.c b/src/modules/rtpengine/rtpengine.c index 06bb404b48f..6f91e607bdc 100644 --- a/src/modules/rtpengine/rtpengine.c +++ b/src/modules/rtpengine/rtpengine.c @@ -699,6 +699,9 @@ static inline int str_prefix(const str *p, const char *q, str *out) { /* handle either "foo-bar" or "foo=bar" from flags */ static inline int str_key_val_prefix(const str *p, const char *q, const str *v, str *out) { if (str_eq(p, q)) { + if(!v->s || !v->len) + return 0; + *out = *v; return 1; } @@ -1992,10 +1995,6 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu if (str_key_val_prefix(&key, "transcode", &val, &s) || str_key_val_prefix(&key, "codec-transcode", &val, &s)) { - if(s.len<=0 && s.s==NULL){ - LM_ERR(" %.*s key needs codec value \n",key.len,key.s); - goto next; - } if (!ng_flags->codec_transcode) { ng_flags->codec_transcode = bencode_list(ng_flags->dict->buffer); bencode_dictionary_add(ng_flags->codec, "transcode", @@ -2006,10 +2005,6 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu } if (str_key_val_prefix(&key, "codec-strip", &val, &s)) { - if(s.len<=0 && s.s==NULL){ - LM_ERR(" %.*s key needs codec value \n",key.len,key.s); - goto next; - } if (!ng_flags->codec_strip) { ng_flags->codec_strip = bencode_list(ng_flags->dict->buffer); bencode_dictionary_add(ng_flags->codec, "strip", @@ -2020,10 +2015,6 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu } if (str_key_val_prefix(&key, "codec-offer", &val, &s)) { - if(s.len<=0 && s.s==NULL){ - LM_ERR(" %.*s key needs codec value \n",key.len,key.s); - goto next; - } if (!ng_flags->codec_offer) { ng_flags->codec_offer = bencode_list(ng_flags->dict->buffer); bencode_dictionary_add(ng_flags->codec, "offer", @@ -2034,10 +2025,6 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu } if (str_key_val_prefix(&key, "codec-mask", &val, &s)) { - if(s.len<=0 && s.s==NULL){ - LM_ERR(" %.*s key needs codec value \n",key.len,key.s); - goto next; - } if (!ng_flags->codec_mask) { ng_flags->codec_mask = bencode_list(ng_flags->dict->buffer); bencode_dictionary_add(ng_flags->codec, "mask", From 9401c827b6127620c0dd27ddb348672ccb93d009 Mon Sep 17 00:00:00 2001 From: Yasin CANER Date: Mon, 3 Dec 2018 11:07:27 +0300 Subject: [PATCH 5/5] rtpengine : b parameter is changed with via-branch in document b parameter is changed with via-branch in document --- src/modules/rtpengine/doc/rtpengine_admin.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/rtpengine/doc/rtpengine_admin.xml b/src/modules/rtpengine/doc/rtpengine_admin.xml index 903e95ff1b3..aec0814e3b0 100644 --- a/src/modules/rtpengine/doc/rtpengine_admin.xml +++ b/src/modules/rtpengine/doc/rtpengine_admin.xml @@ -334,11 +334,11 @@ modparam("rtpengine", "rtpengine_retr", 2)
<varname>extra_id_pv</varname> (string) - The parameter sets the PV definition to use when the b + The parameter sets the PV definition to use when the via-branch parameter is used on rtpengine_delete(), rtpengine_offer(), rtpengine_answer() or rtpengine_manage() command. - Default is empty, the b parameter may not be used then. + Default is empty, the via-branch parameter may not be used then. Set <varname>extra_id_pv</varname> parameter