Răsfoiți Sursa

examples/config: added p-asserted-identity logic on P-CSCF and add Called-Party_ID AVP on S-CSCF

Richard Good 11 ani în urmă
părinte
comite
71f2247cf4
2 a modificat fișierele cu 45 adăugiri și 13 ștergeri
  1. 37 9
      examples/pcscf/kamailio.cfg
  2. 8 4
      examples/scscf/kamailio.cfg

+ 37 - 9
examples/pcscf/kamailio.cfg

@@ -857,6 +857,22 @@ route[Orig_Initial]
 		send_reply("403","Forbidden - You must register first with a S-CSCF");
 		break;
 	}
+
+	#asserted identity header       
+        if (is_present_hf("P-Preferred-Identity") && pcscf_assert_identity("location", "$hdr(P-Preferred-Identity)")) {
+                xlog("L_DBG", "P-Preferred-Identity is asserted " + "$hdr(P-Preferred-Identity)");
+                append_hf("P-Asserted-Identity: $hdr(P-Preferred-Identity)\r\n");
+        } else {
+                xlog("L_DBG", "P-Preferred-Identity not asserted - using default " + "$pcscf_asserted_identity");
+                append_hf("P-Asserted-Identity: <$pcscf_asserted_identity>\r\n");
+        }
+        if(is_present_hf("P-Preferred-Identity")) {
+                remove_hf("P-Preferred-Identity");
+        }
+
+        msg_apply_changes();
+
+
 	if (!pcscf_follows_service_routes("location")){
 		#Variant 1 - deny access to the network
 		#send_reply("400","Bad Request - Not following indicated service routes");
@@ -879,15 +895,6 @@ route[Orig_Initial]
 	$avp(RR_CUSTOM_USER_AVP)="mo";
 	record_route();
    
-	if (is_present_hf("P-Preferred-Identity") && pcscf_assert_identity("location", "$hdr(P-Preferred-Identity)")) {
-		remove_hf("P-Preferred-Identity");
-		append_hf("P-Asserted-Identity: $hdr(P-Preferred-Identity)\r\n");
-	} else if (pcscf_assert_identity("location", "$fu")) {
-		append_hf("P-Asserted-Identity: <$fu>\r\n");
-	} else {
-		append_hf("P-Asserted-Identity: <$pcscf_asserted_identity>\r\n");
-	}
-
 	# Do RTP-Relaying, if necessary:
 	route(RTPPROXY_ORIG);
    
@@ -1092,6 +1099,27 @@ route[Term_Initial]
 ######################################################################
 onreply_route[Term_Initial_reply]
 {
+
+	if (t_check_status("183")||t_check_status("200")){
+                if (!pcscf_is_registered("location")) {
+                        xlog("L_DBG", "IMS: INSIDE TERM_INITIAL_REPLY: can't find contact [$ct] in P-CSCF usrloc\n");
+                        send_reply("403","Forbidden - not registered with P-CSCF");
+                        break;
+                }
+
+                #asserted identity header       
+                if (pcscf_assert_called_identity("location")) {
+                        xlog("L_DBG", "P-Called-Party-ID asserted");
+                } else {
+                        xlog("L_DBG", "P-Called-Party-ID not asserted - using default " + "$pcscf_asserted_identity");
+                        append_hf("P-Asserted-Identity: <$pcscf_asserted_identity>\r\n");
+                }
+                if(is_present_hf("P-Preferred-Identity")) {
+                        remove_hf("P-Preferred-Identity");
+                }
+                msg_apply_changes();
+        }
+
 #!ifdef WITH_RX
 	if (t_check_status("180|183|200")){
 		xlog("L_DBG","Diameter Term authorizing media via Rx\n");

+ 8 - 4
examples/scscf/kamailio.cfg

@@ -717,6 +717,10 @@ route[orig]
         	record_route();    
 	}
 
+	if (is_method("INVITE|MESSAGE")) {
+                append_hf("P-Called-Party-ID: <$ruri>\r\n");
+        }
+
 #!ifdef WITH_RO
 	# before we allow call - lets check credit
 	if (is_method("INVITE")) {
@@ -737,10 +741,10 @@ route[orig]
 		exit;
 	}
 
-	if (!isc_from_as("orig")) {
-		remove_hf("P-Asserted-Identity");
-		append_hf("P-Asserted-Identity: <sip:$fU@$fd>\r\n");
-	}
+	#if (!isc_from_as("orig")) {
+	#	remove_hf("P-Asserted-Identity");
+	#	append_hf("P-Asserted-Identity: <sip:$fU@$fd>\r\n");
+	#}
 
 	# Check for PSTN destinations:
 	if (is_method("INVITE")) {