瀏覽代碼

ims_registrar_scscf: Properly handle the case, when no user-data-xml was provided during SAR (due to the already existing user-data-xml from previous SAR)

Carsten Bock 8 年之前
父節點
當前提交
092ee82175
共有 2 個文件被更改,包括 8 次插入19 次删除
  1. 5 18
      modules/ims_registrar_scscf/cxdx_sar.c
  2. 3 1
      modules/ims_registrar_scscf/save.c

+ 5 - 18
modules/ims_registrar_scscf/cxdx_sar.c

@@ -250,24 +250,11 @@ void async_cdp_callback(int is_timeout, void *param, AAAMessage *saa, long elaps
             }
         }
 
-        if (data->sar_assignment_type == AVP_IMS_SAR_REGISTRATION || data->sar_assignment_type == AVP_IMS_SAR_RE_REGISTRATION) {
-            if (s) {
-                if (build_p_associated_uri(s) != 0) {
-                    LM_ERR("Unable to build p_associated_uri\n");
-                    rerrno = R_SAR_FAILED;
-                    goto error;
-                }
-            }
-
-        }
-
-        if (s) {
-            //here we update the contacts and also build the new contact header for the 200 OK reply
-            if (update_contacts(req, data->domain, &data->public_identity, data->sar_assignment_type, &s, &ccf1, &ccf2, &ecf1, &ecf2, &data->contact_header) <= 0) {
-                LM_ERR("Error processing REGISTER\n");
-                rerrno = R_SAR_FAILED;
-                goto error;
-            }
+        //here we update the contacts and also build the new contact header for the 200 OK reply
+        if (update_contacts(req, data->domain, &data->public_identity, data->sar_assignment_type, &s, &ccf1, &ccf2, &ecf1, &ecf2, &data->contact_header) <= 0) {
+            LM_ERR("Error processing REGISTER\n");
+            rerrno = R_SAR_FAILED;
+            goto error;
         }
         
         if (data->contact_header) {

+ 3 - 1
modules/ims_registrar_scscf/save.c

@@ -832,6 +832,7 @@ int update_contacts(struct sip_msg* msg, udomain_t* _d,
             }
             //now build the contact buffer to be include in the reply message and unlock
             build_contact(impu_rec, contact_header);
+            build_p_associated_uri(*s);
             notify_subscribers(impu_rec, 0, 0);
             ul.unlock_udomain(_d, public_identity);
             break;
@@ -855,6 +856,7 @@ int update_contacts(struct sip_msg* msg, udomain_t* _d,
             }
             //build the contact buffer for all registered contacts on explicit IMPU
             build_contact(impu_rec, contact_header);
+            build_p_associated_uri(impu_rec->s);
 
             subscription = impu_rec->s;
             if (!subscription) {
@@ -878,7 +880,7 @@ int update_contacts(struct sip_msg* msg, udomain_t* _d,
             //now update the implicit set
             for (i = 0; i < subscription->service_profiles_cnt; i++) {
                 for (j = 0; j < subscription->service_profiles[i].public_identities_cnt; j++) {
-                    pi = &((*s)->service_profiles[i].public_identities[j]);
+                    pi = &(subscription->service_profiles[i].public_identities[j]);
 
                     if (memcmp(public_identity->s, pi->public_identity.s, public_identity->len) == 0) { //we don't need to update the explicit IMPU
                         LM_DBG("Ignoring explicit identity <%.*s>, updating later.....\n", public_identity->len, public_identity->s);