- if (sessionIdRequest != sessionIdAnswer) {
- s_warn = anna::functions::asString("Sending an answer which Session-Id (%s) is different than supposed corresponding request (%s)", sessionIdAnswer.c_str(), sessionIdRequest.c_str());
- LOGWARNING(anna::Logger::warning(s_warn, ANNA_FILE_LOCATION));
- a_testCase->addDebugSummaryHint(s_warn);
+ // Update sequence:
+ anna::diameter::codec::functions::setHopByHop(a_message, hbh);
+ anna::diameter::codec::functions::setEndToEnd(a_message, ete);
+ }
+
+ // Session-Id substitution:
+ std::string thisSessionId = anna::diameter::helpers::base::functions::getSessionId(getMsgDataBlock());
+ if (thisSessionId != sessionIdReferenceRequest) {
+ static anna::diameter::codec::Message codecMsg;
+ codecMsg.decode(getMsgDataBlock());
+ codecMsg.getAvp("Session-Id")->getUTF8String()->setValue(sessionIdReferenceRequest);
+ a_message = codecMsg.code();
+ std::string trace = anna::functions::asString("Replacing %s Session-Id (%s) to set the corresponding request one (%s)", (thisIsAnswer ? "answer":"request"), thisSessionId.c_str(), sessionIdReferenceRequest.c_str());
+ LOGDEBUG(anna::Logger::debug(trace, ANNA_FILE_LOCATION));
+ a_testCase->addDebugSummaryHint(trace);