Commit 87cd03c7 authored by Ikram Haq's avatar Ikram Haq
Browse files

Fix CallbackReferance issue in userlocationeventsubscription

parent febb478f
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -1707,8 +1707,6 @@ func checkNotificationRegisteredUsers1(oldZoneId string, newZoneId string, oldAp
			var timestamp TimeStamp
			timestamp.Seconds = int32(seconds)
			zonal.TimeStamp = &timestamp
			zonal.CallbackData = subscription.CallbackReference.CallbackData
			// event.CallbackData = subscription.CallbackReference.CallbackData
			if newZoneId != oldZoneId {
				//process LEAVING events prior to entering ones
				if oldZoneId != "" {
@@ -1720,7 +1718,7 @@ func checkNotificationRegisteredUsers1(oldZoneId string, newZoneId string, oldAp
						zonal.UserLocationEvent = event
						var inlineZonal InlineUserLocationEventNotification
						inlineZonal.UserLocationEventNotification = &zonal
						sendZonalPresenceNotification1(subscription.CallbackReference.NotifyURL, inlineZonal)
						sendZonalPresenceNotification1(subscription.CallbackReference, inlineZonal)
						log.Info("User Notification" + "(" + subsIdStr + "): " + "Leaving event in zone " + oldZoneId + " for user " + userId)
					}
				}
@@ -1732,7 +1730,7 @@ func checkNotificationRegisteredUsers1(oldZoneId string, newZoneId string, oldAp
					zonal.UserLocationEvent = event
					var inlineZonal InlineUserLocationEventNotification
					inlineZonal.UserLocationEventNotification = &zonal
					sendZonalPresenceNotification1(subscription.CallbackReference.NotifyURL, inlineZonal)
					sendZonalPresenceNotification1(subscription.CallbackReference, inlineZonal)
					log.Info("User Notification" + "(" + subsIdStr + "): " + "Entering event in zone " + newZoneId + " for user " + userId)
				}
			}
@@ -3737,7 +3735,7 @@ func handleUserLocationEventSubscription(w http.ResponseWriter, requestBody []ma
			}

			// Validate mandatory properties
			if userSubBody.CallbackReference == nil || userSubBody.CallbackReference.NotifyURL == "" {
			if userSubBody.CallbackReference == "" {
				log.Error("Mandatory CallbackReference parameter not present")
				errHandlerProblemDetails(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest)
				return
@@ -4154,7 +4152,7 @@ func handleUserLocationEventSubscriptionPut(w http.ResponseWriter, requestBody [
				errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError)
				return
			}
			if userSubBody.CallbackReference == nil || userSubBody.CallbackReference.NotifyURL == "" {
			if userSubBody.CallbackReference == "" {
				log.Error("Mandatory CallbackReference parameter not present")
				errHandlerProblemDetails(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest)
				return
@@ -4165,7 +4163,7 @@ func handleUserLocationEventSubscriptionPut(w http.ResponseWriter, requestBody [
				return
			}
			subsIdParamStr := subscriptionID
			selfUrl := strings.Split(userSubBody.ResourceURL, "/")
			selfUrl := strings.Split(userSubBody.Links.Self.Href, "/")
			subsIdStr := selfUrl[len(selfUrl)-1]
			// //Body content not matching parameters
			if subsIdStr != subsIdParamStr {
+19 −0
Original line number Diff line number Diff line
/*
 * AdvantEDGE Location API
 *
 * Location Service is AdvantEDGE's implementation of [ETSI MEC ISG MEC013 Location API](https://www.etsi.org/deliver/etsi_gs/MEC/001_099/013/03.01.01_60/gs_mec013v030101p.pdf) <p>The API is based on the Open Mobile Alliance's specification RESTful Network API for Zonal Presence <p>[Copyright (c) ETSI 2017](https://forge.etsi.org/etsi-forge-copyright-notice.txt) <p>**Micro-service**<br>[meep-loc-serv](https://github.com/InterDigitalInc/AdvantEDGE/tree/master/go-apps/meep-loc-serv) <p>**Type & Usage**<br>Edge Service used by edge applications that want to get information about Users (UE) and Zone locations <p>**Note**<br>AdvantEDGE supports all of Location API endpoints (see below).
 *
 * API version: 3.1.1
 * Contact: AdvantEDGE@InterDigital.com
 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
 */
package server

// OccurrenceInfo : The enumeration OccurrenceInfo indicates whether event reporting is one time.
type OccurrenceInfo string

// List of OccurrenceInfo
const (
	ONE_TIME_EVENT      OccurrenceInfo = "ONE_TIME_EVENT"
	MULTIPLE_TIME_EVENT OccurrenceInfo = "MULTIPLE_TIME_EVENT"
)
+21 −0
Original line number Diff line number Diff line
/*
 * AdvantEDGE Location API
 *
 * Location Service is AdvantEDGE's implementation of [ETSI MEC ISG MEC013 Location API](https://www.etsi.org/deliver/etsi_gs/MEC/001_099/013/03.01.01_60/gs_mec013v030101p.pdf) <p>The API is based on the Open Mobile Alliance's specification RESTful Network API for Zonal Presence <p>[Copyright (c) ETSI 2017](https://forge.etsi.org/etsi-forge-copyright-notice.txt) <p>**Micro-service**<br>[meep-loc-serv](https://github.com/InterDigitalInc/AdvantEDGE/tree/master/go-apps/meep-loc-serv) <p>**Type & Usage**<br>Edge Service used by edge applications that want to get information about Users (UE) and Zone locations <p>**Note**<br>AdvantEDGE supports all of Location API endpoints (see below).
 *
 * API version: 3.1.1
 * Contact: AdvantEDGE@InterDigital.com
 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
 */
package server

type UserEventPara struct {
	// One or more access points forming a monitoring area that could be any shape. See note 1.
	AccessPointList []string `json:"accessPointList,omitempty"`

	OccurrenceInfo *OccurrenceInfo `json:"occurrenceInfo,omitempty"`
	// This IE shall be set to true if a location estimate is required for each event report.
	ReportingLocationReq bool `json:"reportingLocationReq,omitempty"`
	// Identifier of zone (e.g. zone001) to monitor. See note 1.
	ZoneId string `json:"zoneId,omitempty"`
}
+1 −0
Original line number Diff line number Diff line
@@ -30,4 +30,5 @@ type UserLocationEventNotification struct {
	UserLocationEvent *LocationEventType `json:"userLocationEvent"`
	// The identity of the zone.  For the events of \"ENTERING_AREA_EVENT\", it is the zone that the user is currently within.  For the event of \"LEAVING_AREA_EVENT\", it is the zone that the user used to be within. See note 2.
	ZoneId string `json:"zoneId,omitempty"`
	Links  *Links `json:"_links,omitempty"`
}
+11 −5
Original line number Diff line number Diff line
@@ -11,17 +11,23 @@ package server

// A type containing data for notifications, when the area is defined as a circle.
type UserLocationEventSubscription struct {
	SubscriptionType string `json:"subscriptionType"`

	Links *Links `json:"_links,omitempty"`
	// Address of user (e.g. ‘sip’ URI, ‘tel’ URI, ‘acr’ URI) to monitor.
	Address string `json:"address,omitempty"`
	// URI exposed by the client on which to receive notifications via HTTP. See note 1.
	CallbackReference *CallbackReference `json:"callbackReference"`
	CallbackReference string `json:"callbackReference,omitempty"`
	// A correlator that the client can use to tag this particular resource representation during a request to create a resource on the server. See note 2.
	ClientCorrelator string `json:"clientCorrelator,omitempty"`

	ResourceURL string `json:"resourceURL,omitempty"`

	ExpiryDeadline *TimeStamp `json:"expiryDeadline,omitempty"`
	// List of user event values to generate notifications for (these apply to address specified).
	LocationEventCriteria []LocationEventType `json:"locationEventCriteria,omitempty"`
	// Set to TRUE by the service consumer to request a test notification via HTTP on the callbackReference URI, as specified in ETSI GS MEC 009 [4], clause 6.12a.
	RequestTestNotification bool `json:"requestTestNotification,omitempty"`
	// Shall be set to \"UserLocationEventSubscription\".
	SubscriptionType string `json:"subscriptionType"`

	UserEventPara *UserEventPara `json:"userEventPara,omitempty"`

	WebsockNotifConfig *WebsockNotifConfig `json:"websockNotifConfig,omitempty"`
}