r114 - regression_tests/common/ua

erik at minisip.org erik at minisip.org
Tue May 22 13:09:11 CEST 2007


Author: erik
Date: 2007-05-22 13:09:11 +0200 (Tue, 22 May 2007)
New Revision: 114

Modified:
   regression_tests/common/ua/ua.cxx
Log:

 * updated regression testing test app. 



Modified: regression_tests/common/ua/ua.cxx
===================================================================
--- regression_tests/common/ua/ua.cxx	2007-05-21 12:22:09 UTC (rev 113)
+++ regression_tests/common/ua/ua.cxx	2007-05-22 11:09:11 UTC (rev 114)
@@ -106,8 +106,8 @@
 
 class MyCall : public SipDialog{
 	public:
-		MyCall(MRef<SipStack*> stack, MRef<SipIdentity*> ident):
-				SipDialog(stack, ident,""),
+		MyCall(MRef<SipStack*> stack, MRef<SipIdentity*> ident, string cid):
+				SipDialog(stack, ident, cid),
 				myIdentity(ident)
 		{
 				
@@ -185,7 +185,7 @@
 				SipSMCommand invitecmd(
 						*myInvite,
 						SipSMCommand::dialog_layer,
-				SipSMCommand::transaction_layer );
+						SipSMCommand::transaction_layer );
 				getSipStack()->enqueueCommand(invitecmd);
 				return true;
 			}else
@@ -200,7 +200,7 @@
 			{
 				this->dialogState.updateState((SipRequest*) *cmd.getCommandPacket());
 				MRef<SipMessage*> resp = new SipResponse(cmd.getCommandPacket()->getFirstViaBranch(), 
-				 		200, "ok", cmd.getCommandPacket() ); 
+				 		200, "ok", (SipRequest*)*cmd.getCommandPacket() ); 
 				getSipStack()->enqueueCommand( SipSMCommand(resp, 
 						SipSMCommand::dialog_layer, 
 						SipSMCommand::transaction_layer));
@@ -215,6 +215,7 @@
 					SipSMCommand::transaction_layer,
 					SipSMCommand::dialog_layer, "2**"))
 			{
+
 				this->dialogState.updateState((SipResponse*) *cmd.getCommandPacket());
 
 				MRef<SipResponse*> resp = (SipResponse*)*cmd.getCommandPacket();
@@ -254,7 +255,7 @@
 						SipSMCommand::dialog_layer))
 			{
 				MRef<SipMessage*> resp = new SipResponse(cmd.getCommandPacket()->getFirstViaBranch(), 
-				 		200, "ok", cmd.getCommandPacket() ); 
+				 		200, "ok", (SipRequest*)*cmd.getCommandPacket() ); 
 				getSipStack()->enqueueCommand( SipSMCommand(resp, 
 						SipSMCommand::dialog_layer, 
 						SipSMCommand::transaction_layer));
@@ -312,10 +313,9 @@
 
 	private:
 		MRef<SipRequest*> createInvite(string user){
-			MRef<SipRequest*> req = new SipRequest(itoa(rand()), "INVITE"); 
-			req->setUri(user);
+			MRef<SipRequest*> req = new SipRequest("INVITE", user); 
 
-			req->addHeader(new SipHeader(new SipHeaderValueCallID(itoa(rand()))));
+			req->addHeader(new SipHeader(new SipHeaderValueCallID( getCallId() )));
 			req->addHeader(new SipHeader(new SipHeaderValueMaxForwards(50)));
 
 			req->addHeader(new SipHeader(new SipHeaderValueFrom(myIdentity->getSipUri()))); 
@@ -354,10 +354,11 @@
 		CommandString handleCommandResp(string subsystem, const CommandString &cmd){CommandString ret ; return ret;}
 
 		bool handleCommand(const SipSMCommand& cmd){
+			massert(sipStack);
 			if (cmd.getType()==SipSMCommand::COMMAND_STRING){
 
 				if (cmd.getCommandString().getOp()=="call"){	//Act as a client
-					MRef<SipDialog*> myCall = new MyCall(sipStack, myIdentity);
+					MRef<SipDialog*> myCall = new MyCall(sipStack, myIdentity, "");
 					sipStack->addDialog(myCall);
 					//cout << "INFO: Started call with id "<< myCall->getCallId()<<endl;
 					return myCall->handleCommand(cmd);
@@ -368,10 +369,12 @@
 
 			}else{
 				if (cmd.getCommandPacket()->getType()=="INVITE"){
-					MRef<SipDialog*> myCall = new MyCall(sipStack, myIdentity);
+					MRef<SipDialog*> myCall = new MyCall(sipStack, myIdentity, cmd.getCommandPacket()->getCallId() );
 					lastCallId = myCall->getCallId();
 					sipStack->addDialog(myCall);
-					return myCall->handleCommand(cmd);
+					bool ret = myCall->handleCommand(cmd);
+					massert(ret);
+					return ret;
 				}else{
 					cerr << "MyApp: I don't know how to handle packet "<<cmd.getCommandPacket()->getType()<<endl;
 				}



More information about the Minisip-devel mailing list