r3270 - in trunk/libmsip: include/libmsip source source/transactions

svn at minisip.org svn at minisip.org
Wed May 9 13:59:16 CEST 2007


Author: erik
Date: 2007-05-08 19:40:00 +0200 (Tue, 08 May 2007)
New Revision: 3270

Modified:
   trunk/libmsip/include/libmsip/SipLayerDialog.h
   trunk/libmsip/include/libmsip/SipLayerTransaction.h
   trunk/libmsip/source/SipCommandDispatcher.cxx
   trunk/libmsip/source/SipLayerDialog.cxx
   trunk/libmsip/source/SipLayerTransaction.cxx
   trunk/libmsip/source/SipLayerTransport.cxx
   trunk/libmsip/source/SipStackInternal.cxx
   trunk/libmsip/source/transactions/SipTransaction.cxx
   trunk/libmsip/source/transactions/SipTransactionInviteClient.cxx
   trunk/libmsip/source/transactions/SipTransactionInviteServer.cxx
   trunk/libmsip/source/transactions/SipTransactionNonInviteClient.cxx
   trunk/libmsip/source/transactions/SipTransactionNonInviteServer.cxx
Log:

Enhancements and bug fixes in libmsip:
 
 * Store transactions indexed by branch value. This makes the 
   code less complex and more efficient.
 
 * Set "branch" parameter in the transport_error command
   generated by the transport layer so that it can be
   routed to the correct transaction.

 * Same as above, but for the transaction terminated command
   generated by the transactions.

 * Set the destination id part of the SipSMCommand to the branch
   id when adressing the transaction layer (before we set it to
   the call id and it was not used).

 * bug fix: A couple of timers could still be waiting to fire
   when a transaction was terminated by a transport
   error (I'm not sure this was actually any problem, but at least 
   it delayed destroying the transaction).





Modified: trunk/libmsip/include/libmsip/SipLayerDialog.h
===================================================================
--- trunk/libmsip/include/libmsip/SipLayerDialog.h	2007-05-08 13:27:54 UTC (rev 3269)
+++ trunk/libmsip/include/libmsip/SipLayerDialog.h	2007-05-08 17:40:00 UTC (rev 3270)
@@ -49,6 +49,7 @@
 		MRef<SipDefaultHandler*> getDefaultDialogCommandHandler();
 		
 		void addDialog(MRef<SipDialog*> d);
+		MRef<SipDialog*> getDialog(std::string callId);
 		bool removeDialog(std::string callId);
 
 		virtual std::string getMemObjectType() const {return "SipLayerDialog";}

Modified: trunk/libmsip/include/libmsip/SipLayerTransaction.h
===================================================================
--- trunk/libmsip/include/libmsip/SipLayerTransaction.h	2007-05-08 13:27:54 UTC (rev 3269)
+++ trunk/libmsip/include/libmsip/SipLayerTransaction.h	2007-05-08 17:40:00 UTC (rev 3270)
@@ -31,7 +31,7 @@
 #include<list>
 #include<libmutil/Mutex.h>
 #include<libmutil/MemObject.h>
-#include<libmutil/minilist.h>
+#include<map>
 
 class SipCommandDispatcher;
 class SipTransaction;
@@ -46,11 +46,10 @@
 
 		void doHandleAck(bool b);
 		
-		void removeTransaction(MRef<SipTransaction*> t);
-		MRef<SipTransaction*> findTransaction(std::string branch);
+		void removeTransaction(std::string branch);
 
-		void removeTerminatedTransactions();
-		
+		MRef<SipTransaction*> getTransaction(std::string branch);
+
 		std::list<MRef<SipTransaction*> > getTransactions();
 		
 		std::list<MRef<SipTransaction*> > getTransactionsWithCallId(std::string callid);
@@ -66,7 +65,7 @@
 		
 		bool handleAck;
 		
-		minilist<MRef<SipTransaction*> > transactions;
+		std::map<std::string, MRef<SipTransaction*> > transactions;
 
 		MRef<SipCommandDispatcher*> dispatcher;
 		MRef<SipLayerTransport*> transportLayer;

Modified: trunk/libmsip/source/SipCommandDispatcher.cxx
===================================================================
--- trunk/libmsip/source/SipCommandDispatcher.cxx	2007-05-08 13:27:54 UTC (rev 3269)
+++ trunk/libmsip/source/SipCommandDispatcher.cxx	2007-05-08 17:40:00 UTC (rev 3270)
@@ -295,27 +295,18 @@
 		}
 
 		if (c.getCommandString().getOp()==SipCommandString::transaction_terminated){
-			transactionLayer->removeTerminatedTransactions();
-
-			// All transactions will be tried every time a transaction terminates
-			// This can be improved, but is perfectly ok for an
-			// UA. An application with a large number of
-			// dialogs might want to optimize.
-			list<MRef<SipDialog*> > dlgs = getDialogs();
-			list<MRef<SipDialog*> >::iterator i;
-			for ( i=dlgs.begin(); i!=dlgs.end(); i++){
-
-				string n = (*i)->getCurrentStateName();
-				//If the dialog does not use the state
-				//machine functionality the state name will
-				//be an empty string
-				if ( n =="termwait" || n =="") {
-					(*i)->signalIfNoTransactions();
-				}
+			string tid = c.getCommandString().getDestinationId();
+			MRef<SipTransaction *> t = transactionLayer->getTransaction(tid);
+			string cid = t->getCallId();
+			t=NULL;
+			transactionLayer->removeTransaction(tid);
+			MRef<SipDialog*> d = dialogLayer->getDialog(cid);
+			//It is ok to not find a dialog (transaction
+			//without dialog).
+			if (d){
+				d->signalIfNoTransactions();
 			}
-
 			return true;
-
 		}else if (c.getCommandString().getOp()==SipCommandString::call_terminated){
 			return dialogLayer->removeDialog(c.getDestinationId());
 		}else if ( 	c.getCommandString().getOp() == SipCommandString::sip_stack_shutdown ||

Modified: trunk/libmsip/source/SipLayerDialog.cxx
===================================================================
--- trunk/libmsip/source/SipLayerDialog.cxx	2007-05-08 13:27:54 UTC (rev 3269)
+++ trunk/libmsip/source/SipLayerDialog.cxx	2007-05-08 17:40:00 UTC (rev 3270)
@@ -50,8 +50,10 @@
 	list<MRef<SipDialog*> > l;
 	std::map<std::string, MRef<SipDialog*> >::iterator i;
 	dialogListLock.lock();
-	for (i=dialogs.begin(); i!=dialogs.end(); i++)
+	for (i=dialogs.begin(); i!=dialogs.end(); i++){
 		l.push_back( (*i).second );
+		massert( (*i).second );
+	}
 	dialogListLock.unlock();
 	return l;
 }
@@ -72,12 +74,26 @@
 }
 
 void SipLayerDialog::addDialog(MRef<SipDialog*> d){
+	massert(d);
 	massert(d->dialogState.callId!="");
 	dialogListLock.lock();
 	dialogs[d->dialogState.callId] = d;
 	dialogListLock.unlock();
 }
 
+/**
+ *
+ * @return If the dialog was not found, then a null reference is returned.
+ *
+ */
+MRef<SipDialog*> SipLayerDialog::getDialog(string cid){
+	MRef<SipDialog*> ret;
+	map<string, MRef<SipDialog*> >::iterator i = dialogs.find(cid);
+	if (i!=dialogs.end())
+		ret = (*i).second;	
+	return ret;
+}
+
 void SipLayerDialog::setDefaultDialogCommandHandler(MRef<SipDefaultHandler*> cb){
 	defaultHandler=cb;
 }
@@ -99,7 +115,10 @@
 		MRef<SipDialog *> dialog;
 		if (cid.size()>0){
 			dialogListLock.lock();
-			dialog = dialogs[cid];
+			map<string, MRef<SipDialog*> >::iterator d = dialogs.find(cid);
+			if (d != dialogs.end()){
+				dialog = (*d).second;
+			}
 			dialogListLock.unlock();
 			if ( dialog && dialog->handleCommand(c) )
 				return true;

Modified: trunk/libmsip/source/SipLayerTransaction.cxx
===================================================================
--- trunk/libmsip/source/SipLayerTransaction.cxx	2007-05-08 13:27:54 UTC (rev 3269)
+++ trunk/libmsip/source/SipLayerTransaction.cxx	2007-05-08 17:40:00 UTC (rev 3270)
@@ -46,10 +46,9 @@
 }
 
 SipLayerTransaction::~SipLayerTransaction(){
-	MRef<SipTransaction*> trans;
-	for (int i=0; i<transactions.size(); i++){
-		transactions[i]->freeStateMachine();
-	}
+	map<string, MRef<SipTransaction*> >::iterator i;
+	for (i=transactions.begin(); i!=transactions.end(); i++)
+		(*i).second->freeStateMachine();
 }
 
 bool SipLayerTransaction::defaultCommandHandler(const SipSMCommand &cmd){
@@ -83,56 +82,39 @@
 		cerr <<"ERROR: TransactionLayer::defaultCommandHandler: Could not handle: "<<cmd<<endl;
 		return false;
 	}
-
-
 }
 
 void SipLayerTransaction::doHandleAck(bool b){
 	handleAck=b;
 }
 
-MRef<SipTransaction*> SipLayerTransaction::findTransaction(std::string branch){
-	for (int i=0; i<transactions.size();i++)
-		if (transactions[i]->getBranch()==branch)
-			return transactions[i];
-	mdbg << "Warning: SipLayerTransaction::findTransaction: could not find transaction "<< branch<<endl;
-	MRef<SipTransaction*> null;
-	return null;
+MRef<SipTransaction*> SipLayerTransaction::getTransaction(std::string branch){
+	map<string, MRef<SipTransaction*> >::iterator i = transactions.find(branch);
+	if (i==transactions.end()){
+		MRef<SipTransaction*> null;
+		return null;
+	}else{
+		return (*i).second;
+	}
 }
 
 void SipLayerTransaction::addTransaction(MRef<SipTransaction*> t){
-	//cerr << "EE: SipLayerTransaction::addTransaction: new transaction with branch id "<< t->getBranch()<<" added"<<endl;
-	transactions.push_front(t);
+	massert(t->getBranch().size()>0);
+	transactions[t->getBranch()]=t;
 }
 
-void SipLayerTransaction::removeTransaction(MRef<SipTransaction*> t){
-
-	for (int i=0; i< transactions.size(); i++){
-		if (transactions[i]==t){
-			transactions.remove(i);
-			return;
-		}
-	}
-	mdbg << "WARNING: BUG? Cound not remove transaction from SipLayerTransaction!!!!!"<< end;
+void SipLayerTransaction::removeTransaction(string branch){
+	transactions[branch]->freeStateMachine();
+	int n = transactions.erase(branch);
+	massert(n==1);
 }
 
-void SipLayerTransaction::removeTerminatedTransactions(){
-	MRef<SipTransaction*> trans;
-	for (int i=0; i<transactions.size(); i++){
-		if (transactions[i]->getCurrentStateName()=="terminated"){
-			trans = transactions[i];
-			transactions.remove(i);
-			i--;
-			trans->freeStateMachine(); //let's break the cyclic references ...
-		}
-	}
-}
-
 list<MRef<SipTransaction*> > SipLayerTransaction::getTransactions(){
 	list<MRef<SipTransaction*> > ret;
-	for (int i=0; i< transactions.size(); i++)
-		ret.push_back(transactions[i]);
-
+	map<string, MRef<SipTransaction*> >::iterator i;
+	for (i=transactions.begin(); i!=transactions.end(); i++){
+		ret.push_back((*i).second);
+	}
 	return ret;
 }
 
@@ -141,10 +123,10 @@
 
 list<MRef<SipTransaction*> > SipLayerTransaction::getTransactionsWithCallId(string callid){
 	list<MRef<SipTransaction*> > ret;
-	for (int i=0; i< transactions.size(); i++){
-		if (transactions[i]->getCallId()==callid){
-			ret.push_back(transactions[i]);
-		}
+	map<string, MRef<SipTransaction*> >::iterator i;
+	for (i=transactions.begin(); i!=transactions.end(); i++){
+		ret.push_back( (*i).second );
+	
 	}
 	return ret;
 }
@@ -174,13 +156,14 @@
 	}
 
 //	cerr << "SipLayerTransaction: trying "<<transactions.size()<<" transactions"<<endl;
-	for (int i=0; i< transactions.size(); i++){
-		if ( (!hasBranch || transactions[i]->getBranch()== branch || seqMethod=="ACK") &&
-				(!hasSeqMethod || transactions[i]->getCSeqMethod()==seqMethod || 
-				 (seqMethod == "ACK" && transactions[i]->getCSeqMethod() == "INVITE")) ){
+	map<string, MRef<SipTransaction*> >::iterator i;
+	for (i=transactions.begin(); i!=transactions.end(); i++){
+		if ( (!hasBranch || (*i).second->getBranch()== branch || seqMethod=="ACK") &&
+				(!hasSeqMethod || (*i).second->getCSeqMethod()==seqMethod || 
+				 (seqMethod == "ACK" && (*i).second->getCSeqMethod() == "INVITE")) ){
 
 //			cerr << "SipLayerTransaction: trying message with branch <"<<branch<<"> with transaction with branch <"<<transactions[i]->getBranch()<<">"<<endl;
-			bool ret = transactions[i]->handleCommand(c);
+			bool ret = (*i).second->handleCommand(c);
 //			cerr << "SipLayerTransaction: transaction returned "<<ret<<endl;
 #ifdef DEBUG_OUTPUT
 			if (!ret && hasBranch){

Modified: trunk/libmsip/source/SipLayerTransport.cxx
===================================================================
--- trunk/libmsip/source/SipLayerTransport.cxx	2007-05-08 13:27:54 UTC (rev 3269)
+++ trunk/libmsip/source/SipLayerTransport.cxx	2007-05-08 17:40:00 UTC (rev 3270)
@@ -33,7 +33,6 @@
 
 #ifdef WIN32
 #include<winsock2.h>
-//#include<io.h>
 #endif
 
 #include<libmsip/SipResponse.h>
@@ -53,7 +52,6 @@
 #include<libmutil/mtime.h>
 #include<libmutil/dbg.h>
 #include<libmutil/stringutils.h>
-//#include<libmsip/SipDialogContainer.h>
 #include<libmsip/SipCommandString.h>
 #include<libmsip/SipCommandDispatcher.h>
 #include<libmsip/SipHeaderFrom.h>
@@ -943,7 +941,7 @@
 		mdbg << "Transport error in SipLayerTransport: " << message << end;
 		cerr << "SipLayerTransport: sendMessage: exception thrown! " << message << endl;
 #endif
-		CommandString transportError( callId, 
+		CommandString transportError( pack->getDestinationBranch(), 
 					      SipCommandString::transport_error,
 					      "SipLayerTransport: "+message );
 		SipSMCommand transportErrorCommand(

Modified: trunk/libmsip/source/SipStackInternal.cxx
===================================================================
--- trunk/libmsip/source/SipStackInternal.cxx	2007-05-08 13:27:54 UTC (rev 3269)
+++ trunk/libmsip/source/SipStackInternal.cxx	2007-05-08 17:40:00 UTC (rev 3270)
@@ -369,6 +369,11 @@
 			ret+=getTransactionDebugString(*ti,torequests,indent+1);
 		}
 	}
+
+	// If the following assertion fails it is likely to be because a 
+	// timer was not cancelled correctly in a transaction.
+	// (a timer exists for a transaction or dialog that is no longer
+	// used by the stack)
 	massert(torequests.size()==0);
 	return ret;
 }

Modified: trunk/libmsip/source/transactions/SipTransaction.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransaction.cxx	2007-05-08 13:27:54 UTC (rev 3269)
+++ trunk/libmsip/source/transactions/SipTransaction.cxx	2007-05-08 17:40:00 UTC (rev 3270)
@@ -132,7 +132,7 @@
 {
 		//Notify the TU that the transaction is terminated
 		SipSMCommand cmdterminated(
-			CommandString( callId, SipCommandString::transaction_terminated),
+			CommandString( getBranch(), SipCommandString::transaction_terminated),
 			SipSMCommand::transaction_layer,
 			SipSMCommand::transaction_layer);
 		

Modified: trunk/libmsip/source/transactions/SipTransactionInviteClient.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionInviteClient.cxx	2007-05-08 13:27:54 UTC (rev 3269)
+++ trunk/libmsip/source/transactions/SipTransactionInviteClient.cxx	2007-05-08 17:40:00 UTC (rev 3270)
@@ -243,7 +243,7 @@
 		dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE );
 
 		SipSMCommand cmdterminated(
-				CommandString( callId, SipCommandString::transaction_terminated),
+				CommandString( getBranch(), SipCommandString::transaction_terminated),
 				SipSMCommand::transaction_layer,
 				SipSMCommand::dispatcher);
 		dispatcher->enqueueCommand( cmdterminated, HIGH_PRIO_QUEUE );
@@ -281,7 +281,7 @@
 		//dialog->dialogState.updateState( (MRef<SipResponse*>((SipResponse *)*command.getCommandPacket()) ) );
 		
 		SipSMCommand cmdterminated(
-			CommandString( callId, SipCommandString::transaction_terminated),
+			CommandString( getBranch(), SipCommandString::transaction_terminated),
 			SipSMCommand::transaction_layer,
 			SipSMCommand::dispatcher);
 		dispatcher->enqueueCommand( cmdterminated, HIGH_PRIO_QUEUE );
@@ -343,7 +343,7 @@
 		//dialog->dialogState.updateState( (MRef<SipResponse*>((SipResponse *)*command.getCommandPacket()) ) );
 		
 		SipSMCommand cmdterminated(
-			CommandString( callId, SipCommandString::transaction_terminated),
+			CommandString( getBranch(), SipCommandString::transaction_terminated),
 			SipSMCommand::transaction_layer,
 			SipSMCommand::dispatcher);
 		dispatcher->enqueueCommand( cmdterminated, HIGH_PRIO_QUEUE );
@@ -417,7 +417,7 @@
 		dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE );
 
 		SipSMCommand cmdterminated(
-				CommandString( callId, SipCommandString::transaction_terminated),
+				CommandString( getBranch(), SipCommandString::transaction_terminated),
 				SipSMCommand::transaction_layer,
 				SipSMCommand::dispatcher);
 		dispatcher->enqueueCommand( cmdterminated, HIGH_PRIO_QUEUE );
@@ -435,7 +435,7 @@
 				SipSMCommand::transaction_layer,
 				SipSMCommand::transaction_layer)){
 	    SipSMCommand cmd(
-		    CommandString( callId, SipCommandString::transaction_terminated),
+		    CommandString( getBranch(), SipCommandString::transaction_terminated),
 		    SipSMCommand::transaction_layer,
 		    SipSMCommand::dispatcher);
 		dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE );

Modified: trunk/libmsip/source/transactions/SipTransactionInviteServer.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionInviteServer.cxx	2007-05-08 13:27:54 UTC (rev 3269)
+++ trunk/libmsip/source/transactions/SipTransactionInviteServer.cxx	2007-05-08 17:40:00 UTC (rev 3270)
@@ -254,7 +254,7 @@
 		dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE );
 
 		SipSMCommand cmdterminated(
-				CommandString( callId, SipCommandString::transaction_terminated),
+				CommandString( getBranch(), SipCommandString::transaction_terminated),
 				SipSMCommand::transaction_layer,
 				SipSMCommand::dispatcher);
 		dispatcher->enqueueCommand( cmdterminated, HIGH_PRIO_QUEUE );
@@ -283,7 +283,7 @@
 		send(command.getCommandPacket(), false);
 
 		SipSMCommand cmd(
-				CommandString( callId, SipCommandString::transaction_terminated),
+				CommandString( getBranch(), SipCommandString::transaction_terminated),
 				SipSMCommand::transaction_layer,
 				SipSMCommand::dispatcher);
 		dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE );
@@ -377,6 +377,7 @@
 	{
 
 		cancelTimeout("timerG");
+		cancelTimeout("timerH");
 
 		SipSMCommand cmd( CommandString(callId, SipCommandString::transport_error), 
 				SipSMCommand::transaction_layer, 
@@ -385,7 +386,7 @@
 		dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE );
 
 		SipSMCommand cmdterminated(
-				CommandString( callId, SipCommandString::transaction_terminated),
+				CommandString( getBranch(), SipCommandString::transaction_terminated),
 				SipSMCommand::transaction_layer,
 				SipSMCommand::dispatcher);
 		dispatcher->enqueueCommand( cmdterminated, HIGH_PRIO_QUEUE );
@@ -408,7 +409,7 @@
 				SipSMCommand::transaction_layer))
 	{
 		SipSMCommand cmd(
-				CommandString( callId, SipCommandString::transaction_terminated),
+				CommandString( getBranch(), SipCommandString::transaction_terminated),
 				SipSMCommand::transaction_layer,
 				SipSMCommand::dispatcher);
 		dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE );

Modified: trunk/libmsip/source/transactions/SipTransactionNonInviteClient.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionNonInviteClient.cxx	2007-05-08 13:27:54 UTC (rev 3269)
+++ trunk/libmsip/source/transactions/SipTransactionNonInviteClient.cxx	2007-05-08 17:40:00 UTC (rev 3270)
@@ -162,7 +162,7 @@
 		dispatcher->enqueueCommand(cmd, HIGH_PRIO_QUEUE);
 
 		SipSMCommand cmdterminated(
-			CommandString( callId, SipCommandString::transaction_terminated),
+			CommandString( getBranch(), SipCommandString::transaction_terminated),
 			SipSMCommand::transaction_layer,
 			SipSMCommand::dispatcher);
 		dispatcher->enqueueCommand( cmdterminated, HIGH_PRIO_QUEUE);
@@ -265,6 +265,9 @@
 				SipSMCommand::transaction_layer,
 				SipSMCommand::transaction_layer)){
 
+		cancelTimeout("timerE");
+		cancelTimeout("timerF");
+
 		SipSMCommand cmd(
 				CommandString(callId,SipCommandString::transport_error), 
 				SipSMCommand::transaction_layer, 
@@ -273,7 +276,7 @@
 		dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE );
 
 		SipSMCommand cmdterminated(
-				CommandString( callId, SipCommandString::transaction_terminated),
+				CommandString( getBranch(), SipCommandString::transaction_terminated),
 				SipSMCommand::transaction_layer,
 				SipSMCommand::dispatcher);
 		dispatcher->enqueueCommand( cmdterminated, HIGH_PRIO_QUEUE );
@@ -345,7 +348,7 @@
 				SipSMCommand::transaction_layer,
 				SipSMCommand::transaction_layer)){
 		SipSMCommand cmd(
-			CommandString( callId, SipCommandString::transaction_terminated),
+			CommandString( getBranch(), SipCommandString::transaction_terminated),
 			SipSMCommand::transaction_layer,
 			SipSMCommand::dispatcher);
 		dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE );

Modified: trunk/libmsip/source/transactions/SipTransactionNonInviteServer.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionNonInviteServer.cxx	2007-05-08 13:27:54 UTC (rev 3269)
+++ trunk/libmsip/source/transactions/SipTransactionNonInviteServer.cxx	2007-05-08 17:40:00 UTC (rev 3270)
@@ -188,6 +188,9 @@
 				SipCommandString::transport_error,
 				SipSMCommand::transport_layer,
 				SipSMCommand::transaction_layer)){
+
+		
+
 		//inform TU
 		SipSMCommand cmd(
 				CommandString(callId,SipCommandString::transport_error), 
@@ -197,7 +200,7 @@
 		dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE );
 		
 		SipSMCommand cmdterminated(
-			CommandString( callId, SipCommandString::transaction_terminated),
+			CommandString( getBranch(), SipCommandString::transaction_terminated),
 			SipSMCommand::transaction_layer,
 			SipSMCommand::dispatcher);
 		dispatcher->enqueueCommand( cmdterminated, HIGH_PRIO_QUEUE);
@@ -238,6 +241,9 @@
 				SipCommandString::transport_error,
 				SipSMCommand::transport_layer,
 				SipSMCommand::transaction_layer)){
+
+		cancelTimeout("timerJ");
+
 		SipSMCommand cmd(
 				CommandString(callId,SipCommandString::transport_error), 
 				SipSMCommand::transaction_layer, 
@@ -246,7 +252,7 @@
 		dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE);
 		
 		SipSMCommand cmdterminated(
-			CommandString( callId, SipCommandString::transaction_terminated),
+			CommandString( getBranch(), SipCommandString::transaction_terminated),
 			SipSMCommand::transaction_layer,
 			SipSMCommand::dispatcher);
 		dispatcher->enqueueCommand( cmdterminated, HIGH_PRIO_QUEUE );
@@ -268,7 +274,7 @@
 				SipSMCommand::transaction_layer,
 				SipSMCommand::transaction_layer)){
 		SipSMCommand cmd(
-			CommandString( callId, SipCommandString::transaction_terminated),
+			CommandString( getBranch(), SipCommandString::transaction_terminated),
 			SipSMCommand::transaction_layer,
 			SipSMCommand::dispatcher);
 		dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE );



More information about the Minisip-devel mailing list