title: Embedding GSM cellids in Short Messages
body: <p>I'm using the WML function "providelocalinfo" to put location information into Short Messages send via a WIB menu on a GSM handset.</p>
  
  <p>I'm using the WIG WML v.4 Spec from SmartTrust. The relevant section is "9.4 providelocalinfo Element"</p>
  
  <p>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.</p>
  
  <p>Here's the code that I'm using, with the exception of [myservicecentre] being my actual service centre: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;!DOCTYPE wml PUBLIC "-//SmartTrust//DTD WIG-WML 4.0//EN"
    "http://www.smarttrust.com/DTD/WIG-WML4.0.dtd"&gt;
  &lt;wml wibletenc="UCS2"&gt;  
  
    &lt;card id="s"&gt;
      &lt;p&gt;
        &lt;providelocalinfo cmdqualifier="location" destvar="LOC"/&gt;
        &lt;setvar name="X" value="loc=" class="binary"/&gt;
        &lt;sendsm&gt;
            &lt;destaddress value="367"/&gt;
            &lt;userdata docudenc="hex-binary" dcs="245"&gt;
                $(X)$(LOC)
            &lt;/userdata&gt;
            &lt;servicecentreaddress value="[myservicecentre]"/&gt;
        &lt;/sendsm&gt;
      &lt;/p&gt;
    &lt;/card&gt;
  &lt;/wml&gt;
  </code></pre>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>So I'm trying to find information on the following:</p>
  
  <ol>
  <li>How to properly transmit the location information in a safe manner (encodings, casts, etc)</li>
  <li>How to decode the information properly</li>
  <li>How to configure Kannel to honor binary location data</li>
  </ol>
  
  <p>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</p>
  
  <p>Any insight into what I might be doing wrong would be appreciated!</p>