- xapp.Logger.Info("SendSubDelFail: Deleting transaction record. SubId: %v, Xid: %s", params.SubId, params.Xid)
- if c.registry.releaseSequenceNumber(subId) {
- transaction, err = c.tracker.completeTransaction(subId, DELETE)
- if err != nil {
- xapp.Logger.Error("SendSubDelFail: Failed to delete transaction record. Err: %v, SubId: %v, Xid: %s", err, params.SubId, params.Xid)
- return
+ c.sendSubscriptionDeleteResponse("SubDelReq(timer)", trans, subs)
+ return
+}
+
+func (c *Control) sendSubscriptionDeleteResponse(desc string, trans *Transaction, subs *Subscription) {
+
+ if trans.ForwardRespToXapp == true {
+ //Always generate SubDelResp
+ trans.SubDelRespMsg = &e2ap.E2APSubscriptionDeleteResponse{}
+ trans.SubDelRespMsg.RequestId.Id = trans.SubDelReqMsg.RequestId.Id
+ trans.SubDelRespMsg.RequestId.Seq = uint32(subs.GetSubId())
+ trans.SubDelRespMsg.FunctionId = trans.SubDelReqMsg.FunctionId
+
+ var err error
+ trans.Mtype, trans.Payload, err = c.e2ap.PackSubscriptionDeleteResponse(trans.SubDelRespMsg)
+ if err == nil {
+ c.rmrReplyToSender(desc+": SubDelResp to xapp", subs, trans)
+ time.Sleep(3 * time.Second)
+ } else {
+ //TODO error handling improvement
+ xapp.Logger.Error("%s: %s for trans %s (continuing cleaning)", desc, err.Error(), trans)