pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/erlang/osmo_dia2gsup/+/34259?usp=email )

Change subject: Translate GSUP Auth Info Answer error Cause in Diamater AIA
......................................................................

Translate GSUP Auth Info Answer error Cause in Diamater AIA

Change-Id: I32622713c2c1f40e1d9c5597ffab8cb211171fc2
---
M src/server_cb.erl
1 file changed, 29 insertions(+), 7 deletions(-)

Approvals:
  pespin: Looks good to me, approved
  Jenkins Builder: Verified




diff --git a/src/server_cb.erl b/src/server_cb.erl
index 482ba9a..26a7ac2 100644
--- a/src/server_cb.erl
+++ b/src/server_cb.erl
@@ -157,7 +157,10 @@
 -define(DIAMETER_ERROR_CAMEL_SUBSCRIPTION_PRESENT,     4182).
 % permanent (only in Experimental-Result-Code)
 -define(DIAMETER_ERROR_USER_UNKNOWN,                   5001).
+-define(DIAMETER_AUTHORIZATION_REJECTED,               5003).
 -define(DIAMETER_ERROR_ROAMING_NOT_ALLOWED,            5004).
+-define(DIAMETER_MISSING_AVP,                          5005).
+-define(DIAMETER_UNABLE_TO_COMPLY,                     5012).
 -define(DIAMETER_ERROR_UNKNOWN_EPS_SUBSCRIPTION,       5420).
 -define(DIAMETER_ERROR_RAT_NOT_ALLOWED,                        5421).
 -define(DIAMETER_ERROR_EQUIPMENT_UNKNOWN,              5422).
@@ -177,15 +180,23 @@
 -define(GMM_CAUSE_INV_MAND_INFO,       16#60).
 -define(GMM_CAUSE_PROTO_ERR_UNSPEC,    16#6f).

--define(EXP_RES(Foo),  #'Experimental-Result'{'Vendor-Id'=fixme, 
'Experimental-Result-Code'=Foo}).
+-define(EXP_RES(Foo),  #'Experimental-Result'{'Vendor-Id'=10415, 
'Experimental-Result-Code'=Foo}).

+%% see 29.272 Annex A/B
 -type empty_or_intl() :: [] | [integer()].
 -spec gsup_cause2dia(integer()) -> {empty_or_intl(), empty_or_intl()}.
 gsup_cause2dia(?GMM_CAUSE_IMSI_UNKNOWN) -> {[], 
[?EXP_RES(?DIAMETER_ERROR_USER_UNKNOWN)]};
-gsup_cause2dia(?GMM_CAUSE_PLMN_NOTALLOWED) -> {[], 
[?DIAMETER_ERROR_ROAMING_NOT_ALLOWED]};
-gsup_cause2dia(?GMM_CAUSE_GPRS_NOTALLOWED) -> {[], 
[?DIAMETER_ERROR_RAT_NOT_ALLOWED]};
-%gsup_cause2dia(?GMM_CAUSE_INV_MAND_INFO) ->
-%gsup_cause2dia(?GMM_CAUSE_NET_FAIL) ->
+gsup_cause2dia(?GMM_CAUSE_ILLEGAL_MS) -> {[], 
[?EXP_RES(?DIAMETER_ERROR_USER_UNKNOWN)]};
+gsup_cause2dia(?GMM_CAUSE_PLMN_NOTALLOWED) -> {[], 
[?EXP_RES(?DIAMETER_ERROR_ROAMING_NOT_ALLOWED)]};
+gsup_cause2dia(?GMM_CAUSE_GPRS_NOTALLOWED) -> {[], 
[?EXP_RES(?DIAMETER_ERROR_UNKNOWN_EPS_SUBSCRIPTION)]};
+
+gsup_cause2dia(?GMM_CAUSE_LA_NOTALLOWED) -> 
{[?DIAMETER_AUTHORIZATION_REJECTED], []};
+gsup_cause2dia(?GMM_CAUSE_ROAMING_NOTALLOWED) -> {[], 
[?EXP_RES(?DIAMETER_ERROR_ROAMING_NOT_ALLOWED)]};
+gsup_cause2dia(?GMM_CAUSE_NO_SUIT_CELL_IN_LA) -> {[], 
[?EXP_RES(?DIAMETER_ERROR_UNKNOWN_EPS_SUBSCRIPTION)]};
+gsup_cause2dia(?GMM_CAUSE_NET_FAIL) -> {[?DIAMETER_UNABLE_TO_COMPLY], []};
+gsup_cause2dia(?GMM_CAUSE_CONGESTION) -> {[?DIAMETER_UNABLE_TO_COMPLY], []};
+gsup_cause2dia(?GMM_CAUSE_INV_MAND_INFO) -> {[?DIAMETER_MISSING_AVP], []};
+gsup_cause2dia(?GMM_CAUSE_PROTO_ERR_UNSPEC) -> {[?DIAMETER_UNABLE_TO_COMPLY], 
[]};
 % TODO: more values
 gsup_cause2dia(_) -> {fixme, []}.

@@ -229,9 +240,11 @@
                        Resp = #'AIA'{'Session-Id'=SessionId, 'Origin-Host'=OH, 
'Origin-Realm'=OR,
                                      'Result-Code'=2001, 
'Auth-Session-State'=1,
                                      'Authentication-Info'=AuthInfo};
-               #{message_type := send_auth_info_err} ->
+               #{message_type := send_auth_info_err, cause:=Cause} ->
+                       {Res, ExpRes} = gsup_cause2dia(Cause),
                        Resp = #'AIA'{'Session-Id'=SessionId, 'Origin-Host'=OH, 
'Origin-Realm'=OR,
-                                     
'Result-Code'=?DIAMETER_ERROR_USER_UNKNOWN,
+                                     'Result-Code'=Res,
+                                     'Experimental-Result'=ExpRes,
                                      'Auth-Session-State'=1};
                timeout ->
                        Resp = #'AIA'{'Session-Id'=SessionId, 'Origin-Host'=OH, 
'Origin-Realm'=OR,

--
To view, visit 
https://gerrit.osmocom.org/c/erlang/osmo_dia2gsup/+/34259?usp=email
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: I32622713c2c1f40e1d9c5597ffab8cb211171fc2
Gerrit-Change-Number: 34259
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <[email protected]>
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: lynxis lazus <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to