Last active
December 13, 2015 16:28
-
-
Save EduardoOliveira/19ab68564025a4bcb4c5 to your computer and use it in GitHub Desktop.
SMSProxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get install smstools | |
contents of /etc/smsd.conf: | |
# | |
# /etc/smsd.conf | |
# | |
# Description: Main configuration file for the smsd | |
# | |
devices = GSM1 | |
outgoing = /var/spool/sms/outgoing | |
checked = /var/spool/sms/checked | |
incoming = /var/spool/sms/incoming | |
logfile = /var/log/smstools/smsd.log | |
infofile = /var/run/smstools/smsd.working | |
pidfile = /var/run/smstools/smsd.pid | |
outgoing = /var/spool/sms/outgoing | |
checked = /var/spool/sms/checked | |
failed = /var/spool/sms/failed | |
incoming = /var/spool/sms/incoming | |
sent = /var/spool/sms/sent | |
stats = /var/log/smstools/smsd_stats | |
#loglevel = 7 | |
#delaytime = 10 | |
#errorsleeptime = 10 | |
#blocktime = 3600 | |
#stats = /var/log/smsd_stats | |
#stats_interval = 3600 | |
#stats_no_zeroes = no | |
#checkhandler = /usr/local/bin/smscheck | |
receive_before_send = no | |
# autosplit 0=no 1=yes 2=with text numbers 3=concatenated | |
autosplit = 3 | |
# store_received_pdu 0=no, 1=unsupported, 2=unsupported and 8bit, 3=all | |
#store_received_pdu = 1 | |
#validity = 255 | |
#decode_unicode_text = no | |
#internal_combine = no | |
# You can specify here an external program that is started whenever an alarm occurs. | |
# alarmhandler = /path/to/an/alarmhandler/script | |
# Specifies what levels start an alarmhandler. You can use value between 2 and 5. | |
# alarmlevel = 4 | |
# eventhandler = @EVENTHANDLER@ | |
#blacklist = /etc/smstools/blacklist | |
#whitelist = /etc/smstools/whitelist | |
#[queues] | |
# Commented lines are examples for germany | |
# D1 = /var/spool/sms/D1 | |
# D2 = /var/spool/sms/D2 | |
# O2 = /var/spool/sms/O2 | |
# EPLUS = /var/spool/sms/EPLUS | |
# QUAM = /var/sppol/sms/QUAM | |
# MOBILCOM = /var/spool/sms/MOBILCOM | |
#OTHER = /var/spool/sms/OTHER | |
#[provider] | |
# Commented lines are examples for germany | |
# D1 = 49160, 49170, 49171, 49175, 49151 | |
# D2 = 491520, 49162, 49172, 49173, 49174 | |
# O2 = 49176, 49179, 49159 | |
# EPLUS = 49163, 49177, 49178, 49157 | |
# QUAM = 49150 | |
# MOBILCOM = 49156 | |
#OTHER = 0,1,2,3,4,5,6,7,8,9 | |
[GSM1] | |
init = AT+CPMS="MT","MT","MT" | |
# # Windows: /dev/com1, Solaris: /dev/cua/a, Linux /dev/ttyS0 | |
device = /dev/ttyUSB0 | |
incoming = yes | |
# queues = OTHER | |
# You don't need a PIN for mobile phones | |
pin = xxxx ############################################################# INSERT PIN HERE! | |
# mode = new | |
# smsc = 491722270000 | |
baudrate = 19200 | |
# rtscts = yes | |
# cs_convert = yes | |
# report = no | |
# memory_start = 1 | |
# primary_memory = memory name | |
# secondary_memory = memory name | |
# secondary_memory_max = number | |
# pdu_from_file = /var/spool/sms/GSM1-PDU | |
# sending_disabled = no | |
# decode_unicode_text = no | |
# internal_combine = no | |
# | |
#[GSM2] | |
#init = ATE0 | |
# Windows: /dev/com2, Solaris: /dev/cua/b, Linux /dev/ttyS1 | |
#device = /dev/ttyS1 | |
#incoming = yes | |
#queues = OTHER | |
#You don't need a PIN for mobile phones | |
#pin = 2222 | |
#mode = new | |
#smsc = 491710760000 | |
#baudrate = 19200 | |
#rtscts = yes | |
#cs_convert = yes | |
#report = no | |
#memory_start = 1 | |
#primary_memory = memory name | |
#secondary_memory = memory name | |
#secondary_memory_max = number | |
#pdu_from_file = /var/spool/sms/GSM2-PDU | |
#sending_disabled = no | |
#decode_unicode_text = no | |
#internal_combine = no | |
#[GSM1] | |
#init = | |
#device = /dev/ttyS0 | |
#incoming = yes | |
#pin = | |
#baudrate = 19200 | |
###################################################################################################### | |
END CONTENT | |
###################################################################################################### | |
smstools restart | |
debug: failf /var/log/smstools/smsd.log | |
alow php access: | |
chmod 777 /var/spool/sms/outgoing/ | |
sendSMS.php | |
<?php | |
function shutdown(){ | |
var_dump(error_get_last()); | |
} | |
#Debug | |
#register_shutdown_function('shutdown'); | |
file_put_contents("/var/spool/sms/outgoing/".md5(time()), | |
"To:".$_GET['phone']."\n\n".$_GET['text']); | |
############################### EXAMPLE ############################### | |
https://someDomain.com/sendSMS.php?phone=351xxxxxxxxx&text=<INSERT MESSAGE HERE> | |
Based On: | |
http://blog.biolizards.be/setting-up-a-smsgateway-part1/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment