### Description siptrace module not mirror relayed ACK message.
### Troubleshooting
#### Reproduction Need patch vanilla kamailio config like this diff ```patch --- kamailio.cfg +++ /etc/kamailio/kamailio.cfg @@ -1,4 +1,8 @@ #!KAMAILIO +#!define WITH_DEBUG +#!define WITH_PSTN +#!define WITH_NAT + # # Kamailio (OpenSER) SIP Server v5.1 - default configuration script # - web: https://www.kamailio.org @@ -137,7 +141,9 @@ #!define FLT_ACCMISSED 2 #!define FLT_ACCFAILED 3 #!define FLT_NATS 5 +#!define FLT_SIPTRACE 8
+ #!define FLB_NATB 6 #!define FLB_NATSIPPING 7
@@ -198,8 +204,8 @@ * pstn.gw_ip = "10.0.0.101" desc "My PSTN GW Address" * * - by default is empty to avoid misrouting */ -pstn.gw_ip = "" desc "PSTN GW Address" -pstn.gw_port = "" desc "PSTN GW Port" +pstn.gw_ip = "8.8.8.8" desc "PSTN GW Address" +pstn.gw_port = "5060" desc "PSTN GW Port" #!endif
#!ifdef WITH_VOICEMAIL @@ -286,6 +292,16 @@ loadmodule "debugger.so" #!endif
+loadmodule "siptrace.so" +modparam("siptrace", "duplicate_uri", "sip:217.12.247.98:9060") +modparam("siptrace", "hep_mode_on", 1) +modparam("siptrace", "hep_version", 3) +modparam("siptrace", "hep_capture_id", 1) +modparam("siptrace", "trace_to_database", 0) +## `trace_flag` value must be equal to FLT_SIPTRACE value at head of "default.cfg" file +modparam("siptrace", "trace_flag", 8) +modparam("siptrace", "trace_on", 1) + # ----------------- setting module-specific parameters ---------------
@@ -310,9 +326,10 @@
# ----- rr params ----- # set next param to 1 to add value to ;lr param (helps with some UAs) -modparam("rr", "enable_full_lr", 0) +modparam("rr", "enable_full_lr", 1) # do not append from tag to the RR (no need for this script) modparam("rr", "append_fromtag", 0) +modparam("rr", "enable_double_rr", 1)
# ----- registrar params ----- modparam("registrar", "method_filtering", 1) @@ -536,6 +553,9 @@ if(!t_is_set("failure_route")) t_on_failure("MANAGE_FAILURE"); }
+ sip_trace(); + setflag(FLT_SIPTRACE); + if (!t_relay()) { sl_reply_error(); } ``` #### Debugging Data
none
#### Log Messages ```text {1 20 ACK 1258335781} 15(2198) DEBUG: siptrace [siptrace.c:507]: sip_trace_store_db(): database connection not initialized {1 20 ACK 1258335781} 15(2198) DEBUG: siptrace [siptrace_hep.c:498]: pipport2su(): the port string is 35060 {1 20 ACK 1258335781} 15(2198) DEBUG: siptrace [siptrace_hep.c:498]: pipport2su(): the port string is 5060 {1 20 ACK 1258335781} 15(2198) DEBUG: <core> [core/proxy.c:264]: mk_proxy(): doing DNS lookup... {1 20 ACK 1258335781} 15(2198) DEBUG: siptrace [siptrace_hep.c:183]: trace_send_hep3_duplicate(): setting up the socket_info {1 20 ACK 1258335781} 15(2198) exec: *** cfgtrace:request_route=[RELAY] c=[/etc/kamailio/kamailio.cfg] l=557 a=39 n=setflag {1 20 ACK 1258335781} 15(2198) exec: *** cfgtrace:request_route=[RELAY] c=[/etc/kamailio/kamailio.cfg] l=562 a=16 n=if {1 20 ACK 1258335781} 15(2198) exec: *** cfgtrace:request_route=[RELAY] c=[/etc/kamailio/kamailio.cfg] l=559 a=24 n=t_relay {1 20 ACK 1258335781} 15(2198) DEBUG: tm [t_lookup.c:1319]: t_newtran(): msg id=1 , global msg id=0 , T on entrance=0xffffffffffffffff {1 20 ACK 1258335781} 15(2198) DEBUG: tm [t_lookup.c:476]: t_lookup_request(): start searching: hash=11341, isACK=1 {1 20 ACK 1258335781} 15(2198) DEBUG: tm [t_lookup.c:435]: matching_3261(): RFC3261 transaction matching failed {1 20 ACK 1258335781} 15(2198) DEBUG: tm [t_lookup.c:659]: t_lookup_request(): no transaction found {1 20 ACK 1258335781} 15(2198) DEBUG: tm [t_funcs.c:284]: t_relay_to(): forwarding ACK statelessly {1 20 ACK 1258335781} 15(2198) DEBUG: <core> [core/md5utils.c:67]: MD5StringArray(): MD5 calculated: 307e4757bd94a80e26f17adb5260cb13 {1 20 ACK 1258335781} 15(2198) DEBUG: <core> [core/forward.c:557]: forward_request(): Sending: ``` Received ACK is mirrored but relayed ACK is not mirrored. Full log in attached file `kamailio.log` [kamailio.log](https://github.com/kamailio/kamailio/files/2766269/kamailio.log)
#### SIP Traffic
SIP messages and mirrored traffic in attached pcap file. Packet 19 is not mirrored. [kamailio-ack.zip](https://github.com/kamailio/kamailio/files/2766281/kamailio-ack.zip)
### Possible Solutions
Not know
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
``` / # kamailio -v version: kamailio 5.1.6 (x86_64/linux) flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: unknown compiled on 03:24:34 Nov 23 2018 with gcc 8.2.0 ```
* **Operating System**:
Alpine Linux edge
``` / # cat /etc/os-release NAME="Alpine Linux" ID=alpine VERSION_ID=3.8.0 PRETTY_NAME="Alpine Linux v3.8" HOME_URL="http://alpinelinux.org" BUG_REPORT_URL="http://bugs.alpinelinux.org" ```
@sergey-safarov i think the issue is in `freeswitch` you can try these PRs for freeswitch in order [merged] https://freeswitch.org/stash/projects/FS/repos/freeswitch/pull-requests/1660...
https://freeswitch.org/stash/projects/FS/repos/freeswitch/pull-requests/1523... https://freeswitch.org/stash/projects/FS/repos/freeswitch/pull-requests/1524... https://freeswitch.org/stash/projects/FS/repos/freeswitch/pull-requests/1516...
let us know which (if any) of these fix your issue with freeswitch.
Thank you Luis I will try this PR. Could you also look [rfc3665](https://tools.ietf.org/html/rfc3665) Here is many calls examples with proxy. I cannot find here `ACK` and `BYE` messages with `Record-Route` header.
If you want to mirror all the sip traffic, just set this modparam:
* https://www.kamailio.org/docs/modules/stable/modules/siptrace.html#siptrace....
If you still want to do selective mirroring, for outgoing ACK you have to use onsend_route block, because the ACK doesn't have a corresponding response, there cannot be a transaction for it, so it is forwarded in stateless mode.
Should this still not work, then reopen.
Closed #1811.
Luis @lazedo, i merged FS PRs 1523, 1524, 1516 into FS master and made same test. ACK message is still no send to siptrace server.
@sergey-safarov then you're good. for the `sip trace`, as @miconda commented , did you tried to change the trace_mode ? @miconda if only we could filter out the `OPTIONS` ..., its a blocker for us not having that.
This kamailio config change is fixed `ACK` packet mirroring ```sh onsend_route { if (is_method("ACK")) { sip_trace(); } } ```
@lazedo yes `trace_mode` also works as expected. I created this ticket to get working selective mirroring on your kamailio config. In short time i will create PR for your config.