[Overview] [Code Structure] [Database Prerequisites] [Configuration and Usage] [Topology Hidding (THIG)] [Example]
To use it you need the The CDiameterPeer Module (cdp) loaded. This is because this module communicates using Diameter with the Home Subscriber Server over the IMS_Cx inteface.
-- MySQL dump 10.9 -- -- Host: localhost Database: icscf -- ------------------------------------------------------ -- Server version 4.1.20-log ;;;;;;;; -- -- Current Database: `icscf` -- ; CREATE DATABASE `icscf` ; USE `icscf`; -- -- Table structure for table `nds_trusted_domains` -- DROP TABLE IF EXISTS `nds_trusted_domains`; CREATE TABLE `nds_trusted_domains` ( `id` int(11) NOT NULL auto_increment, `trusted_domain` varchar(83) NOT NULL default '', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -- Table structure for table `s_cscf` -- DROP TABLE IF EXISTS `s_cscf`; CREATE TABLE `s_cscf` ( `id` int(11) NOT NULL auto_increment, `name` varchar(83) NOT NULL default '', `s_cscf_uri` varchar(83) NOT NULL default '', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -- Table structure for table `s_cscf_capabilities` -- DROP TABLE IF EXISTS `s_cscf_capabilities`; CREATE TABLE `s_cscf_capabilities` ( `id` int(11) NOT NULL auto_increment, `id_s_cscf` int(11) NOT NULL default '0', `capability` int(11) NOT NULL default '0', PRIMARY KEY (`id`), KEY `idx_capability` (`capability`), KEY `idx_id_s_cscf` (`id_s_cscf`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; ;;;;;;; -- MySQL dump 10.9 -- -- Host: localhost Database: icscf -- ------------------------------------------------------ -- Server version 4.1.20-log ;;;;;;;; -- -- Current Database: `icscf` -- CREATE DATABASE `icscf` ; USE `icscf`; -- -- Dumping data for table `nds_trusted_domains` -- ; LOCK TABLES `nds_trusted_domains` WRITE; INSERT INTO `nds_trusted_domains` VALUES (1,'open-ims.test'); UNLOCK TABLES;; -- -- Dumping data for table `s_cscf` -- ; LOCK TABLES `s_cscf` WRITE; INSERT INTO `s_cscf` VALUES (1,'First and only S-CSCF','sip:scscf.open-ims.test:6060'); UNLOCK TABLES;; -- -- Dumping data for table `s_cscf_capabilities` -- ; LOCK TABLES `s_cscf_capabilities` WRITE; INSERT INTO `s_cscf_capabilities` VALUES (1,1,0),(2,1,1); UNLOCK TABLES;; ;;;;;;; # DB access rights grant delete,insert,select,update on icscf.* to icscf@localhost identified by 'heslo'; grant delete,insert,select,update on icscf.* to provisioning@localhost identified by 'provi';
# # $Id: icscf.cfg 396 2007-07-19 18:09:57Z placido $ # # Interrogating - CSCF configuration script # # ----------- global configuration parameters ------------------------ debug=3 log_stderror=yes memlog=5 sip_warning=yes fork=yes children=4 listen=127.0.0.1 port=5060 alias=icscf.open-ims.test alias=open-ims.test 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 "/opt/OpenIMSCore/ser_ims/modules/mysql/mysql.so" loadmodule "/opt/OpenIMSCore/ser_ims/modules/sl/sl.so" loadmodule "/opt/OpenIMSCore/ser_ims/modules/tm/tm.so" modparam("tm", "fr_timer", 10000) loadmodule "/opt/OpenIMSCore/ser_ims/modules/rr/rr.so" loadmodule "/opt/OpenIMSCore/ser_ims/modules/maxfwd/maxfwd.so" loadmodule "/opt/OpenIMSCore/ser_ims/modules/textops/textops.so" loadmodule "/opt/OpenIMSCore/ser_ims/modules/icscf/icscf.so" modparam("icscf","name","icscf.open-ims.test") 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.open-ims.test") modparam("icscf","hash_size",128) modparam("icscf","icid_value_prefix","I-CSCFabcd") modparam("icscf","icid_gen_addr","127.0.0.1") modparam("icscf","orig_ioi","open-ims.test") modparam("icscf","term_ioi","open-ims.test") modparam("icscf","route_on_term_user_unknown","lir_term_user_unknown") loadmodule "/opt/OpenIMSCore/ser_ims/modules/enum/enum.so" loadmodule "/opt/OpenIMSCore/ser_ims/modules/cdp/cdp.so" modparam("cdp","config_file","/opt/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 withing 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")&&!t_check_status("480")){ I_scscf_drop(); } } failure_route[REGISTER_failure] { if (t_check_status("408")||t_check_status("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")&&!t_check_status("480")){ I_scscf_drop(); } } failure_route[Initial_Request_failure] { if (t_check_status("408")||t_check_status("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("127.0.0.1", "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=~".*@open-ims\.test.*") { # 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=~".*@open-ims\.test.*") { # 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; }; }; }
1.5.2