question on USSD messages

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Neels Hofmeyr nhofmeyr at sysmocom.de
Sat Nov 26 15:04:29 UTC 2016


Hi all,

I'm looking at USSD message generation in openbsc, and would like to move a
bit of msg generation to libosmocore.

However, in libosmocore's gsm0480.c I already find an implementation that seems
to do the same, yet with some differences I'm not sure how to deal with.

The function originally in openbsc:
  gsm0480_send_releaseComplete()

On the iu branch, I've moved the msg generation to
  gsm0480_gen_releaseComplete()
This should rather go to libosmocore.

There I already find
  gsm0480_create_ussd_resp()

The openbsc variants are rather shorter. Is it incomplete/incorrect?? Is the
libosmocore gsm0480_create_ussd_resp() just bloat for this case??

For convenience, let me paste the code:

openbsc's Release Complete, very lean:

    struct msgb *gsm0480_gen_releaseComplete(void)
    {
            struct msgb *msg;
    
            msg = gsm48_msgb_alloc_name("GSM 04.08 USSD REL COMPL");
            if (!msg)
                    return NULL;
    
            gsm0480_l3hdr_push(msg, GSM48_PDISC_NC_SS,
                               GSM0480_MTYPE_RELEASE_COMPLETE);
            return msg;
    }

Note that the above does not set a direction flag nor trans_id in the
proto_discr, like libosmocore's gsm0480_create_ussd_resp() does; neither do I
understand the purpose of all the constant "code/id" TLs and wrapping:

    struct msgb *gsm0480_create_ussd_resp(uint8_t invoke_id, uint8_t trans_id, const char *text)
    {
            struct msgb *msg;
            uint8_t *ptr8;
            int response_len;
    
            msg = msgb_alloc_headroom(1024, 128, "GSM 04.80");
            if (!msg)
                    return NULL;
    
            /* First put the payload text into the message */
            ptr8 = msgb_put(msg, 0);
            gsm_7bit_encode_n_ussd(ptr8, msgb_tailroom(msg), text, &response_len);
            msgb_put(msg, response_len);
    
            /* Then wrap it as an Octet String */
            msgb_wrap_with_TL(msg, ASN1_OCTET_STRING_TAG);
    
            /* Pre-pend the DCS octet string */
            msgb_push_TLV1(msg, ASN1_OCTET_STRING_TAG, 0x0F);
    
            /* Then wrap these as a Sequence */
            msgb_wrap_with_TL(msg, GSM_0480_SEQUENCE_TAG);
    
            /* Pre-pend the operation code */
            msgb_push_TLV1(msg, GSM0480_OPERATION_CODE,
                            GSM0480_OP_CODE_PROCESS_USS_REQ);
    
            /* Wrap the operation code and IA5 string as a sequence */
            msgb_wrap_with_TL(msg, GSM_0480_SEQUENCE_TAG);
    
            /* Pre-pend the invoke ID */
            msgb_push_TLV1(msg, GSM0480_COMPIDTAG_INVOKE_ID, invoke_id);
    
            /* Wrap this up as a Return Result component */
            msgb_wrap_with_TL(msg, GSM0480_CTYPE_RETURN_RESULT);
    
            /* Wrap the component in a Facility message */
            msgb_wrap_with_TL(msg, GSM0480_IE_FACILITY);
    
            /* And finally pre-pend the L3 header */
            gsm0480_l3hdr_push(msg,
                               GSM48_PDISC_NC_SS | trans_id
                               | (1<<7) /* TI direction = 1 */,
                               GSM0480_MTYPE_RELEASE_COMPLETE);
            return msg;
    }

Thanks for any insights!

~N


-- 
- Neels Hofmeyr <nhofmeyr at sysmocom.de>          http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Alt-Moabit 93
* 10559 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschäftsführer / Managing Directors: Harald Welte
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.osmocom.org/pipermail/openbsc/attachments/20161126/e8d9168b/attachment.bin>


More information about the OpenBSC mailing list