First release for SMS Gateway Ultimate Android App

This commit is contained in:
Benjamin Renard 2017-11-14 17:34:28 +01:00
parent 698d7502b0
commit 12e06ba2dd

View file

@ -3,7 +3,7 @@
# #
# Mail2SMS # Mail2SMS
# #
# Postfix transport to sending SMS by using SMS Gateway Android App # Postfix transport to sending SMS by using SMS Gateway Ultimate Android App
# #
# SMS recipients are detected in call arguments and To, CC and BCC # SMS recipients are detected in call arguments and To, CC and BCC
# mail headers. The phone number detection mechamism look for a suite # mail headers. The phone number detection mechamism look for a suite
@ -20,7 +20,7 @@
# in master.cf : # in master.cf :
# #
# sms unix - n n - 1 pipe # sms unix - n n - 1 pipe
# flags=Rq user=nobody:nogroup argv=/usr/local/sbin/mail2sms ${user} # flags=Rq user=nobody:nogroup argv=/usr/local/sbin/mail2sms -H [SMS Host] -p [SMS Port] -s ${user}
# #
# in transport : # in transport :
# #
@ -32,13 +32,10 @@
# #
# Android App : # Android App :
# * Install this app : # * Install this app :
# https://play.google.com/store/apps/details?id=eu.apksoft.android.smsgateway # https://play.google.com/store/apps/details?id=com.icecoldapps.smsgatewayultimate
# * In App # * In App
# * In Settings screen : # * Add SMS Gateway and keep attention on port
# * check "Listen for HTTP send SMS commands" # * Start SMS gateway in main screen
# * check "Prevent CPU sleep mode" (adviced)
# * check "Start gateway automatically after phone boot" (adviced)
# * Start server in main screen
# #
# Usage : # Usage :
# #
@ -144,8 +141,9 @@ def send_sms(recipient, text):
start=stop start=stop
return True return True
url_params={ url_params={
'phone': recipient, 'smstype': 'sms',
'text': text.encode('utf8') 'smsto': recipient,
'smsbody': text.encode('utf8')
} }
if options.smspwd: if options.smspwd:
url_params['password']=options.smspwd url_params['password']=options.smspwd
@ -153,7 +151,7 @@ def send_sms(recipient, text):
url_parts=[ url_parts=[
'http', 'http',
'%s:%s' % (options.smshost, options.smsport), '%s:%s' % (options.smshost, options.smsport),
'/sendsms', '/send.html',
'', '',
urlencode(url_params), urlencode(url_params),
'' ''
@ -167,7 +165,7 @@ def send_sms(recipient, text):
logging.fatal('Fail to open URL %s : %s' % (url,e)) logging.fatal('Fail to open URL %s : %s' % (url,e))
return False return False
logging.debug(u'SMS gateway return : "%s"' % data) logging.debug(u'SMS gateway return : "%s"' % data)
if re.search('Mess?age SENT!', data): if re.search('The SMS has been sent', data):
return True return True
logging.error('Fail to send SMS. Gateway return : "%s"' % data) logging.error('Fail to send SMS. Gateway return : "%s"' % data)
return False return False
@ -181,7 +179,7 @@ def check_gateway_status():
logging.fatal('Fail to open URL %s : %s' % (url,e)) logging.fatal('Fail to open URL %s : %s' % (url,e))
return False return False
logging.debug(u'SMS gateway return : "%s"' % data) logging.debug(u'SMS gateway return : "%s"' % data)
if re.search('Welcome to SMS Gateway', data): if re.search('Text:', data):
return True return True
return False return False