Skip to content

Commit

Permalink
Successful Rx Call, with dedicated bearer setup and teardown
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkneipp committed Oct 3, 2023
1 parent b3a7cb1 commit 5260314
Show file tree
Hide file tree
Showing 6 changed files with 185 additions and 129 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Dependency on Redis for inter-service messaging
- Significant performance improvements under load
- Basic Rx support for RAA, AAA, ASA and STA
- Rx MO call flow support (AAR -> RAR -> RAA -> AAA)
- Dedicated bearer setup and teardown on Rx call
- Asymmetric geored support
- Configurable redis connection (Unix socket or TCP)
- Basic database upgrade support in tools/databaseUpgrade
Expand Down
27 changes: 22 additions & 5 deletions lib/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ class IMS_SUBSCRIBER(Base):
ifc_path = Column(String(18), doc='Path to template file for the Initial Filter Criteria')
pcscf = Column(String(512), doc='Proxy-CSCF serving this subscriber')
pcscf_realm = Column(String(512), doc='Realm of PCSCF')
pcscf_active_session = Column(String(512), doc='Session Id for the PCSCF when in a call')
pcscf_timestamp = Column(DateTime, doc='Timestamp of last ue attach to PCSCF')
pcscf_peer = Column(String(512), doc='Diameter peer used to reach PCSCF')
sh_profile = Column(Text(12000), doc='Sh Subscriber Profile')
Expand Down Expand Up @@ -1626,8 +1627,8 @@ def Update_Serving_MME(self, imsi, serving_mme, serving_mme_realm=None, serving_
self.safe_close(session)


def Update_Proxy_CSCF(self, imsi, proxy_cscf, pcscf_realm=None, pcscf_peer=None, pcscf_timestamp=None, propagate=True):
self.logTool.log(service='Database', level='debug', message="Update_Proxy_CSCF for sub " + str(imsi) + " to pcscf " + str(proxy_cscf) + " with realm " + str(pcscf_realm) + " and peer " + str(pcscf_peer), redisClient=self.redisMessaging)
def Update_Proxy_CSCF(self, imsi, proxy_cscf, pcscf_realm=None, pcscf_peer=None, pcscf_timestamp=None, pcscf_active_session=None, propagate=True):
self.logTool.log(service='Database', level='debug', message="Update_Proxy_CSCF for sub " + str(imsi) + " to pcscf " + str(proxy_cscf) + " with realm " + str(pcscf_realm) + " and peer " + str(pcscf_peer) + " for session id " + str(pcscf_active_session), redisClient=self.redisMessaging)
Session = sessionmaker(bind = self.engine)
session = Session()

Expand All @@ -1640,6 +1641,7 @@ def Update_Proxy_CSCF(self, imsi, proxy_cscf, pcscf_realm=None, pcscf_peer=None,
#Strip duplicate SIP prefix before storing
proxy_cscf = proxy_cscf.replace("sip:sip:", "sip:")
result.pcscf = proxy_cscf
result.pcscf_active_session = pcscf_active_session
try:
if pcscf_timestamp is not None and pcscf_timestamp is not 'None':
result.pcscf_timestamp = datetime.strptime(pcscf_timestamp, '%Y-%m-%dT%H:%M:%SZ')
Expand All @@ -1660,6 +1662,7 @@ def Update_Proxy_CSCF(self, imsi, proxy_cscf, pcscf_realm=None, pcscf_peer=None,
result.pcscf_timestamp = None
result.pcscf_realm = None
result.pcscf_peer = None
result.pcscf_active_session = None
pcscf_timestamp_string = None

session.commit()
Expand All @@ -1670,7 +1673,7 @@ def Update_Proxy_CSCF(self, imsi, proxy_cscf, pcscf_realm=None, pcscf_peer=None,
if propagate == True:
if 'IMS' in self.config['geored']['sync_actions'] and self.config['geored']['enabled'] == True:
self.logTool.log(service='Database', level='debug', message="Propagate IMS changes to Geographic PyHSS instances", redisClient=self.redisMessaging)
self.handleGeored({"imsi": str(imsi), "pcscf": result.pcscf, "pcscf_realm": str(result.pcscf_realm), "pcscf_timestamp": pcscf_timestamp_string, "pcscf_peer": str(result.pcscf_peer)})
self.handleGeored({"imsi": str(imsi), "pcscf": result.pcscf, "pcscf_realm": str(result.pcscf_realm), "pcscf_timestamp": pcscf_timestamp_string, "pcscf_peer": str(result.pcscf_peer), "pcscf_active_session": str(pcscf_active_session)})
else:
self.logTool.log(service='Database', level='debug', message="Config does not allow sync of IMS events", redisClient=self.redisMessaging)
except Exception as E:
Expand Down Expand Up @@ -1988,8 +1991,22 @@ def Get_UE_by_IP(self, subscriber_routing):
result.pop('_sa_instance_state')
result = self.Sanitize_Datetime(result)
return result
#Get Subscriber ID from IMSI
subscriber_details = Get_Subscriber(imsi=str(imsi))

def Get_IMS_Subscriber_By_Session_Id(self, sessionId):
self.logTool.log(service='Database', level='debug', message="Called Get_IMS_Subscriber_By_Session_Id() for Session " + str(sessionId), redisClient=self.redisMessaging)

Session = sessionmaker(bind = self.engine)
session = Session()

try:
result = session.query(IMS_SUBSCRIBER).filter_by(pcscf_active_session=sessionId).one()
except Exception as E:
self.safe_close(session)
raise ValueError(E)
result = result.__dict__
result.pop('_sa_instance_state')
result = self.Sanitize_Datetime(result)
return result

def Store_IMSI_IMEI_Binding(self, imsi, imei, match_response_code, propagate=True):
#IMSI 14-15 Digits
Expand Down
Loading

0 comments on commit 5260314

Please sign in to comment.