<!-- 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) - [x] 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 - [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description When doing t_reply/send_reply stateful, the ACC module will not add the to-tag to the ACC events. This patch will fix this and ensure that we get the to-tag that was locally generated used in the reply.
example :
``` modparam("acc", "acc_prepare_always", 1) modparam("acc_json", "acc_missed_flag", 6)
failure_route[test] { setflag(6); // MISSED_ACC, the failure will be recorded by ACC t_flush_flags(); // This will set the flags in the newly created transaction t_reply("500", "Service Unavailable"); } ``` This does generate an ACC event, however the to-tag is not populated, my guess this is because the TM callback is done before the to-tag is generated.
This patch will populate the to-tag immediately.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2422
-- Commit Summary --
* acc: add to-tag for locally generated replies
-- File Changes --
M src/modules/acc/acc.c (7) M src/modules/acc/acc_api.h (1) M src/modules/acc/acc_logic.c (20)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2422.patch https://github.com/kamailio/kamailio/pull/2422.diff
@miconda commented on this pull request.
static inline void env_set_to(struct hdr_field *to) { acc_env.to = to; }
+// static inline void env_set_totag(str *to_tag) +// { +// acc_env.to_tag = to_tag; +// }
I guess this part can be removed if not intended to be used.
@miconda commented on this pull request.
@@ -372,6 +380,9 @@ void acc_onreq( struct cell* t, int type, struct tmcb_params *ps )
int tmcb_types; int is_invite;
+ LM_ERR("is_mc_on: %d\n", is_mc_on(ps->req)); + LM_ERR("is_acc_on: %d\n", is_acc_on(ps->req)); + LM_ERR("is_acc_prepare_on: %d\n", is_acc_prepare_on(ps->req));
There are couple of error messages which I guess are only for testing purposes. Before merging should be removed. I could spot in two other places, besides the three here.
Sorry, about the delay, I left it unfinished before taking a long week-end off, I will push adjustments tomorrow
@jchavanton pushed 1 commit.
1138ac481818c9fb1e54b36bc9f99a781a059dc1 acc: add to-tag for locally generated replies
@jchavanton pushed 1 commit.
ef1618d9d8c23227a7e86c62d2a75b1d5a4167a9 acc: add to-tag for locally generated replies
Still working on it, or it is finished from your point of view?
it is working, but as I integrate it in a complicated routing configuration, I may find more little modifications.
Just found one ...
We could wait a few more days.
@jchavanton pushed 1 commit.
051300e04bb6bc24796c03f0b80fda87ab07627f acc: add to-tag for locally generated replies
Would be good if I could also improve this to always have the real reason phrase sent. Having a look at the options.
``` acc_env.code = code; if (reply==FAKED_REPLY || reply==NULL) { /* code */ acc_env.code_s.s = int2bstr((unsigned long)code, code_buf, &acc_env.code_s.len); /* reason */ acc_env.reason.s = error_text(code); acc_env.reason.len = strlen(acc_env.reason.s); ```
@jchavanton pushed 1 commit.
c5f6ff37f61f99e0ec9322d9dc3c4a48af8f1b59 acc: use sent reason phrase for locally generated
not expecting more modifications based on testing. ready to review/merge
Thanks!
Merged #2422 into master.