diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2019-02-06 17:54:21 +0700 |
---|---|---|
committer | Vadim Yanitskiy <axilirator@gmail.com> | 2019-02-13 12:50:14 +0000 |
commit | 3acfe68b8b1a0d59ddad0afcc85f06098280e380 (patch) | |
tree | 0ecee1c4b6b387846520378fa2a52475bdd4003b | |
parent | f20c6b7bd5200ed09d1563a1e61a5b62b033eeff (diff) |
libmsc/gsm_04_80.c: add msc_send_ussd_release_complete_cause()
According to GSM 04.80, section 2.5.1, Release complete message
may have an optional Cause IE. Let's add a new function, that
allows to specify cause location and value.
This function will be used by the upcoming changes.
Change-Id: I3b9e8e4f473d113d5b9e9e5d33f7914202077203
Depends Change-Id: (libosmocore) Ie3ac85fcef90a5e532334ba3482804d5305c88d7
-rw-r--r-- | include/osmocom/msc/gsm_04_80.h | 3 | ||||
-rw-r--r-- | src/libmsc/gsm_04_80.c | 28 |
2 files changed, 31 insertions, 0 deletions
diff --git a/include/osmocom/msc/gsm_04_80.h b/include/osmocom/msc/gsm_04_80.h index 073794b06..b786dcc49 100644 --- a/include/osmocom/msc/gsm_04_80.h +++ b/include/osmocom/msc/gsm_04_80.h @@ -12,3 +12,6 @@ int msc_send_ussd_notify(struct ran_conn *conn, int level, const char *text); int msc_send_ussd_release_complete(struct ran_conn *conn, uint8_t transaction_id); +int msc_send_ussd_release_complete_cause(struct ran_conn *conn, + uint8_t transaction_id, + uint8_t cause_loc, uint8_t cause_val); diff --git a/src/libmsc/gsm_04_80.c b/src/libmsc/gsm_04_80.c index 502848f0e..e3547f41d 100644 --- a/src/libmsc/gsm_04_80.c +++ b/src/libmsc/gsm_04_80.c @@ -86,3 +86,31 @@ int msc_send_ussd_release_complete(struct ran_conn *conn, return -1; return msc_tx_dtap(conn, msg); } + +int msc_send_ussd_release_complete_cause(struct ran_conn *conn, + uint8_t transaction_id, + uint8_t cause_loc, uint8_t cause_val) +{ + struct msgb *msg; + uint8_t *cause_ie; + + msg = gsm0480_create_release_complete(transaction_id); + if (!msg) + return -1; + + /* Encode cause IE (see GSM 04.08, section 10.5.4.11) + * with fixed length (2 bytes of TL, 2 bytes of payload). + * NOTE: we don't use gsm48_encode_cause() API because + * it wants gsm_mncc_cause struct from us. */ + cause_ie = msgb_put(msg, 2 + 2); + cause_ie[0] = GSM48_IE_CAUSE; + cause_ie[1] = 2; + + /* Coding standard defined for the GSM PLMNs, + * location and cause: as given by caller, + * no extension, no diagnostics. */ + cause_ie[2] = (1 << 7) | (0x03 << 5) | (cause_loc & 0x0f); + cause_ie[3] = (1 << 7) | cause_val; + + return msc_tx_dtap(conn, msg); +} |