[sr-dev] git:master: examples/config: added p-asserted-identity logic on P-CSCF and add Called-Party_ID AVP on S-CSCF

Richard Good richard.good at smilecoms.com
Wed Feb 12 07:57:07 CET 2014


Module: sip-router
Branch: master
Commit: 71f2247cf4dc6f8d3a0b148461322f6b680f1174
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=71f2247cf4dc6f8d3a0b148461322f6b680f1174

Author: Richard Good <richard.good at smilecoms.com>
Committer: Richard Good <richard.good at smilecoms.com>
Date:   Tue Feb 11 09:42:27 2014 +0200

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

---

 examples/pcscf/kamailio.cfg |   46 ++++++++++++++++++++++++++++++++++--------
 examples/scscf/kamailio.cfg |   12 +++++++---
 2 files changed, 45 insertions(+), 13 deletions(-)

diff --git a/examples/pcscf/kamailio.cfg b/examples/pcscf/kamailio.cfg
index 9925089..6185310 100644
--- a/examples/pcscf/kamailio.cfg
+++ b/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");
diff --git a/examples/scscf/kamailio.cfg b/examples/scscf/kamailio.cfg
index 24670d8..aea60b2 100644
--- a/examples/scscf/kamailio.cfg
+++ b/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")) {




More information about the sr-dev mailing list