Hello,
I am a Kamailio noob :). I am trying to get Asterisk to forward calls to my SIP provider via Kamailio. The same machine is running Kamailio and Asterisk. I do not want to consume credentials as they have to be passed on all the way to my SIP provider. There is no NAT of any sorts. SIP Phone/Users connect to Asterisk.I do not need to authenticate when forwarding call from Asterisk to Kamailio as they are both running on the same server but I do need to make sure that Kamailio dials and forwards 011+number to be sent from local host port 5062(Asterisk listener) to SIP provider only. I have 6 Public IP addresses mapped on the server. I want to use the force_send_socket to allow me to change source IP of SIP requests when being sent to the SIP provider on the basis of credentials username in the request. I have pasted my config below. Please tell me what am I doing wrong here. In the kamctlrc file i have SIP_DOMAIN=localhost
Thank you
#------CONFIG BEGINS------------------ mpath="/lib/kamailio/modules_k/"
debug=3 fork=yes
children=4 auto_aliases=no alias=localhost alias=192.168.10.1 alias=192.168.10.2 alias=192.168.10.3 alias=192.168.10.4 alias=192.168.10.5 alias=192.168.10.6
disable_tcp=yes
loadmodule "sl.so" loadmodule "rr.so" loadmodule "maxfwd.so" loadmodule "/lib/kamailio/modules/tm.so" loadmodule "textops.so"
modparam("rr", "enable_full_lr", 1)
route { # Sanity Check # ------------
# filter too old messages if (!mf_process_maxfwd_header("10")) { log("LOG: Too many hops\n"); sl_send_reply("483","Too Many Hops"); break; };
if(msg:len>2048) { sl_send_reply("413", "message too large to be forwarded over UDP without fragmentation"); exit; };
# Record Route and NAT Preset # -------------------- if (method != "REGISTER") { record_route(); };
# Loose Route
# ----------- if (loose_route()) {
route(1); return; };
# Call Type Processing # -------------------- if (uri != myself) { route(1); return; };
if (uri == myself) { if (method == "BYE") { route(4); return; } else if (method == "CANCEL") { route(4); return; } else if (method == "INVITE") { route(3); return; } else if (method == "NOTIFY") { sl_send_reply("200", "Understood"); return; } else if (method == "OPTIONS") { sl_send_reply("200", "Got it"); return; } }; route(1); }
# Default Message Handling # ----------------------- route[1] { t_on_reply("1"); if (!t_relay()) { sl_reply_error(); }; }
# INVITE Message Handling # ----------------------------------
# ---------------------------------- route[3] { if (uri =~ "^sip:011[0-9]@*") { rewritehostport("sip.voipprovider.com:5060"); if (search("^(Contact|m): .*user01*@(127.0.0.1|localhost)")) { force_send_socket(192.168.0.2:5060); }; route(1); return; };
}
# CANCEL and BYE Message Handling # ---------------------------------- route[4] { route(1); }