|
|
SMS Server Tools 3 Community |
Welcome, Guest. The forum is currently read-only, but will open soon. |
Fri Nov 22, 2024 05:13 |
This topic is locked
Page: 1
Author |
Post |
|
#1 Fri Feb 26, 2010 09:41, 179 months ago.
|
Member
Registered: Feb 2010
Location: China
|
Operating system name and version: CentOS 5.3 Version of smsd: 3.0.10 Smsd installed from: EPEL package repository Name and model of a modem / phone: Motorola A1200r (Ming) Interface: USB Hi folks, First, thanks to Stefan, Keke and everyone who contributed to SMSTools. It is really nifty. I'm setting it up so my server can send alerts when something breaks. I just discovered the tool last night, and had it up and running in just a couple of hours. I've already reached this goal, but I noticed a problem along the way. SMSTools will ignore incoming SMS. The msg is received on the phone. The smsd log file shows the message is there, but nothing is ever created in the incoming directory. I'm hoping someone can make a suggestion for what to look for to debug this issue. My setup. /etc/smsd.conf/var/log/smsd/smsd.log(extract) new msg is receivedSELinux is enabled, but nothing is showing up in the audit logs. Setting selinux to permissive does not change anything. P.S. I use INIT of at+cpms="SM" because I don't want smsd sorting through 4096 empty mail slots in the phone's memory.
|
|
#2 Fri Feb 26, 2010 11:17, 179 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Thank's for your brief report. As the answer from the modem seems to follow GSM 07.05 specification, I see no other reason than that the answer does not contain <CR> characters. There are <LF> characters, as the log has linefeeds shown. However, there should be both <CR> and <LF> as the definition says. If my guess is correct, we have to change the code. I assume that the firmware of a modem cannot be altered. Hopefully you can compile smsd from sources... Download the latest version, 3.1.6 or 3.1.7beta and extract it into the /usr/local/src directory. Go to the /usr/local/src/smstools3/src. Edit smsd.c using some of your favourite editor. Find "Trying to get stored message". You will see the following piece of a code. Insert those lines which are colored to the place shown. writelogfile(LOG_INFO, 0, "Trying to get stored message %i",sim); sprintf(command,"AT+CMGR=%i\r",sim); // 3.1beta3: Some modems answer OK in case of empty memory space (added "|(OK)") if (put_command(command, answer, sizeof(answer), 1, "(\\+CMGR:.*OK)|(ERROR)|(OK)") == -2) return -2;
if (!strchr(answer, '\r')) { char *p;
while ((p = strchr(answer, '\n'))) *p = '\r'; }
if (strstr(answer,",,0\r")) // No SMS, because Modem answered with +CMGR: 0,,0 return -1; if (strstr(answer,"ERROR")) // No SMS, because Modem answered with ERROR return -1;
Save, make and test. Let me know about the results. I do not yet publish a new version, because this issue was not verified.
|
|
#3 Tue Mar 02, 2010 00:01, 179 months ago.
|
Member
Registered: Feb 2010
Location: China
Topic owner
|
Hi keke, No joy with 3.1.6. smstools aborts with or without the patch. I'll try 3.1.7Beta. FYI: Here is what I got with 3.1.6....
|
|
#4 Tue Mar 02, 2010 00:05, 179 months ago.
|
Member
Registered: Feb 2010
Location: China
Topic owner
|
3.1.7Beta is equally unhappy. (no patch)
|
|
#5 Tue Mar 02, 2010 00:34, 179 months ago.
|
Member
Registered: Feb 2010
Location: China
Topic owner
|
Unfortunately, plugging the patch into 3.0.10 doesn't fix anything either.
Also, I inserted a printf into the patch and ran smsd -t , and the output is never seen.
|
|
#6 Tue Mar 02, 2010 13:29, 179 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Problem with a PIN is caused by the quotation marks which are received from a modem. This can be fixed in the modeminit.c: writelogfile(LOG_INFO,modemname,"Checking if modem needs PIN"); put_command(modem,modemname,send_delay,"AT+CPIN?\r",answer,sizeof(answer),50, cpin_expect);
while ((p = strchr(answer, '"'))) strcpy(p, p + 1);
if (strstr(answer,"+CPIN: SIM PIN") && !strstr(answer, "PIN2"))
However, better not to use a PIN while other issues are still unresolved... I do not understand why your system does not accept incoming messages . It seems that there is nothing wrong in the answer from a modem, and the answer and PDU should be handled correctly by the smsd code. Hopefully you can do one more test: Stop the smsd if it's running. Remove the smsd.log file. Send an SMS to your device (while smsd is not running). Start the smsd, use the original version 3.0.10. When you can see from the log that a message was tried to handle, stop the smsd. Now, do not alter smsd.log with any editor. Create a dump of it: hexdump -C < /var/log/smsd.logShow this dump here. It may be long, but I can make it shorted, if necessary, after I have seen what character there is actually in the log.
|
|
#7 Wed Mar 03, 2010 06:23, 179 months ago.
|
Member
Registered: Feb 2010
Location: China
Topic owner
|
The removal of the double quotes fixed the modem init problem in 3.1.6. (I don't use a PIN anyway.) This is from 3.0.10. Just before the extra code you provided to convert 0x0a to 0x0d, I added a It shows there is a CR+LF at the end of each part. That might explain why the extra code didn't seem to do anything. But, it is also different from what is normally output to the log file, and that puzzles me.
|
|
#8 Wed Mar 03, 2010 06:25, 179 months ago.
|
Member
Registered: Feb 2010
Location: China
Topic owner
|
CR+LF would obviously throw off the END2=BEGIN1+1 logic in the code after that.
|
|
#9 Wed Mar 03, 2010 06:35, 179 months ago.
|
Member
Registered: Feb 2010
Location: China
Topic owner
|
Ah yes, that's it. I made this change in 3.1.0, and msgs start appearing in the incoming dir.
begin1=strstr(answer,"+CMGR:"); if (begin1==0) return -1; end1=strstr(begin1,"\r"); if (end1==0) return -1;
if ( strstr(begin1,"\r\n") ) { begin2=end1+2; } else { begin2=end1+1; }
end2=strstr(begin2+1,"\r"); if (end2==0) return -1;
|
|
#10 Wed Mar 03, 2010 12:03, 179 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Thanks for the information and the extra logging code. It shows that there is double line-ending used by the modem. Your fix works, but I will include this kind of a fix in the next version: writelogfile(LOG_INFO, 0, "Trying to get stored message %i", sim); sprintf(command, "AT+CMGR=%i\r", sim); // 3.1beta3: Some modems answer OK in case of empty memory space (added "|(OK)") if (put_command(command, answer, sizeof(answer), 1, "(\\+CMGR:.*OK)|(ERROR)|(OK)") == -2) return -2;
while ((begin1 = strchr(answer, '\n'))) *begin1 = '\r';
while ((begin1 = strstr(answer, "\r\r"))) strcpy(begin1, begin1 +1);
if (strstr(answer, ",,0\r")) // No SMS, because Modem answered with +CMGR: 0,,0 return -1; if (strstr(answer, "ERROR")) // No SMS, because Modem answered with ERROR return -1;
|
This topic is locked
Page: 1
Time in this board is UTC.
|
|
|
|
|
|
|