[sr-dev] git:master: modules/websocket: Updated example kamailio.cfg

Peter Dunkley peter.dunkley at crocodile-rcs.com
Thu Oct 25 22:36:52 CEST 2012


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

Author: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Date:   Thu Oct 25 21:35:57 2012 +0100

modules/websocket: Updated example kamailio.cfg

- Reflects latest MSRP related updates

---

 modules/websocket/example/kamailio.cfg |   31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/modules/websocket/example/kamailio.cfg b/modules/websocket/example/kamailio.cfg
index 09fd968..b43583b 100644
--- a/modules/websocket/example/kamailio.cfg
+++ b/modules/websocket/example/kamailio.cfg
@@ -411,11 +411,8 @@ event_route[msrp:frame-in] {
 	if(msrp_is_reply())
 	{
 		msrp_relay();
-		exit;
 	}
-
-	# handle AUTH MSRP requests
-	if($msrp(method)=="AUTH")
+	else if($msrp(method)=="AUTH")
 	{
 		if($msrp(nexthops)>0)
 		{
@@ -423,12 +420,12 @@ event_route[msrp:frame-in] {
 			exit;
 		}
 
-		if(!www_authenticate("MY_DOMAIN", "subscriber"))
+		if(!www_authenticate("MY_DOMAIN", "subscriber", "$msrp(method)"))
 		{
 			if(auth_get_www_authenticate("myrealm", "1",
 						"$var(wauth)"))
 			{
-				msrp_reply("401", "Authorization Required",
+				msrp_reply("401", "Unauthorized",
 						"$var(wauth)");
 			} else {
 				msrp_reply("500", "Server Error");
@@ -461,14 +458,15 @@ event_route[msrp:frame-in] {
 				+ $var(sessid) + ";tcp\r\n"
 				+ "Expires: " + $var(expires) + "\r\n";
 		msrp_reply("200", "OK", "$var(expires)");
-		exit;
 	}
-
-	if($msrp(method)=="SEND")
+	else if($msrp(method)=="SEND" || $msrp(method)=="REPORT")
 	{
 		if($msrp(nexthops)>1)
 		{
-			msrp_reply("200", "Received");
+			if ($msrp(method)!="REPORT")
+			{
+				msrp_reply("200", "OK");
+			}
 			msrp_relay();
 			exit;
 		}
@@ -476,16 +474,21 @@ event_route[msrp:frame-in] {
 		if($sht(msrp=>$var(sessid)::srcaddr) == $null)
 		{
 			# one more hop, but we don't have address in htable
-			msrp_reply("481", "No Such Session");
+			msrp_reply("481", "Session-does-not-exist");
 			exit;
 		}
+		else if($msrp(method)!="REPORT")
+		{
+			msrp_relay("200", "OK");
+		}
 		msrp_relay_flags("1");
 		msrp_set_dst("$sht(msrp=>$var(sessid)::srcaddr)",
 				"$sht(msrp=>$var(sessid)::srcsock)");
 		msrp_relay();
-		exit;
 	}
-
-	msrp_relay();
+	else
+	{
+		msrp_reply("501", "Request-method-not-understood");
+	}
 }
 #!endif




More information about the sr-dev mailing list