Skip to content

Commit

Permalink
Add Sh-IMS-Data to sh_user_data
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkneipp committed Nov 3, 2023
1 parent 64d47d6 commit 9d00636
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion default_sh_user_data.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--This is the default iFC template used by PyHSS, variables come from the Jinja2 template passed inside diameter.py where you can additional variables if required -->
<Sh-Data>
<IMSPrivateUserIdentity>{{ Sh_template_vars['imsi'] }}@ims.mnc{{ Sh_template_vars['mnc'] }}.mcc{{ Sh_template_vars['mcc'] }}.3gppnetwork.org</IMSPrivateUserIdentity>
<IMSPrivateUserIdentity>{{ Sh_template_vars['imsi'] }}@ims.mnc{{ Sh_template_vars['mnc'] }}.mcc{{ Sh_template_vars['mcc'] }}.3gppnetwork.org</IMSPrivateUserIdentity>
<!-- This provides the Public Identifiers to the Application Server -->
<PublicIdentifiers>
<IMSPublicIdentity>sip:{{ Sh_template_vars['msisdn'] }}@ims.mnc{{ Sh_template_vars['mnc'] }}.mcc{{ Sh_template_vars['mcc'] }}.3gppnetwork.org</IMSPublicIdentity>
Expand All @@ -21,6 +21,11 @@
</EPSLocationInformation>
</Extension>

<Sh-IMS-Data>
<S-CSCFName>{{ Sh_template_vars['scscf'] }}</S-CSCFName>
<IMSUserState>{{ Sh_template_vars['imsUserState'] }}</IMSUserState>
</Sh-IMS-Data>

<!-- This container for the XCAP Data for the Subscriber -->

<!-- XCAP data from Database -->
Expand Down
8 changes: 7 additions & 1 deletion lib/diameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2206,6 +2206,7 @@ def Answer_16777217_306(self, packet_vars, avps):
#Define values so we can check if they've been changed
msisdn = None
imsi = None
scscf = None
try:
user_identity_avp = self.get_avp_data(avps, 700)[0]
msisdn = self.get_avp_data(user_identity_avp, 701)[0] #Get MSISDN from AVP in request
Expand All @@ -2226,8 +2227,13 @@ def Answer_16777217_306(self, packet_vars, avps):
self.logTool.log(service='HSS', level='debug', message="Getting susbcriber info based on MSISDN", redisClient=self.redisMessaging)
subscriber_details = self.database.Get_Subscriber(msisdn=msisdn)
imsi = subscriber_details.get('imsi', None)
scscf = subscriber_ims_details.get('scscf', None)
if scscf is not None:
imsUserState = 1
else:
imsUserState = 0
self.logTool.log(service='HSS', level='debug', message="Got subscriber details: " + str(subscriber_details), redisClient=self.redisMessaging)
subscriber_details = {**subscriber_details, **subscriber_ims_details}
subscriber_details = {**subscriber_details, **subscriber_ims_details, 'imsUserState': imsUserState}
self.logTool.log(service='HSS', level='debug', message="Merged subscriber details: " + str(subscriber_details), redisClient=self.redisMessaging)
else:
self.logTool.log(service='HSS', level='error', message="No MSISDN or IMSI in Answer_16777217_306() input", redisClient=self.redisMessaging)
Expand Down

0 comments on commit 9d00636

Please sign in to comment.