r2918 - trunk/libminisip/source/sip
mikma at minisip.org
mikma at minisip.org
Fri Nov 17 18:41:45 CET 2006
Author: mikma
Date: 2006-11-17 18:41:43 +0100 (Fri, 17 Nov 2006)
New Revision: 2918
Modified:
trunk/libminisip/source/sip/DefaultDialogHandler.cxx
Log:
Reject unimplemented or unhandled request methods
Modified: trunk/libminisip/source/sip/DefaultDialogHandler.cxx
===================================================================
--- trunk/libminisip/source/sip/DefaultDialogHandler.cxx 2006-11-17 17:34:36 UTC (rev 2917)
+++ trunk/libminisip/source/sip/DefaultDialogHandler.cxx 2006-11-17 17:41:43 UTC (rev 2918)
@@ -36,6 +36,7 @@
#include<libmsip/SipHeaderAcceptContact.h>
#include<libmsip/SipMessage.h>
#include<libmsip/SipMessageContentIM.h>
+#include<libmsip/SipRequest.h>
#include<libmsip/SipCommandString.h>
#include<libmutil/massert.h>
@@ -320,6 +321,37 @@
}
+ // Reject unimplemented or unhandled request methods
+ if( pkt->getType()!=SipResponse::type ){
+ int statusCode;
+ const char *reasonPhrase;
+
+ if( pkt->getType()=="CANCEL" ){
+ statusCode = 481;
+ reasonPhrase = "Call/Transaction Does Not Exist";
+ }
+// else{
+// statusCode = 501;
+// reasonPhrase = "Not Implemented";
+// }
+ else{
+ statusCode = 405;
+ reasonPhrase = "Method Not Allowed";
+ }
+
+ MRef<SipMessage*> req = *pkt;
+ string branch = req->getDestinationBranch();
+ MRef<SipResponse*> resp =
+ new SipResponse(branch, statusCode, reasonPhrase,
+ *req);
+ SipSMCommand cmd( *resp, SipSMCommand::dialog_layer,
+ SipSMCommand::transaction_layer );
+ // Send responses directly to the transport layer bypassing
+ // the transaction layer
+ sipStack->enqueueCommand(cmd, HIGH_PRIO_QUEUE);
+ return true;
+ }
+
mdbg << "DefaultDialogHandler ignoring " << pkt->getString() << end;
return false;
More information about the Minisip-devel
mailing list