Michał Woźniak
Michał Woźniak

Reputation: 31

injecting AT command to gammu SMS daemon

I need to do call diverts(redirects) on SIM card which is used by gammu sms daemon all the time. The divert operation can be done few times per day. Gammu sms daemon is occupying communication with GSM modem 24h/day. I cannot send any AT command to port, while daemon is running. Gammu tool(not daemon) have ready to use commands to divert calls, and they work perfectly, while daemon is stopped. Of course, when daemon is running command correctly claims, that port is busy.

Is there any way to gently inject AT commands to gammu-smsd, and read the response?

My idea is to: 1. Stop daemon. 2. Perform call divert, read the result 3. Start daemon but this idea don't look like smart or elegant solution.

If injecting commands to sms daemon is not possible, is there any gentle way to stop the daemon not by killing process? I don't want to interrupt daemon work, while it is sending SMS.

Upvotes: 1

Views: 1368

Answers (1)

Michal Čihař
Michal Čihař

Reputation: 10091

You can use SIGUSR1 and SIGUSR2 to suspend and resume the daemon and use Gammu command line while SMSD is suspended.

See Gammu SMSD Signals Documentation for more information. There is even example for this:

SMSD_PID=`pidof gammu-smsd`
if [ -z "$SMSD_PID" ] ; then
    echo "Failed to figure out SMSD PID!"
else
    kill -SIGUSR1 $SMSD_PID
    gammu identify
    kill -SIGUSR2 $SMSD_PID
fi

Upvotes: 1

Related Questions