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. Wed Mar 12, 2025 20:06
SMSTools3 Community » Search Bottom

Page:  1  2  Next

Keywords:
Mode: All keywords (AND)
mfaisal: Hello, I need a script for the following scenario: If sms received from number 923452057192 then grep a text from incoming sms and then send a msg to the numbers mention in /home/uat/users.txt #more /home/uat/users.txt 923002316589 923452121569 923218200041
mfaisal: SUSE 10: 3.1.14: SOURCES: sources / package repository / from elsewhere... MOXA 110: ttyUSB0: serial / USB / some adapter... If you are asking for support, please fill out the information above. Delete this line. Thank you. send_sms() { FILE=`mktemp /tmp/send_XXXXXX` echo "To: $FROM" > $FILE echo "" >> $FILE echo -n "$2" >> $FILE FILE2=`mktemp /var/spool/sms/outgoing/send_XXXXXX` mv $FILE $FILE2 } if [ "$1" = "RECEIVED" ]; then FROM=`formail -zx From: < $2` TEXT=`sed -e '1,/^$/ d' < "$2"` grep -R $TEXT /usr/local/bin/* > /dev/null if test $? = 0 then exit else send_sms "$FROM" "Request is not macthed with Criteria" fi fi exit 0
mfaisal: Dear Keke, Now i acheived my target from the following script: ############################################# ALLOWED_NUMBERS=" 07895245312 " ############################################# send_sms() { FILE=`mktemp /tmp/send_XXXXXX` echo "To: $FROM" > $FILE echo "" >> $FILE echo -n "$2" >> $FILE FILE2=`mktemp /var/spool/sms/outgoing/send_XXXXXX` mv $FILE $FILE2 } if [ "$1" = "RECEIVED" ]; then FROM=`formail -zx From: < $2` key=" $FROM " if [[ $ALLOWED_NUMBERS == *$key* ]]; then TEXT=`sed -e '1,/^$/ d' < "$2"` if echo -n "$TEXT" | grep -i "daily" > /dev/null then /scripts/test else exit fi else send_sms "$FROM" "You are not authorized to perform this action" fi fi
mfaisal: Dear KeKe, Now script is working if number is matched with "ALLOWED_NUMBERS" but if number is not matched with "ALLOWED_NUMBERS" then does not generate a sms to sendder, as per my understanding my script is as follow, but i can't understand how can integarate a send_sms function in my script, please, please help me. #/bin/bash ########################## ALLOWED_NUMBERS=" 923002878358 " ########################## if [ "$1" = "RECEIVED" ]; then FROM=`formail -zx From: < $2` key=" $FROM " if [[ $ALLOWED_NUMBERS == *$key* ]]; then TEXT=`sed -e '1,/^$/ d' < "$2"` if echo -n "$TEXT" | grep -i "FW" > /dev/null then /scripts/test else send_sms() { FILE=`mktemp /tmp/send_XXXXXX` echo "To: $FROM" >> $FILE echo "Comment: MBL auto-answer" >> $FILE FILE2=`mktemp /var/spool/sms/outgoing/send_XXXXXX` mv $FILE $FILE2 send_sms "$FROM" "This Number only accept SMS" } fi fi fi
mfaisal: Dear Keke, Now my script is: ############################################## #!/bin/bash ALLOWED_NUMBERS=" 923212911018 923002878358 " if [ "$1" = "RECEIVED" ]; then FROM=`formail -zx From: < $2` key=" $FROM " if [[ $ALLOWED_NUMBERS == *$key* ]]; then TEXT=`sed -e '1,/^$/ d' < "$3"` if echo -n "$TEXT" | grep -i "FW" > /dev/null then /scripts/test else send_sms() { FILE=`mktemp /tmp/send_XXXXXX` echo "To: $2" >> $FILE echo "" >> $FILE echo "You are not Authorized to perform an action" >> $FILE FILE2=`mktemp /var/spool/sms/outgoing/send_XXXXXX` mv $FILE $FILE2 } fi fi fi ############################################## If i send a sms from 923212911018 that contain a word like "Fw", then logs says: GSM1: Exec: eventhandler encountered errors: GSM1: ! /usr/local/bin/smsd_eventhandler-script1.sh: line 12: : No such file or directory
mfaisal: Dear Keke, Now my script is: ############################################## #!/bin/bash #Script Created by FAISAL (m.faisal@meezanbank.com) ALLOWED_NUMBERS=" 923212911018 923002878358 " if [ "$1" = "RECEIVED" ]; then FROM=`formail -zx From: < $2` key=" $FROM " if [[ $ALLOWED_NUMBERS == *$key* ]]; then TEXT=`sed -e '1,/^$/ d' < "$3"` if echo -n "$TEXT" | grep -i "FW" > /dev/null then /scripts/test else send_sms() { FILE=`mktemp /tmp/send_XXXXXX` echo "To: $2" >> $FILE echo "" >> $FILE echo "You are not Authorized to perform an action" >> $FILE FILE2=`mktemp /var/spool/sms/outgoing/send_XXXXXX` mv $FILE $FILE2 } fi fi fi ############################################## If i send a sms from 923212911018 that contain a word like "Fw", then logs says: GSM1: Exec: eventhandler encountered errors: GSM1: ! /usr/local/bin/smsd_eventhandler-script1.sh: line 12: : No such file or directory
mfaisal: Dear Please correct my script, i dont understand where i made a mistake.
mfaisal: Dear Keke, As per my understanding or experience in Shell programming, i made a following script, I am requesting you please correct my script, i m very gratefull to you. Kindly consider this one. ************************************************** #!/bin/bash #Script Created by FAISAL (m.faisal@meezanbank.com) if [ "$1" = "RECEIVED" ]; then ALLOWED_NUMBERS="923212911016" FROM=`formail -zx From: < $2` key=" $FROM " if [[ $ALLOWED_NUMBERS == *$key* ]]; then TEXT=`sed -e '1,/^$/ d' < "$3"` if echo -n "$TEXT" | grep -i "FW" > /dev/null then /scripts/test if test $? = 0 then FILE=`mktemp /tmp/send_XXXXXX` echo "To: $FROM" >> $FILE echo "Your Requested Operation is in Progress" >> $FILE echo "" >> $FILE FILE2=`mktemp /var/spool/sms/outgoing/send_XXXXXX` mv $FILE $FILE2 else FILE=`mktemp /tmp/send_XXXXXX` echo "To: $FROM" >> $FILE echo "Your Requested Operation is failed!" >> $FILE echo "" >> $FILE FILE2=`mktemp /var/spool/sms/outgoing/send_XXXXXX` mv $FILE $FILE2 else FILE=`mktemp /tmp/send_XXXXXX` echo "To: $1" >> $FILE echo "You are not Authorized to perform an action" >> $FILE echo "" >> $FILE FILE2=`mktemp /var/spool/sms/outgoing/send_XXXXXX` mv $FILE $FILE2 exit **************************************************
mfaisal: Hello KEKE, As per my understanding or experience in Shell programming, i made a following script, I am requesting you yo please correct my script ***************************************************** if [ "$1" = "RECEIVED" ]; then ALLOWED_NUMBERS="923212911016 923468200033" FROM=`formail -zx From: < $2` key=" $FROM " if [[ $ALLOWED_NUMBERS == *$key* ]]; then TEXT=`sed -e '1,/^$/ d' < "$3"` if echo -n "$TEXT" | grep -i "FW" > /dev/null; then /scripts/test else send_sms() { FILE=`mktemp /tmp/send_XXXXXX` echo "To: $1" >> $FILE if [ "x$2" != "x" ]; then echo "Provider: $2" >> $FILE fi echo "You are not Authorized to perform an action" >> $FILE echo "" >> $FILE echo -n "$2" >> $FILE FILE2=`mktemp /var/spool/sms/outgoing/send_XXXXXX` mv $FILE $FILE2 } exit fi fi fi **************************************************
mfaisal: But how can i configure a reply msg that "You are not authorized to perform this action" to the number that not matched a list.
mfaisal: Operating system name and version: SUSE 10 Version of smsd: 3.1.14 Smsd installed from: sources Name and model of a modem / phone: Moxa U110 Interface: USB I made a following script to execute my operation related script if someone send a sms with contain word "fw", now i want to deploy some security means like if SMS received to specific numbers like "03452057192 03452409990 03432120500" then execute the script otherwise if number not matched than send a SMS with "You are not authrized to perform this action" ######################################## #!/bin/bash if [ "$1" = "RECEIVED" ]; then TEXT=`sed -e '1,/^$/ d' < "$2"` if echo -n "$TEXT" | grep -i "FW" >/dev/null; then /scripts/fw else exit fi fi ######################################
mfaisal: Please give me a rpm of new version.
mfaisal: Operating system name and version: FC7 Version of smsd: 3.0.10 Smsd installed from: rpm Name and model of a modem / phone: MOXA UPort 1110 Interface: ttyUSB0 2011-04-28 12:42:02,7, GSM1: <- ÏßïïïßÏïïï 2011-04-28 12:42:02,2, GSM1: Modem handler 0 terminated. 2011-04-28 12:42:06,7, GSM1: put_command expected (OK)|(ERROR), timeout occurred. 2011-04-28 12:42:06,7, GSM1: <- 2011-04-28 12:42:06,7, GSM1: -> 2011-04-28 12:42:06,7, GSM1: Command is sent, waiting for the answer 2011-04-28 12:42:11,7, GSM1: put_command expected (OK)|(ERROR), timeout occurred. 2011-04-28 12:42:11,7, GSM1: <- ïÿßÿ 2011-04-28 12:42:11,7, GSM1: -> AT 2011-04-28 12:42:11,7, GSM1: Command is sent, waiting for the answer 2011-04-28 12:42:17,7, GSM1: put_command expected (OK)|(ERROR), timeout occurred. 2011-04-28 12:42:17,7, GSM1: <- Ïßïïï 2011-04-28 12:42:17,7, GSM1: -> 2011-04-28 12:42:17,7, GSM1: Command is sent, waiting for the answer 2011-04-28 12:42:22,7, GSM1: put_command expected (OK)|(ERROR), timeout occurred. 2011-04-28 12:42:22,7, GSM1: <- ßÿßÿ 2011-04-28 12:42:22,7, GSM1: -> AT 2011-04-28 12:42:22,7, GSM1: Command is sent, waiting for the answer
mfaisal: Operating system name and version: SUSE 10.3 Version of smsd: 3.1.14 Smsd installed from: sources Name and model of a modem / phone: MOXA UPort 1110 Interface: USB Hi, if /var/log/smsd.log contain a following error, then email generate to sysadmin@mblonline.com: MODEM IS NOT REGISTERED, WAITING 1 SEC. BEFORE RETRYING
mfaisal: Operating system name and version: SUSE Linux 10.0 Version of smsd: 3.1.14 Smsd installed from: sources / package repository / from elsewhere... Name and model of a modem / phone: MOXA UPort 11x0 USB Interface: USB ERROR: 2011-02-24 12:55:36,5, GSM1: MODEM IS NOT REGISTERED, WAITING 1 SEC. BEFORE RETRYING 1. TIME 2011-02-24 12:55:37,5, GSM1: Signal Strength Indicator: (10,99) -93 dBm (Workable), Bit Error Rate: not known or not detectable
mfaisal: Hi, Please correct a following script: #!/bin/bash COUNTRY_CODE="91" ADMIN_TO="03212911018" EMAIL_GROUP="itops@mblonline.com" EMAIL_FROM="sms@mblonline.com" EMAIL="sysadmin@mblonline.com" MAIL="/bin/mail" send_sms() { FILE=`mktemp /tmp/send_XXXXXX` echo "To: $1" >> $FILE if [ "x$3" != "x" ]; then echo "Provider: $3" >> $FILE fi echo "Comment: MBL auto-answer" >> $FILE echo "" >> $FILE echo -n "$2" >> $FILE FILE2=`mktemp /var/spool/sms/outgoing/send_XXXXXX` mv $FILE $FILE2 } DATE=`date +"%Y-%m-%d %H:%M:%S"` FROM=`formail -zx From: < $2` FROM_TOA=`formail -zx From_TOA: < $2` MODEM=`formail -zx Modem: < $2` TEXT=`sed -e '1,/^$/ d' < $2` if [ "$1" = "CALL" ]; then if [ "x$FROM" != "x" ]; then if [ "${FROM:0:1}" = "0" ]; then FROM="$COUNTRY_CODE${FROM:1}" fi send_sms "$FROM" "This Number only accept SMS" if [ "x$ADMIN_TO" != "x" ]; then send_sms "$ADMIN_TO" "Got a call from $FROM at $DATE" SUBJECT=Got a Missed call from ${SUBJECT//FROM/$FROM} message="From: $EMAIL_FROM" Subject: $SUBJECT $MAIL -s "${SUBJECT}" "${EMAIL}" fi fi fi exit 0 OUTPUT OF SCRIPT: ./smsd_eventhandler-missedcall.sh: line 29: $2: ambiguous redirect ./smsd_eventhandler-missedcall.sh: line 30: $2: ambiguous redirect ./smsd_eventhandler-missedcall.sh: line 31: $2: ambiguous redirect ./smsd_eventhandler-missedcall.sh: line 32: $2: ambiguous redirect
mfaisal: Dear Keke, I am very gratefull to you. I need one more favour: send the sms to SENDER like: Thanks for SMS, we will contact you soon.
mfaisal: Hi, If any message sending failed then email its content to my email address sms@domain.com
mfaisal: Dear Keke, TEXT=`sed -e '1,/^$/ d' < "$2"` if echo -n "$TEXT" | grep "ITOPS" >/dev/null; then # Do the actions... fi above mention script grep the ITOPS word from the message and forward to the desiree group, but also i want to email the same message to my email group.
mfaisal: Thanks Keke I want to forward incoming SMS to my group as well as email to group address
mfaisal: Thanks keke, I am very gratefull to you. One more fever if i want email to it itops@domain.com
mfaisal: hElOo Keke, I want to forward selected msg to particular group. Like if msg contain ITOPS then forward to desiree group.
mfaisal: Hi Keke, According to you my script is: ############################## EMAIL="sysadmin@mblonline.com" MAIL="/bin/mail" EMAIL1="sms@mblonline.com" SUBJECT="New SMS received by $FROM" ############################## echo clear if [ "$1" == "RECEIVED" ]; then if [ -n "$EMAIL" ]; then FROM=`formail -zx From: < $2` sms=`cat $2` message="From: $EMAIL1 To: $EMAIL ${sms}" echo -n "$message" | $MAIL -s "$SUBJECT" "$EMAIL" fi fi But Sender mobile number is not attached with subject yet.
mfaisal: Hello, One more thing that i want : if i sent SMS from my mobile to my smstools number then smstools forward the sms to my desiree group.
mfaisal: Thanks keke, I need an one more favour, how can i grep the sender mobile number from the SMS and attached with Subject line

Page:  1  2  Next

SMSTools3 Community » Search Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.