Create a unified SMS UDH and add it to the message text

To send an SMS (7 bit) longer than 160 characters, you need to break the message into 153 pieces of messsage data and prefix each of them with a 5-octet UDH (user data header), explaining that these are parts of a multi-part SMS and should be "reused" collected by the "receiving device.

Since the UDH is sent as part of the message data, any service that I send should hopefully ignore it and send it to the recipientโ€™s phone, which will decode it and combine the parts of a long SMS.

I use the following test code, but I get two separate messages. Any suggestions on what I'm doing wrong?

private void sendButton_Click(object sender, EventArgs e)
{
    if ((cellNumberText.Text.Trim().Length == 10) && (messageText.Text.Trim().Length > 0))
    {
        SendSms(cellNumberText.Text.Trim(), BuildUdh(255, 2, 1) + "Hello first time.  ");
        SendSms(cellNumberText.Text.Trim(), BuildUdh(255, 2, 2) + "Hello second time.  ");
    }
}

private string BuildUdh(byte messageId, byte partCount, byte partId)
{
    var udg = new byte[5];
    udg[0] = 0x00;
    udg[1] = 0x03;
    udg[2] = messageId;
    udg[3] = partCount;
    udg[4] = partId;

    return BitConverter.ToString(udg);
+3
1

, SMS. (, SMPP EMI/UCP) SMSC , , SMS User Data.

BuildUdh Concat, UDH .

private string BuildUdh(byte messageId, byte partCount, byte partId)
{
    var udg = new byte[6];
    udg[0] = 0x05;      // Overall length of UDH
    udg[1] = 0x00;      // IE Concat 
    udg[2] = 0x03;      // IE parameter Length
    udg[3] = messageId;
    udg[4] = partCount;
    udg[5] = partId;
[..]

AT + C SMS, PDU UDHI 140 .

hth, cheerio Steve

+3

Source: https://habr.com/ru/post/1759603/


All Articles