Browse code

Merge 8c7805c62249c2234b9f29b64369749eb48f29b6 into 0afc10d9b1b3f65b92d649d530b6363476b3d03b

alexyosifov authored on 29/11/2021 10:57:32 • GitHub committed on 29/11/2021 10:57:32
Showing 3 changed files
... ...
@@ -310,14 +310,38 @@
310 310
     <section id="ims_usrloc_scscf.p.user_data_xsd">
311 311
       <title>user_data_xsd (string)</title>
312 312
       <para> </para>
313
-      <para><emphasis> Default value is 1800 </emphasis></para>
313
+      <para><emphasis> Default value is NULL </emphasis></para>
314 314
       <example>
315
-        <title>Set <varname>unreg_validity</varname> parameter</title>
315
+        <title>Set <varname>user_data_xsd</varname> parameter</title>
316 316
         <programlisting format="linespecific">
317 317
         modparam("ims_usrloc_scscf", "user_data_xsd", "/usr/local/etc/kamailio/CxDataType_Rel6.xsd")
318 318
         </programlisting>
319 319
       </example>
320 320
     </section>
321
+
322
+    <section id="ims_usrloc_scscf.p.realm">
323
+      <title>realm (string)</title>
324
+      <para> </para>
325
+      <para><emphasis> Default value is NULL </emphasis></para>
326
+      <example>
327
+        <title>Set <varname>realm</varname> parameter</title>
328
+        <programlisting format="linespecific">
329
+        modparam("ims_usrloc_scscf", "realm", "kamailio-ims.org")
330
+        </programlisting>
331
+      </example>
332
+    </section>
333
+
334
+    <section id="ims_usrloc_scscf.p.skip_realm">
335
+      <title>skip_realm (int)</title>
336
+      <para>Skipping defined network name in the <varname>realm</varname> for NOTIFY's Message body reginfo tag. </para>
337
+      <para><emphasis> Default value is 0 </emphasis></para>
338
+      <example>
339
+        <title>Set <varname>skip_realm</varname> parameter</title>
340
+        <programlisting format="linespecific">
341
+        modparam("ims_usrloc_scscf", "skip_realm", 1)
342
+        </programlisting>
343
+      </example>
344
+    </section>
321 345
   </section>
322 346
 
323 347
   <section>
... ...
@@ -125,6 +125,9 @@ shtable_t sub_dialog_table;
125 125
 
126 126
 int contact_delete_delay = 30;   //If contact is put into delay delete state this is how long we delay before deleting
127 127
 
128
+char* cscf_realm = 0;
129
+int skip_cscf_realm = 0;
130
+
128 131
 new_shtable_t pres_new_shtable;
129 132
 insert_shtable_t pres_insert_shtable;
130 133
 search_shtable_t pres_search_shtable;
... ...
@@ -170,6 +173,8 @@ static param_export_t params[] = {
170 173
     {"db_mode",				INT_PARAM, &db_mode},
171 174
     {"db_url", 				PARAM_STR, &db_url},
172 175
     {"timer_procs",             INT_PARAM, &ul_timer_procs},
176
+	{"realm",               PARAM_STRING, &cscf_realm},
177
+	{"skip_realm",          INT_PARAM, &skip_cscf_realm},
173 178
 	{0, 0, 0}
174 179
 };
175 180
 
... ...
@@ -79,6 +79,9 @@ extern int subs_hash_size;
79 79
 
80 80
 extern int contact_delete_delay;
81 81
 
82
+extern char* cscf_realm;
83
+extern int skip_cscf_realm;
84
+
82 85
 /*!
83 86
  * \brief Create a new domain structure
84 87
  * \param  _n is pointer to str representing name of the domain, the string is
... ...
@@ -706,6 +709,7 @@ int get_impus_from_subscription_as_string(udomain_t* _d, impurecord_t* impu_rec,
706 709
     ims_public_identity* impi;
707 710
     int bytes_needed = 0;
708 711
     int len = 0;
712
+    char* p = NULL;
709 713
 
710 714
     LM_DBG("getting IMPU subscription set\n");
711 715
 
... ...
@@ -723,18 +727,30 @@ int get_impus_from_subscription_as_string(udomain_t* _d, impurecord_t* impu_rec,
723 727
     for (i = 0; i < impu_rec->s->service_profiles_cnt; i++) {
724 728
         for (j = 0; j < impu_rec->s->service_profiles[i].public_identities_cnt; j++) {
725 729
             impi = &(impu_rec->s->service_profiles[i].public_identities[j]);
726
-            LM_DBG("Got Record %.*s (%i)\n", impi->public_identity.len,
727
-              impi->public_identity.s, impi->public_identity.len);
728 730
 
729
-            if (barring < 0) {
730
-                //get all records
731
-                bytes_needed += impi->public_identity.len;
732
-                (*num_impus)++;
731
+            if (skip_cscf_realm && cscf_realm) {
732
+                p = strstr(impi->public_identity.s, cscf_realm);
733
+            } else {
734
+                p = NULL;
735
+            }
736
+
737
+            if (p) {
738
+                LM_DBG("Skip Record %.*s (%i)\n", impi->public_identity.len,
739
+              impi->public_identity.s, impi->public_identity.len);
733 740
             } else {
734
-                if (impi->barring == barring) {
735
-                    //add the record to the list
741
+                LM_DBG("Got Record %.*s (%i)\n", impi->public_identity.len,
742
+                impi->public_identity.s, impi->public_identity.len);
743
+
744
+                if (barring < 0) {
745
+                    //get all records
736 746
                     bytes_needed += impi->public_identity.len;
737 747
                     (*num_impus)++;
748
+                } else {
749
+                    if (impi->barring == barring) {
750
+                        //add the record to the list
751
+                        bytes_needed += impi->public_identity.len;
752
+                        (*num_impus)++;
753
+                    }
738 754
                 }
739 755
             }
740 756
         }
... ...
@@ -761,21 +777,30 @@ int get_impus_from_subscription_as_string(udomain_t* _d, impurecord_t* impu_rec,
761 777
     for (i = 0; i < impu_rec->s->service_profiles_cnt; i++) {
762 778
         for (j = 0; j < impu_rec->s->service_profiles[i].public_identities_cnt; j++) {
763 779
             impi = &(impu_rec->s->service_profiles[i].public_identities[j]);
764
-            if (barring < 0) {
765
-                //get all records
766
-                (*impus)[count].s = ptr;
767
-                memcpy(ptr, impi->public_identity.s, impi->public_identity.len);
768
-                (*impus)[count].len = impi->public_identity.len;
769
-                ptr += impi->public_identity.len;
770
-                count++;
780
+
781
+            if (skip_cscf_realm && cscf_realm) {
782
+                p = strstr(impi->public_identity.s, cscf_realm);
771 783
             } else {
772
-                if (impi->barring == barring) {
773
-                    //add the record to the list
784
+                p = NULL;
785
+            }
786
+
787
+            if (p == NULL) {
788
+                if (barring < 0) {
789
+                    //get all records
774 790
                     (*impus)[count].s = ptr;
775 791
                     memcpy(ptr, impi->public_identity.s, impi->public_identity.len);
776 792
                     (*impus)[count].len = impi->public_identity.len;
777 793
                     ptr += impi->public_identity.len;
778 794
                     count++;
795
+                } else {
796
+                    if (impi->barring == barring) {
797
+                        //add the record to the list
798
+                        (*impus)[count].s = ptr;
799
+                        memcpy(ptr, impi->public_identity.s, impi->public_identity.len);
800
+                        (*impus)[count].len = impi->public_identity.len;
801
+                        ptr += impi->public_identity.len;
802
+                        count++;
803
+                    }
779 804
                 }
780 805
             }
781 806
         }