When registering to an upstream provider using the uac module, the source port of REGISTER messages alternates seemingly randomly between either 5060 or the lowest available port, e.g., 1024, 1025, 1026. All SIP providers that I tested send subsequent INVITEs of incoming calls to the originating ip/port of the prior REGISTER, which is problematic when kamilio is running behind a firewall.
I tested both the latest master (7c03340b4b486afaf00b14a6589c13b7165240a0) and 4.4 (df5ef6183350d99f77087dd83950ef35466e84a1) on Debian unstable/amd64.
#### /etc/kamailio/kamailio.cfg ``` #!KAMAILIO
debug=3
loadmodule "kex.so" loadmodule "corex.so" loadmodule "tm.so" loadmodule "tmx.so" loadmodule "sl.so" loadmodule "rr.so" loadmodule "pv.so" loadmodule "db_text.so" loadmodule "dialog.so" loadmodule "uac.so"
#!define DBURL "text:///etc/kamailio/dbtext"
modparam("rr", "append_fromtag", 1) modparam("dialog", "dlg_flag", 4) modparam("dialog", "track_cseq_updates", 1) modparam("uac", "restore_dlg", 1) modparam("uac", "reg_db_url", DBURL) modparam("uac", "reg_timer_interval", 60) modparam("uac", "reg_retry_interval", 60) modparam("uac", "reg_contact_addr", "1.2.3.4:5060")
request_route { exit; } ```
#### /etc/kamailio/dbtext/uacreg ``` l_uuid(string) l_username(string) l_domain(string) r_username(string) r_domain(string) realm(string) auth_username(string) auth_password(string) auth_proxy(string) expires(int) flags(int) reg_delay(int) 12345678:user:domain.local:11111111:sip.example.org:sip.example.org:11111111:XXXXXXXXXXXXXXXX:sip:sip.example.org:600:0:0 ```