产生连锁信息UDH和prePEND它来消息文本 [英] Generate an concatenated SMS UDH and prepend it to message text

查看:303
本文介绍了产生连锁信息UDH和prePEND它来消息文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了发送短信(7位)超过160个字符长,你必须打破信息成153字消息话题的数据部分,每个这些有5 octect UDH preFIX(用户数据报头),说明,这些是一个多短信部件,应'重新组合由接收装置​​

由于UDH发送的消息数据的一部分,无论服务,我要送它通过应,希望,忽略它,并将其发送给收件人的手机,这将去code,并串联的部分长短信。

我使用了下面的测试code,但我得到两个不同的消息。任何建议,我在做什么错了?

 私人无效sendButton_Click(对象发件人,EventArgs的)
{
    如果((cellNumberText.Text.Trim()==长度10)及。&安培;(messageText.Text.Trim()长度大于0))
    {
        SendSms(cellNumberText.Text.Trim(),BuildUdh(255,2,1)+你好第一次。);
        SendSms(cellNumberText.Text.Trim(),BuildUdh(255 2,2)+你好秒时间。);
    }
}

私人字符串BuildUdh(字节MESSAGEID,字节partCount,字节PARTID)
{
    VAR UDG =新的字节[5];
    UDG [0] = 0×00;
    UDG [1] = 0×03;
    UDG [2] = MESSAGEID;
    UDG [3] = partCount;
    UDG [4] = PARTID;

    返回BitConverter.ToString(UDG);
 

解决方案

这要看您使用发送短信的服务。在大多数内容接口(例如SMPP或EMI / UCP)SMSC的,你可以使用上面描述的技术,但你必须指定要发送的短信中包含用户数据头。

除了你BuildUdh正常建设Concat的信息元素,但缺少UDH的总长度在第一个字节。

 私人字符串BuildUdh(字节MESSAGEID,字节partCount,字节PARTID)
{
    VAR UDG =新的字节[6];
    UDG [0] = 0×05; // UDH的总长度
    UDG [1] = 0×00; // IE Con​​cat的
    UDG [2] = 0×03; // IE参数长度
    UDG [3] = MESSAGEID;
    UDG [4] = partCount;
    UDG [5] = PARTID;
[..]
 

如果您使用的是手机和它的AT + C接口发送短信,你必须做到位填充你自己的,并提交与UDHI集PDU和140字节的数据。

心连心,cheerio史蒂夫

In order to send SMS (7-bit) longer than 160 chars, you have to break the message up into 153 character messsage data parts and prefix each of these with a 5 octect UDH (user data header), explaining that these are parts of a multipart SMS and should be 're-assembled' by the receiving device.

As the UDH is sent as part of the message data, whatever service I'm sending it through should, hopefully, ignore it and send it on to the recipient phone which will decode it and concatenate the parts of the long SMS.

I am using the following test code, but I get two separate messages. Any suggestions as to what I am 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);

解决方案

It depends on the service which are you using to send the SMS with. In most Content Interfaces (for example SMPP or EMI/UCP) to SMSC's you could use the technique described above, but you have to specify that the SMS you are sending contains a User Data Header.

Besides your BuildUdh Function build the Concat Info-element correctly, but is missing the overall length of the UDH in the First Byte.

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;
[..]

If you use a mobile phone and the AT+C interface of it to send the SMS you have to do the bit stuffing on your own, and submit a PDU with UDHI set and 140 bytes of data.

hth, cheerio Steve

这篇关于产生连锁信息UDH和prePEND它来消息文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆