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); }
Sorry made a mistake in the code pasted earlier. The force_send_scoket line should not be
force_send_socket(192.168.0.2:5060) but
force_send_socket(192.168.10.2:5060)
Thank you.
--- On Fri, 2/19/10, Slot Zero slotzero1@yahoo.com wrote:
From: Slot Zero slotzero1@yahoo.com Subject: [Kamailio-Users] Forward calls from Asterisk to SIP provider via Kamailio for termination To: users@lists.kamailio.org Date: Friday, February 19, 2010, 7:10 PM 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); }
Kamailio (OpenSER) - Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
Can anyone help me here.
--- On Fri, 2/19/10, Slot Zero slotzero1@yahoo.com wrote:
From: Slot Zero slotzero1@yahoo.com Subject: [Kamailio-Users] Forward calls from Asterisk to SIP provider via Kamailio for termination To: users@lists.kamailio.org Date: Friday, February 19, 2010, 7:10 PM 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); }
Kamailio (OpenSER) - Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
On Saturday 20 February 2010, Slot Zero wrote:
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
Hi Slot,
do you observe an error with your quoted configuration, or it does not behave like you expect?
Cheers,
Henning
Hi Henning,
There is no error. Just it doesn't behave the way it should. By the way the thread you replied to has an error in the config I had sent. Please find it corrected below. 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 # -------------- 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.10.2:5060); }; route(1); return; };
}
# CANCEL and BYE Message Handling # ---------------------------------- route[4] { route(1); }
Cheers
--- On Tue, 2/23/10, Henning Westerholt henning.westerholt@1und1.de wrote:
From: Henning Westerholt henning.westerholt@1und1.de Subject: Re: [Kamailio-Users] Forward calls from Asterisk to SIP provider via Kamailio for termination To: users@lists.kamailio.org Cc: "Slot Zero" slotzero1@yahoo.com Date: Tuesday, February 23, 2010, 7:57 AM On Saturday 20 February 2010, Slot Zero wrote:
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
Hi Slot,
do you observe an error with your quoted configuration, or it does not behave like you expect?
Cheers,
Henning
Why would you append Record-Route header prior to loose_route() check? How do you know the request isn't a sequential request?
Hi Alex,
Well I did a record route because I want the return path packets coming from provider to Kamailio and then to Asterisk. My setup is as follows
Asterisk and Kamailio are listeniing on all IPs on the server. Asterisk is listening on 5062(UDP) and Kamailio is listening on 5060 (UDP). The more and more I look at my config I have started to believe I might have complicated a bit too much for myself :). I might be able to describe what I my main goal is. My provider requires a username/password be delivered with every INVITE I send to it. I am already using a trunk from them which is directly connected to asterisk. My server has 7 Public IPs. Main IP is e.g. 172.16.31.32 (CIDR is /30 hence the gateway IP is 172.16.31.31). Now I was also given a pool of 8 Public IPs e.g. 192.168.10.0/29 which are configured as aliases to the one ethernet card given to me on the server. I want to use Kamailio to enable me to send PSTN/VoIP calls on my second and thrid account from the same provider on the IP subnet given to me. Main IP is already in use. Asterisk will always stay as the main UAS for my client and UAC for my provider as A2Billing is running aswell. I also want that any exchange of information between Kamailio and Asterisk should be via loopback interface. I do not want to use Database it was already a pain in the complex rate cards setup of A2Billing :). I would be extremely greatful if you or anyone else can tell me if my analysis and direction to solve the issue is correct. Thank you
Cheers
--- On Tue, 2/23/10, Alex Balashov abalashov@evaristesys.com wrote:
From: Alex Balashov abalashov@evaristesys.com Subject: Re: [Kamailio-Users] Forward calls from Asterisk to SIP provider via Kamailio for termination To: users@lists.kamailio.org Date: Tuesday, February 23, 2010, 9:02 AM Why would you append Record-Route header prior to loose_route() check? How do you know the request isn't a sequential request?
-- Alex Balashov - Principal Evariste Systems LLC
Tel : +1 678-954-0670 Direct : +1 678-954-0671 Web : http://www.evaristesys.com/
Kamailio (OpenSER) - Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
On 02/23/2010 12:21 PM, Slot Zero wrote:
Well I did a record route because I want the return path packets coming from provider to Kamailio and then to Asterisk. My setup is as follows
Sequential (in-dialog) requests will follow Route: set, and/or the Record-Route header that was in the initial request and is copied to the final reply for the opening transaction. That's one of the things that makes them sequential. You don't have to - indeed, should not - do that. You should add Record-Route only to initial requests.
Hmmmmmm
Makes sense. Any suggestion for the config I am using because in the heart all I want to use is the force_send_socket and forward from asterisk to kamailio to provider and back.
--- On Tue, 2/23/10, Alex Balashov abalashov@evaristesys.com wrote:
From: Alex Balashov abalashov@evaristesys.com Subject: Re: [Kamailio-Users] Forward calls from Asterisk to SIP provider via Kamailio for termination To: "Slot Zero" slotzero1@yahoo.com Cc: users@lists.kamailio.org Date: Tuesday, February 23, 2010, 12:26 PM On 02/23/2010 12:21 PM, Slot Zero wrote:
Well I did a record route because I want the return
path packets coming from
provider to Kamailio and then to Asterisk. My setup is
as follows
Sequential (in-dialog) requests will follow Route: set, and/or the Record-Route header that was in the initial request and is copied to the final reply for the opening transaction. That's one of the things that makes them sequential. You don't have to - indeed, should not - do that. You should add Record-Route only to initial requests.
-- Alex Balashov - Principal Evariste Systems LLC
Tel : +1 678-954-0670 Direct : +1 678-954-0671 Web : http://www.evaristesys.com/