Vadim Yanitskiy has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/12843 )

Change subject: libmsc/gsm_04_80.c: add msc_send_ussd_release_complete_cause()
......................................................................

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
---
M include/osmocom/msc/gsm_04_80.h
M src/libmsc/gsm_04_80.c
2 files changed, 31 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/msc/gsm_04_80.h b/include/osmocom/msc/gsm_04_80.h
index 073794b..b786dcc 100644
--- a/include/osmocom/msc/gsm_04_80.h
+++ b/include/osmocom/msc/gsm_04_80.h
@@ -12,3 +12,6 @@
                         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 502848f..e3547f4 100644
--- a/src/libmsc/gsm_04_80.c
+++ b/src/libmsc/gsm_04_80.c
@@ -86,3 +86,31 @@
                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);
+}

--
To view, visit https://gerrit.osmocom.org/12843
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I3b9e8e4f473d113d5b9e9e5d33f7914202077203
Gerrit-Change-Number: 12843
Gerrit-PatchSet: 4
Gerrit-Owner: Vadim Yanitskiy <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <[email protected]>
Gerrit-Reviewer: Vadim Yanitskiy <[email protected]>
Gerrit-Reviewer: daniel <[email protected]>

Reply via email to