|
|
SMS Server Tools 3 Community |
Welcome, Guest. The forum is currently read-only, but will open soon. |
Sat Jul 27, 2024 03:21 |
This topic is locked
Page: 1
Author |
Post |
|
#1 Wed Aug 26, 2009 11:45, 181 months ago.
|
Member
Registered: Aug 2009
Location: Poznan, Poland
|
Hello, I was wondering is it possible, to as a modem a query "*101#" which will check status of prepaid card. Of course it's possible and I have found a perfect solution for this on this forum. But I stuck on a different problem, I would like to store this answer to dataase. I tried to look inside of scripts/regular_run script, but it is working on files only and I don't know how can I ask modem through command line to get answer for my "*101#" question? When I use regular_run_cmd = ATDT*101# answer is in regular_run_statfile for reading once, then this file is deleted in the "next loop". I can see that when I try to use regular_run, regular_run_cmd is skiped, so I can't ask for this file content every loop. My smsd.conf (part with modem config): My regrular_run.sh (very simple to check can I grab the contents of a answer file): #!/bin/bash DATE=`date +"%Y-%m-%d %H:%M:%S"` ANSWER=`cat /var/log/smsd_regular_run_answer.log`
echo $DATE $ANSWER >> /tmp/tmp111
'bash' Syntax Highlight powered by GeSHi After starting I get this piece of log: Maby there's another way to grab answer and put this file into database? Regards Mikolaj
|
|
#2 Thu Aug 27, 2009 17:47, 181 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Thanks for your report. The regular_run script can be used to communicate with a modem because a modem port is close while running this script. However, I do not recommend this kind of usage, especially if you are not very familiar with some command line terminal interface. The regular_run_statfile is deleted on every loop because this file should contain the latest information, or nothing if there was no commands to run. Your script (regular_run.sh) could check if the file exists, like: If you can change and compile the source code of smsd, we can make this functionality much better: Currently regular_run is executed first. There usually is regular_run_statfile available while running regular_run, but it's from the previous run. With a small change to the code, we can get a better execution order: regular_run_cmdfile first, then regular_run_cmd's and regular_run script last. You still have to check the existence of a statfile, but when it's available, it's content is fresh. # diff -pu6 smsd.c smsd_changed.c Hopefully you can make and test this change. I will include this change in the next version, but it's not known when the next version is released. Probably not very soon... Any comments and feedback are welcome (as usual ![;)](./templates/default/smilies/wink.gif) ).
|
|
#3 Wed Sep 02, 2009 10:36, 181 months ago.
|
Member
Registered: Aug 2009
Location: Poznan, Poland
Topic owner
|
I will try to change this code... but I'm a little afraid of this ;-)
I'll let you know when I do that. But first I have to find out how to use this diff file ;-)
Regards Mikolaj
PS Can you give me an example how to ask modem in this regular_run.sh file to answer for this "ATDT*101#" ? I have no idea how to do that. I was looking for example on this forum but no results where found.
|
|
#4 Wed Sep 02, 2009 16:30, 181 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
mikolajj wrote I will try to change this code... but I'm a little afraid of this ;-)
I'll let you know when I do that. But first I have to find out how to use this diff file ;-) Actually, do not apply that previous batch...Like said, it changes the script regular_run to be executed last, but it's not enough. That script can be used to create commands for regular_run_cmdfile and therefore it should be executed first too. Here is a new patch for version 3.1.5. The script is executed twice, first time with an argument PRE_RUN. During this run, the script can create commands to regular_run_cmdfile. Next all cmd's are executed and last the script is executed with an argument POST_RUN. During this run, the script can examine regular_run_statfile and make some actions required. This patch can be applied to the original 3.1.5 smsd.c using the following command (running in src directory): patch < /tmp/patchfilediff -u smsd.c smsd_changed.c > /tmp/patchfilemikolajj wrote PS Can you give me an example how to ask modem in this regular_run.sh file to answer for this "ATDT*101#" ? I have no idea how to do that. I was looking for example on this forum but no results where found.
With this new patch you can use the regular_run.sh like:
|
|
#5 Tue Sep 08, 2009 11:47, 181 months ago.
|
Member
Registered: Aug 2009
Location: Poznan, Poland
Topic owner
|
Hurrayyy ;-)
It's working ;-)
Regards Mikolaj
|
|
#6 Tue Sep 08, 2009 12:01, 181 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Good. ![:)](./templates/default/smilies/smile.gif) Thanks for the information. This change will be included in the next version. Probably a new setting should be used to keep this feature backward compatible. Currently it may take up to three months until the next version is released.
|
This topic is locked
Page: 1
Time in this board is UTC.
|
|
|
![](images/shadow-topright.gif) |
|
![](images/shadow-bottomright.gif) |
|