Hi all,

I'm doing some experimenting with kamailio -- currently looking for a replacement of our existing (aging) SIP infrastructure.

One of the experiments that I'm doing is testing the dialog module's dlg_set_timeout function. The issue that I'm having is while I do see that kamailio is generating a BYE, and sends it out to the B-leg of the call properly, the BYE goes to a private address on the A-leg.

To Note:
- kamailio is behind a NAT (on AWS)
- both UA endpoints are remote and are both behind a NAT
- Not sure if this matters, but I do have the topos module enabled, though I see the same behavior regardless if it's enabled or not.
- Have set nathelpers (fix_nated_register, fix_nated_contact,etc...) which helps calls between endpoints and the endpoints themselves are able to send/receive BYEs when they generate them; however doesn't seem to help if kamailio locally generates the BYE.

The only thing I do see within my logs is when the BYE is being generated by kamailio, it uses the private IP of my UA and not public for the caller. Callee, the public address is referenced. If more information is needed, please let me know (just didn't want to spam my script/ logs). Thanks.

Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: dialog [dlg_req_within.c:399]: send_bye(): sending BYE to caller
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: tm [uac.c:458]: t_uac_prepare(): next_hop=<sip:1000@10.0.0.47:38606;line=9k4wsgc9>
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: tm [uac.c:158]: dlg2hash(): hashid 40484
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/parse_fline.c:249]: parse_first_line(): first line type 1 (request) flags 1
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/msg_parser.c:679]: parse_msg(): SIP Request:
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/msg_parser.c:680]: parse_msg():  method:  <BYE>
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/msg_parser.c:682]: parse_msg():  uri:     <sip:1000@10.0.0.47:38606;line=9k4wsgc9>
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/msg_parser.c:684]: parse_msg():  version: <SIP/2.0>
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/parse_hname2.c:301]: parse_sip_header_name(): parsed header name [Via] type 1
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/parse_via.c:1300]: parse_via_param(): Found param type 232, <branch> = <z9hG4bK42e9.4a962087000000000000000000000000.0>; state=16
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/parse_via.c:2639]: parse_via(): end of header reached, state=5
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/msg_parser.c:555]: parse_headers(): Via found, flags=2
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/msg_parser.c:557]: parse_headers(): this is the first via
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/parse_hname2.c:301]: parse_sip_header_name(): parsed header name [To] type 3
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/parse_addr_spec.c:185]: parse_to_param(): add param: tag=ueisi99vbf
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/parse_addr_spec.c:884]: parse_addr_spec(): end of header reached, state=29
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/msg_parser.c:172]: get_hdr_field(): <To> [61]; uri=[sip:1000@fakedomain.com]
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/msg_parser.c:174]: get_hdr_field(): to body (44)[<sip:1000@fakedomain.com>], to tag (10)[ueisi99vbf]
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/parse_hname2.c:301]: parse_sip_header_name(): parsed header name [From] type 4
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/parse_hname2.c:301]: parse_sip_header_name(): parsed header name [CSeq] type 5
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/msg_parser.c:152]: get_hdr_field(): cseq <CSeq>: <1> <BYE>
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/parse_hname2.c:301]: parse_sip_header_name(): parsed header name [Call-ID] type 6
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/parse_hname2.c:301]: parse_sip_header_name(): parsed header name [Content-Length] type 12
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/msg_parser.c:187]: get_hdr_field(): content_length=0
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/parse_hname2.c:301]: parse_sip_header_name(): parsed header name [Max-Forwards] type 8
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/msg_parser.c:91]: get_hdr_field(): found end of header
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/parse_addr_spec.c:185]: parse_to_param(): add param: tag=1132060721
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/parser/parse_addr_spec.c:884]: parse_addr_spec(): end of header reached, state=29
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: topos [tps_msg.c:1013]: tps_request_sent(): handling outgoing request (1, 1)
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: topos [tps_msg.c:417]: tps_pack_message(): compacted headers - x_via1: [SIP/2.0/UDP <KAMAILIO PUBLIC IP>:5060;branch=z9hG4bK42e9.4a962087000000000000000000000000.0](85) - x_via2: [](0) - x_vbranch1: [z9hG4bK42e9.4a962087000000000000000000000000.0](46)
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: topos [tps_msg.c:539]: tps_pack_message(): compacted headers - a_rr: [](0) - b_rr: [](0) - s_rr: [](0)
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: topos [tps_msg.c:544]: tps_pack_message(): compacted headers - as_contact: [](0) - bs_contact: [](0)
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: topos [tps_msg.c:1027]: tps_request_sent(): no x-uuid header - nothing to do
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/msg_translator.c:1799]: check_boundaries(): no multi-part body
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: topos [topos_mod.c:567]: tps_msg_sent(): new outbound buffer generated
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: tm [uac.c:686]: send_prepared_request_impl(): uac: 0x7f22f94448e8  branch: 0  to 10.0.0.47:38606
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: <core> [core/onsend.c:50]: run_onsend(): required parameters are not available - ignoring
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: dialog [dlg_req_within.c:432]: send_bye(): BYE sent to caller
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: dialog [dlg_req_within.c:399]: send_bye(): sending BYE to callee
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: tm [uac.c:458]: t_uac_prepare(): next_hop=<sip:1001@<UA PUBLIC IP>:5066>
Jan 26 16:33:29 localhost /opt/kamailio-5.6.2/sbin/kamailio[1238222]: DEBUG: tm [uac.c:158]: dlg2hash(): hashid 40482