Recieving SMS from dbus

People in this thread have found out, how to add dbus listener, which would be triggered on incoming SMS. But SMS is encoded in-to a PDU string so it has to be decoded first. I've added support for this in-to latest (0.0.9) from ussd-comon package. You can use gsmdecode.decode_pdu (pdumsg) function, which would return to you something like this:
{'sender': '3656523',
  'timestamp': {
      'year': '10',
      'month': '03',
      'day': '13',
      'hour': '00',
      'second': '57',
      'minute': '48'
      'timezone': '12',}, 
  'pid': 0, 
  'user_data': 'Decoded SMS message ',
  'part': True,
  'udl': 132,
  'address_len': 18,
  'type': 64, 'dcs': 8,
  'type_of_address': 208}
But you should remember, that long SMS messages are just sequence of several messages. So you should check for 'part' element and if it is true you should accumulate messages somewhere. So your signal listener would look like this:
import gsmdecode
def callback(pdumsg, msgcenter, somestring, sendernumber):
        global message
        pdu = gsmdecode.decode_pdu (pdumsg)
        if pdu != None :
                print pdu
                print pdu['user_data']
                message += pdu['user_data']
                if not pdu['part']:
                        print message
                        message = ""
Check for None was added, because this signal is triggered for delivery notifications too. I hadn't nor time nor need to write PDU decoding for them, so decode_pdu returns None in such cases.