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. Fri Aug 29, 2025 15:24
SMSTools3 Community » Search Bottom

Page:  1

Keywords:
Mode: All keywords (AND)
jabss: Also made an adaptation to be able to re-charge the car with the prepaid vouchers: #!/bin/bash ############################################################ # # SIMPLE RECHARGE SCRIPT V1 # # Sends a "get balance" request to USBDEVICE_TOASK # Reads the answer from USBDEVICE_TOREAD # Can work in parallel with SMSTOOLS3 # Works with Huawei E220 HSDPA Modem # # JOAO SILVA 2019 - PORTUGAL # ########################################################### USBDEVICE_TOREAD=/dev/ttyUSB1 USBDEVICE_TOASK=/dev/ttyUSB0 GETBALANCE="'AT+CUSD=1,"*123#",15\r'" VOUCHERCODE=$1 RECHARGE="'AT+CUSD=1,"*123*$VOUCHERCODE#",15\r'" CHECKBALANCE="/bin/check-balance.sh" # THIS GETBALANCE & RECHARGE STRINGS ARE FOR LYCA MOBILE PORTUGAL ########################################################## # VERBOSE FLAG ########################################################## if [ -z "$1" ]; then # TESTS VERBOSE - Any argument will make it verbose echo "No argument supplied. You need to specify the voucher code as argument like:" echo "# recharge-lyca.sh <voucher-code>" verbose=0 exit else verbose=1 #echo "verbose ON. No message means everything is OK" echo "Charging LYCA card with voucher code $1" fi ########################################################## # VERBOSE FUNCTION ########################################################## verbose() { if [ "$verbose" = "1" ]; then echo $1 else sleep 0; fi } ########################################################## # LISTENING DAEMON FUNCTION ########################################################## ListeningDaemon() { while read line do alarm=`echo $line | awk -F ':' '{print $1}'` #alarm=`echo $line ` case $alarm in "+CUSD") saldo=`echo $line ` verbose "Result: $saldo" #echo "$saldo" exit 0 ;; esac done } # MAIN CURRENTBALANCE=`$CHECKBALANCE` echo -e "Current Balance is $CURRENTBALANCE\n" read -p "Are you sure you want to recharge SIM with voucher $VOUCHERCODE? " -n 1 -r echo # (optional) move to a new line if [[ $REPLY =~ ^[Yy]$ ]] then # do dangerous stuff echo -e "\nRecharging with code $VOUCHERCODE" # set baudrate for USB1 stty -F /dev/ttyUSB1 cs8 9600 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts #Send the "get balance" command to USBDEVICE_TOASK echo -e -n $RECHARGE > $USBDEVICE_TOASK #/dev/ttyUSB0 #Immediately try to read the answer in USBDEVICE_TOREAD ListeningDaemon <$USBDEVICE_TOREAD fi echo "Canceling... bye"
jabss: For whoever is interested, I've spend a few hours doing a much simpler script that fits my needs. Tested on a Huawei E220 HSDPA Modem with a LYCA Mobile Portugal SIM. You may need to adapt it to your case, so use with caution. #!/bin/bash ############################################################ # # SIMPLE CHECK BALANCE V1 # # Sends a "get balance" request to USBDEVICE_TOASK # Reads the answer from USBDEVICE_TOREAD # Can work in parallel with SMSTOOLS3 # Works with Huawei E220 HSDPA Modem # # JOAO SILVA 2019 - PORTUGAL # ########################################################### USBDEVICE_TOREAD=/dev/ttyUSB1 USBDEVICE_TOASK=/dev/ttyUSB0 GETBALANCE="'AT+CUSD=1,"*123#",15\r'" # THIS GETBALANCE STRING IS FOR LYCA MOBILE PORTUGAL ########################################################## # VERBOSE FLAG ########################################################## if [ -z "$1" ]; then # TESTS VERBOSE - Any argument will make it verbose #echo "No argument supplied" verbose=0 else verbose=1 echo "verbose ON. No message means everything is OK" fi ########################################################## # VERBOSE FUNCTION ########################################################## verbose() { if [ "$verbose" = "1" ]; then echo $1 else sleep 0; fi } ########################################################## # LISTENING DAEMON FUNCTION ########################################################## ListeningDaemon() { while read line do alarm=`echo $line | awk -F ':' '{print $1}'` case $alarm in "+CUSD") saldo=`echo $line | awk '{print $6}'` verbose "SALDO: $saldo" echo "$saldo" exit 0 ;; esac done } # MAIN # set baudrate for USB1 stty -F /dev/ttyUSB1 cs8 9600 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts #Send the "get balance" command to USBDEVICE_TOASK echo -e -n $GETBALANCE > $USBDEVICE_TOASK #/dev/ttyUSB0 #Immediately try to read the answer in USBDEVICE_TOREAD ListeningDaemon <$USBDEVICE_TOREAD
jabss: Solved with this config file: # # Description: Main configuration file for the smsd # devices = GSM1 incoming = /var/spool/sms/incoming outgoing = /var/spool/sms/outgoing checked = /var/spool/sms/checked failed = /var/spool/sms/failed sent = /var/spool/sms/sent logfile = /var/log/smsd.log eventhandler = /bin/event-handler.sh receive_before_send = yes autosplit = 3 loglevel = 7 [GSM1] #init = AT+CPMS="ME","ME","ME" init = AT+CPMS="MT" # AT+CPMS="MT" --> Read SMS messages from all storages on the mobile phone. For instance when the phone supports "ME" and "SM", the "MT" memory combines the "ME" and "SM" memories as if it was a single storage. device = /dev/ttyUSB0 incoming = yes pin = 0000 baudrate = 9600 report = yes #memory_start = 0 signal_quality_ber_ignore = yes
jabss: Hi, Can't get it to work. The script is returning " 1 ". The balance message is "O seu saldo sâ–’o e8.81. Obrigado por escolher a Lycamobile.", so no expiration date. The code to get the balance is "*123#" and this is a Huawei E220 HSDPA Modem connected to an OpenWRT router. I changed the settings accordingly but still no luck. Could it be because the modem device is /dev/ttyUSB0 and balance is being reported to /dev/ttyUSB1 ? My settings: get_balance_after=5 # 1 = get the balance after at least one message is sent. max_age=0 # an integer for hours, 0 = disable periodic checking. alert_balance=2 # an integer for "euros". alert_expiration=0 # an integer for days. alert_to="" ussd_command="AT+CUSD=1,\"*123#\",15" balance_prefix="o e" balance_suffix=". Obrigado" balance_expiration="" So far I have a manual, painful, way of checking the balance (see below) so using this automated script would help a lot. The errors I'm getting: 2019-02-26 11:48:32,6, GSM1: Running a regular_run (PRE_RUN) 2019-02-26 11:48:32,7, GSM1: Running regular_run (modem): /var/spool/sms/regular_run/GSM1.sh PRE_RUN "/var/spool/sms/regular_run/GSM1.statfile" GSM1 2019-02-26 11:48:32,3, GSM1: Done: regular_run (modem), execution time 0 sec., status: 256 (1) 2019-02-26 11:48:32,3, GSM1: ALERT: problem with regular_run (modem), result 1 2019-02-26 11:48:32,3, GSM1: Regular_run /var/spool/sms/regular_run/GSM1.sh PRE_RUN returned 1 2019-02-26 11:48:32,6, GSM1: Running a regular_run POST_RUN 2019-02-26 11:48:32,7, GSM1: Running regular_run_post_run (modem): /var/spool/sms/regular_run/GSM1.sh POST_RUN "/var/spool/sms/regular_run/GSM1.statfile" GSM1 2019-02-26 11:48:32,3, GSM1: Done: regular_run_post_run (modem), execution time 0 sec., status: 256 (1) 2019-02-26 11:48:32,6, GSM1: ALERT (continues, 2): problem with regular_run_post_run (modem), result 1 2019-02-26 11:48:32,3, GSM1: Regular_run /var/spool/sms/regular_run/GSM1.sh POST_RUN returned 1 2019-02-26 11:48:42,6, GSM1: Checking device for incoming SMS 2019-02-26 11:48:42,6, GSM1: Checking if modem is ready My procedure to check balance on a Huawei E220 HSDPA Modem (assuming that the modem is using /dev/ttyUSB0 and /dev/ttyUSB1): 1) Open two terminals (let's say A and B). 2) Terminal A: stty -F /dev/ttyUSB1 9600 3) Terminal A: cat /dev/ttyUSB0 (keep it going) 4) Terminal B: Open minicom, configure serial port to: /dev/ttyUSB0, 9600 8N1) 5) Terminal B: In minicom, write: AT+CUSD=1,"*123#",15 6) Check the balance in terminal A. Among several "^BOOT:xxxxx,x,x,x" messages, you shoud have the balance message. Any hint what might be wrong on the script? Thanks!
jabss: Operating system name and version: OpenWRT CHAOS CALMER (15.05.1, r48532) Version of smsd: Smsd v3.1.15 Smsd installed from: package repository Name and model of a modem / phone: Huawei Technologies Co., Ltd. E220 HSDPA Modem / E230/E270/E870 HSDPA/HSUPA Modem Interface: USB Hello, I'm using SMStools with an Huawei USB HSDPA pen in OpenWRT for years without any problem. Recently I had an outage and had to reinstall everything from scratch. SMStools3 haven't worked well since then. Although it can send SMS, it can't definitely receive it. Althought the smsd.conf file has been very simple, I've been tweaking it with parameters from other forum posts, but without success... To be honest, I'm also not 100% what I'm doing, just testing what have worked for others but now I'm not even able to send SMS because the daemon fails starting. Anyway, with an higher log level, I'm able to see a "+CME ERROR: 13 (SIM failure)". My first opinion was that what it says (SIM failure), but I've tried that SIM in my smartphone and I can send/receive SMS/calls. The SIM is from LYCAMobile Portugal, BTW. I've also tried a different USB modem (another Huawei with a different model), but the error remains. Any idea? # # Description: Main configuration file for the smsd # devices = GSM1 incoming = /var/spool/sms/incoming outgoing = /var/spool/sms/outgoing checked = /var/spool/sms/checked failed = /var/spool/sms/failed sent = /var/spool/sms/sent receive_before_send = no autosplit = 3 [GSM1] init = AT+CPMS="ME","ME","ME" device = /dev/ttyUSB0 incoming = yes pin = 0000 baudrate = 9600 Error log: root@Mojito:~# cat /var/log/smsd.log 2018-08-07 11:13:57,2, smsd: Smsd v3.1.15 started. 2018-08-07 11:13:57,2, smsd: Running as root:root. 2018-08-07 11:13:57,7, smsd: Running startup_check (shell): /var/spool/sms/incoming/smsd_script.UHJsSw /tmp/smsd_data.RdmnkX 2018-08-07 11:13:57,7, smsd: Done: startup_check (shell), execution time 0 sec., status: 0 (0) 2018-08-07 11:13:57,4, smsd: File mode creation mask: 022 (0644, rw-r--r--). 2018-08-07 11:13:57,5, smsd: Outgoing file checker has started. PID: 2104. 2018-08-07 11:13:57,7, smsd: All PID's: 2104,2106 2018-08-07 11:13:57,5, GSM1: Modem handler 0 has started. PID: 2106. 2018-08-07 11:13:57,5, GSM1: Using check_memory_method 1: CPMS is used. 2018-08-07 11:13:57,6, GSM1: Checking device for incoming SMS 2018-08-07 11:13:57,6, GSM1: Checking if modem is ready 2018-08-07 11:13:58,7, GSM1: -> AT 2018-08-07 11:13:58,7, GSM1: Command is sent, waiting for the answer 2018-08-07 11:13:58,7, GSM1: <- OK 2018-08-07 11:13:58,6, GSM1: Pre-initializing modem 2018-08-07 11:13:58,7, GSM1: -> ATE0+CMEE=1;+CREG=2 2018-08-07 11:13:58,7, GSM1: Command is sent, waiting for the answer 2018-08-07 11:13:58,7, GSM1: <- +CME ERROR: 13 (SIM failure) 2018-08-07 11:13:58,3, GSM1: Modem did not accept the pre-init string 2018-08-07 11:13:58,6, GSM1: Checking if modem needs PIN 2018-08-07 11:13:59,7, GSM1: -> AT+CPIN? 2018-08-07 11:13:59,7, GSM1: Command is sent, waiting for the answer 2018-08-07 11:13:59,7, GSM1: <- +CME ERROR: 13 (SIM failure) 2018-08-07 11:13:59,2, GSM1: PIN handling: expected READY, modem answered +CME ERROR: 13 (SIM failure), SIM failure 2018-08-07 11:13:59,2, GSM1: Modem handler 0 terminated abnormally. PID: 2106.

Page:  1

SMSTools3 Community » Search Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.