lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/erlang/osmo_dia2gsup/+/32513 )


Change subject: Allow to add APN wildcard via configuration
......................................................................

Allow to add APN wildcard via configuration

If the osmo-hlr doesn't send a default APN but it is required.
Set application environment append_default_apn to "true".
See the example sys.config.

Change-Id: I5767cb3c4082809f2ac5a4361a4758b54f24ad48
---
M examples/sys.config
M src/server_cb.erl
2 files changed, 44 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/erlang/osmo_dia2gsup 
refs/changes/13/32513/1

diff --git a/examples/sys.config b/examples/sys.config
index 8814893..8ad9bdf 100644
--- a/examples/sys.config
+++ b/examples/sys.config
@@ -8,5 +8,7 @@

         {origin_host, "hss.localdomain"},
         {origin_realm, "localdomain"},
-        {vendor_id, 0}
+        {vendor_id, 0},
+        % Append default APN to diameter
+        {append_default_apn, "false"}
 ]}].
diff --git a/src/server_cb.erl b/src/server_cb.erl
index fc8e397..709ef44 100644
--- a/src/server_cb.erl
+++ b/src/server_cb.erl
@@ -136,6 +136,22 @@
                                                 'Pre-emption-Vulnerability'=1}
        }).

+-spec gen_default_apn(integer()) -> #'APN-Configuration'{}.
+gen_default_apn(ContextIdentifier) ->
+       #'APN-Configuration'{'Context-Identifier' = ContextIdentifier,
+                            'PDN-Type' = ?PDN_TYPE_DEFAULT,
+                            % The EPS-Subscribed-QoS-Profile AVP and the AMBR 
AVP shall be present in the
+                            % APN-Configuration AVP when the APN-Configuration 
AVP is sent in the
+                            % APN-Configuration-Profile AVP and when the 
APN-Configuration-Profile AVP is
+                            % sent within a ULA (as part of the 
Subscription-Data AVP).
+                            'EPS-Subscribed-QoS-Profile' = ?EPS_QOS_DEFAULT,
+                            'AMBR' = #'AMBR'{'Max-Requested-Bandwidth-UL' = 
100000000,
+                                             'Max-Requested-Bandwidth-DL' = 
100000000},
+                            % The default APN Configuration shall not contain 
the Wildcard APN (see 3GPP TS
+                            % 23.003 [3], clause 9.2); the default APN shall 
always contain an explicit APN
+                            'Service-Selection' = "*"
+                           }.
+
 -spec gsup_pdp2dia_apn('GSUPPdpInfo'()) -> #'APN-Configuration'{}.
 gsup_pdp2dia_apn(GsupPdpInfo) ->
        #'APN-Configuration'{'Context-Identifier' = maps:get(pdp_context_id, 
GsupPdpInfo),
@@ -275,7 +291,18 @@
                                                                          
'PDP-Context'=PdpContexts},

                                        % build the APN-Configuration-Profile
-                                       ApnCfgList = lists:map(fun 
gsup_pdp2dia_apn/1, PdpInfoList),
+                                       ApnCfgList2 = lists:map(fun 
gsup_pdp2dia_apn/1, PdpInfoList),
+                                       % append default apn
+                                       AppendDefaultApn = 
application:get_env(osmo_dia2gsup, append_default_apn, "true"),
+                                       case AppendDefaultApn of
+                                               "true" ->
+                                                       LastApn = 
lists:last(ApnCfgList2),
+                                                       ApnCfgList = 
ApnCfgList2 ++ 
[gen_default_apn(LastApn#'APN-Configuration'.'Context-Identifier' + 1)];
+                                               _ ->
+                                                       ApnCfgList = ApnCfgList2
+                                       end,
+                                       lager:info("ApnCfgList: ~p~n", 
[ApnCfgList]),
+
                                        FirstApn = lists:nth(1, ApnCfgList),
                                        DefaultCtxId = 
FirstApn#'APN-Configuration'.'Context-Identifier',
                                        ApnCfgProf = 
#'APN-Configuration-Profile'{'Context-Identifier' = DefaultCtxId,

--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo_dia2gsup/+/32513
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: erlang/osmo_dia2gsup
Gerrit-Branch: master
Gerrit-Change-Id: I5767cb3c4082809f2ac5a4361a4758b54f24ad48
Gerrit-Change-Number: 32513
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <[email protected]>
Gerrit-MessageType: newchange

Reply via email to