Tuesday, October 9, 2012

Send and receive SMS using GSM modem or phone on Ubuntu | TechyTalk.info

Send and receive SMS using GSM modem or phone on Ubuntu | TechyTalk.info.

#go to terminal and give the msg as below
#sudo python sms.py 'CellNumber Msg you want to send'
import gammu
import sys

def main():
    words = sys.argv[1].split(None, 1)
    dest = words[0]
    msg = words[1]
    print msg + "-----" + dest
    #return

    sms = gammu.StateMachine()
    sms.ReadConfig()
    sms.Init()

    message = {
        'Text': msg,
        'SMSC': {'Location': 1},
        'Number': destinationNumber,
    }
    print sms.SendSMS(message)

if  __name__ =='__main__':
    main()

No comments:

Post a Comment