aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Engel <tobias@ccc.de>2012-03-28 13:50:29 +0200
committerTobias Engel <tobias@ccc.de>2012-03-28 13:50:29 +0200
commit588dff78bb873b05066e765dd5da25c2743fad11 (patch)
tree5dd2f47bc40282e99c48430407aa6f8386b17f51
parent6d66a3ce55df5af86a7766178322a00d6c60026b (diff)
Return Error component added
gsm0480_send_ss_return_error sends a return error component with the supplied error code, and optionally ASN.1 BER formatted parameters (GSM 04.80 4.3)
-rw-r--r--openbsc/include/openbsc/gsm_04_80.h4
-rw-r--r--openbsc/src/libmsc/gsm_04_80.c36
2 files changed, 38 insertions, 2 deletions
diff --git a/openbsc/include/openbsc/gsm_04_80.h b/openbsc/include/openbsc/gsm_04_80.h
index ea5033564..61542a95e 100644
--- a/openbsc/include/openbsc/gsm_04_80.h
+++ b/openbsc/include/openbsc/gsm_04_80.h
@@ -18,6 +18,10 @@ int gsm0480_send_ss_reject(struct gsm_subscriber_connection *conn,
const struct ss_request *request,
uint8_t problem_category,
uint8_t problem_code);
+int gsm0480_send_ss_return_error(struct gsm_subscriber_connection *conn,
+ const struct ss_request *req,
+ uint8_t error_code,
+ struct msgb *parameters);
int gsm0480_send_ussdNotify(struct gsm_subscriber_connection *conn, int level, const char *text);
int gsm0480_send_releaseComplete(struct gsm_subscriber_connection *conn);
diff --git a/openbsc/src/libmsc/gsm_04_80.c b/openbsc/src/libmsc/gsm_04_80.c
index 85445dc59..b0e25605e 100644
--- a/openbsc/src/libmsc/gsm_04_80.c
+++ b/openbsc/src/libmsc/gsm_04_80.c
@@ -91,8 +91,8 @@ int gsm0480_send_ussd_response(struct gsm_subscriber_connection *conn,
/* Send response to a mobile-originated Invoke */
int gsm0480_send_ss_return_result(struct gsm_subscriber_connection *conn,
- const struct ss_request *req,
- struct msgb *msg)
+ const struct ss_request *req,
+ struct msgb *msg)
{
struct gsm48_hdr *gh;
@@ -149,6 +149,38 @@ int gsm0480_send_ss_reject(struct gsm_subscriber_connection *conn,
return gsm0808_submit_dtap(conn, msg, 0, 0);
}
+int gsm0480_send_ss_return_error(struct gsm_subscriber_connection *conn,
+ const struct ss_request *req,
+ uint8_t error_code,
+ struct msgb *parameters)
+{
+ struct msgb *msg = parameters;
+ struct gsm48_hdr *gh;
+
+ if(!msg)
+ msg = gsm48_msgb_alloc();
+
+ /* Pre-pend the error code */
+ msgb_push_TLV1(msg, GSM_0480_ERROR_CODE_TAG, error_code);
+
+ /* Before it insert the invoke ID */
+ msgb_push_TLV1(msg, GSM0480_COMPIDTAG_INVOKE_ID, req->invoke_id);
+
+ /* Wrap this up as a Reject component */
+ msgb_wrap_with_TL(msg, GSM0480_CTYPE_RETURN_ERROR);
+
+ /* Wrap the component in a Facility message */
+ msgb_wrap_with_TL(msg, GSM0480_IE_FACILITY);
+
+ /* And finally pre-pend the L3 header */
+ gh = (struct gsm48_hdr *) msgb_push(msg, sizeof(*gh));
+ gh->proto_discr = GSM48_PDISC_NC_SS;
+ gh->proto_discr |= req->transaction_id | (1<<7); /* TI direction = 1 */
+ gh->msg_type = GSM0480_MTYPE_RELEASE_COMPLETE;
+
+ return gsm0808_submit_dtap(conn, msg, 0, 0);
+}
+
int gsm0480_send_ussdNotify(struct gsm_subscriber_connection *conn, int level, const char *text)
{
struct gsm48_hdr *gh;