SMS Server Tools 3
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. The forum is currently read-only, but will open soon. Tue Jul 01, 2025 01:40
SMSTools3 Community » Search Bottom

Page:  1

Keywords:
Mode: All keywords (AND)
Ines: Manually, not regular run and others.
Ines: Hello Please think about the possibility of creating an message with ussd codes, to send it from spool directory. For example: To: ignored or blank Type: ussd Suffix: 15 *109# or To: USSD Suffix: 15 *109# In this example smsd would send: AT+CUSD=1,"*109#",15
Ines: whether this modem can have 2 nodes/ports in linux? (sms and data simultaneously)
Ines: Especially for you ;) I sent in one time 15 text messages, my slow modem (phone nokia 6230) has sent 12 of them in 1 minute and 3 seconds. Its a over 13000 per day, about 6000 during business hours ;)
Ines: eventhadler with ticket system, etc... RECEIVED: sms functions from $ALLOWED_NO -> sms text: uptime password answer "X:y:Z up X days, 20:22, X users, load average: X, Y, Z" sms text: ip password answer "IP: X.Y.Z.Z" sms text: ping password answer "www.example1.com: 0% lost 192.168.0.2: 50% lost 172.19.64.2: 100% lost user1.examplelan.net: 0% lost" sms text: ping password 1.2.3.4 www.example2.com ftp.xyzexample.com answer "1.2.3.4: 0% lost www.example2.com: 50% lost ftp.xyzexample.com: 100% lost" sms text: reboot password answer "Reboot in progress" and execute reboot. sms text: blah no answering and log to syslog "Wrong command or password (blah)" From other numbers -> if number begins with "48" and hours are from 08:45 to 19:00 then example SMS: blah answer: "SMS Ticket no. 11/07/2 has been received and forwarded to specialists." forwarded to $WHOS sms: "Ticket no. 11/07/2 FROM_NUMBER: blah" and forwarded to $MAILTO mail if number begins with "48" and hours are from 19:01 to 08:44 then example SMS: blah answer: "SMS Ticket no. 11/07/2 has been received, will be checked as soon as posible." forwarded to $WHOS sms at 8:50 (am) hour: "Ticket no. 11/07/2 (11-07-03 22:32:39) FROM_NUMBER: blah" and forwarded to $MAILTO mail if not begins with "48" only sms to $MAILTO is send -------------------- CALL: if call is from number begins with "48" then hangup and sending SMS: "Only text messages are accepted. One-time info" number is saved to log, and will not be notified again other calls: only hangup and log. #!/bin/bash sys_log() { logger -t smsd-handler -i "$1 from no.: $FROM" } send_sms() { FILESMS=$(mktemp /var/spool/sms/outgoing/handler_send_XXXXXX) /bin/echo -e "To: $FROM\n\n$1" > $FILESMS } send_sms_night() { FILESMS=$(mktemp /var/spool/sms/myfiles/_ticket_night_send_XXXXXX) /bin/echo -e "To: $WHO\n\n$1" > $FILESMS } # /etc/crontab # after night: send at 8:50 # 50 8 * * * smsd find /var/spool/sms/myfiles/ -name "_ticket_night_send*" -type f -exec mv {} /var/spool/sms/outgoing/ \; >/dev/null send_sms_day() { FILESMS=$(mktemp /var/spool/sms/outgoing/_ticket_day_send_XXXXXX) /bin/echo -e "To: $WHO\n\n$1" > $FILESMS } reg_expr() { /bin/echo -n "$TEXT" | grep -i "$1" >/dev/null } if [ "$1" == "RECEIVED" ]; then ALLOWED_NO=" 12345678900 12345678901 12345678901 " FROM=$(formail -zx From: < $2) key=" $FROM " if [[ $ALLOWED_NO == *$key* ]]; then TEXT=$(sed -e '1,/^$/ d' < "$2") if reg_expr "uptime password"; then UPTIME=$(uptime) sys_log "Authorized uptime" send_sms "$UPTIME" elif reg_expr "ip password"; then IPU="$(ifconfig eth0| sed -n '/^[A-Za-z0-9]/ {N;/dr:/{;s/.*dr://;s/ .*//;p;}}')" sys_log "Authorized ip check" send_sms "IP: $IPU" elif reg_expr "ping password"; then TEXT=$(formail -I "" <$2|sed 's/ping password \?//'); if [ "$TEXT" == "" ]; then TEXT="www.example1.com 192.168.0.2 172.19.64.2 user1.examplelan.net" fi for ip in $TEXT; do ping="$ip: $(/bin/ping -qc5 -s1 $ip | grep transmitted | awk '{print $6}') lost\n"; pings+="$ping" done send_sms "$pings" sys_log "Authorized ping" elif reg_expr "reboot password"; then send_sms "Reboot in progress" sys_log "Authorized reboot" sleep 20; sudo /sbin/reboot # #/etc/sudoers # smsd ALL=NOPASSWD:/sbin/reboot else sys_log "Wrong command or password ($TEXT)" fi else sys_log "New SMS" # ^48 = my country code FROM_TMP="$(echo $FROM | grep ^48)" SMSTEXT="$(formail -I "" <$2)" # admin mail MAILTO="login1@example1.com" if [ -n "$FROM_TMP" ]; then MYTIME=$(date +%H%M) ISTIME=$(expr $MYTIME \> 0844)$(expr $MYTIME \< 1901) TICKET_NO_DATE=$(date +%g/%m) TICKET_FILE=/var/spool/sms/myfiles/tickets_no # IT specialists numbers. WHOS="12345678905 12345678906" if [ ! -f "$TICKET_FILE" ]; then echo 0 > "$TICKET_FILE" fi TICKET_NO=$(($(cat $TICKET_FILE)+1)) echo "$TICKET_NO" > "$TICKET_FILE" if [ "$ISTIME" = "11" ]; then /bin/echo -e "SMS Ticket no.: $TICKET_NO_DATE/$TICKET_NO\n$FROM: $SMSTEXT\n\n-- \nAutomatic info" | mail $MAILTO -s "SMS Ticket: $FROM" send_sms "SMS Ticket no. $TICKET_NO_DATE/$TICKET_NO has been received and forwarded to specialists." for where in $WHOS; do WHO="$where"; send_sms_day "Ticket $TICKET_NO_DATE/$TICKET_NO\n$FROM: $SMSTEXT" done else /bin/echo -e "SMS Ticket no.: $TICKET_NO_DATE/$TICKET_NO\n$FROM: $SMSTEXT\n\n-- \nAutomatic info" | mail $MAILTO -s "Night SMS Ticket: $FROM" send_sms "SMS Ticket no. $TICKET_NO_DATE/$TICKET_NO has been received, will be checked as soon as posible." SEND_TIME=$(formail -zx Sent: < $2) for where in $WHOS; do WHO="$where"; send_sms_night "Ticket $TICKET_NO_DATE/$TICKET_NO ($SEND_TIME)\n$FROM: $SMSTEXT" done fi else /bin/echo -e "SMS from: $FROM\n$SMSTEXT\n\n-- \nAutomatic info" | mail $MAILTO -s "SMS: $FROM" fi fi fi if [ "$1" == "CALL" ]; then # ^48 = my country code FROM=$(formail -zx From: < $2 | grep ^48) if [ -n "$FROM" ]; then LISTCALLS=/var/spool/sms/myfiles/listcalls if [ ! -f "$LISTCALLS" ]; then touch "$LISTCALLS" fi CALLGREP=$(grep "^$FROM$" "$LISTCALLS") if [ "$FROM" != "$CALLGREP" ]; then echo "$FROM" >> "$LISTCALLS" sys_log "Not listed CALL" send_sms "Only text messages are accepted. One-time info" else sys_log "Listed CALL" fi fi fi
Ines: #!/bin/bash MYTIME=$(date +%H%M) ISTIME=$(expr $MYTIME \> 0659)$(expr $MYTIME \< 2301) if [ "$ISTIME" = "11" ]; then { # # rest of the script # } fi If you dont want receive balance/expiration alert in the night. In this example script run only from 7:00 to 23:00 (after 0659, before 2301)
Ines: Oh yes... to little sleep ;) Thx
Ines: # Global configuration devices = Nokia-6230-play keep_filename = no hangup_incoming_call = yes voicecall_hangup_ath = no autosplit = 3 decode_unicode_text = yes internal_combine = yes #alarmhandler = /usr/bin/.alarm #alarmlevel = 7 loglevel = 5 eventhandler = /usr/bin/.eventhandler #blacklist = /etc/smstools/blacklist whitelist = /etc/sms.wlist 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 phonecalls = /var/spool/sms/phonecalls sent = /var/spool/sms/sent stats = /var/log/smstools/smsd_stats # Modem configuration [Nokia-6230-play] init = AT+CPMS="SM","ME","MT" # tested without any custom inits init2 = AT+CNMI=2,0,0,1,0 device = /dev/ttyACM0 check_memory_method = 2 # tested with 1 incoming = yes baudrate = 115200 # tested with 9600 to 460800 report_device_details = no admin_to = MY_NO adminmessage_limit = 6
Ines: Operating system name and version: Linux Ubuntu 8.04.4 LTS Version of smsd: 3.1.14 Smsd installed from: sources Name and model of a phone: Nokia 6230 Interface: DKU-2 (USB) My smsd doesnt report CALL, i checked this with syslog (logger $1 $2) in eventhandler, alarmhandler (echo $1 to $6). RECEIVED and other actions are reported. Only CALL doesnt. In smsd.log is only "Unexpected input: RING", and normal ending call action. In phonecalls dir doesnt exist any call file. No alarm, and other errors. Any idea?
Ines: i changed last time end of the script "not authorized" section is a crap ;) sleep 20; sudo /sbin/reboot else exit fi else sys_log "New SMS" MAILTO="my@mail.address" SMSTEXT="$(formail -I "" <$2)" SMSFROM="$(formail -zx From: < $2)" /bin/echo -e "SMS from: $SMSFROM\n$SMSTEXT" | mail $MAILTO -s "SMS: $SMSFROM" fi fi if number isn't in ALLOWED_NO then sms is forwarded to my mail address.
Ines: Errata: sleep 20; sudo /sbin/reboot else sys_log "Unauthorized action" # or ##send_sms "You are not authorized" exit fi else # nothing exit fi fi
Ines: #!/bin/bash # system log sys_log() { logger -t smsd-handler -i "$1 from no.: $FROM" } # write sms to smsd send_sms() { FILETMP=$(mktemp /tmp/_tmp_handler_send_XXXXXX) # \n = new line /bin/echo -e "To: $FROM\n\n$1" > $FILETMP FILESMS=$(mktemp /var/spool/sms/outgoing/handler_send_XXXXXX) mv "$FILETMP" "$FILESMS" } # expression for if reg_expr() { /bin/echo -n "$TEXT" | grep -i "$1" >/dev/null } if [ "$1" == "RECEIVED" ]; then # allowed numbers ALLOWED_NO=" 12345678900 12345678901 12345678902 " FROM=$(formail -zx From: < $2) key=" $FROM " if [[ $ALLOWED_NO == *$key* ]]; then TEXT=$(sed -e '1,/^$/ d' < "$2") # UPTIME check if reg_expr "uptime password"; then UPTIME=$(uptime) sys_log "Authorized uptime" send_sms "$UPTIME" # PING check elif reg_expr "ping password"; then # ping function my_ping() { /bin/ping -qc5 -s1 $1 | grep transmitted } status1=$(my_ping 192.168.0.2) status2=$(my_ping 192.168.1.2) set $status1 n1=$6 set $status2 n2=$6 sys_log "Authorized ping" send_sms "Ping lost:\n# N1: $n1 # N2: $n2" # REBOOT elif reg_expr "reboot password"; then send_sms "Rebooting Server" sys_log "Authorized reboot" sleep 20; sudo /sbin/reboot else # nothing exit fi else sys_log "Unuthorized action" # or ##send_sms "You are not authorized" fi fi Reboot perms for smsd (/etc/sudoers): smsd ALL=NOPASSWD:/sbin/reboot Small example for others
Ines: Description: send alerts reported by various system monitors, mails notify, etc.... Usage: Private Number of users: 5 Deployment: 1 organization Volume of 160-character SMs per day: 20 (typical) Hardware: 3 x PC linux server, 1 x Nokia 6230 with DKU-2 I use phone connected to master server and two servers connected via ser2net (serial to network proxy) [sms daemon with network client would be better]

Page:  1

SMSTools3 Community » Search Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.