[OpenSIPS-Users] Asteriak load balance
Gonzalo Gonzalez
gonzovoip at yahoo.com
Sun Jan 25 21:09:06 CET 2009
Thanks; I have made some progress on my config, but now I have an issue sending the calls to the gateways. I took a config file from "Building a telephony system with openser" from Flavio E. Goncalves an adapted it to my needs, but when I try to pass a call to PSTN I receive error 404, not found.
This is the debug of the call:
U 192.168.1.101:4142 -> 192.168.1.102:5060
INVITE sip:13057286338 at 192.168.1.102 SIP/2.0.
Via: SIP/2.0/UDP 192.168.1.101:4142;branch=z9hG4bK-d8754z-d32c024c26331414-1---d8754z-;rport.
Max-Forwards: 70.
Contact: <sip:7862702200 at 192.168.1.101:4142>.
To: "13057286338"<sip:13057286338 at 192.168.1.102>.
From: "Gonzo"<sip:7862702200 at 192.168.1.102>;tag=b7384713.
Call-ID: YmFmZDgxYmI2YTVmMDJjZWRkZjM4OGI3YzhiMjljYTg..
CSeq: 1 INVITE.
Allow: INVITE, ACK,
CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO.
Content-Type: application/sdp.
User-Agent: X-Lite release 1100l stamp 47546.
Content-Length: 474.
.
v=0.
o=- 0 2 IN IP4 192.168.1.101.
s=CounterPath X-Lite 3.0.
c=IN IP4 192.168.1.101.
t=0 0.
m=audio 28830 RTP/AVP 107 119 100 106 0 105 98 8 3 101.
a=alt:1 2 : MlZdUnJz Ygmz8XzM 192.168.1.101 28830.
a=alt:2 1 : tM0AgMUl 5/M2r2zq 5.247.86.54 28830.
a=fmtp:101 0-15.
a=rtpmap:107 BV32/16000.
a=rtpmap:119 BV32-FEC/16000.
a=rtpmap:100 SPEEX/16000.
a=rtpmap:106 SPEEX-FEC/16000.
a=rtpmap:105 SPEEX-FEC/8000.
a=rtpmap:98 iLBC/8000.
a=rtpmap:101 telephone-event/8000.
a=sendrecv.
U 192.168.1.102:5060 -> 192.168.1.101:4142
SIP/2.0 404 Not Found.
Via: SIP/2.0/UDP 192.168.1.101:4142;branch=z9hG4bK-d8754z-d32c024c26331414-1---d8754z-;rport=4142.
To:
"13057727932"<sip:13057286338 at 192.168.1.102>;tag=c97b4d1cb1f3d0da549e06a8d482ef63.3872.
From: "Gonzo"<sip:7862702200 at 192.168.1.102>;tag=b7384713.
Call-ID: YmFmZDgxYmI2YTVmMDJjZWRkZjM4OGI3YzhiMjljYTg..
CSeq: 1 INVITE.
Server: OpenSIPS (1.4.4-notls (i386/linux)).
Content-Length: 0.
.
U 192.168.1.101:4142 -> 192.168.1.102:5060
ACK sip:13057286338 at 192.168.1.102 SIP/2.0.
Via: SIP/2.0/UDP 192.168.1.101:4142;branch=z9hG4bK-d8754z-d32c024c26331414-1---d8754z-;rport.
To: "13057286338"<sip:13057286338 at 192.168.1.102>;tag=c97b4d1cb1f3d0da549e06a8d482ef63.3872.
From: "Gonzo"<sip:7862702200 at 192.168.1.102>;tag=b7384713.
Call-ID: YmFmZDgxYmI2YTVmMDJjZWRkZjM4OGI3YzhiMjljYTg..
CSeq: 1 ACK.
Content-Length: 0.
An this is my config file:
# ----------- global configuration parameters
------------------------
debug=3 # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=no # (cmd line: -E)
children=4
port=5060
disable_tcp=yes
# ------------------ module loading ----------------------------------
#set module path
mpath="/usr/local/lib/opensips/modules/"
loadmodule "db_mysql.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "uri.so"
loadmodule "uri_db.so"
loadmodule "domain.so"
loadmodule "permissions.so"
loadmodule "group.so"
loadmodule "mi_fifo.so"
loadmodule "dispatcher.so"
# Uncomment this if you want digest authentication
# mysql.so must be loaded !
loadmodule "auth.so"
loadmodule "auth_db.so"
# ----------------- setting
module-specific parameters ---------------
modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
modparam("usrloc", "db_mode", 2)
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("rr", "enable_full_lr", 1)
modparam("auth_db|permissions|uri_db|usrloc","db_url","mysql://opensips:opensipsrw@localhost/opensips")
modparam("permissions", "db_mode", 1)
modparam("permissions", "trusted_table", "trusted")
modparam("domain", "db_mode", 1) # Use caching
# ------ dispatcher params --------
modparam("dispatcher", "list_file", "/usr/local/etc/opensips/dispatcher.list")
modparam("dispatcher", "force_dst", 1)
# ------------------------- request routing logic -------------------
# main routing logic
route{
#
# -- 1 -- Request Validation
#
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
};
if (msg:len >= 2048 ) {
sl_send_reply("513", "Message too big");
exit;
};
#
# -- 2 -- Routing Preprocessing
#
## Record-route all except Register
if (!method=="REGISTER") record_route();
##Loose_route packets
if (loose_route()) {
# mark routing logic in request
append_hf("P-hint: rr-enforced\r\n");
route(1);
};
#CANCEL processing
if (is_method("CANCEL")) {
if (t_check_trans()) t_relay();
exit;
};
t_check_trans();
#
# -- 3 -- Determine Request Target
#
if (method=="REGISTER") {
route(2);
} else {
route(3);
};
}
route[1] {
#
# -- 4 -- Forward request to target
#
## Forward statefully
if (!t_relay()) {
sl_reply_error();
};
exit;
}
route[2] {
## Register request handler
if (is_uri_host_local()) {
if (!www_authorize("", "subscriber")) {
www_challenge("", "1");
exit;
};
if (!check_to()) {
sl_send_reply("403", "Forbidden");
exit;
};
save("location");
exit;
} else if
{
sl_send_reply("403", "Forbidden");
};
}
route[3] {
## INVITE request handler
if (is_from_local()){
# From an internal domain -> check the credentials and the FROM
if(!allow_trusted()){
if (!proxy_authorize("","subscriber")) {
proxy_challenge("","1");
exit;
} else if (!check_from()) {
sl_send_reply("403",
"Forbidden, use From=ID");
exit;
};
} else {
log("Request bypassed the auth.using allow_trusted");
};
consume_credentials();
#Verify aliases, if found replace R-URI.
lookup("aliases");
if (is_uri_host_local()) {
# -- Inbound to
Inbound
route(10);
} else {
# -- Inbound to outbound
route(11);
};
} else {
#From an external domain ->do not check credentials
#Verify aliases, if found replace R-URI.
lookup("aliases");
if (is_uri_host_local()) {
#-- Outbound to inbound
route(12);
} else
{
# -- Outbound to outbound
route(13);
};
};
}
route[4] {
# routing to the public network
ds_select_dst("1", "0");
record_route();
t_relay();
}
route[10] {
#from an internal domain -> inbound
#Native SIP destinations are handled using the location table
#Gateway destinations are handled by regular expressions
append_hf("P-hint: inbound->inbound \r\n");
if (uri=~"^sip:[2-9][0-9]{6}@") {
if
(is_user_in("credentials","local")) {
route(4);
exit;
} else {
sl_send_reply("403", "No permissions for local calls");
exit;
};
};
if (uri=~"^sip:1[2-9][1-9]{9}@") {
if (is_user_in("credentials","ld")) {
route(4);
exit;
} else {
sl_send_reply("403", "No permissions for long distance");
exit;
};
};
if (uri=~"^sip:011[0-9]*@") {
if (is_user_in("credentials","int")) {
route(4);
exit;
} else {
sl_send_reply("403", "No permissions for international calls");
};
};
if (!lookup("location")) {
sl_send_reply("404", "Not Found");
exit;
};
route(1);
}
route[11] {
# from an internal domain -> outbound
# Simply route the call outbound using DNS search
append_hf("P-hint: inbound->outbound \r\n");
route(1);
}
route[12] {
# From an external domain -> inbound
# Verify aliases, if found replace R-URI.
lookup("aliases");
if (!lookup("location")) {
sl_send_reply("404", "Not Found");
exit;
};
route(1);
}
route[13] {
#From an external domain outbound
#we are not accepting these calls
append_hf("P-hint: outbound->inbound
\r\n");
sl_send_reply("403", "Forbidden");
exit;
}
Any Idea why calls are getting rejected?
--- On Fri, 1/23/09, Robin Rodriguez <rrodriguez at ifbyphone.com> wrote:
From: Robin Rodriguez <rrodriguez at ifbyphone.com>
Subject: Re: [OpenSIPS-Users] Asteriak load balance
To: gonzovoip at yahoo.com
Cc: users at lists.opensips.org
Date: Friday, January 23, 2009, 4:05 PM
Gonzalo Gonzalez wrote:
Thanks.....
Could somebody share a simple config file using dispatcher module.
Thanks
Gonzo
http://www.dialogic.com/products/docs/appnotes/10833_HMP_OpenSER_SIP_an.pdf
is the most concise example i've ever seen on using dispatcher, should
be enough to get you going. A zip file is linked in the pdf that with a
sample config
--
Robin D. Rodriguez
Systems Engineer
Ifbyphone, Inc.
Phone: (866) 250-1663
Fax: (847) 676-6553
rrodriguez at ifbyphone.com
http://www.ifbyphone.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20090125/5c870b2d/attachment-0001.htm
More information about the Users
mailing list