diff --git a/context/gsm_build.go b/context/gsm_build.go index 483a18ec..dba60bb1 100644 --- a/context/gsm_build.go +++ b/context/gsm_build.go @@ -163,7 +163,7 @@ func BuildGSMPDUSessionEstablishmentReject(smContext *SMContext, cause uint8) ([ return m.PlainNasEncode() } -func BuildGSMPDUSessionReleaseCommand(smContext *SMContext) ([]byte, error) { +func BuildGSMPDUSessionReleaseCommand(smContext *SMContext, cause uint8) ([]byte, error) { m := nas.NewMessage() m.GsmMessage = nas.NewGsmMessage() m.GsmHeader.SetMessageType(nas.MsgTypePDUSessionReleaseCommand) @@ -175,7 +175,7 @@ func BuildGSMPDUSessionReleaseCommand(smContext *SMContext) ([]byte, error) { pDUSessionReleaseCommand.SetExtendedProtocolDiscriminator(nasMessage.Epd5GSSessionManagementMessage) pDUSessionReleaseCommand.SetPDUSessionID(uint8(smContext.PDUSessionID)) pDUSessionReleaseCommand.SetPTI(smContext.Pti) - pDUSessionReleaseCommand.SetCauseValue(0x0) + pDUSessionReleaseCommand.SetCauseValue(cause) return m.PlainNasEncode() } diff --git a/producer/pdu_session.go b/producer/pdu_session.go index 54a257f5..f00d516e 100644 --- a/producer/pdu_session.go +++ b/producer/pdu_session.go @@ -322,7 +322,12 @@ func HandlePDUSessionSMContextUpdate(smContextRef string, body models.UpdateSmCo } } - if buf, err := smf_context.BuildGSMPDUSessionReleaseCommand(smContext); err != nil { + cause := nasMessage.Cause5GSMRegularDeactivation + if m.PDUSessionReleaseRequest.Cause5GSM != nil { + cause = m.PDUSessionReleaseRequest.Cause5GSM.GetCauseValue() + } + + if buf, err := smf_context.BuildGSMPDUSessionReleaseCommand(smContext, cause); err != nil { logger.PduSessLog.Errorf("Build GSM PDUSessionReleaseCommand failed: %+v", err) } else { response.BinaryDataN1SmMessage = buf