<!-- 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 - [ ] Small bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds new functionality) - [x] 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 - [x] Related to issue #1783
#### Description <!-- Describe your changes in detail --> The result of this check is always false (or I think so because I always obtain 0!=8) and the function dlg_new_dialog() is never executed.
The function dlg_new_dialog() must be executed to save the new dialog. In other case the cnxcc module (I don know if there are more modules affected) doesn't work.
Can anyone review if this check is important, please?
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/1791
-- Commit Summary --
* dialog: The result of this check is always false and the function dlg_new_dialog() is never executed
-- File Changes --
M src/modules/dialog/dlg_handlers.c (2)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/1791.patch https://github.com/kamailio/kamailio/pull/1791.diff
Did you set the `dlg_flag` parameter for dialog module?
* https://www.kamailio.org/docs/modules/stable/modules/dialog.html#dialog.p.fl...
If yes, that is not required if you use `dlg_manage()`. If you set the modparam, then you have to do setflag(X) where X is the value for dlg_flag modparam.
Otherwise, if I didn't miss something, the condition there should to be ok to execute the code - dlg_flag_mask is 0 by default (with no dlg_flag set) and the expression evaluates to if(0!=0) return:
``` if((req->flags&dlg_flag_mask)!=dlg_flag_mask) return; ``
You are right, sorry for the noise. But I have some doubts.
You said that dlg_flag parameter is not required but if I don't set the dlg_flag, kamailio gives me an error when load dialog module: ``` Jan 9 10:53:08 pepelux /usr/local/sbin/kamailio[27387]: ERROR: dialog [dialog.c:519]: mod_init(): invalid dlg flag -1!! Jan 9 10:53:08 pepelux /usr/local/sbin/kamailio[27387]: ERROR: <core> [core/sr_module.c:911]: init_mod(): Error while initializing module dialog (/usr/local/lib64/kamailio/modules/dialog.so) ```
It worked for me as follow: ``` #!define DLG_FLAG 3 modparam("dialog", "dlg_flag", DLG_FLAG) route(CNXCC); dlg_manage(); ```
My problem was that I called route(CNXCC) after dlg_manage() and it seems that it is necessary to execute cnxcc functions before the dlg_manage().
Thanks for the help
Closed #1791.
Hmm, I thought that requiring to set dlg_flag was removed, but apparently it is not. We should get rid of that, needs to be fixed somehow.
I just pushed a patch (404f403786478a917637186446bb285e8e32cc59) that should remove the requirement of setting the dlg_flag parameter. Can you give it some tests and confirm if all works fine or not? When all ok, it can be backported.
All works fine for me. Thanks for the fix