| 455 | } |
| 456 | |
| 457 | void SipDialog::dialogPushState( |
| 458 | SipState newSipState, // The new sip state. |
| 459 | int code, // The SIP message code that caused the state change, or 0 for ACK or total failures. |
| 460 | char timer) |
| 461 | { |
| 462 | SipState oldSipState = getSipState(); |
| 463 | DialogState::msgState oldDialogState = getDialogState(); |
| 464 | setSipState(newSipState); |
| 465 | |
| 466 | // If it is a new state, inform L3. |
| 467 | DialogState::msgState nextDialogState = getDialogState(); // based on the newSipState we just set. |
| 468 | LOG(DEBUG) <<LOGVAR(oldSipState)<<LOGVAR(newSipState)<<LOGVAR(getSipState())<<LOGVAR(mPrevDialogState)<<LOGVAR(oldDialogState)<<LOGVAR(nextDialogState)<<dialogText(); |
| 469 | if (nextDialogState == DialogState::dialogStarted) { |
| 470 | // This state is used for MO transactions just to indicate the dialog is active, |
| 471 | // but the MO state machine already knows that since it created the dialog, |
| 472 | // so we dont return this state as a notification. |
| 473 | return; |
| 474 | } |
| 475 | if (permittedTransition(mPrevDialogState,nextDialogState)) { |
| 476 | DialogMessage *dmsg = new DialogMessage(mTranId,nextDialogState,code); |
| 477 | dialogQueueMessage(dmsg); |
| 478 | } else { |
| 479 | LOG(DEBUG) << "no dialog state change"; |
| 480 | } |
| 481 | mPrevDialogState = nextDialogState; |
| 482 | |
| 483 | // A timer may be specified if the SIP state is one indicating failure. |
| 484 | // The timer letter corresponds to one of those specified in RFC3261, and specifies the dialog |
| 485 | // should not be destroyed until the timer expires. |
| 486 | switch (timer) { |
| 487 | case 0: |
| 488 | break; // default, no timer specified. |
| 489 | case 'D': |
| 490 | // RFC3261 17.1.1.2 says set Timer D to 32s instead of 64*T1. Whatever. |
| 491 | if (dsPeer()->ipIsReliableTransport()) { |
| 492 | mTimerD.setOnce(32000); |
| 493 | } |
| 494 | break; |
| 495 | case 'K': |
| 496 | mTimerK.setOnce(T4); |
| 497 | break; |
| 498 | default: assert(0); |
| 499 | } |
| 500 | } |
| 501 | |
| 502 | |
| 503 | void SipDialog::dialogChangeState( |
no test coverage detected