How to send WAP Push data through SMPP

After publishing the article on “How to send WAP Push data through SMPP”, there is a lot of requests on how to formulate the GSM SMS User Data.

Basically, the following is an example in java with remark in the code to explain how this is done:

  public String toSmsBinary() {
    /**
     GSM SMS User Data
     06: UDH Length which is 6
     05: 16 bit address
     04: Length(4)
     0B84: Destination Port(2948)
     23F0: Source Port(9200)
     
     Wireless Session Protocol 
     90: Transaction ID
     06: PDU Type(Push)
     01: Headers Length is 1
     AE: Content-Type is application/vnd.wap.sic
     
     */
    StringBuilder ud = new StringBuilder().append("0605040b8423f0900601ae");
    ud.append(toWBXML());
    return ud.toString();

  }

The above function creates the GSM SMS User Data and Wireless Session Protocol (WSP) header. Continue reading How to send WAP Push data through SMPP

Example to read MMS message and write to a file in Perl

This example is a simple subroutine to check whether the content is a MMS and write to a file. Combine the example in “Detect WAP browser and redirect to different url in Perl”, you can route the URL request to another URL if it is not a MMS content.

The subroutine “doRedirrect” is meant to do that, or you can do a simple print message to state that this requested URL is for MMS.

The following is the code for this:


sub doMMSC {
   my $class=shift;

   my $length = $ENV{'CONTENT_LENGTH'};

   if ($ENV{'CONTENT_TYPE'} ne "application/vnd.wap.mms-message") {
      &doRedirrect;
      return;
   }
   

   my $count = read(STDIN, $body, $length);
   if ($count == $length) {
      open ER, ">incoming.mms";
      print ER $body;
      close ER;    
   }

}