Incoming message from SIPInterface.
| 732 | |
| 733 | // Incoming message from SIPInterface. |
| 734 | void SipMOInviteClientTransactionLayer::MOWriteHighSide(SipMessage *sipmsg) |
| 735 | { |
| 736 | int code = sipmsg->smGetCode(); |
| 737 | LOG(DEBUG) <<LOGVAR(code) <<LOGVAR(dgIsInvite()); |
| 738 | if (code == 0) { // It is a SIP Request. Switch based on the method. |
| 739 | if (sipmsg->isCANCEL()) { |
| 740 | mTimerBF.stop(); |
| 741 | // I dont think the peer is supposed to do this, but lets cancel it: |
| 742 | SipMTCancel(sipmsg); |
| 743 | } else if (sipmsg->isBYE()) { |
| 744 | // A BYE should not be sent by the peer until dialog established, and we are supposed to send 405 error. |
| 745 | // but instead we are going to quietly terminate the dialog anyway. |
| 746 | SipMTBye(sipmsg); |
| 747 | } else { |
| 748 | // Not expecting any others. |
| 749 | // Must send 405 error. |
| 750 | LOG(WARNING)<<"SIP Message ignored:"<<sipmsg; |
| 751 | SipMessageReply oops(sipmsg,405,string("Method Not Allowed"),this); |
| 752 | sipWrite(&oops); |
| 753 | } |
| 754 | } else { // It is a SIP reply. |
| 755 | saveMOResponse(sipmsg); LOG(DEBUG)<<"saveResponse"<<sipmsg; |
| 756 | if (dgIsInvite()) { // It is INVITE |
| 757 | stopTimers(); // Yes we stop the timers for every possible case. TimerBF will be restarted when handleInviteResponse sends the reply. |
| 758 | handleInviteResponse(code,true); |
| 759 | } else { // It is a MESSAGE |
| 760 | handleSMSResponse(sipmsg); |
| 761 | } |
| 762 | } |
| 763 | } |
| 764 | |
| 765 | // Outgoing message. |
| 766 | void SipMOInviteClientTransactionLayer::moWriteLowSide(SipMessage *sipmsg) |