<!-- Kamailio Pull Request Template -->
<!-- IMPORTANT: - for detailed contributing guidelines, read: https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md - pull requests must be done to master branch, unless they are backports of fixes from master branch to a stable branch - backports to stable branches must be done with 'git cherry-pick -x ...' - code is contributed under BSD for core and main components (tm, sl, auth, tls) - code is contributed GPLv2 or a compatible license for the other components - GPL code is contributed with OpenSSL licensing exception -->
#### Pre-Submission Checklist <!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply --> <!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above--> <!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list --> - [x] Commit message has the format required by CONTRIBUTING guide - [x] Commits are split per component (core, individual modules, libs, utils, ...) - [x] Each component has a single commit (if not, squash them into one commit) - [x] No commits to README files for modules (changes must be done to docbook files in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change - [x] Small bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds new functionality) - [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist: <!-- Go over all points below, and after creating the PR, tick the checkboxes that apply --> - [ ] PR should be backported to stable branches - [x] Tested changes locally - [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description <!-- Describe your changes in detail --> Kamailio crashes when codec-flags value are not setted with codecs. it is fixed. codec-flags information added to document. An example is added to document. You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/1742
-- Commit Summary --
* rtpengine : add information to doc about transcode * rtpengine : codec flag crash is fixed * rtpengine : codec-transcode and other flags are added to doc
-- File Changes --
M src/modules/rtpengine/doc/rtpengine_admin.xml (32) M src/modules/rtpengine/rtpengine.c (20)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/1742.patch https://github.com/kamailio/kamailio/pull/1742.diff
@rfuchs - does the patch to the rtpengine module code look ok for you?
rfuchs commented on this pull request.
@@ -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){
There's actually a much better solution to this, which is to change `str_key_val_prefix()`, which is where the bug actually is.
The function should read:
``` 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; } ... `
Then all the explicit null checks here and below can be removed.
ycaner06 commented on this pull request.
@@ -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){
I avoid changing function because i afraid that breaking other parts. At monday , i can change it as you wish.
@ycaner06 pushed 1 commit.
13f565e rtpengine : str_key_val_prefix is fixed for null values
@ycaner06 pushed 1 commit.
9401c82 rtpengine : b parameter is changed with via-branch in document
Looks good to me now. @miconda do you prefer to have these commits squashed or merge as they are now?
@rfuchs - up to you, do you it as you prefer -- usually we squash if a commit is changing or is an improvement of the previous commit.
Merged #1742 into master.