Ejemplo n.º 1
0
def sms_alarm(participants, test):
  global gammu

  plist = []
  for p in participants:
    if p['phone_number'] != '':
       plist.append(p['phone_number'])
  if plist:
    # Start Gammu when we need it!
    if gammu == None:
      gammu = GammuSms(log)

    logstr = "Send SMS to: %s" % ", ".join(plist)
    log.info(logstr)
    for phone_number in plist:
      gammu.send_sms(phone_number, db.sms_notification(test))
Ejemplo n.º 2
0
def get_sms_credits():
  if db.use_sms():
    log.info("Try to get prepaid credits.")
    credit = GammuSms.get_credits(log)
    log.info("Prepaid credit is EUR %s." % credit)
    if credit != '--':
      db.save_credit(credit)