r3271 - in trunk/libmsip: include/libmsip source source/transactions
svn at minisip.org
svn at minisip.org
Wed May 9 13:59:22 CEST 2007
Author: erik
Date: 2007-05-08 21:27:58 +0200 (Tue, 08 May 2007)
New Revision: 3271
Modified:
trunk/libmsip/include/libmsip/SipLayerTransaction.h
trunk/libmsip/include/libmsip/SipTransaction.h
trunk/libmsip/source/SipLayerTransaction.cxx
trunk/libmsip/source/SipLayerTransport.cxx
trunk/libmsip/source/transactions/SipTransaction.cxx
trunk/libmsip/source/transactions/SipTransactionInviteClient.cxx
trunk/libmsip/source/transactions/SipTransactionInviteServer.cxx
trunk/libmsip/source/transactions/SipTransactionInviteServerUA.cxx
trunk/libmsip/source/transactions/SipTransactionNonInviteClient.cxx
trunk/libmsip/source/transactions/SipTransactionNonInviteServer.cxx
Log:
* Implement RFC3261 handling of cancelling INVITE transactions
when acting as a client.
-> Index transactions by branch+CSeq method instead of only
by branch. The CANCEL server transaction has the same branch
as the INVITE client transaction. This means that we will
process both the CANCEL transaction and the INVITE one
independently as described in RFC3261. (before we were more
like RFC2543).
We're still not RFC3261 when we receive a CANCEL.
Modified: trunk/libmsip/include/libmsip/SipLayerTransaction.h
===================================================================
--- trunk/libmsip/include/libmsip/SipLayerTransaction.h 2007-05-08 17:40:00 UTC (rev 3270)
+++ trunk/libmsip/include/libmsip/SipLayerTransaction.h 2007-05-08 19:27:58 UTC (rev 3271)
@@ -46,9 +46,17 @@
void doHandleAck(bool b);
- void removeTransaction(std::string branch);
+ /**
+ * @param A transaction ID is composed of the branch
+ * parameter AND the CSeq method part concatenated
+ */
+ void removeTransaction(std::string transactionId);
- MRef<SipTransaction*> getTransaction(std::string branch);
+ /**
+ * @param A transaction ID is composed of the branch
+ * parameter AND the CSeq method part concatenated
+ */
+ MRef<SipTransaction*> getTransaction(std::string transactionId);
std::list<MRef<SipTransaction*> > getTransactions();
Modified: trunk/libmsip/include/libmsip/SipTransaction.h
===================================================================
--- trunk/libmsip/include/libmsip/SipTransaction.h 2007-05-08 17:40:00 UTC (rev 3270)
+++ trunk/libmsip/include/libmsip/SipTransaction.h 2007-05-08 19:27:58 UTC (rev 3271)
@@ -56,7 +56,6 @@
public:
SipTransaction(MRef<SipStackInternal*> stackInternal,
- //MRef<SipDialog*> d,
int cseq,
const std::string &cseqMethod,
const std::string &branch,
Modified: trunk/libmsip/source/SipLayerTransaction.cxx
===================================================================
--- trunk/libmsip/source/SipLayerTransaction.cxx 2007-05-08 17:40:00 UTC (rev 3270)
+++ trunk/libmsip/source/SipLayerTransaction.cxx 2007-05-08 19:27:58 UTC (rev 3271)
@@ -88,8 +88,8 @@
handleAck=b;
}
-MRef<SipTransaction*> SipLayerTransaction::getTransaction(std::string branch){
- map<string, MRef<SipTransaction*> >::iterator i = transactions.find(branch);
+MRef<SipTransaction*> SipLayerTransaction::getTransaction(string tid){
+ map<string, MRef<SipTransaction*> >::iterator i = transactions.find(tid);
if (i==transactions.end()){
MRef<SipTransaction*> null;
return null;
@@ -100,12 +100,12 @@
void SipLayerTransaction::addTransaction(MRef<SipTransaction*> t){
massert(t->getBranch().size()>0);
- transactions[t->getBranch()]=t;
+ transactions[t->getBranch()+t->getCSeqMethod()]=t;
}
-void SipLayerTransaction::removeTransaction(string branch){
- transactions[branch]->freeStateMachine();
- int n = transactions.erase(branch);
+void SipLayerTransaction::removeTransaction(string tid){
+ transactions[tid]->freeStateMachine();
+ int n = transactions.erase(tid);
massert(n==1);
}
Modified: trunk/libmsip/source/SipLayerTransport.cxx
===================================================================
--- trunk/libmsip/source/SipLayerTransport.cxx 2007-05-08 17:40:00 UTC (rev 3270)
+++ trunk/libmsip/source/SipLayerTransport.cxx 2007-05-08 19:27:58 UTC (rev 3271)
@@ -941,7 +941,7 @@
mdbg << "Transport error in SipLayerTransport: " << message << end;
cerr << "SipLayerTransport: sendMessage: exception thrown! " << message << endl;
#endif
- CommandString transportError( pack->getDestinationBranch(),
+ CommandString transportError( pack->getDestinationBranch()+pack->getCSeqMethod(),
SipCommandString::transport_error,
"SipLayerTransport: "+message );
SipSMCommand transportErrorCommand(
Modified: trunk/libmsip/source/transactions/SipTransaction.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransaction.cxx 2007-05-08 17:40:00 UTC (rev 3270)
+++ trunk/libmsip/source/transactions/SipTransaction.cxx 2007-05-08 19:27:58 UTC (rev 3271)
@@ -132,7 +132,7 @@
{
//Notify the TU that the transaction is terminated
SipSMCommand cmdterminated(
- CommandString( getBranch(), SipCommandString::transaction_terminated),
+ CommandString( getBranch()+getCSeqMethod(), SipCommandString::transaction_terminated),
SipSMCommand::transaction_layer,
SipSMCommand::transaction_layer);
@@ -153,7 +153,10 @@
}
void SipTransaction::handleTimeout(const string &c){
- SipSMCommand cmd(CommandString(callId,c),SipSMCommand::transaction_layer,SipSMCommand::transaction_layer); //Is the second parameter ignored? --EE
+ SipSMCommand cmd(
+ CommandString(getBranch()+getCSeqMethod(),c),
+ SipSMCommand::transaction_layer,
+ SipSMCommand::transaction_layer);
dispatcher->enqueueTimeout( this, cmd);
}
Modified: trunk/libmsip/source/transactions/SipTransactionInviteClient.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionInviteClient.cxx 2007-05-08 17:40:00 UTC (rev 3270)
+++ trunk/libmsip/source/transactions/SipTransactionInviteClient.cxx 2007-05-08 19:27:58 UTC (rev 3271)
@@ -243,7 +243,7 @@
dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE );
SipSMCommand cmdterminated(
- CommandString( getBranch(), SipCommandString::transaction_terminated),
+ CommandString( getBranch()+getCSeqMethod(), 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( getBranch(), SipCommandString::transaction_terminated),
+ CommandString( getBranch()+getCSeqMethod(), 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( getBranch(), SipCommandString::transaction_terminated),
+ CommandString( getBranch()+getCSeqMethod(), 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( getBranch(), SipCommandString::transaction_terminated),
+ CommandString( getBranch()+getCSeqMethod(), 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( getBranch(), SipCommandString::transaction_terminated),
+ CommandString( getBranch()+getCSeqMethod(), 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 17:40:00 UTC (rev 3270)
+++ trunk/libmsip/source/transactions/SipTransactionInviteServer.cxx 2007-05-08 19:27:58 UTC (rev 3271)
@@ -254,7 +254,7 @@
dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE );
SipSMCommand cmdterminated(
- CommandString( getBranch(), SipCommandString::transaction_terminated),
+ CommandString( getBranch()+getCSeqMethod(), 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( getBranch(), SipCommandString::transaction_terminated),
+ CommandString( getBranch()+getCSeqMethod(), SipCommandString::transaction_terminated),
SipSMCommand::transaction_layer,
SipSMCommand::dispatcher);
dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE );
@@ -386,7 +386,7 @@
dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE );
SipSMCommand cmdterminated(
- CommandString( getBranch(), SipCommandString::transaction_terminated),
+ CommandString( getBranch()+getCSeqMethod(), SipCommandString::transaction_terminated),
SipSMCommand::transaction_layer,
SipSMCommand::dispatcher);
dispatcher->enqueueCommand( cmdterminated, HIGH_PRIO_QUEUE );
@@ -409,7 +409,7 @@
SipSMCommand::transaction_layer))
{
SipSMCommand cmd(
- CommandString( getBranch(), SipCommandString::transaction_terminated),
+ CommandString( getBranch()+getCSeqMethod(), SipCommandString::transaction_terminated),
SipSMCommand::transaction_layer,
SipSMCommand::dispatcher);
dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE );
Modified: trunk/libmsip/source/transactions/SipTransactionInviteServerUA.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionInviteServerUA.cxx 2007-05-08 17:40:00 UTC (rev 3270)
+++ trunk/libmsip/source/transactions/SipTransactionInviteServerUA.cxx 2007-05-08 19:27:58 UTC (rev 3271)
@@ -143,12 +143,11 @@
SipTransactionInviteServerUA::SipTransactionInviteServerUA(MRef<SipStackInternal*> stack,
- //MRef<SipDialog*> d,
int seq_no,
const string &cSeqMethod,
const string &branch,
const string &callid) :
- SipTransactionInviteServer(stack, /*d,*/ seq_no, cSeqMethod, branch, callid)
+ SipTransactionInviteServer(stack, seq_no, cSeqMethod, branch, callid)
{
changeStateMachine();
}
Modified: trunk/libmsip/source/transactions/SipTransactionNonInviteClient.cxx
===================================================================
--- trunk/libmsip/source/transactions/SipTransactionNonInviteClient.cxx 2007-05-08 17:40:00 UTC (rev 3270)
+++ trunk/libmsip/source/transactions/SipTransactionNonInviteClient.cxx 2007-05-08 19:27:58 UTC (rev 3271)
@@ -162,7 +162,7 @@
dispatcher->enqueueCommand(cmd, HIGH_PRIO_QUEUE);
SipSMCommand cmdterminated(
- CommandString( getBranch(), SipCommandString::transaction_terminated),
+ CommandString( getBranch()+getCSeqMethod(), SipCommandString::transaction_terminated),
SipSMCommand::transaction_layer,
SipSMCommand::dispatcher);
dispatcher->enqueueCommand( cmdterminated, HIGH_PRIO_QUEUE);
@@ -276,7 +276,7 @@
dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE );
SipSMCommand cmdterminated(
- CommandString( getBranch(), SipCommandString::transaction_terminated),
+ CommandString( getBranch()+getCSeqMethod(), SipCommandString::transaction_terminated),
SipSMCommand::transaction_layer,
SipSMCommand::dispatcher);
dispatcher->enqueueCommand( cmdterminated, HIGH_PRIO_QUEUE );
@@ -348,7 +348,7 @@
SipSMCommand::transaction_layer,
SipSMCommand::transaction_layer)){
SipSMCommand cmd(
- CommandString( getBranch(), SipCommandString::transaction_terminated),
+ CommandString( getBranch()+getCSeqMethod(), 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 17:40:00 UTC (rev 3270)
+++ trunk/libmsip/source/transactions/SipTransactionNonInviteServer.cxx 2007-05-08 19:27:58 UTC (rev 3271)
@@ -200,7 +200,7 @@
dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE );
SipSMCommand cmdterminated(
- CommandString( getBranch(), SipCommandString::transaction_terminated),
+ CommandString( getBranch()+getCSeqMethod(), SipCommandString::transaction_terminated),
SipSMCommand::transaction_layer,
SipSMCommand::dispatcher);
dispatcher->enqueueCommand( cmdterminated, HIGH_PRIO_QUEUE);
@@ -252,7 +252,7 @@
dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE);
SipSMCommand cmdterminated(
- CommandString( getBranch(), SipCommandString::transaction_terminated),
+ CommandString( getBranch()+getCSeqMethod(), SipCommandString::transaction_terminated),
SipSMCommand::transaction_layer,
SipSMCommand::dispatcher);
dispatcher->enqueueCommand( cmdterminated, HIGH_PRIO_QUEUE );
@@ -274,7 +274,7 @@
SipSMCommand::transaction_layer,
SipSMCommand::transaction_layer)){
SipSMCommand cmd(
- CommandString( getBranch(), SipCommandString::transaction_terminated),
+ CommandString( getBranch()+getCSeqMethod(), SipCommandString::transaction_terminated),
SipSMCommand::transaction_layer,
SipSMCommand::dispatcher);
dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE );
More information about the Minisip-devel
mailing list