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);
Profk