Page 1 of 1

Session Number

Posted: Thu Oct 27, 2016 9:31 am
by ndiefi
How do I get Session Number from DeliverSm, Am processing USSD requests via SMPP

Re: Session Number

Posted: Sat Oct 29, 2016 9:09 pm
by alt
Hello ndiefi,

USSD over SMPP very oft is vendor specific. Try to check description from provider. I can try to help you if you send me this description.

You can also try following code

Code: Select all

        public void GetItsSessionInfoFromDeliverSm(DeliverSm deliverSm)
        {
            byte[] bytes = deliverSm.Optional[OptionalTags.ItsSessionInfo];
            ushort id = GetUssdSessionId(bytes);
            bool end = GetUssdSessionEnd(bytes);
        }

        private ushort GetUssdSessionId(byte[] bytes)
        {
            return BitConverter.ToUInt16(new[] { bytes[0], (byte)(bytes[1] >> 1) }, 0);
        }

        private bool GetUssdSessionEnd(byte[] bytes)
        {
            return (bytes[1] & 0x1) == 0x1;
        }