Skip to content

Commit

Permalink
Added fixes for roaming
Browse files Browse the repository at this point in the history
  • Loading branch information
zarya committed Jan 2, 2024
1 parent 09a9865 commit 6a7bb92
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/diameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1283,14 +1283,15 @@ def Answer_16777251_316(self, packet_vars, avps):
mcc = decodedPlmn[0]
mnc = decodedPlmn[1]
subscriberIsRoaming = False
subscriberRoamingAllowed = False
if str(mcc) != str(self.MCC) and str(mnc) != str(self.MNC):
subscriberIsRoaming = True

if subscriberIsRoaming:
self.logTool.log(service='HSS', level='debug', message=f"[diameter.py] [Answer_16777251_318] [AIA] Subscriber {imsi} is roaming", redisClient=self.redisMessaging)
subscriberRoamingAllowed = self.validateSubscriberRoaming(subscriber=subscriber_details, mcc=mcc, mnc=mnc)

if not subscriberRoamingAllowed:
if not subscriberRoamingAllowed and subscriberIsRoaming:
avp = ''
session_id = self.get_avp_data(avps, 263)[0] #Get Session-ID
avp += self.generate_avp(263, 40, session_id) #Session-ID AVP set
Expand Down Expand Up @@ -1609,14 +1610,17 @@ def Answer_16777251_318(self, packet_vars, avps):
decodedPlmn = self.DecodePLMN(plmn=plmn)
mcc = decodedPlmn[0]
mnc = decodedPlmn[1]
subscriberIsRoaming=False
subscriberRoamingAllowed=False

if str(mcc) != str(self.MCC) and str(mnc) != str(self.MNC):
subscriberIsRoaming = True

if subscriberIsRoaming:
self.logTool.log(service='HSS', level='debug', message=f"[diameter.py] [Answer_16777251_318] [AIA] Subscriber {imsi} is roaming", redisClient=self.redisMessaging)
subscriberRoamingAllowed = self.validateSubscriberRoaming(subscriber=subscriber_details, mcc=mcc, mnc=mnc)

if not subscriberRoamingAllowed:
if not subscriberRoamingAllowed and subscriberIsRoaming:
avp = ''
session_id = self.get_avp_data(avps, 263)[0] #Get Session-ID
avp += self.generate_avp(263, 40, session_id) #Session-ID AVP set
Expand Down

0 comments on commit 6a7bb92

Please sign in to comment.