I can see TM API is exposing
tmb.t_get_reply_totag(msg, &to_tag);
looking at what can be done from acc_logic.c
on_missed
/* set env variables */
env_set_to( get_rpl_to(t,reply) );
env_set_code_status( code, reply);
...
On Thu, Jul 30, 2020 at 11:51 PM Julien Chavanton <jchavanton(a)gmail.com>
wrote:
> Hi, considering this example :
>
>
> 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.
>
> I wonder if there is a way to populate the to-tag immediately ?
>
> I will dig it further, but maybe there is a trick I am missing
>
>
### Description
I have an edge fleet of kamailio hosts holding connections to SIP clients. Behind this edge fleet I have authoritative proxies (APs) managing call routing and branching.
I have noticed an issue with ACK processing in this scenario:
1. Branch a call to multiple devices which are connected to the same edge host.
2. AP fowards the INVITEs to a single kamailio edge host. which then fowards those INVITEs to the devices
3. On device with branch index 0, reply 4xx response
4. The authoritative proxy will automatically ACK this response back to the edge host. Edge host receives ACK for branch index 0
5. Have another device reply 200 OK. This gets back to the caller device fine.
6. The caller will send the ACK for the 200 OK. At the authoritative proxy, kamailio will build the via and hardcodes this via construction with branch index 0.
7. Edge host receives ACK with branch index 0, checks and sees it already got the ACK with branch index 0 (ACK from step 4) and does not forward the 200 OK ACK to the device which is trying to accept the call.
Summary:
Kamailio builds VIA headers which suffix the branch index. Note the .0 in the via header below. This via was generated from a message with branch index 0.
SIP/2.0/TLS 172.xxx.xxx.xxx:5061;received=34.xxx.xxx.xxx;branch=z9hG4bK3e52.8b4427a3530f17e60bf152a73caf0b38.0;i=9c52a
When doing ACK processing, Kamailio fowards ACKs with hardcoded 0-th branch index (this gets suffix'd to the via branch). If the branch with index 0 had already replied, it may have already been ACK'd and therefore the next ACK will not be forwarded by the edge host.
https://github.com/kamailio/kamailio/blob/master/src/core/forward.c#L527
### Possible Solutions
The simplest solution I can see to this problem is to change how the VIA is constructed for INVITE requests. To avoid collisions with the 200 OK ACK, change the logic so that the value written to the branch index part of the via branch value is 1 greater than the actual branch index.
As far as I can tell, this requires changes inside t_msgbuilder.c and t_lookup. The first change is to pass b + 1 instead of b when constructing the via header value.
```
int t_calc_branch(struct cell *t,
int b, char *branch, int *branch_len)
{
return branch_builder( t->hash_index,
0, t->md5,
b+1, branch, branch_len );
}
```
The second is to update the reply matching logic which parses the branch index, so that it decrements the value.
```
/* sanity check */
if (unlikely(reverse_hex2int(hashi, hashl, &hash_index)<0
||hash_index>=TABLE_ENTRIES
|| reverse_hex2int(branchi, branchl, &branch_id)<0
|| branch_id>=sr_dst_max_branches <--- this should become strict greater
|| loopl!=MD5_LEN)
) {
DBG("DEBUG: t_reply_matching: poor reply labels %d label %d "
"branch %d\n", hash_index, entry_label, branch_id );
goto nomatch2;
}
/* add the decrement here */
branch_id--;
```
--
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/2419
Module: kamailio
Branch: master
Commit: 3bbaca477c27b2e1864a72491578279be2295fe1
URL: https://github.com/kamailio/kamailio/commit/3bbaca477c27b2e1864a72491578279…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2020-07-30T20:46:13+02:00
modules: readme files regenerated - app_lua ... [skip ci]
---
Modified: src/modules/app_lua/README
---
Diff: https://github.com/kamailio/kamailio/commit/3bbaca477c27b2e1864a72491578279…
Patch: https://github.com/kamailio/kamailio/commit/3bbaca477c27b2e1864a72491578279…
---
diff --git a/src/modules/app_lua/README b/src/modules/app_lua/README
index a1f0c05984..545fb78f14 100644
--- a/src/modules/app_lua/README
+++ b/src/modules/app_lua/README
@@ -94,6 +94,9 @@ Chapter 1. Admin Guide
To read more about KEMI exports and available KSR submodules, see:
* http://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/
+ Note: to have the old Lua module 'sr' available, load the 'app_lua_sr'
+ Kamailio module.
+
Lua (http://www.lua.org) is a fast and easy to embed scripting
language. Exported API from SIP router to Lua is documented in the
dokuwiki.
@@ -203,7 +206,7 @@ lua_dofile("/usr/local/etc/kamailio/lua/myscript.lua");
Example 1.6. lua_dostring usage
...
-if(!lua_dostring("sr.log([[err]], [[----------- Hello World from $fU\n]])"))
+if(!lua_dostring("KSR.log([[err]], [[----------- Hello World from $fU\n]])"))
{
xdbg("SCRIPT: failed to execute lua script!\n");
}
@@ -237,7 +240,7 @@ lua_run("lua_func3", "$rU", "2", "$si");
Example 1.8. lua_runstring usage
...
-if(!lua_runstring("sr.log([[err]], [[----------- Hello World from $fU\n]])"))
+if(!lua_runstring("KSR.log([[err]], [[----------- Hello World from $fU\n]])"))
{
xdbg("SCRIPT: failed to execute lua script!\n");
}
@@ -297,7 +300,7 @@ if(!lua_runstring("sr.log([[err]], [[----------- Hello World from $fU\n]])"))
'/usr/local/etc/kamailio/lua/myscript.lua'.
...
function sr_append_fu_to_reply()
- sr.hdr.append_to_reply("P-From: " .. sr.pv.get("$fu") .. "\r\n");
+ KSR.hdr.append_to_reply("P-From: " .. KSR.pv.get("$fu") .. "\r\n");
end
...
#### 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 #2414
#### Description
* dialog PUBLISH was missing SIP-If-Mach
* pua was inserting a new record for every dialog state
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2416
-- Commit Summary --
* pua: fix send_publish() behavior on PUA_DB_ONLY
-- File Changes --
M src/modules/pua/send_publish.c (13)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2416.patchhttps://github.com/kamailio/kamailio/pull/2416.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/2416
Hello, this tracker is for bugs and feature requests, not for general user support. Please contact our users list for this kind of questions at: Kamailio (SER) - Users Mailing List sr-users(a)lists.kamailio.org You might need to subscribe before, if you not already on the list.
--
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/2417#issuecomment-666303616
Please help me.
How to kamailio connect to Sip trunk with credentials (username & password)
--
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/2418