Dinossauro: I believe this is a simple task. Just use queues and use your script to control the number of messages.
devices = GSM01,GSM02,GSM03,GSM04
[your usual configuration goes here]
[queues]
ALL_MODEMS = /var/spool/sms/queue/all
GSM01 = /var/spool/sms/queue/GSM01
GSM02 = /var/spool/sms/queue/GSM02
GSM03 = /var/spool/sms/queue/GSM03
GSM04 = /var/spool/sms/queue/GSM04
[providers]
ALL_MODEMS = 0,1,2,3,4,5,6,7,8,9,s
GSM01 = 0
GSM02 = 0
GSM03 = 0
GSM04 = 0
And then, apply this diff to original sendsms. Not tested intensively but may to the job. This assumes that you will
sendsms GSM0[1 or 2 or 3 or 4] NUMBER "Message text" and control the limit of 50 in any other way.
The method allows you to send 50 messages to modem GSM01, 50 to GSM02 and so on, but do not control or distribute them..
45,56c45,46
< MODEM=$1
< DEST=$2
< TEXT=$3
<
< if [ -z "$MODEM" ]; then
< printf "Modem: "
< read MODEM
< if [ -z "$MODEM" ]; then
< echo "Cannot send without a modem defined."
< exit 1
< fi
< fi
---
> DEST=$1
> TEXT=$2
76c66
< if [ $# -gt 3 ]; then
---
> if [ $# -gt 2 ]; then
78c68
< while [ $n -gt 2 ]; do
---
> while [ $n -gt 1 ]; do
89d78
< echo "Modem: $MODEM"
92d80
<
126c114
< FILE=`mktemp "/var/spool/sms/queue/$MODEM"_XXXXXX`
---
> FILE=`mktemp /var/spool/sms/outgoing/send_XXXXXX`
Cheers
|
Dinossauro: Operating system name and version: Fedora 16/64
Version of smsd: 3.1.14
Smsd installed from: sources
Name and model of a modem: 30 Huawei E303C
Interface: USB
I'm running SMSTools3 in a pretty decent machine. With 8GB RAM and large and fast HDD. This machine use to be a mySQL server.
After long and frustrating struggle with USB changing ports and often spontaneous reboots (that turns out to be both due some bad USB hubs), I'm finally dealing with modems issues only.
My main problem right now its delivery rate and stability. I think I the speed would be very improved if I can solve this:
2012-09-13 16:12:39,5, GSM25: Took 22.2 seconds to get a file /var/spool/sms/queue/all/00306-28561669, lost 0 times, 157 SMS files and 28 LOCK files seen.
2012-09-13 16:12:40,5, GSM05: Took 22.2 seconds to get a file /var/spool/sms/queue/all/00306-28561670, lost 0 times, 156 SMS files and 28 LOCK files seen.
2012-09-13 16:12:40,5, GSM04: Took 11.8 seconds to get a file /var/spool/sms/queue/all/00306-28561683, lost 0 times, 142 SMS files and 28 LOCK files seen.
2012-09-13 16:12:42,5, GSM26: Took 10.9 seconds to get a file /var/spool/sms/queue/all/00306-28561687, lost 0 times,
This happened 3381 times just today .
web3:# tail -n30000 /var/log/smsd.log |grep Took|grep 2012-09-13|wc
3381 74382 551800
Do you guys have any ideas about?
The problem described here happened, so I'm using this slightly hacked version:
http://smstools3.kekekasvi.com/topic.php?id=892
Thanks to flo0, for this BTW...
Concerning instability I'm dealing with those errors 500. Maybe anyone can share a successful init string to this Huawei E303C modems?
2012-09-13 16:26:49,5, GSM13: Took 6.2 seconds to get a file /var/spool/sms/queue/all/00306-28562724, lost 0 times, 293 SMS files and 25 LOCK files seen.
2012-09-13 16:26:50,5, GSM30: SMS sent, Message_id: 180, To: X, sending time 4 sec.
2012-09-13 16:26:50,5, GSM08: SMS sent, Message_id: 131, To: X, sending time 4 sec.
2012-09-13 16:26:51,3, GSM22: The modem answer was not OK: +CMS ERROR: 500 (Unknown error)
2012-09-13 16:26:51,5, GSM22: Waiting 10 sec. before retrying
2012-09-13 16:26:51,5, GSM20: SMS sent, Message_id: 39, To: X, sending time 3 sec.
2012-09-13 16:26:52,5, GSM04: Took 12.8 seconds to get a file /var/spool/sms/queue/all/00306-28562720, lost 0 times, 297 SMS files and 25 LOCK files seen.
2012-09-13 16:26:53,5, GSM13: SMS sent, Message_id: 229, To: X, sending time 4 sec.
2012-09-13 16:26:53,5, GSM19: Took 14.3 seconds to get a file /var/spool/sms/queue/all/00306-28562718, lost 0 times, 299 SMS files and 25 LOCK files seen.
2012-09-13 16:26:53,5, GSM12: Took 14.7 seconds to get a file /var/spool/sms/queue/all/00306-28562719, lost 0 times, 298 SMS files and 25 LOCK files seen.
2012-09-13 16:26:54,5, GSM11: Took 11.8 seconds to get a file /var/spool/sms/queue/all/00306-28562722, lost 0 times, 295 SMS files and 25 LOCK files seen.
2012-09-13 16:26:54,3, GSM25: The modem answer was not OK: +CMS ERROR: 500 (Unknown error)
2012-09-13 16:26:54,5, GSM25: Waiting 10 sec. before retrying
2012-09-13 16:26:55,5, GSM04: SMS sent, Message_id: 20, To: X, sending time 3 sec.
2012-09-13 16:26:55,5, GSM14: Took 17.7 seconds to get a file /var/spool/sms/queue/all/00306-28562716, lost 0 times, 301 SMS files and 25 LOCK files seen.
2012-09-13 16:26:56,5, GSM09: Took 10.6 seconds to get a file /var/spool/sms/queue/all/00306-28562725, lost 0 times, 292 SMS files and 25 LOCK files seen.
2012-09-13 16:26:56,5, GSM19: SMS sent, Message_id: 142, To: X, sending time 3 sec.
2012-09-13 16:26:57,5, GSM10: Took 9.4 seconds to get a file /var/spool/sms/queue/all/00306-28562730, lost 0 times, 287 SMS files and 25 LOCK files seen.
2012-09-13 16:26:57,5, GSM11: SMS sent, Message_id: 220, To: X, sending time 3 sec.
2012-09-13 16:26:58,5, GSM29: Took 8.2 seconds to get a file /var/spool/sms/queue/all/00306-28562731, lost 0 times, 286 SMS files and 25 LOCK files seen.
2012-09-13 16:26:59,5, GSM14: SMS sent, Message_id: 22, To: X, sending time 4 sec.
2012-09-13 16:26:59,5, GSM09: SMS sent, Message_id: 206, To: X, sending time 3 sec.
2012-09-13 16:26:59,5, GSM12: SMS sent, Message_id: 40, To: X, sending time 6 sec.
2012-09-13 16:26:59,5, GSM05: Took 12.9 seconds to get a file /var/spool/sms/queue/all/00306-28562727, lost 0 times, 290 SMS files and 25 LOCK files seen.
2012-09-13 16:27:00,5, GSM10: SMS sent, Message_id: 21, To: X, sending time 3 sec.
2012-09-13 16:27:01,5, GSM15: Took 10.0 seconds to get a file /var/spool/sms/queue/all/00306-28562732, lost 0 times, 285 SMS files and 25 LOCK files seen.
This is 10s of my log.
An PHP Daemon check if the spool have less than 100 messages and any running modems and if so, reads from a remote database 400 messages, writing them directly to /var/spool/sms/queue/all , I used to do this using
file_put_contents( "$file", $content,LOCK_EX);
Which I change to
function ffile_put_contents($file,$content) {
if (file_put_contents( "$file.LOCK", $content,LOCK_EX) !== false){
rename("$file.LOCK",$file);
return true;
} else{
return false;
}
}
with no results.
This is the striped smsd.conf
devices = GSM01,GSM02,GSM03,GSM04,GSM05,GSM06,GSM07,GSM08,GSM09,GSM10,GSM11, GSM12,GSM13,GSM14,GSM15,GSM16,GSM17,GSM18,GSM19,GSM20,GSM21,GSM22,GSM23,GSM24,GSM25,GSM26,GSM27,GSM28,GSM29,GSM30
autosplit =0
loglevel = 5
eventhandler = /usr/src/smstools3/scripts/smsevent
ignore_outgoing_priority = yes
smart_logging = yes
stats = /var/spool/sms/stats
stats_interval = 30
stats_no_zeroes = no
status_signal_quality = yes
status_interval = 5
keep_filename = no
executable_check = yes
checked = /var/spool/sms/checked
incoming = /var/spool/sms/incoming
logfile = /var/log/smsd.log
failed = /var/spool/sms/failed
sent = /var/spool/sms/sent
outgoing = /var/spool/sms/outgoing
receive_before_send = no
[default]
init = AT^CURC=0
init2 = AT+CPMS="SM","SM","SM"
baudrate = 19200
trust_spool = yes
check_memory_method = 31
primary_memory = SM
voicecall_hangup_ath = yes
voicecall_ignore_modem_response = yes
report = yes
incoming = yes
outgoing = yes
cs_convert = yes
report_device_details = yes
max_continuous_sending = 1000
ussd_convert = 2
regular_run_cmd = AT+CUSD=1,"xxxx",15
regular_run_interval = 3600
regular_run_logfile = /var/log/creditsUSSD.txt
[queues]
ALL_MODEMS = /var/spool/sms/queue/all
GSM01 = /var/spool/sms/queue/GSM01
.
.
.
GSM30 = /var/spool/sms/queue/GSM30
[providers]
ALL_MODEMS = 0,1,2,3,4,5,6,7,8,9,s
GSM01 = 0
.
.
.
GSM30 = 0
[GSM01]
device = /dev/gsmmodem01
queues = ALL_MODEMS, GSM01
.
.
.
[GSM30]
device = /dev/gsmmodem30
queues = ALL_MODEMS, GSM30
Anyway I will be very grateful to any help to fix or improve this numbers.
Best regards,
|