Hi,
Well it is almost working ;) thanks daniel. The only problem is, i am using kamailio 1.5 and there are no : location_internal and location_external tables in mysql. So it is working from 192.168.0.0/24 to 10.10.10.0/24 network but not in the other way.. I changed (location_internal and location_external) by location table in my .cfg file. I guess it's the problem. Here are the call Flow and my .cfg file.
http://www.nabble.com/file/p23632701/callOk.jpg
http://www.nabble.com/file/p23632701/callNoOk.jpg
And my .cfg file.
# $Id$ # # Simple application level gateway config script. # # Assumes that SER/rtpproxy run on a machine, which connected to # two non-routable letworks: 192.168.0.0/24 and 192.168.1.1/24. # # Correspondingly, this machine has two IP addresses: 192.168.0.1 # and 192.168.1.1. # # 192.168.0.0/24 - "internal" network # 192.168.1.0/24 - "external" network # # rtpproxy started with `-l 192.168.0.1/192.168.1.1' option. #
####### Global Parameters #########
debug=4 log_stderror=yes log_facility=LOG_LOCAL7
fork=yes children=4
/* uncomment the following lines to enable debugging */ #debug=9 #fork=no #log_stderror=no
/* uncomment the next line to disable TCP (default on) */ #disable_tcp=yes
/* uncomment the next line to enable the auto temporary blacklisting of not available destinations (default disabled) */ #disable_dns_blacklist=no
/* uncomment the next line to enable IPv6 lookup after IPv4 dns lookup failures (default disabled) */ #dns_try_ipv6=yes
/* uncomment the next line to disable the auto discovery of local aliases based on revers DNS on IPs (default on) */ #auto_aliases=on #alias=l-at9875.rd.francetelecom.fr:5060
/* uncomment the following lines to enable TLS support (default off) */ #disable_tls = no #listen = tls:your_IP:5061 #tls_verify_server = 1 #tls_verify_client = 1 #tls_require_client_certificate = 0 #tls_method = TLSv1 #tls_certificate = "/usr/local/etc/kamailio/tls/user/user-cert.pem" #tls_private_key = "/usr/local/etc/kamailio/tls/user/user-privkey.pem" #tls_ca_list = "/usr/local/etc/kamailio/tls/user/user-calist.pem"
port=5060
/* uncomment and configure the following line if you want Kamailio to bind on a specific interface/port/proto (default bind on all available) */ listen=udp:192.168.0.2 listen=udp:10.10.10.2
# ------------------ module loading ----------------------------------
#set module path mpath="/usr/local/lib64/kamailio/modules/"
/* uncomment next line for MySQL DB support */ loadmodule "db_mysql.so" loadmodule "mi_fifo.so" loadmodule "sl.so" loadmodule "tm.so" loadmodule "rr.so" loadmodule "pv.so" loadmodule "maxfwd.so" loadmodule "usrloc.so" loadmodule "registrar.so" loadmodule "textops.so" loadmodule "uri_db.so" loadmodule "siputils.so" loadmodule "xlog.so" loadmodule "acc.so" loadmodule "auth.so" loadmodule "auth_db.so" loadmodule "domain.so" loadmodule "presence.so" loadmodule "presence_xml.so" loadmodule "nathelper.so"
/* uncomment next line for aliases support NOTE: a DB (like db_mysql) module must be also loaded */ #loadmodule "alias_db.so"
# ----------------- setting module-specific parameters ---------------
# ----- mi_fifo params ----- modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
# ----- rr params ----- # add value to ;lr param to cope with most of the UAs modparam("rr", "enable_full_lr", 1) # do not append from tag to the RR (no need for this script) modparam("rr", "append_fromtag", 0)
# ----- rr params ----- modparam("registrar", "method_filtering", 1) /* uncomment the next line to disable parallel forking via location */ modparam("registrar", "append_branches", 0) /* uncomment the next line not to allow more than 10 contacts per AOR */ modparam("registrar", "max_contacts", 10)
# ----- uri_db params ----- /* by default we disable the DB support in the module as we do not need it in this configuration */ modparam("uri_db", "use_uri_table", 0) modparam("uri_db", "db_url", "")
# ----- acc params ----- /* what sepcial events should be accounted ? */ modparam("acc", "early_media", 1) modparam("acc", "report_ack", 1) modparam("acc", "report_cancels", 1) /* by default ww do not adjust the direct of the sequential requests. if you enable this parameter, be sure the enable "append_fromtag" in "rr" module */ modparam("acc", "detect_direction", 0) /* account triggers (flags) */ modparam("acc", "failed_transaction_flag", 3) modparam("acc", "log_flag", 1) modparam("acc", "log_missed_flag", 2) modparam("acc", "log_extra", "src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd") /* uncomment the following lines to enable DB accounting also */ #c#modparam("acc", "db_flag", 1) #c#modparam("acc", "db_missed_flag", 2) #c#modparam("domain", "db_url", #c# "mysql://openser:openserrw@localhost/openser") #c#modparam("acc", "db_extra", #c# "src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
# ----- usrloc params ----- /* uncomment the following lines if you want to enable DB persistency for location entries */ modparam("usrloc", "db_mode", 3) modparam("usrloc", "db_url", "mysql://openser:openserrw@localhost/openser")
# ----- auth_db params ----- /* uncomment the following lines if you want to enable the DB based authentication */ modparam("auth_db", "calculate_ha1", yes) modparam("auth_db", "password_column", "password") modparam("auth_db", "db_url", "mysql://openser:openserrw@localhost/openser") modparam("auth_db", "load_credentials", "")
# ----- alias_db params ----- /* uncomment the following lines if you want to enable the DB based aliases */ #modparam("alias_db", "db_url", # "mysql://openser:openserrw@localhost/openser")
# ----- domain params ----- /* uncomment the following lines to enable multi-domain detection support */ modparam("domain", "db_url", "mysql://openser:openserrw@localhost/openser") modparam("domain", "db_mode", 1) # Use caching
# ----- multi-module params ----- /* uncomment the following line if you want to enable multi-domain support in the modules (dafault off) */ modparam("alias_db|auth_db|usrloc|uri_db", "use_domain", 1)
# ----- presence params ----- /* uncomment the following lines if you want to enable presence */ modparam("presence|presence_xml", "db_url", "mysql://openser:openserrw@localhost/openser") modparam("presence_xml", "force_active", 1) modparam("presence", "server_address", "sip:10.10.10.2:5060")
# -- nathelper modparam("nathelper", "rtpproxy_sock", "udp:127.0.0.1:7890") modparam("nathelper", "natping_interval", 15)
#--------xlog params--------- modparam("xlog","buf_size",8192)
# ------------------ main fun below ----------------------------------
route { # initial sanity checks -- messages with # max_forwars == 0, or excessively long requests, # or those that don't addressed to us if (!mf_process_maxfwd_header("10")) { sl_send_reply("483", "Too Many Hops"); exit; }; if (msg:len > max_len) { sl_send_reply("513", "Message too big"); exit; }; if (!(uri == myself) && method == "INVITE") { sl_send_reply("403", "Call cannot be served here"); exit; };
##### if (has_totag()) { # sequential request withing a dialog should # take the path determined by record-routing if (loose_route()) {
if (is_method("SUBSCRIBE") && uri == myself) { # in-dialog subscribe requests route(3); exit; } if ( is_method("ACK") ) { if ( t_check_trans() ) { # non loose-route, but stateful ACK; must be an ACK after a 487 or e.g. 404 from upstream server t_relay(); exit; } else { # ACK without matching transaction ... ignore and discard.\n"); exit; } } sl_send_reply("404","Not here"); } exit; }
#### Request with no Username in RURI #### # if ($rU==NULL) { # sl_send_reply("484","Address Incomplete"); # exit; # }
##### REGISTER ###### if (method == "REGISTER") { route(2); };
#### BYE CANCEL #### if (method == "BYE" || method == "CANCEL") unforce_rtp_proxy();
##### Do strict routing if pre-loaded route headers present #### if (loose_route()) { t_relay(); exit; };
##### INVITE ###### if (is_method("INVITE")){ route(2); record_route();
} #### PUBLISH/SUBSCRIBE #### if (is_method("PUBLISH|SUBSCRIBE")){ xlog("L_INFO", "SUBSCRIBE: method [$rm] from [$fu]\n"); route(3); };
if (!t_relay()) sl_reply_error();
}
#################### ROUTES ##############################
######### Rtpproxy Bridge mode REGISTER/INVITE methods ########### route[2] { if(is_method("REGISTER")) { if (dst_ip == 10.10.10.2) { save("location"); xlog("L_INFO","REGISTER [$ru] SIP Request: method [$rm] from [$fu] at [$Tf]\n"); } else if (dst_ip == 192.168.0.2) { save("location"); } else { sl_send_reply("403", "Call cannot be served here"); } exit; } if(is_method("INVITE")) { if (lookup("location")) { if (dst_ip == 10.10.10.2) if (force_rtp_proxy("FAII")) t_on_reply("1"); if (dst_ip == 192.168.0.2) if (force_rtp_proxy("FAEI")) t_on_reply("1"); } else if (lookup("location")) { if (dst_ip == 10.10.10.2) if (force_rtp_proxy("FAIE")) t_on_reply("1"); if (dst_ip == 192.168.0.2) if (force_rtp_proxy("FAEE")) t_on_reply("1"); } else { sl_send_reply("403", "Call cannot be served here"); exit; } } return; }
############## Presence ################ route[3] { if (!t_newtran()) { sl_reply_error(); exit; };
if(is_method("PUBLISH")) { handle_publish(); t_release(); } else if( is_method("SUBSCRIBE")) { handle_subscribe(); t_release(); } exit; # if presence enabled, this part will not be executed if (is_method("PUBLISH") || $rU==null) { sl_send_reply("404", "Not here"); exit; } xlog("L_INFO","TestRoute [$fu] est rentre ici a [$Tf]\n"); return; }
onreply_route[1] { if (!(status=~"183" || status=~"200")) exit; force_rtp_proxy("FA"); }
Any idea ?
Cheers, Karhu