2
0

mt.cfg 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. ######################################################################
  2. # Terminating, Initial requests
  3. ######################################################################
  4. route[MT] {
  5. t_on_reply("MT_reply");
  6. }
  7. ######################################################################
  8. # Replies to Originating Initial Requests
  9. ######################################################################
  10. onreply_route[MT_reply] {
  11. if (!strempty($(ct{tobody.params}))) {
  12. append_hf("C-Params: $(ct{tobody.params})\r\n");
  13. }
  14. # In case of 1xx and 2xx do NAT
  15. if(status=~"[12][0-9][0-9]")
  16. route(NATMANAGE);
  17. #!ifdef WITH_RX
  18. if (t_check_status("183")){
  19. xlog("L_DBG", "IMS: Received 183 inside term_initial_reply\n");
  20. xlog("L_DBG", "About to test if this is a retransmitted reply which is still currently suspended\n");
  21. if (t_is_retr_async_reply()) {
  22. xlog("L_DBG", "Dropping retransmitted reply which is still currently suspended\n");
  23. drop();
  24. }
  25. xlog("L_DBG","Diameter: Term authorizing media via Rx\n");
  26. $avp(FTAG_CUSTOM_AVP)=$ft;
  27. $avp(TTAG_CUSTOM_AVP)=$tt;
  28. $avp(CALLID_CUSTOM_AVP)=$ci;
  29. $var(aarret) = Rx_AAR("MT_aar_reply","term","",-1);
  30. xlog("L_DBG", "AAR return code is $var(aarret)\n");
  31. switch ($var(aarret)) {
  32. case 1:
  33. #suspend was successful and we must break
  34. xlog("L_DBG", "Success sending AAR for media\n");
  35. exit;
  36. case -1:
  37. #this is retransmitted response so we just drop it
  38. xlog("L_DBG", "AAR still processing dropping retransmitted response\n");
  39. drop();
  40. exit;
  41. default:
  42. xlog("L_ERR", "Unable to send AAR for media\n");
  43. #comment this if you want to allow even if Rx fails
  44. dlg_terminate("all", "Sorry no QoS available");
  45. exit;
  46. }
  47. }
  48. }
  49. route[MT_aar_reply]
  50. {
  51. xlog("L_DBG", "IMS: TERM_SESSION_AAR_REPLY\n");
  52. #this is async so to know status we have to check the reply avp
  53. switch ($avp(s:aar_return_code)) {
  54. case 1:
  55. xlog("L_DBG", "Diameter: Orig AAR success on media authorization\n");
  56. break;
  57. default:
  58. xlog("L_ERR", "IMS: AAR failed Orig\n");
  59. xlog("L_ERR", "IMS: ttag: "+ "$avp(TTAG_CUSTOM_AVP)");
  60. xlog("L_ERR", "IMS: ftag: "+ "$avp(FTAG_CUSTOM_AVP)");
  61. xlog("L_ERR", "IMS: callid: "+ "$avp(CALLID_CUSTOM_AVP)");
  62. #comment this if you want to allow even if Rx fails
  63. if(dlg_get("$avp(CALLID_CUSTOM_AVP)","$avp(FTAG_CUSTOM_AVP)","$avp(TTAG_CUSTOM_AVP)")){
  64. dlg_terminate("all", "Sorry no QoS available");
  65. exit;
  66. }
  67. }
  68. #!endif
  69. }
  70. ######################################################################
  71. # In-Dialog-MT-Requests
  72. ######################################################################
  73. route[MT_indialog] {
  74. t_on_reply("MT_indialog_reply");
  75. }
  76. onreply_route[MT_indialog_reply] {
  77. # In case of 1xx and 2xx do NAT
  78. if(status=~"[12][0-9][0-9]")
  79. route(NATMANAGE);
  80. #!ifdef WITH_RX
  81. if(t_check_status("200") && is_method("INVITE")) {
  82. if (t_is_retr_async_reply()) {
  83. xlog("L_DBG", "Dropping retransmitted reply which is still currently suspended\n");
  84. drop();
  85. }
  86. xlog("L_DBG", "IMS: TERM_SUBSEQUENT reply. This is a 200 OK to a re-INVITE\n");
  87. xlog("L_DBG","Diameter: Term authorizing media via Rx\n");
  88. $avp(FTAG_CUSTOM_AVP)=$ft;
  89. $avp(TTAG_CUSTOM_AVP)=$tt;
  90. $avp(CALLID_CUSTOM_AVP)=$ci;
  91. $var(aarret) = Rx_AAR("MT_indialog_aar_reply","term","",-1);
  92. xlog("L_DBG", "AAR return code is $var(aarret)\n");
  93. switch ($var(aarret)) {
  94. case 1:
  95. #suspend was successful and we must break
  96. xlog("L_DBG", "Success sending AAR for media\n");
  97. exit;
  98. case -1:
  99. #this is retransmitted response so we just drop it
  100. xlog("L_DBG", "AAR still processing dropping retransmitted response\n");
  101. drop();
  102. exit;
  103. default:
  104. xlog("L_ERR", "Unable to send AAR for media\n");
  105. #comment this if you want to allow even if Rx fails
  106. dlg_terminate("all", "Sorry no QoS available");
  107. exit;
  108. }
  109. }
  110. }
  111. route[MT_indialog_aar_reply]
  112. {
  113. #this is async so to know status we have to check the reply avp
  114. switch ($avp(s:aar_return_code)) {
  115. case 1:
  116. xlog("L_DBG", "Diameter: Orig AAR success on media authorization\n");
  117. break;
  118. default:
  119. xlog("L_ERR", "IMS: AAR failed Orig\n");
  120. xlog("L_ERR", "IMS: ttag: "+ "$avp(TTAG_CUSTOM_AVP)");
  121. xlog("L_ERR", "IMS: ftag: "+ "$avp(FTAG_CUSTOM_AVP)");
  122. xlog("L_ERR", "IMS: callid: "+ "$avp(CALLID_CUSTOM_AVP)");
  123. #comment this if you want to allow even if Rx fails
  124. if(dlg_get("$avp(CALLID_CUSTOM_AVP)","$avp(FTAG_CUSTOM_AVP)","$avp(TTAG_CUSTOM_AVP)")){
  125. dlg_terminate("all", "Sorry no QoS available");
  126. exit;
  127. }
  128. }
  129. #!endif
  130. }