Advertisement
Guest User

Untitled

a guest
Sep 1st, 2012
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.62 KB | None | 0 0
  1.  
  2. #
  3. # $Id: icscf.cfg 680 2009-06-18 04:29:13Z vingarzan $
  4. #
  5. # Interrogating - CSCF configuration script
  6. #
  7.  
  8. # ----------- global configuration parameters ------------------------
  9.  
  10. debug=1
  11. log_stderror=yes
  12. memlog=5
  13. sip_warning=yes
  14.  
  15. fork=yes
  16. children=4
  17.  
  18.  
  19. listen=xxx.xxx.xxx.xxx
  20. port=5060
  21. alias="icscf.ims.mydomain.com"
  22. alias="ims.mydomain.com"
  23.  
  24. check_via=no # (cmd. line: -v)
  25. dns=no # (cmd. line: -r)
  26. rev_dns=no # (cmd. line: -R)
  27.  
  28. # ------------------ module loading ----------------------------------
  29.  
  30. # Uncomment this if you want to use SQL database
  31. loadmodule "/usr/lib/ser/modules/mysql.so"
  32. loadmodule "/usr/lib/ser/modules/sl.so"
  33.  
  34. loadmodule "/usr/lib/ser/modules/tm.so"
  35. modparam("tm", "fr_timer", 10000)
  36.  
  37. loadmodule "/usr/lib/ser/modules/rr.so"
  38. loadmodule "/usr/lib/ser/modules/maxfwd.so"
  39. loadmodule "/usr/lib/ser/modules/textops.so"
  40.  
  41.  
  42. loadmodule "/usr/lib/ser/modules/icscf.so"
  43. modparam("icscf","name","icscf.ims.mydomain.com")
  44.  
  45. modparam("icscf","db_url","mysql://icscf:heslo@localhost/icscf")
  46. modparam("icscf","db_nds_table","nds_trusted_domains")
  47. modparam("icscf","db_scscf_table","s_cscf")
  48. modparam("icscf","db_capabilities_table","s_cscf_capabilities")
  49.  
  50. # Comment the following line to enable realm routing
  51. modparam("icscf","forced_hss_peer","hss.ims.mydomain.com")
  52.  
  53. modparam("icscf","hash_size",128)
  54.  
  55. modparam("icscf","icid_value_prefix","I-CSCFabcd")
  56. modparam("icscf","icid_gen_addr","")
  57. modparam("icscf","orig_ioi","ims.mydomain.com")
  58. modparam("icscf","term_ioi","ims.mydomain.com")
  59.  
  60. modparam("icscf","route_on_term_user_unknown","lir_term_user_unknown")
  61.  
  62. loadmodule "/usr/lib/ser/modules/enum.so"
  63.  
  64. loadmodule "/usr/lib/ser/modules/cdp.so"
  65. modparam("cdp","config_file","/etc/openimscore/icscf.xml")
  66.  
  67.  
  68. # -- rr params --
  69. # add value to ;lr param to make some broken UAs happy
  70. modparam("rr", "enable_full_lr", 1)
  71.  
  72. # ------------------------- request routing logic -------------------
  73.  
  74. # main routing logic
  75.  
  76. route{
  77.  
  78. route(Sanity_Checks);
  79.  
  80. #route(NDS);
  81.  
  82. if (method=="REGISTER"){
  83. route(REGISTER);
  84. break;
  85. }
  86.  
  87. #If there is a Route header we try to do loose route
  88. if (search("^Route:")){
  89. # subsequent messages within a dialog should take the
  90. # path determined by record-routing
  91. if (loose_route()) {
  92. # mark routing logic in request
  93. append_hf("P-hint: I-CSCF rr-enforced\r\n");
  94. if (!t_relay()){
  95. sl_reply_error();
  96. break;
  97. }
  98. break;
  99. }
  100. }
  101.  
  102. if (method=="INVITE" || method=="SUBSCRIBE" || method=="MESSAGE" ||
  103. method=="INFO" || method=="PUBLISH" || method=="CANCEL"){
  104. route(Initial_Request);
  105. break;
  106. }else{
  107. # Shouldn't get here unless missconfigured (add more methods as initial) or
  108. # somebody is routing here unknown messages
  109. if ( !t_newtran()) {
  110. sl_reply_error();
  111. break;
  112. };
  113. append_to_reply("Allow: INVITE,SUBSCRIBE,MESSAGE,INFO,PUBLISH,CANCEL\r\n");
  114. t_reply("406","Initial Request Method not allowed at the I-CSCF");
  115. break;
  116. }
  117. }
  118.  
  119.  
  120. route[Sanity_Checks]
  121. {
  122. # initial sanity checks -- messages with
  123. # max_forwards==0, or excessively long requests
  124. if (!mf_process_maxfwd_header("10")) {
  125. sl_send_reply("483","Too Many Hops");
  126. exit;
  127. };
  128.  
  129. if (msg:len >= max_len ) {
  130. sl_send_reply("513", "Message too big");
  131. exit;
  132. };
  133.  
  134. if(@hf_value.max_forwards=="0"){
  135.  
  136. exit;
  137. }
  138. }
  139.  
  140. route[NDS]
  141. {
  142. if (!I_NDS_is_trusted()){
  143. log(-1,"Received message from NDS untrusted domain!\n");
  144. if (method=="REGISTER"){
  145. sl_send_reply("403","Forbidden - Network Domain Security doesn't trust traffic from source domain");
  146. break;
  147. }
  148. I_NDS_strip_headers();
  149. }
  150. }
  151.  
  152. route[REGISTER]
  153. {
  154. # first, don't repeat a succesful UAR
  155. if (I_trans_in_processing())
  156. break;
  157.  
  158. # I_UAR("0") means UAR_REGISTRATION/DEREGISTRATION
  159. # I_UAR("1") means UAR_REGISTRATION_AND_CAPABILITIES
  160. if (I_UAR("0")){
  161. if (I_scscf_select("0")) {
  162. t_on_reply("REGISTER_reply");
  163. t_on_failure("REGISTER_failure");
  164. if (!t_relay()) {
  165. if ( !t_newtran()) {
  166. sl_reply_error();
  167. break;
  168. };
  169. t_reply("500","Error forwarding towards S-CSCF");
  170. break;
  171. }
  172. break;
  173. }else{
  174. I_scscf_drop();
  175. if ( !t_newtran()) {
  176. sl_reply_error();
  177. break;
  178. };
  179. t_reply("500", "Server error on UAR select S-CSCF");
  180. break;
  181. }
  182. }else{
  183. if ( !t_newtran()) {
  184. sl_reply_error();
  185. break;
  186. };
  187. t_reply("500", "Server error on UAR");
  188. break;
  189. }
  190. }
  191.  
  192. onreply_route[REGISTER_reply]
  193. {
  194. if (!t_check_status("(408)|(480)")){
  195. I_scscf_drop();
  196. }
  197. }
  198.  
  199. failure_route[REGISTER_failure]
  200. {
  201. if (t_check_status("(408)|(480)")){
  202. #log(-1,"Got a failure for REGISTER!!!\n");
  203. if (I_scscf_select("1")) {
  204. t_on_reply("REGISTER_reply");
  205. t_on_failure("REGISTER_failure");
  206. if (!t_relay()) {
  207. t_reply("500","Error forwarding towards next S-CSCF");
  208. break;
  209. }
  210. break;
  211. }else{
  212. t_reply("500", "Server error on UAR select next S-CSCF");
  213. break;
  214. }
  215. }else{
  216. I_scscf_drop();
  217. }
  218. }
  219.  
  220.  
  221. route[Initial_Request]
  222. {
  223. # first, don't repeat a succesful LIR
  224. if (I_trans_in_processing())
  225. break;
  226.  
  227. if (I_LIR()){
  228. if (I_scscf_select("0")) {
  229. t_on_reply("Initial_Request_reply");
  230. t_on_failure("Initial_Request_failure");
  231. if (!t_relay()) {
  232. if ( !t_newtran()) {
  233. sl_reply_error();
  234. break;
  235. };
  236. t_reply("500","Error forwarding towards S-CSCF");
  237. break;
  238. }
  239. break;
  240. }else{
  241. I_scscf_drop();
  242. if ( !t_newtran()) {
  243. sl_reply_error();
  244. break;
  245. };
  246. t_reply("500", "Server error on LIR select S-CSCF");
  247. break;
  248. }
  249. }else{
  250. if ( !t_newtran()) {
  251. sl_reply_error();
  252. break;
  253. };
  254. t_reply("500", "Server error on LIR");
  255. break;
  256. }
  257. }
  258.  
  259. onreply_route[Initial_Request_reply]
  260. {
  261. if (!t_check_status("(408)|(480)")){
  262. I_scscf_drop();
  263. }
  264. }
  265.  
  266. failure_route[Initial_Request_failure]
  267. {
  268. if (t_check_status("(408)|(480)")){
  269. #log(-1,"Got a failure for Initial Request!!\n");
  270. if (I_scscf_select("1")) {
  271. t_on_reply("Initial_Request_reply");
  272. t_on_failure("Initial_Request_failure");
  273. if (!t_relay()) {
  274. t_reply("500","Error forwarding towards next S-CSCF");
  275. break;
  276. }
  277. break;
  278. }else{
  279. t_reply("500", "Server error on LIR select next S-CSCF");
  280. break;
  281. }
  282. }else{
  283. I_scscf_drop();
  284. }
  285. }
  286.  
  287. onreply_route[PSTN_reply]
  288. {
  289. log(1,">> PSTN_reply\n");
  290. }
  291.  
  292.  
  293. route[PSTN]
  294. {
  295. t_on_reply("PSTN_reply");
  296. t_relay_to_udp("", "9060");
  297. exit;
  298. }
  299.  
  300. route[lir_term_user_unknown]
  301. {
  302. if (uri=~"tel:.*") {
  303. # not an existing tel identity in our domain
  304. # maybe it should go to PSTN... maybe to another IMS domain... query ENUM!
  305. if(!enum_query()){
  306. route(PSTN);
  307. exit;
  308. }
  309. if ( ! uri=~".*@ims\.mydomain\.com.*") { # ENUM resolved to another domain
  310. t_on_reply("Initial_Request_reply");
  311. t_on_failure("Initial_Request_failure");
  312. if (!t_relay()) {
  313. t_reply("500","Error forwarding to external domain");
  314. exit;
  315. };
  316. exit;
  317. } else {
  318. if ( !t_newtran()) {
  319. sl_reply_error();
  320. exit;
  321. };
  322. t_reply("604","Does not exist anywhere - HSS User Unknown");
  323. exit;
  324. };
  325. } else {
  326. if ( uri=~".*@ims\.mydomain\.com.*") { # we received a request for our domain (non-tel), but HSS said "User Unknown"
  327. if ( !t_newtran()) {
  328. sl_reply_error();
  329. exit;
  330. };
  331. t_reply("604","Does not exist anywhere - HSS User Unknown");
  332. exit;
  333. } else {
  334. # try to forward non-tel request to other domain
  335. t_on_reply("Initial_Request_reply");
  336. t_on_failure("Initial_Request_failure");
  337. if (!t_relay()) {
  338. t_reply("500","Error forwarding to external domain");
  339. exit;
  340. };
  341. exit;
  342. };
  343. };
  344. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement