r2911 - in trunk: libminisip/source/sip libmsip/include/libmsip
libmsip/source libmsip/source/dialogs
erik at minisip.org
erik at minisip.org
Fri Nov 17 17:04:33 CET 2006
Author: erik
Date: 2006-11-17 17:04:33 +0100 (Fri, 17 Nov 2006)
New Revision: 2911
Modified:
trunk/libminisip/source/sip/SipDialogConfVoip.cxx
trunk/libminisip/source/sip/SipDialogPresenceClient.cxx
trunk/libminisip/source/sip/SipDialogPresenceServer.cxx
trunk/libminisip/source/sip/SipDialogVoip.cxx
trunk/libminisip/source/sip/SipDialogVoipClient.cxx
trunk/libmsip/include/libmsip/SipDialog.h
trunk/libmsip/source/SipLayerDialog.cxx
trunk/libmsip/source/dialogs/SipDialog.cxx
trunk/libmsip/source/dialogs/SipDialogRegister.cxx
Log:
libmsip improvement:
When creating a SipDialog you can use the StateMachine functionality.
The "termwait" state name that is a special state where you
(application layer) are done, but you wait for transactions to complete.
You are then told when there is no more transactions (SipDialog will
send a "no_transactions"). You are then expected to tell the SIP
stack that you are ready to be removed from the stack by sending
"call_terminated" to the dispatcher. Bug: If you don't use the state
machine, the SipDialog class will not send a "no_transactions" message
to your dialog, and you can not tell the stack to remove the dialog
from the stack.
This way you can create dialogs that are not state machines.
You set the "isTerminated" flag when you are done, and send a
"call_terminated" command to the dispatcher.
-> Added a "isTerminated" attribute to the dialogState class. The
SipDialog class will not only check for "termwait" state, but also
this flag. This enables you to get a notification when all transactions
within the dialog has completed.
-> Set isTerminated flag in dialogs that does not want to be in
the stack any longer.
Modified: trunk/libminisip/source/sip/SipDialogConfVoip.cxx
===================================================================
--- trunk/libminisip/source/sip/SipDialogConfVoip.cxx 2006-11-17 15:10:36 UTC (rev 2910)
+++ trunk/libminisip/source/sip/SipDialogConfVoip.cxx 2006-11-17 16:04:33 UTC (rev 2911)
@@ -689,6 +689,7 @@
SipSMCommand::dialog_layer,
SipSMCommand::dialog_layer) ){
lastInvite=NULL;
+ dialogState.isTerminated=true;
SipSMCommand cmd(
CommandString( dialogState.callId, SipCommandString::call_terminated),
SipSMCommand::dialog_layer,
Modified: trunk/libminisip/source/sip/SipDialogPresenceClient.cxx
===================================================================
--- trunk/libminisip/source/sip/SipDialogPresenceClient.cxx 2006-11-17 15:10:36 UTC (rev 2910)
+++ trunk/libminisip/source/sip/SipDialogPresenceClient.cxx 2006-11-17 16:04:33 UTC (rev 2911)
@@ -207,6 +207,9 @@
SipCommandString::no_transactions,
SipSMCommand::dialog_layer,
SipSMCommand::dialog_layer) ){
+
+ dialogState.isTerminated=true;
+
SipSMCommand cmd( CommandString( dialogState.callId, SipCommandString::call_terminated),
SipSMCommand::dialog_layer,
SipSMCommand::dispatcher);
Modified: trunk/libminisip/source/sip/SipDialogPresenceServer.cxx
===================================================================
--- trunk/libminisip/source/sip/SipDialogPresenceServer.cxx 2006-11-17 15:10:36 UTC (rev 2910)
+++ trunk/libminisip/source/sip/SipDialogPresenceServer.cxx 2006-11-17 16:04:33 UTC (rev 2911)
@@ -157,6 +157,8 @@
SipCommandString::no_transactions,
SipSMCommand::dialog_layer,
SipSMCommand::dialog_layer) ){
+
+ dialogState.isTerminated=true;
SipSMCommand cmd( CommandString( dialogState.callId, SipCommandString::call_terminated), //FIXME: callId is ""
SipSMCommand::dialog_layer,
Modified: trunk/libminisip/source/sip/SipDialogVoip.cxx
===================================================================
--- trunk/libminisip/source/sip/SipDialogVoip.cxx 2006-11-17 15:10:36 UTC (rev 2910)
+++ trunk/libminisip/source/sip/SipDialogVoip.cxx 2006-11-17 16:04:33 UTC (rev 2911)
@@ -126,7 +126,7 @@
a1002 gui(cterm)+---------------+ a1305 gui(call_terminated)
v |
a1102 | no_transactions
- V a1304
+ V a1101
+---------------+
| |
| terminated |
@@ -239,6 +239,9 @@
dispatcher->enqueueCommand( cmd, HIGH_PRIO_QUEUE);
*/
+
+ dialogState.isTerminated=true;
+
/* Tell the GUI */
CommandString cmdstr( dialogState.callId, SipCommandString::call_terminated);
sipStack->getCallback()->handleCommand("gui", cmdstr );
@@ -261,6 +264,7 @@
SipSMCommand::dialog_layer) ){
lastInvite=NULL;
+ dialogState.isTerminated=true;
SipSMCommand cmd(
CommandString( dialogState.callId,
SipCommandString::call_terminated),
Modified: trunk/libminisip/source/sip/SipDialogVoipClient.cxx
===================================================================
--- trunk/libminisip/source/sip/SipDialogVoipClient.cxx 2006-11-17 15:10:36 UTC (rev 2910)
+++ trunk/libminisip/source/sip/SipDialogVoipClient.cxx 2006-11-17 16:04:33 UTC (rev 2911)
@@ -293,6 +293,9 @@
{
if (transitionMatchSipResponse("INVITE", command, SipSMCommand::transaction_layer, SipSMCommand::dialog_layer, "3**\n4**\n5**\n6**")){
+
+ dialogState.isTerminated=true;
+
MRef<LogEntry *> rejectedLog( new LogEntryCallRejected() );
rejectedLog->start = time( NULL );
rejectedLog->peerSipUri = dialogState.remoteTag;
Modified: trunk/libmsip/include/libmsip/SipDialog.h
===================================================================
--- trunk/libmsip/include/libmsip/SipDialog.h 2006-11-17 15:10:36 UTC (rev 2910)
+++ trunk/libmsip/include/libmsip/SipDialog.h 2006-11-17 16:04:33 UTC (rev 2911)
@@ -105,6 +105,7 @@
bool isEarly;
bool isEstablished;
+ bool isTerminated;
std::list<MRef<SipAuthenticationDigest*> > auths;
};
Modified: trunk/libmsip/source/SipLayerDialog.cxx
===================================================================
--- trunk/libmsip/source/SipLayerDialog.cxx 2006-11-17 15:10:36 UTC (rev 2910)
+++ trunk/libmsip/source/SipLayerDialog.cxx 2006-11-17 16:04:33 UTC (rev 2911)
@@ -51,7 +51,7 @@
void SipLayerDialog::removeTerminatedDialogs(){
for (int i=0; i< dialogs.size(); i++){
- if (dialogs[i]->getCurrentStateName()=="terminated"){
+ if ( dialogs[i]->dialogState.isTerminated || dialogs[i]->getCurrentStateName()=="terminated"){
MRef<SipDialog *> dlg = dialogs[i];
dialogs.remove(i);
//merr << "CESC: SipMsgDispatcher::hdleCmd : breaking the dialog vicious circle" << endl;
Modified: trunk/libmsip/source/dialogs/SipDialog.cxx
===================================================================
--- trunk/libmsip/source/dialogs/SipDialog.cxx 2006-11-17 15:10:36 UTC (rev 2910)
+++ trunk/libmsip/source/dialogs/SipDialog.cxx 2006-11-17 16:04:33 UTC (rev 2911)
@@ -72,6 +72,7 @@
dialogState.isEarly=false; //same as for "secure"?! -EE
dialogState.isEstablished = false;
+ dialogState.isTerminated = false;
dialogState.rseqNo = (uint32_t)-1;
}
@@ -95,7 +96,8 @@
void SipDialog::signalIfNoTransactions(){
- if (getCurrentStateName()=="termwait"){
+ //State name is used only by dialogs that are StateMachines.
+ if (dialogState.isTerminated || getCurrentStateName()=="termwait"){
list<MRef<SipTransaction*> > t = getTransactions();
@@ -508,6 +510,8 @@
+ "; remoteUri=" + dialogState.remoteUri
+ "; remoteTarget=" + dialogState.remoteTarget
+ string("; isEarly=") + string(dialogState.isEarly?"true":"false")
+ + string("; isEstablished=") + string(dialogState.isEstablished?"true":"false")
+ + string("; isTerminated=") + string(dialogState.isTerminated?"true":"false")
+ "\n";
ret+= " route_set: ";
Modified: trunk/libmsip/source/dialogs/SipDialogRegister.cxx
===================================================================
--- trunk/libmsip/source/dialogs/SipDialogRegister.cxx 2006-11-17 15:10:36 UTC (rev 2910)
+++ trunk/libmsip/source/dialogs/SipDialogRegister.cxx 2006-11-17 16:04:33 UTC (rev 2911)
@@ -476,6 +476,7 @@
SipSMCommand::dialog_layer,
SipSMCommand::dialog_layer)){
+ dialogState.isTerminated=true;
CommandString cmdstr ( dialogState.callId,
SipCommandString::call_terminated);
cmdstr["identityId"] = getDialogConfig()->sipIdentity->getId();
More information about the Minisip-devel
mailing list