### Description
<Sipwise Hat on>
We have a module that has tm callbacks of type TMCB_REQUEST_FWDED and it calls uac.replace_from API. I noticed that this call was failing in a forking scenario:
First branch:
```
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692(a)127.126.0.1[0]} tm [t_hooks.c:258]: run_trans_callbacks_internal(): DBG: trans=0x7f89149cf660, callback type 16, id 0 entered
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692(a)127.126.0.1[0]} pv_headers [pv_headers.c:413]: pv_apply_headers(): xavp->name:headers.0 br_xname:headers.0 keys_count: 21
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692(a)127.126.0.1[0]} pv_headers [pv_headers.c:445]: pv_apply_headers(): replace_from[From]: sip:4311002@spce.test
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692(a)127.126.0.1[0]} uac [uac.c:489]: replace_from_api(): dsp=(nil) (len=0) , uri=0x7ffde172f250 (len=21)
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692(a)127.126.0.1[0]} uac [replace.c:361]: replace_uri(): uri to replace [sip:testuser1002@spce.test]
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692(a)127.126.0.1[0]} uac [replace.c:362]: replace_uri(): replacement uri is [sip:4311002@spce.test]
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692(a)127.126.0.1[0]} uac [replace.c:506]: replace_uri(): encode is=<aVBYbwMxODMSLiN6KQM7LQplW2h4fiwKMBM-> len=36
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692(a)127.126.0.1[0]} pv_headers [pv_headers.c:464]: pv_apply_headers(): skip unchanged To header
```
Second branch:
```
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692(a)127.126.0.1[1]} tm [t_hooks.c:258]: run_trans_callbacks_internal(): DBG: trans=0x7f89149cf660, callback type 16, id 0 entered
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692(a)127.126.0.1[1]} pv_headers [pv_headers.c:413]: pv_apply_headers(): xavp->name:headers.1 br_xname:headers.1 keys_count: 21
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692(a)127.126.0.1[1]} pv_headers [pv_headers.c:445]: pv_apply_headers(): replace_from[From]: sip:4311002@spce.test
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692(a)127.126.0.1[1]} uac [uac.c:489]: replace_from_api(): dsp=(nil) (len=0) , uri=0x7ffde172f250 (len=21)
Nov 20 16:24:59 spce proxy[28430]: ERROR: {1 NGCP%invite_q_forking%///1-28692(a)127.126.0.1[1]} uac [replace.c:267]: replace_uri(): called uac_replace_from() multiple times on the message
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692(a)127.126.0.1[1]} pv_headers [pv_headers.c:464]: pv_apply_headers(): skip unchanged To header
```
### Possible solution
allow TMCB_REQUEST_FWDED cb to be executed as BRANCH_ROUTE
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2141
#### 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 -->
- [X] PR should be backported to stable branches
- [X] Tested changes locally
- [X] Related to issue #2141
#### Description
Execute TMCB_REQUEST_FWDED cb as BRANCH_ROUTE there's branch_route actions
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2142
-- Commit Summary --
* tm: execute TMCB_REQUEST_FWDED cb as BRANCH_ROUTE when necessary
-- File Changes --
M src/modules/tm/t_fwd.c (16)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2142.patchhttps://github.com/kamailio/kamailio/pull/2142.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2142
Module: kamailio
Branch: master
Commit: bc40eaa4fe446bffd9f41d5d6b21becd7b7fdc87
URL: https://github.com/kamailio/kamailio/commit/bc40eaa4fe446bffd9f41d5d6b21bec…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2019-11-21T10:01:14+01:00
tm: execute TMCB_REQUEST_FWDED cb as BRANCH_ROUTE when necessary
---
Modified: src/modules/tm/t_fwd.c
---
Diff: https://github.com/kamailio/kamailio/commit/bc40eaa4fe446bffd9f41d5d6b21bec…
Patch: https://github.com/kamailio/kamailio/commit/bc40eaa4fe446bffd9f41d5d6b21bec…
---
diff --git a/src/modules/tm/t_fwd.c b/src/modules/tm/t_fwd.c
index 33a50d7799..81a0f20841 100644
--- a/src/modules/tm/t_fwd.c
+++ b/src/modules/tm/t_fwd.c
@@ -374,15 +374,19 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
goto error03;
}
}
+ /* run the specific callbacks for this transaction */
+ if (unlikely(has_tran_tmcbs(t, TMCB_REQUEST_FWDED)))
+ run_trans_callbacks( TMCB_REQUEST_FWDED , t, i_req, 0,
+ -i_req->REQ_METHOD);
+
tm_ctx_set_branch_index(T_BR_UNDEFINED);
set_route_type(backup_route_type);
+ } else {
+ /* run the specific callbacks for this transaction */
+ if (unlikely(has_tran_tmcbs(t, TMCB_REQUEST_FWDED)))
+ run_trans_callbacks( TMCB_REQUEST_FWDED , t, i_req, 0,
+ -i_req->REQ_METHOD);
}
-
- /* run the specific callbacks for this transaction */
- if (unlikely(has_tran_tmcbs(t, TMCB_REQUEST_FWDED)))
- run_trans_callbacks( TMCB_REQUEST_FWDED , t, i_req, 0,
- -i_req->REQ_METHOD);
-
if (likely( !(flags & UAC_DNS_FAILOVER_F) && i_req->dst_uri.s &&
i_req->dst_uri.len)){
/* no dns failover and non-empty dst_uri => use it as dst
<!-- 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 -->
- [X] PR should be backported to stable branches
- [X] Tested changes locally
#### Description
<!-- Describe your changes in detail -->
Previous version did not allow deletion of all rows in the table although this is allowed as described in section [9.2.9](http://www.asipto.com/pub/kamailio-devel-guide/#c09f_delete) of the Kamailio SIP Server v3.2.0 Development Guide. Former code always assumed filters would be involved so this change skips the filter matching if no filter is applied.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2140
-- Commit Summary --
* db_redis: allow deletion of all rows
-- File Changes --
M src/modules/db_redis/redis_dbase.c (7)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2140.patchhttps://github.com/kamailio/kamailio/pull/2140.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2140