Only a small subset of SIP states are passed to the L3 Control layer as dialog states.
| 526 | |
| 527 | // Only a small subset of SIP states are passed to the L3 Control layer as dialog states. |
| 528 | DialogState::msgState SipDialog::getDialogState() const |
| 529 | { |
| 530 | // Do not add a default case so that if someone adds a new SipState they will get a warning here. |
| 531 | // Therefore we define every state including the impossible ones. |
| 532 | switch (getSipState()) { |
| 533 | case SSNullState: |
| 534 | return DialogState::dialogUndefined; |
| 535 | case Starting: // (pat) MOC or MOSMS or inboundHandover sent INVITE; MTC not used. |
| 536 | return DialogState::dialogStarted; |
| 537 | case Proceeding: // (pat) MOC received Trying, Queued, BeingForwarded; MTC sent Trying |
| 538 | case Connecting: // (pat) MTC sent OK. |
| 539 | // TODO: Is this correct for MTC Connecting? |
| 540 | return DialogState::dialogProceeding; |
| 541 | case Ringing: // (pat) MOC received Ringing, notably not used for MTC sent Ringing, which is probably a bug of no import. |
| 542 | return DialogState::dialogRinging; |
| 543 | case Active: // (pat) MOC received OK; MTC sent ACK |
| 544 | return DialogState::dialogActive; |
| 545 | |
| 546 | case MODClearing: // (pat) MOD sent BYE |
| 547 | case MODCanceling: // (pat) MOD sent a cancel, see forceSIPClearing. |
| 548 | case MTDClearing: // (pat) MTD received BYE. |
| 549 | case MTDCanceling: // (pat) received CANCEL |
| 550 | case Canceled: // (pat) received OK to CANCEL. |
| 551 | case Cleared: // (pat) MTD sent OK to BYE, or MTD internal error loss of FIFO, or MOSMS received OK, or MTSMS sent OK. |
| 552 | return DialogState::dialogBye; |
| 553 | |
| 554 | case MOCBusy: // (pat) MOC received Busy; MTC not used. |
| 555 | case SSTimeout: |
| 556 | case MODError: // (pat) MOD sent a cancel, see forceSIPClearing. |
| 557 | case SSFail: |
| 558 | return DialogState::dialogFail; |
| 559 | |
| 560 | //case SipRegister: // (pat) This SIPEngine is being used for registration, none of the other stuff applies. |
| 561 | //case SipUnregister: // (pat) This SIPEngine is being used for registration, none of the other stuff applies. |
| 562 | case MOSMSSubmit: // (pat) SMS message submitted, "MESSAGE" method. Set but never used. |
| 563 | case HandoverInbound: |
| 564 | case HandoverOutbound: |
| 565 | return DialogState::dialogUndefined; |
| 566 | } |
| 567 | devassert(0); |
| 568 | return DialogState::dialogUndefined; |
| 569 | } |
| 570 | |
| 571 | |
| 572 | // Handle response to INVITE or MESSAGE. |