modules/websocket: Updated example kamailio.cfg
authorPeter Dunkley <peter.dunkley@crocodile-rcs.com>
Thu, 25 Oct 2012 20:35:57 +0000 (21:35 +0100)
committerPeter Dunkley <peter.dunkley@crocodile-rcs.com>
Thu, 25 Oct 2012 20:35:57 +0000 (21:35 +0100)
- Reflects latest MSRP related updates

modules/websocket/example/kamailio.cfg

index 09fd968..b43583b 100644 (file)
@@ -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