linux - Gammu runonreceive doesnt passing variables -


i want configure rapsberry sms ping pong player. installed gammu-smsd , configured gammu-smsdrc follows:

# configuration file gammu sms daemon  # gammu library configuration, see gammurc(5) [gammu] # please configure this! port = /dev/ttyusb3 pin= 4135 connection = @ # debugging logformat = textall  # smsd configuration, see gammu-smsdrc(5) [smsd] runonreceive = sudo /var/spool/gammu/receivesms.sh service = files pin = 4135 # increase debugging information debuglevel = 1 logfile = /var/spool/gammu/gammu.log include_smsc = 491722270333  # paths messages stored inboxpath = /var/spool/gammu/inbox/ outboxpath = /var/spool/gammu/outbox/ sentsmspath = /var/spool/gammu/sent/ errorsmspath = /var/spool/gammu/error/ 

so far, sending sms receiving sms works fine!

so tried runonreceive thing. , wrote small script should sms sender number , text. , if text "ping" gammu-smsd should send pong sender.

reveivessms.sh:

#!/bin/sh from=$sms_1_number message=$sms_1_text reply=""  if test "$message" = "ping";     reply="pong!" else     reply="y u no play ping pong?" fi   sudo echo "$reply" | /usr/bin/gammu-smsd-inject -c /etc/gammu-smsdrc text "$from" 

gammu.log is:

wed 2016/05/25 09:04:31 gammu-smsd[21681]: received message from: +49160xxxxx wed 2016/05/25 09:04:31 gammu-smsd[21681]: read 1 messages wed 2016/05/25 09:04:31 gammu-smsd[21681]: received in20160525_090429_00_+49160xxxxxx_00.txt wed 2016/05/25 09:04:31 gammu-smsd[21994]: starting run on receive: sudo /var/spool/gammu/receivesms.sh in20160525_090429_00_+49160xxxxxx_00.txt  wed 2016/05/25 09:04:31 gammu-smsd[21681]: process finished wed 2016/05/25 09:04:53 gammu-smsd[21681]: found 1 sms "" text "y u no play ping pong?" cod 3 lgt 22 udh: t 1 l 0 dlr: -1 fls: -1 wed 2016/05/25 09:04:53 gammu-smsd[21681]: new message send: outc20160525_090431_00__sms0.smsbackup wed 2016/05/25 09:04:53 gammu-smsd[21681]: message without smsc, assuming want use 1 phone wed 2016/05/25 09:05:19 gammu-smsd[21681]: sms sent on device: "/dev/ttyusb3" status=500, reference=-1 wed 2016/05/25 09:05:19 gammu-smsd[21681]: error getting send status of message: unknown error. (unknown[27]) 

hmm no message replied...

so tried without passing parameters , changed receivesms.sh to:

#!/bin/sh sudo echo gude wie | /usr/bin/gammu-smsd-inject -c /etc/gammu-smsdrc text 49160xxxx 

and working. seems, variable passing receicesms.sh doesn't work. have no idea why?

getting run on receive send sms reply gammu-smsd-inject mission.

for else coming across issue. solved redirecting stdout , stderr of gammu-smsd-inject command /dev/null.

echo "this somehow works" | gammu-smsd-inject text $from > /dev/null 2>&1 

regards


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -