Hello, I am having probs with the fix_nated_register() function, I still see the private IP, even thought the nat_uac_test(31) shows the user behind a NAT
This is the REGISTER section in kamailio.cfg:
if (method=="REGISTER") { xlog("L_INFO","mylog: starting to process REGISTER.Info: [$au].\n"); if (!www_authorize("", "subscriber")) { xlog("L_INFO","mylog: REGISTER came without auth, sending challenge.\n"); www_challenge("", "0"); exit; }; if (nat_uac_test("31")){ xlog("L_INFO","mylog: Device behind NAT.\n"); fix_nated_register(); force_rport(); } save("location"); xlog("L_INFO","mylog: save-location successful.\n"); exit;
this is the debug log [level 6], it shows the via with a public IP
Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: mylog: starting to process REGISTER.Info: [100]. Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: DBG:auth:check_nonce: comparing [491a03a9000000041ba5231fd93870c44415f01d1a0d1963] and [491a03a9000000041ba5231fd93870c44415f01d1a0d1963] Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: DBG:core:db_new_result: allocate 28 bytes for result set at 0x81ab8a0 Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: DBG:db_mysql:db_mysql_get_columns: 1 columns returned from the query Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: DBG:core:db_allocate_columns: allocate 4 bytes for result names at 0x81a7288 Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: DBG:core:db_allocate_columns: allocate 4 bytes for result types at 0x81a7258 Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: DBG:db_mysql:db_mysql_get_columns: allocate 8 bytes for RES_NAMES[0] at 0x81a7268 Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: DBG:db_mysql:db_mysql_get_columns: RES_NAMES(0x81a7268)[0]=[password] Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: DBG:db_mysql:db_mysql_get_columns: use DB_STRING result type Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: DBG:db_mysql:db_mysql_convert_rows: allocate 8 bytes for rows at 0x81a7278 Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: DBG:db_mysql:db_mysql_convert_row: allocate 20 bytes for row values at 0x81ab880 Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: DBG:db_mysql:db_mysql_str2val: converting STRING [100] Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: DBG:auth_db:get_ha1: HA1 string calculated: e8f9a8a478e49a182e9cceeb3e43277f Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: DBG:auth:check_response: our result = '84a320db7e04e3ddd3ef84a5173187cd' Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: DBG:auth:check_response: authorization is OK Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: DBG:auth:post_auth: nonce index= 4 Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: DBG:core:db_free_columns: freeing 1 columns Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: DBG:core:db_free_columns: freeing RES_NAMES[0] at 0x81a7268 Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: DBG:core:db_free_columns: freeing result names at 0x81a7288 Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: DBG:core:db_free_columns: freeing result types at 0x81a7258 Nov 11 17:09:04 sp1094a ../../sbin/kamailio[14219]: DBG:core:db_free_rows: freeing 1 rows Nov 11 17:09:05 sp1094a ../../sbin/kamailio[14219]: DBG:core:db_free_row: freeing row values at 0x81ab880 Nov 11 17:09:05 sp1094a ../../sbin/kamailio[14219]: DBG:core:db_free_rows: freeing rows at 0x81a7278 Nov 11 17:09:05 sp1094a ../../sbin/kamailio[14219]: DBG:core:db_free_result: freeing result set at 0x81ab8a0 Nov 11 17:09:05 sp1094a ../../sbin/kamailio[14219]: DBG:core:check_via_address: params 204.9.239.67, 192.168.1.108, 0 Nov 11 17:09:05 sp1094a ../../sbin/kamailio[14219]: mylog: Device behind NAT. Nov 11 17:09:05 sp1094a ../../sbin/kamailio[14219]: DBG:core:parse_headers: flags=ffffffffffffffff Nov 11 17:09:05 sp1094a ../../sbin/kamailio[14219]: DBG:core:parse_headers: flags=8000000 Nov 11 17:09:05 sp1094a ../../sbin/kamailio[14219]: DBG:registrar:build_contact: created Contact HF: Contact: <sip:100@192.168.1.108 7566;rinstance=89990b40ab560825>;expires=3341, <sip:100@192.168.1.108:44568;rinstance=f0942ae1a596ea83>;expires=3597 Nov 11 17:09:05 sp1094a ../../sbin/kamailio[14219]: DBG:core:parse_headers: flags=ffffffffffffffff Nov 11 17:09:05 sp1094a ../../sbin/kamailio[14219]: DBG:core:check_via_address: params 204.9.239.67, 192.168.1.108, 0 Nov 11 17:09:05 sp1094a ../../sbin/kamailio[14219]: mylog: save-location successful. Nov 11 17:09:05 sp1094a ../../sbin/kamailio[14219]: DBG:core:destroy_avp_list: destroying list 0xb60e11c0 Nov 11 17:09:05 sp1094a ../../sbin/kamailio[14219]: DBG:core:receive_msg: cleaning up
and this is how the AOR is stored in the location db [ private IP]