[solved] SMS command not working

Hey there,
playSMS is a great tool and nice to handle if you have spend some times for testing :smile:

But I’m frustrated using SMS Command Module.

Scenario:
My Company is using PRTG for Monitoring reasons, sending Notification works fine (using scripts and gammu-smsd-inject, not playsms http api).
Now I want to Acknowledge an Alarm, PRTG provides an HTTP(s) API which works fine while manual testing.

I created an SMS_Command with the Keyword ‘ACK’, and PlaySMS reacts on the Keyword (Status in Reports -> All Feature Messages -> Keyword ACK) but playsms doesn’t run the script as I added to write in a test.log.
There is no logging for recognizing the keyword. The Directory itself is 777 chmodded.

Any Idea?

Edit config.php and set logstate to 3, then restart playsmsd

Do debug, run this command:

tail -f /var/log/playsms/playsms.log -n0 | test1.txt

And then run single test for keyword ACK

Anton

Logfile:
    2015-06-15 12:50:57 PID557ead29589cd admin L3 recvsms # isrecvsmsd:1 dt:2015-06-15 12:50:52 sender:+49151****** m:ACK 11610 test  receiver: smsc:
    - - 2015-06-15 12:50:57 PID557ead29589cd admin L3 gammu__incoming # sender:+4915111458579 receiver: dt:2015-06-15 12:50:52 msg:
    - - 2015-06-15 12:50:58 PID557ead29589cd admin L3 recvsmsd # id:98 dt:2015-06-15 12:50:52 sender:+49151****** m:ACK 11610 test  receiver: smsc:
    - - 2015-06-15 12:50:58 PID557ead29589cd admin L3 setsmsincomingaction # dt:2015-06-15 12:50:52 sender:+49151****** m:ACK 11610 test  receiver: smsc:
    - - 2015-06-15 12:50:58 PID557ead29589cd admin L3 sms__command # command_exec:/var/lib/playsms/sms_command/1/PRTG.sh '+49151*******' 'ACK' '11610 test'
    - - 2015-06-15 12:50:58 PID557ead29589cd admin L3 sms__command # command_output is empty
    - - 2015-06-15 12:50:58 PID557ead29589cd admin L3 setsmsincomingaction # feature:sms_command datetime:2015-06-15 12:50:52 sender:+49151******** receiver: keyword:ACK message:11610 test  raw:ACK 11610 test  smsc:

So it says command output is empty. If i run this script manually there is an Output.
The Output command in the script is: echo “You are not authorized to this Action”

Did you see what happenned after reading the log, carefully ?

Anton

What is happening?
the script should echo the text and (fur debug reasons) echo his Actions to a test.log

You ran exactly like this with the quote ?

/var/lib/playsms/sms_command/1/PRTG.sh '+49151*******' 'ACK' '11610 test'

with real number, of course

Anton

yes:

root@SD-SMS01:/var/lib/playsms/sms_command/1/PRTG.sh '+49151******' 'ACK' '11610 test'
    Sie sind nicht Autorisiert

Is it possible that your server config prevented shell_exec() function ?

see here at line 72:

anton

Okay, I tuned my script and it is working but I didn’t change anything of the echo command, more the fine tuning of the work flow. Also there is some data missing in between.

Unfortunately my other testscript doesn’t run, it just echoes system uptime and timestamp. I’ll post the log later but I think there is “no output” again.

Might there be another Folder, where the script is cached?

OK, so far so good.
My Output with echo works now (don’t know why). But there are several issues:
I can’t get any Output with curl, I think curl can’t be executed, So, the control of authorization (Number = User and Passwordhash) doesn’t work too.

Maybe I’ll create another script, which will be called by the SMS command. Let’s see, I’ll Report.

ok, Problem solved:
as WWW-data user, I can’t run curl and some other commands,

So i outsourced the Code to another script and when a sms command is recognized by Playsms the scripts calls the other scripts with sudo: sudo -i -u sms

It’s important to use the -i option to run the script in the sudo user enviroment!

is your playsmsd not running as root ?

anton