SMS gateway how to

So you’ve gotten the unsavory task of rewriting the SMS Gateway because the old one is coded in the C equivalent of level 1 code? You have extremely few specs and the old code makes you run for aspirin? What the hell do you do? Here is the walk through:

1.) First you need the specs for the protocols you are going to be working with. If you are lucky you only have to do SMPP, if you are less lucky you have to do UCP/EMI too. Read them carefully.
2.) If you have to do some serious trigger actions when these small messages drop in then I suggest you go with PostgreSQL. So download it and install, make sure you get the dev related stuff too, some headers I think.
3.) Download the libpqxx source and compile it as a static library, you might need headers from #2 to accomplish this.
4.) Download smppcxx and compile to a static library.
5.) Use docs and headers acquired in #2 to compile the triggers you need.
6.) Using your triggers and compiled libraries you can now proceed to actually code the main app. By now you should have gotten better specs from HQ.

Some tips: Make use of the kannel project if you can. Use a lot of C++/stdlib bling to make the code slick and tiny. Don’t try and use some kind of cygwin or mingw/msys environment to do this on windows, go with linux right away and save yourself a lot of pain. Fire up some nice ide like anjuta or kdev. I almost forgot, SMPPSim is a very nice tool to test with. Good luck! You’re gonna need it…

  • Digg
  • del.icio.us
  • blogmarks
  • Reddit
  • Simpy
  • StumbleUpon
  • Technorati
  • description
  • Ma.gnolia
  • Slashdot
  • Sphinn
  • Spurl

Related Posts

Compare UK Homeowner Loan Options
Compare cheap life insurance quotes

Tags: , , , , , , , , ,

Viewing 4 Comments

    • ^
    • v
    yes this is good, now how do i send it in arabic, the encoding / decoding bit
    • ^
    • v
    Yay my very first real comment!

    Jean: You have to check the spec for the version of smpp/emi(upc) that you will be using and how the operator you will be working with encodes arabic. I had this problem with special German characters.

    The solution is that you have to map them by replacing normal ascii characters, if the versions you will be working with won't allow for double byte character encodings. I had to work with GSM7 when I mapped special German characters. After you have your mapping tables finished you will probably have to store your arabic characters as double bytes in the PostgreSQL database.

    Be very careful now because PostgreSQL stores the characters in a mixed single and double byte sequence. Arabic will probably be mapped to values that won't make sense in the ascii range, that is how you can get to them. Your code has to realize that aha this is not an ascii character, but what character is it then? Look up in the Arabic to for instance GSM7 table, aha that arabic character will replace for instance "{", so we put an "{" in the SMS message instead and everything should be fine.

    I hope I made sense?
    • ^
    • v
    More useful links:
    http://en.wikipedia.org/wiki/Short_message_service
    www.netfunitalia.it/downloads/SMSC_EMI_Specific...

    Also clarification on the above: When I said it won't make sense in the ascii range I meant the first byte in each Arabic character.
    • ^
    • v
    Basically this is how it would work:

    Mass SMS service:
    Operator puts a message in the database -> this triggers a trigger which determines who to send to and calls the gateway with the proper parameters ->the gateway parses the message that comes from the database byte by byte and replaces each Arabic character with the proper ascii replacement -> the gateway now determines which operator(s) to send to -> the messages are sent to the operator Short Message Central or SMC which in turn transmits them to each cell phone.

    Service request SMS service:
    User sends a request to your service number with some kind of message -> the gateway parses the message and replaces each designated ascii character with the proper Arabic character -> the message is stored in the database -> a trigger gets triggered by this and alerts:

    1.) Another software that can deduce from the contents of the message what to answer and stores the answer in some table which in turn triggers another trigger so the reply gets sent back to the user. Examples are weather and stock quotes.

    2.) Instead of another software it is a human that sees the message and sends an appropriate message back. Examples are super premium services like personal horoscopes or why not booking a table at a restaurant.

Trackbacks

close Reblog this comment
blog comments powered by Disqus