This is called for the second and subsequent received INVITEs as well as the ACK. We send the current response, whatever it is.
| 1439 | // This is called for the second and subsequent received INVITEs as well as the ACK. |
| 1440 | // We send the current response, whatever it is. |
| 1441 | void SipMTInviteServerTransactionLayer::MTWriteHighSide(SipMessage *sipmsg) { // Incoming message from SIPInterface. |
| 1442 | LOG(DEBUG); |
| 1443 | SipState state = getSipState(); |
| 1444 | if (sipmsg->smGetCode() == 0) { |
| 1445 | if (sipmsg->isINVITE()) { |
| 1446 | if (mtLastResponse.smIsEmpty()) { MTCSendTrying(); } |
| 1447 | else { sipWrite(&mtLastResponse); } |
| 1448 | } else if (sipmsg->isACK()) { |
| 1449 | if (state == SSNullState || state == Proceeding || state == Connecting) { |
| 1450 | dialogPushState(Active,0); |
| 1451 | gSipInterface.dmAddLocalTag(dgGetDialog()); |
| 1452 | } else { |
| 1453 | // We could be failed or canceled, so ignore the ACK. |
| 1454 | } |
| 1455 | stopTimers(); // happiness |
| 1456 | // The spec shows a short Timer I being started here, but all it does is specify a time |
| 1457 | // when the dialog will stop absorbing additional ACKS, thus suppressing error messages. |
| 1458 | // Well, how about if we just never throw an error for that? Done. |
| 1459 | } else if (sipmsg->isCANCEL()) { |
| 1460 | SipMTCancel(sipmsg); |
| 1461 | } else if (sipmsg->isBYE()) { // TODO: This should not happen. |
| 1462 | SipMTBye(sipmsg); |
| 1463 | } else if (sipmsg->isMESSAGE()) { |
| 1464 | // It is a duplicate MESSAGE. Resend the current response. |
| 1465 | if (mtLastResponse.smIsEmpty()) { |
| 1466 | if (! gConfig.getBool("SIP.RFC3428.NoTrying")) { MTSMSSendTrying(); } // Otherwise just ignore the duplicate MESSAGE. |
| 1467 | } else { |
| 1468 | sipWrite(&mtLastResponse); |
| 1469 | } |
| 1470 | } else { |
| 1471 | // Not expecting any others. Must send 405 error. |
| 1472 | LOG(WARNING)<<"SIP Message ignored:"<<sipmsg; |
| 1473 | SipMessageReply oops(sipmsg,405,string("Method Not Allowed"),this); |
| 1474 | sipWrite(&oops); |
| 1475 | } |
| 1476 | } else { |
| 1477 | LOG(WARNING)<<"SIP Message ignored:"<<sipmsg; |
| 1478 | } |
| 1479 | } |
| 1480 | |
| 1481 | // Return TRUE to remove the dialog. |
| 1482 | bool SipMTInviteServerTransactionLayer::mtPeriodicService() |
no test coverage detected