在短消息中嵌入 GSM 小区
我正在使用 WML 功能“providelocalinfo”将位置信息放入通过 GSM 手机上的 WIB 菜单发送的短消息中。
我正在使用 SmartTrust 的 WIG WML v.4 规范。 相关部分是“9.4 Providelocalinfo Element”
我使用示例中的代码,然后通过SMS传输变量,并使用Kannel从SMSC检索消息。
这是我正在使用的代码,但 [myservicecentre] 是我的实际服务中心:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE wml PUBLIC "-//SmartTrust//DTD WIG-WML 4.0//EN"
"http://www.smarttrust.com/DTD/WIG-WML4.0.dtd">
<wml wibletenc="UCS2">
<card id="s">
<p>
<providelocalinfo cmdqualifier="location" destvar="LOC"/>
<setvar name="X" value="loc=" class="binary"/>
<sendsm>
<destaddress value="367"/>
<userdata docudenc="hex-binary" dcs="245">
$(X)$(LOC)
</userdata>
<servicecentreaddress value="[myservicecentre]"/>
</sendsm>
</p>
</card>
</wml>
我在收到的消息中看到的是“loc=”,后跟 7 个字节(八位字节)或二进制数据。 我试图找到解释如何解码这些数据的文档,但没有找到任何明确解释的内容。
在解码后的 7 个八位字节中, 前 3 个八位位组始终相同, 接下来的 2 个八位位组往往在三个唯一值之间变化, 最后 2 个八位字节似乎是 cellid。
因此,我对接收器进行了编码,以提取最后两个八位字节并构造一个 16 位 GSM cellid。 大多数时候它与网络中已知的 cellid 匹配。 但很多时候,值并不匹配。
因此,我试图找到有关以下内容的信息:
- 如何以安全的方式正确传输位置信息(编码、转换等)
- 如何正确解码信息
- 如何配置 Kannel 以遵循二进制位置数据
我已经检查过我在以下文档中无果查找,但没有找到相关数据: GSM 03.38、GSM 04.07、GSM 04.08、GSM 11.15 以及 WIG WML Spec V .4
任何有关我可能做错的事情的见解将不胜感激!
I'm using the WML function "providelocalinfo" to put location information into Short Messages send via a WIB menu on a GSM handset.
I'm using the WIG WML v.4 Spec from SmartTrust. The relevant section is "9.4 providelocalinfo Element"
I use the code as in the example, and then transmit the variable via SMS, and use Kannel to retrieve the message from the SMSC.
Here's the code that I'm using, with the exception of [myservicecentre] being my actual service centre:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE wml PUBLIC "-//SmartTrust//DTD WIG-WML 4.0//EN"
"http://www.smarttrust.com/DTD/WIG-WML4.0.dtd">
<wml wibletenc="UCS2">
<card id="s">
<p>
<providelocalinfo cmdqualifier="location" destvar="LOC"/>
<setvar name="X" value="loc=" class="binary"/>
<sendsm>
<destaddress value="367"/>
<userdata docudenc="hex-binary" dcs="245">
$(X)$(LOC)
</userdata>
<servicecentreaddress value="[myservicecentre]"/>
</sendsm>
</p>
</card>
</wml>
What I see in my received messages is "loc=" followed by 7 bytes (octets) or binary data. I have tried to find documentation explaining how to decode this data, but found nothing the explains this clearly.
Of the decoded 7 octets,
the first 3 octets are always the same,
The next 2 octets tend to vary between three unique values,
the last 2 octets appear to be the cellid.
So I have coded the receiver to pull the last two octets and construct a 16-bit GSM cellid. Most of the time it matches known cellids from the network. But quite often, the value does not match.
So I'm trying to find information on the following:
- How to properly transmit the location information in a safe manner (encodings, casts, etc)
- How to decode the information properly
- How to configure Kannel to honor binary location data
I've examined the following documents in my vain searching, but not found the relevant data:
GSM 03.38, GSM 04.07, GSM 04.08, GSM 11.15, as well as the WIG WML Spec V .4
Any insight into what I might be doing wrong would be appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个问题就不多说了! 我想总结一下我的发现,以防其他人发现它们有用:
需要发送 dcs 设置不等于 0 的消息。dcs="0" 发送打包的数据(尊重每个八位字节的低 7 位;这当最大消息大小实际上为 140 个八位字节时,允许 160 个字符的 SMS 消息)
需要以二进制安全方式解析数据:当二进制数据本身可能是这样时,遇到 0x0A 时停止搜索的正则表达式将失败需要
我发现不需要更改 Kannel 的默认配置。
干杯
免责声明:16 位 GSM Cell-Id 的安全传输需要处理一些我理解的设置,因为它们默认情况下没有配置。 我可能依赖过其他默认值,但我不知道它们可能会有所不同。
Not too many bites on this question! I wanted to summarize my findings in case others can find them useful:
Need to send messages with a dcs setting not equal to 0. dcs="0" sends data packed (honoring the lower 7-bits of each octet; this allows 160 character SMS messages when the max message size is actually 140 octets)
Need to parse the data in a binary safe manner: regex expressions that stop searching when 0x0A is encountered will fail when the binary data itself can be that value.
I found no need to change Kannel's default configuration.
Cheers
Disclaimer: Safe transmission of 16-bit GSM Cell-Ids requires dealing with a few settings that I understand only because they weren't configured by default. There are probably other defaults that I've depended on but am unaware that they can vary.
要解码位置信息,您需要查看 GSM 11.14 第 48 页
1.19 位置信息
移动国家代码 (MCC)、移动网络代码 (MNC)、位置区域代码 (LAC) 和
小区 ID 按照 TS GSM 04.08 [8] 进行编码。
根据个人经验,这里提到的第一个八位字节通常会被省略,因此前三个不变的字节是长度和国家/地区。 接下来的 2 个是网络运营商代码。
To decode the location info, you need to look in GSM 11.14 page 48
1.19 LOCATION INFORMATION
The mobile country code (MCC), the mobile network code (MNC), the location area code (LAC) and the
cell ID are coded as in TS GSM 04.08 [8].
From personal experience, the first octet mentioned here is usually left off, so your first three unchanging bytes are the length and the country. The next 2 are the network operator code.