when using the below script blocks for handling SUBSCRIBE messages, the nat_keepalive does not work as expected. ``` #!ifdef NAT_TRAVERSAL_ROLE route[PRESENCE_NAT] { force_rport(); if (client_nat_test("3")) { if(is_first_hop()) set_contact_alias(); nat_keepalive(); } } #!endif
route[HANDLE_SUBSCRIBE] { if (!is_method("SUBSCRIBE")) { return; }
#!ifdef NAT_TRAVERSAL_ROLE route(PRESENCE_NAT); #!endif
if (!t_newtran()) { sl_reply_error(); exit; }
if(has_totag()) { route(HANDLE_RESUBSCRIBE); } else { route(HANDLE_NEW_SUBSCRIBE); } t_release(); exit; } ```
i believe this should be backported to stable branches Thanks You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/1344
-- Commit Summary --
* nat_traversal: fix local generated transactions
-- File Changes --
M src/modules/nat_traversal/nat_traversal.c (29)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/1344.patch https://github.com/kamailio/kamailio/pull/1344.diff
First, it looks like `pkg_free` has to be done on `tmp`.
Then I think this needs to be tuned, otherwise can affect performances for forwarded subscribe requests, because the operation will be done twice. The execution of the callback for `TMCB_RESPONSE_SENT` should be done only when `param->rpl==FAKED_REPLY` (which is when a local response is generated).
@miconda thanks for the comments. i think `tmp` will be freed with `free_sip_msg`. will update the `FAKED_REPLY`
`tmp` is not freed there, because DYN_BUF is not defined. You can wrap it in ifdef if you want, but that define should be removed, is inactive for long time.
@lazedo pushed 1 commit.
d4bb995 nat_traversal: handle TMCB_RESPONSE_SENT only for FAKED_REPLY
@miconda ah, didn't know that, fixing
@lazedo pushed 1 commit.
fde873c nat_traversal: free allocated buffer
Merged #1344.
I squashed and merged in a single commit. You can backport if needed.