Module: kamailio
Branch: master
Commit: e330a71081c0b8e431c1885dfc79a0ae45cc782d
URL: 
https://github.com/kamailio/kamailio/commit/e330a71081c0b8e431c1885dfc79a0ae45cc782d

Author: Carsten Bock <cars...@ng-voice.com>
Committer: Carsten Bock <cars...@ng-voice.com>
Date: 2017-01-12T14:44:03+01:00

IMS-Registrar-S-CSCF: Make the error-reply-code configurable

---

Modified: src/modules/ims_registrar_scscf/doc/ims_registrar_scscf_admin.xml
Modified: src/modules/ims_registrar_scscf/reg_mod.c
Modified: src/modules/ims_registrar_scscf/reg_mod.h
Modified: src/modules/ims_registrar_scscf/reply.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/e330a71081c0b8e431c1885dfc79a0ae45cc782d.diff
Patch: 
https://github.com/kamailio/kamailio/commit/e330a71081c0b8e431c1885dfc79a0ae45cc782d.patch

---

diff --git a/src/modules/ims_registrar_scscf/doc/ims_registrar_scscf_admin.xml 
b/src/modules/ims_registrar_scscf/doc/ims_registrar_scscf_admin.xml
index 672088f..ef1bfdf 100644
--- a/src/modules/ims_registrar_scscf/doc/ims_registrar_scscf_admin.xml
+++ b/src/modules/ims_registrar_scscf/doc/ims_registrar_scscf_admin.xml
@@ -407,6 +407,30 @@
        </programlisting>
       </example>
     </section>
+
+    <section>
+      <title>error_reply_code (int)</title>
+
+      <para>In certain error conditions, the S-CSCF may not be able to process
+       the request (e.g. in case of database failures). Per default and
+       according to the Specs, the S-CSCF would return a 500 error in this
+       case. However, according to the SIP-Specs for DNS-SRV, this won't
+       trigger a failover, which may be desired.</para>
+
+      <para>This parameter let's you override the default 500 with another
+       return-code (e.g. 503) in order to get the desired behaviour.</para>
+
+      <para><emphasis> Default value is 500. </emphasis></para>
+
+      <example>
+        <title>Set <varname>error_reply_code</varname> parameter</title>
+
+        <programlisting format="linespecific">...
+        modparam("ims_registrar_scscf", "error_reply_code", 503)
+...</programlisting>
+      </example>
+    </section>
+
   </section>
 
   <section>
diff --git a/src/modules/ims_registrar_scscf/reg_mod.c 
b/src/modules/ims_registrar_scscf/reg_mod.c
index a84b396..66ec247 100644
--- a/src/modules/ims_registrar_scscf/reg_mod.c
+++ b/src/modules/ims_registrar_scscf/reg_mod.c
@@ -101,6 +101,8 @@ int ue_unsubscribe_on_dereg = 0;  /*many UEs do not 
unsubscribe on de reg - ther
 
 int user_data_always = 0; /* Always Reports that user data is missing to HSS */
 
+int error_reply_code = 500; /**< Error-Reply-Code */
+
 /* parameters storage */
 str cxdx_dest_realm = str_init("ims.smilecoms.com");
 
@@ -270,6 +272,7 @@ static param_export_t params[] = {
     {"ue_unsubscribe_on_dereg", INT_PARAM, &ue_unsubscribe_on_dereg},
     {"subscription_expires_range", INT_PARAM, &subscription_expires_range},
     {"user_data_always", INT_PARAM, &user_data_always},
+    {"error_reply_code", INT_PARAM, &error_reply_code},
     {"notification_list_size_threshold", INT_PARAM, 
&notification_list_size_threshold},
        {"max_notification_list_size", INT_PARAM, &max_notification_list_size},
        {"notification_processes", INT_PARAM, &notification_processes},
diff --git a/src/modules/ims_registrar_scscf/reg_mod.h 
b/src/modules/ims_registrar_scscf/reg_mod.h
index 5bd2fa6..2d3e399 100644
--- a/src/modules/ims_registrar_scscf/reg_mod.h
+++ b/src/modules/ims_registrar_scscf/reg_mod.h
@@ -85,6 +85,7 @@
 
 
 extern int nat_flag;
+extern int error_reply_code;
 extern int tcp_persistent_flag;
 extern int received_avp;
 
diff --git a/src/modules/ims_registrar_scscf/reply.c 
b/src/modules/ims_registrar_scscf/reply.c
index 1185510..559135a 100644
--- a/src/modules/ims_registrar_scscf/reply.c
+++ b/src/modules/ims_registrar_scscf/reply.c
@@ -674,6 +674,7 @@ int reg_send_reply_transactional(struct sip_msg* _m, 
contact_for_header_t* conta
     }
 
     code = codes[rerrno];
+    if ((code == 500) && (error_reply_code > 0)) code = error_reply_code;
     switch (code) {
         case 200: msg.s = MSG_200;
             msg.len = sizeof (MSG_200) - 1;
@@ -767,6 +768,8 @@ int reg_send_reply(struct sip_msg* _m, 
contact_for_header_t* contact_header) {
     }
 
     code = codes[rerrno];
+    if ((code == 500) && (error_reply_code > 0)) code = error_reply_code;
+
     switch (code) {
         case 200: msg.s = MSG_200;
             msg.len = sizeof (MSG_200) - 1;


_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to