Archive

Posts Tagged ‘gammu-smsd’

Using gammu-smsd with multiple phone

July 27, 2010 57 comments

This mini tutorial will show you how to use gammu-smsd with multiple modem.

The idea of using multiple modem is you want to have backup on your system, or you want to use some scheduler where the first modem work on the day and the second one works on the night, or anything else, it’s depends on your need.

In this implementation, i’m using gammu 1.28 (compilled with MySQL support) and my modem is Sierra Wireless Aircard 881 and Wavecom Fasttrack Supreme WM20392.

OK, now let’s create smsdrc config for these two modem. You can put it anywhere, i’m choosing /etc/.smsdrc-sierra and /etc/.smsdrc-fasttrack.

This is /etc/.smsdrc-sierra configuration:

[gammu]
device = /dev/tty.sierra05
connection = at115200

[smsd]
service = MYSQL
PIN = 1234
logfile = /etc/.smsdlog-sierra
debuglevel = 255
phoneid = sierra

user = root
password = password
pc = localhost
database = kalkun

And /etc/.smsdrc-fasttrack configuration:

[gammu]
device = /dev/tty.PL2303-0000101D
connection = at115200

[smsd]
service = MYSQL
PIN = 1234
logfile = /etc/.smsdlog-fasttrack
debuglevel = 255
phoneid = fasttrack

user = root
password = password
pc = localhost
database = kalkun

Now, you can run each daemon by passing configuration parameter on it:

$ gammu-smsd -c /etc/.smsdrc-sierra

and

$ gammu-smsd -c /etc/.smsdrc-fasttrack

As you can see, the configuration for this two modem is almost the same, except for one thing, phoneid. phoneid is the key, it’s unique string for every modem you’ve configured. So, if you want to send sms through the first modem (in this case, it’s sierra), you have to specified this in your CreatorID and SenderID field on outbox parameter, for example the SQL statement should be something like this:

INSERT INTO outbox (DestinationNumber, TextDecoded, SenderID, CreatorID, Coding) VALUES (‘123456’, ‘Hi, this is sierra.’, ‘sierra’, ‘sierra’, ‘Default_No_Compression’);

Or you can easily do that with gammu-smsd-inject:

$ gammu-smsd-inject -c /etc/.smsdrc-sierra TEXT 123456 -text “Hi, this is sierra.”

Where 123456 is your destination number, you’ve to change it.

So, if you want to send sms over the second modem (in this case, fasttrack), it’s should be like this:

INSERT INTO outbox (DestinationNumber, TextDecoded, SenderID, CreatorID, Coding) VALUES (‘123456’, ‘Hi, this is fasttrack.’, ‘fasttrack’, ‘fasttrack’, ‘Default_No_Compression’);

Or, if you are using gammu-smsd-inject:

$ gammu-smsd-inject -c /etc/.smsdrc-fasttrack TEXT 123456 -text “Hi, this is fasttrack.”

OK, now sending sms over multiple modem is works like a charm.

Now, you may ask, how to detect incoming sms comes from which modem? sierra or fasttrack?

The answer is look at the RecipientID from the inbox table, it’s show which modem has the incoming sms. Quick SQL code to get incoming sms from specific modem:

SELECT * FROM inbox where RecipientID=’sierra’;

Or, if you want to get incoming sms from fasttrack:

SELECT * FROM inbox where RecipientID=’fasttrack’;

That’s all for multiple modem 😀
Kalkun should have this feature in the future 🙂

Advertisements