Commit 889ce79c authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Fix HTTP response handling

parent 936566db
......@@ -735,24 +735,28 @@ void smf_app::handle_itti_msg(itti_n11_create_sm_context_response& m) {
Logger::smf_app().debug(
"PDU Session Create SM Context: Set promise with ID %d to ready", m.pid);
trigger_http_response(
m.res.get_http_code(), m.pid, N11_SESSION_CREATE_SM_CONTEXT_RESPONSE);
nlohmann::json response_message_json = {};
m.res.to_json(response_message_json);
trigger_http_response(response_message_json, m.pid);
}
//------------------------------------------------------------------------------
void smf_app::handle_itti_msg(itti_n11_update_sm_context_response& m) {
Logger::smf_app().debug(
"PDU Session Update SM Context: Set promise with ID %d to ready", m.pid);
trigger_http_response(
m.res.get_http_code(), m.pid, N11_SESSION_UPDATE_SM_CONTEXT_RESPONSE);
nlohmann::json response_message_json = {};
m.res.to_json(response_message_json);
trigger_http_response(response_message_json, m.pid);
}
//------------------------------------------------------------------------------
void smf_app::handle_itti_msg(itti_n11_release_sm_context_response& m) {
Logger::smf_app().debug(
"PDU Session Release SM Context: Set promise with ID %d to ready", m.pid);
trigger_http_response(
m.res.get_http_code(), m.pid, N11_SESSION_RELEASE_SM_CONTEXT_RESPONSE);
nlohmann::json response_message_json = {};
m.res.to_json(response_message_json);
trigger_http_response(response_message_json, m.pid);
}
//------------------------------------------------------------------------------
......
......@@ -5420,29 +5420,25 @@ void smf_context::send_pdu_session_release_response(
sps->timer_T3592 = itti_inst->timer_setup(
T3592_TIMER_VALUE_SEC, 0, TASK_SMF_APP, TASK_SMF_APP_TRIGGER_T3592,
scid);
// Trigger response to AMF
nlohmann::json response_message_json = {};
resp->res.to_json(response_message_json);
smf_app_inst->trigger_http_response(
response_message_json, resp->pid,
N11_SESSION_RELEASE_SM_CONTEXT_RESPONSE);
} break;
default: {
smf_app_inst->trigger_http_response(
http_status_code_e::HTTP_STATUS_CODE_204_NO_CONTENT, resp->pid,
N11_SESSION_RELEASE_SM_CONTEXT_RESPONSE);
resp->res.set_http_code(
http_status_code_e::HTTP_STATUS_CODE_204_NO_CONTENT);
}
}
} else {
resp->res.set_http_code(
http_status_code_e::HTTP_STATUS_CODE_406_NOT_ACCEPTABLE);
// Trigger response to AMF
nlohmann::json response_message_json = {};
resp->res.to_json(response_message_json);
smf_app_inst->trigger_http_response(
response_message_json, resp->pid,
N11_SESSION_RELEASE_SM_CONTEXT_RESPONSE);
}
// send ITTI message to SMF_APP interface to trigger the response towards AMFs
Logger::smf_app().info(
"Sending ITTI message %s to task TASK_SMF_APP", resp->get_msg_name());
int ret = itti_inst->send_msg(resp);
if (RETURNok != ret) {
Logger::smf_app().error(
"Could not send ITTI message %s to task TASK_SMF_APP",
resp->get_msg_name());
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment