YAS - Yet Another SMSC
a SIP Message Exchange Server and Framework

Introduction

This is a very basic, incomplete implentation of SIP Message RFC 3428 to somewhat act as a GSM SMSC would act.

License

This code is licensed under GPLv3.

Features

  • Work in conjunction with OpenBTS 2.4's SIP Message implementation
  • Handle shortcodes
  • Shortcode modules loaded dynamically, just add them to the current dir
  • Shortcode modules insulated from crashing smsc.py with try/except catch all
  • Shortcode "SDK" framework
  • Bounce unknown codes

    To Do

  • Map IMSI destinations to asterisk extensions by looping them back to OpenBTS
  • Send real PSTN bound text messages to a real exchange
  • Map inbound text messages from a real exchange to the IMSI
  • Make short code module imports secure

    How to Run

    Just run smsc.py under python. It will listen to a 5062 and transmit messages to the OpenBTS software on 5063 by default. Change the top of smsc.py if you want to reassign ports.

    How to Write Code

    When a shortcode comes in, the python script takes a look at the destination number. Then, it tries to see if it can attempt to import short_NNNNN, where NNNNN is a variable length destination number. Care should be taken as to who you let make calls, and what the destination number is.

    Your job is to write short_NNNN.py (for example, short_1337.py), and create just one function: moSMS(from number, destination number, text)

    After you have processed the request in a desired way, simply return a string, like: return str(some_variable) or return "hello world"

    Some examples exist such as short_1000 (directory service), short_1001 (echo service), and short_1002 (math service) to get you started.

    Right now, to keep things simple (heheh), messaging is synchronous. Eventually, there will be a process for silently receiving SIP Messages and transmitting them asynchronous.

    simulator.py and short_tester.py

    To help in development, simulator.py acts like OpenBTS. Simply type in: , and your message will be sent over SIP Message to the smsc.py server. You can test your short codes end-to-end this way.

    Alternately, there is short_tester.py. This is a simple script (you can probably write a better one), that invokes the short code module's only moSMS() function for testing purposes. Both source and destination numbers are faked, so type away for quick testing and development.

    Download

    Click here to access the directory