Session Number

.NET library for SMPP protocol
Locked
ndiefi
Posts: 1
Joined: Thu Oct 27, 2016 9:24 am

Session Number

Post by ndiefi » Thu Oct 27, 2016 9:31 am

How do I get Session Number from DeliverSm, Am processing USSD requests via SMPP
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Session Number

Post by alt » Sat Oct 29, 2016 9:09 pm

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;
        }
Locked