[sr-dev] git:master: Updated example config for S-CSCF

admin at sip-router.org admin at sip-router.org
Wed Mar 20 17:31:44 CET 2013


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

Author: Carsten Bock <carsten at ng-voice.com>
Committer: Carsten Bock <carsten at ng-voice.com>
Date:   Wed Mar 20 17:31:34 2013 +0100

Updated example config for S-CSCF

---

 examples/scscf/kamailio.cfg |   42 ++++++++++++++++++++++++++++++++----------
 1 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/examples/scscf/kamailio.cfg b/examples/scscf/kamailio.cfg
index 4fa09b0..444cd74 100644
--- a/examples/scscf/kamailio.cfg
+++ b/examples/scscf/kamailio.cfg
@@ -430,16 +430,38 @@ route[XMLRPC] {
 # Route for handling Registrations:
 ######################################################################
 route[REGISTER] {
-	xlog("L_ERR", "Enter register block");
-	t_newtran();
-	
-	ims_www_authenticate(NETWORKNAME);
-
-	#check to see if user is authenticated - ie sip header has auth information - (already challenged)
-	if ($avp(maa_return_code) == 1) {
-		# user has not been authenticated. Lets send a challenge via 401 Unauthorized
-		ims_www_challenge("$td"); 
-		exit;
+        if (!ims_www_authenticate(NETWORKNAME)) {
+                if ($? == -2) {
+                        t_reply("403", "Authentication Failed");
+                        exit;
+                } else if ($? == -3) {
+                        t_reply("400", "Bad Request");
+                        exit;
+                } else {
+                        #user has not been authenticated. Lets send a challenge via 401 Unauthorized
+                        xlog("L_DBG","About to challenge! auth_ims\n");
+                        ims_www_challenge("$td");
+                        #this is async so to know status we have to check the reply avp
+                        xlog("L_DBG","maa_return code is $avp(s:maa_return_code)\n");
+
+                        switch ($avp(s:maa_return_code)){
+                                case 1: #success
+                                        xlog("L_DBG", "MAR success - 401/407 response sent from module");
+                                        break;
+                                case -1: #failure
+                                        xlog("L_ERR", "MAR failure - error response sent from module");
+                                        break;
+                                case -2: #error
+                                        xlog("L_ERR", "MAR error - sending error response now");
+                                        t_reply("500", "MAR failed");
+                                        break;
+                                default:
+                                        xlog("L_ERR", "Unknown return code from MAR, value is [$avp(s:uaa_return_code)]");
+                                        t_reply("500", "Unknown response code from MAR");
+                                        break;
+                        }
+                        exit;
+                }
 	} else {
 		# We need to check if this user is registered or not
 		if (!impu_registered("location")) {




More information about the sr-dev mailing list