Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # $Id: icscf.cfg 680 2009-06-18 04:29:13Z vingarzan $
- #
- # Interrogating - CSCF configuration script
- #
- # ----------- global configuration parameters ------------------------
- debug=1
- log_stderror=yes
- memlog=5
- sip_warning=yes
- fork=yes
- children=4
- listen=xxx.xxx.xxx.xxx
- port=5060
- alias="icscf.ims.mydomain.com"
- alias="ims.mydomain.com"
- check_via=no # (cmd. line: -v)
- dns=no # (cmd. line: -r)
- rev_dns=no # (cmd. line: -R)
- # ------------------ module loading ----------------------------------
- # Uncomment this if you want to use SQL database
- loadmodule "/usr/lib/ser/modules/mysql.so"
- loadmodule "/usr/lib/ser/modules/sl.so"
- loadmodule "/usr/lib/ser/modules/tm.so"
- modparam("tm", "fr_timer", 10000)
- loadmodule "/usr/lib/ser/modules/rr.so"
- loadmodule "/usr/lib/ser/modules/maxfwd.so"
- loadmodule "/usr/lib/ser/modules/textops.so"
- loadmodule "/usr/lib/ser/modules/icscf.so"
- modparam("icscf","name","icscf.ims.mydomain.com")
- modparam("icscf","db_url","mysql://icscf:heslo@localhost/icscf")
- modparam("icscf","db_nds_table","nds_trusted_domains")
- modparam("icscf","db_scscf_table","s_cscf")
- modparam("icscf","db_capabilities_table","s_cscf_capabilities")
- # Comment the following line to enable realm routing
- modparam("icscf","forced_hss_peer","hss.ims.mydomain.com")
- modparam("icscf","hash_size",128)
- modparam("icscf","icid_value_prefix","I-CSCFabcd")
- modparam("icscf","icid_gen_addr","")
- modparam("icscf","orig_ioi","ims.mydomain.com")
- modparam("icscf","term_ioi","ims.mydomain.com")
- modparam("icscf","route_on_term_user_unknown","lir_term_user_unknown")
- loadmodule "/usr/lib/ser/modules/enum.so"
- loadmodule "/usr/lib/ser/modules/cdp.so"
- modparam("cdp","config_file","/etc/openimscore/icscf.xml")
- # -- rr params --
- # add value to ;lr param to make some broken UAs happy
- modparam("rr", "enable_full_lr", 1)
- # ------------------------- request routing logic -------------------
- # main routing logic
- route{
- route(Sanity_Checks);
- #route(NDS);
- if (method=="REGISTER"){
- route(REGISTER);
- break;
- }
- #If there is a Route header we try to do loose route
- if (search("^Route:")){
- # subsequent messages within a dialog should take the
- # path determined by record-routing
- if (loose_route()) {
- # mark routing logic in request
- append_hf("P-hint: I-CSCF rr-enforced\r\n");
- if (!t_relay()){
- sl_reply_error();
- break;
- }
- break;
- }
- }
- if (method=="INVITE" || method=="SUBSCRIBE" || method=="MESSAGE" ||
- method=="INFO" || method=="PUBLISH" || method=="CANCEL"){
- route(Initial_Request);
- break;
- }else{
- # Shouldn't get here unless missconfigured (add more methods as initial) or
- # somebody is routing here unknown messages
- if ( !t_newtran()) {
- sl_reply_error();
- break;
- };
- append_to_reply("Allow: INVITE,SUBSCRIBE,MESSAGE,INFO,PUBLISH,CANCEL\r\n");
- t_reply("406","Initial Request Method not allowed at the I-CSCF");
- break;
- }
- }
- route[Sanity_Checks]
- {
- # initial sanity checks -- messages with
- # max_forwards==0, or excessively long requests
- 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(@hf_value.max_forwards=="0"){
- exit;
- }
- }
- route[NDS]
- {
- if (!I_NDS_is_trusted()){
- log(-1,"Received message from NDS untrusted domain!\n");
- if (method=="REGISTER"){
- sl_send_reply("403","Forbidden - Network Domain Security doesn't trust traffic from source domain");
- break;
- }
- I_NDS_strip_headers();
- }
- }
- route[REGISTER]
- {
- # first, don't repeat a succesful UAR
- if (I_trans_in_processing())
- break;
- # I_UAR("0") means UAR_REGISTRATION/DEREGISTRATION
- # I_UAR("1") means UAR_REGISTRATION_AND_CAPABILITIES
- if (I_UAR("0")){
- if (I_scscf_select("0")) {
- t_on_reply("REGISTER_reply");
- t_on_failure("REGISTER_failure");
- if (!t_relay()) {
- if ( !t_newtran()) {
- sl_reply_error();
- break;
- };
- t_reply("500","Error forwarding towards S-CSCF");
- break;
- }
- break;
- }else{
- I_scscf_drop();
- if ( !t_newtran()) {
- sl_reply_error();
- break;
- };
- t_reply("500", "Server error on UAR select S-CSCF");
- break;
- }
- }else{
- if ( !t_newtran()) {
- sl_reply_error();
- break;
- };
- t_reply("500", "Server error on UAR");
- break;
- }
- }
- onreply_route[REGISTER_reply]
- {
- if (!t_check_status("(408)|(480)")){
- I_scscf_drop();
- }
- }
- failure_route[REGISTER_failure]
- {
- if (t_check_status("(408)|(480)")){
- #log(-1,"Got a failure for REGISTER!!!\n");
- if (I_scscf_select("1")) {
- t_on_reply("REGISTER_reply");
- t_on_failure("REGISTER_failure");
- if (!t_relay()) {
- t_reply("500","Error forwarding towards next S-CSCF");
- break;
- }
- break;
- }else{
- t_reply("500", "Server error on UAR select next S-CSCF");
- break;
- }
- }else{
- I_scscf_drop();
- }
- }
- route[Initial_Request]
- {
- # first, don't repeat a succesful LIR
- if (I_trans_in_processing())
- break;
- if (I_LIR()){
- if (I_scscf_select("0")) {
- t_on_reply("Initial_Request_reply");
- t_on_failure("Initial_Request_failure");
- if (!t_relay()) {
- if ( !t_newtran()) {
- sl_reply_error();
- break;
- };
- t_reply("500","Error forwarding towards S-CSCF");
- break;
- }
- break;
- }else{
- I_scscf_drop();
- if ( !t_newtran()) {
- sl_reply_error();
- break;
- };
- t_reply("500", "Server error on LIR select S-CSCF");
- break;
- }
- }else{
- if ( !t_newtran()) {
- sl_reply_error();
- break;
- };
- t_reply("500", "Server error on LIR");
- break;
- }
- }
- onreply_route[Initial_Request_reply]
- {
- if (!t_check_status("(408)|(480)")){
- I_scscf_drop();
- }
- }
- failure_route[Initial_Request_failure]
- {
- if (t_check_status("(408)|(480)")){
- #log(-1,"Got a failure for Initial Request!!\n");
- if (I_scscf_select("1")) {
- t_on_reply("Initial_Request_reply");
- t_on_failure("Initial_Request_failure");
- if (!t_relay()) {
- t_reply("500","Error forwarding towards next S-CSCF");
- break;
- }
- break;
- }else{
- t_reply("500", "Server error on LIR select next S-CSCF");
- break;
- }
- }else{
- I_scscf_drop();
- }
- }
- onreply_route[PSTN_reply]
- {
- log(1,">> PSTN_reply\n");
- }
- route[PSTN]
- {
- t_on_reply("PSTN_reply");
- t_relay_to_udp("", "9060");
- exit;
- }
- route[lir_term_user_unknown]
- {
- if (uri=~"tel:.*") {
- # not an existing tel identity in our domain
- # maybe it should go to PSTN... maybe to another IMS domain... query ENUM!
- if(!enum_query()){
- route(PSTN);
- exit;
- }
- if ( ! uri=~".*@ims\.mydomain\.com.*") { # ENUM resolved to another domain
- t_on_reply("Initial_Request_reply");
- t_on_failure("Initial_Request_failure");
- if (!t_relay()) {
- t_reply("500","Error forwarding to external domain");
- exit;
- };
- exit;
- } else {
- if ( !t_newtran()) {
- sl_reply_error();
- exit;
- };
- t_reply("604","Does not exist anywhere - HSS User Unknown");
- exit;
- };
- } else {
- if ( uri=~".*@ims\.mydomain\.com.*") { # we received a request for our domain (non-tel), but HSS said "User Unknown"
- if ( !t_newtran()) {
- sl_reply_error();
- exit;
- };
- t_reply("604","Does not exist anywhere - HSS User Unknown");
- exit;
- } else {
- # try to forward non-tel request to other domain
- t_on_reply("Initial_Request_reply");
- t_on_failure("Initial_Request_failure");
- if (!t_relay()) {
- t_reply("500","Error forwarding to external domain");
- exit;
- };
- exit;
- };
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement