|
|
SMS Server Tools 3 Community |
Welcome, Guest. The forum is currently read-only, but will open soon. |
Fri Nov 22, 2024 04:55 |
This topic is locked
Page: 1 2 Next
Author |
Post |
|
#1 Tue Jul 28, 2009 15:52, 186 months ago.
|
Member
Registered: Jul 2009
Location: Bandung, Indonesia
|
Hi all, I try to make a system where client can send their sms (contained contact file in it that compressed) to server using sms gateway concept. In this case, server must handle 3 condition : registration, request sending file to server (by client), and request take file in server (by client, and server will be send it to client). In this case, I separate this plan by two side : client side and server side. In client side, I'm develop an application (jar) using J2ME that can read/write phonebook (in symbian S60), compression contact (client can select how many contact that they want to compress), and send it to server via sms. In this thread, I think I didn't need to tell it more, because out of topic. My application run well in my Nokia N81 when I test it. In server side, I'm use sms gateway concept to send and receive sms from and to client (also using database mysql). Database will saving 4 things (in 4 field) : ID client (generate by server in client registration phase), name+phone number of client (that contained in sms of registration), and file backup phone book (that send by client in sending file phase, in form of sms). My thread focus in server side. I want to make an script for the eventhandler (will be add on /etc/smsd.conf) that contain with that three condition above : 1. ) In registration phase. Check incoming sms from client that register to server via SMS. If incoming sms contain "reg" (not case sensitive), server will generate an ID for client (ie : Cxxx) and send a sms : "$name, thanks for registration. Your ID is $id_client_that_generated_by_server_after_client_registration" If sms didn't contain "reg", server will send client a sms "Sorry, your format is wrong. Type : REG#your_name". 2.) Request sending file to server (by client) phase. Check incoming sms from client that contain "KRM#id_client" (KRM not case sensitive). If incoming sms didn't contain "krm" and or wrong/not valid ID, server will send client a sms "The format of your sms and or your ID is wrong. Type KRM#ID" If it's true, server will send a sms to client :"$name, now you may send files to server". And after client send their file to server via sms and server received it, server will send sms report to client : "$name, your file was saved in the server". 3. Check incoming sms form client that contain "GET#id_client" (GET not case sensitive). If incoming sms didn't contain "get" and or wrong/not valid ID, server will send client a sms "your format of sms or your ID is wrong. Type GEt#ID" If it's true, server will send a sms to client :"$name, wait a minutes. We will send your file via SMS". I've try to write the script (based on example of sms server tools and also my friend) to solve my problem in server side above (but "reg" only, I can't for "krm" and "get" ), like this : I'm save it in /usr/local/bin as BUPB_handler (or in BUPB_handler.sh? ) and put a line in /etc/smsd.conf. The configuration like this : But unfortunatelly, it didn't run well. What's wrong with that? Hope you help me. Thanks. Regard
|
|
#2 Tue Jul 28, 2009 16:18, 186 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
You have several syntax errors in your script. For example: if ["$1" !="RECEIVED"]; then
should have more spaces: if [ "$1" != "RECEIVED" ]; then
While developing and testing a script, run it manually. When running inside the smsd, you cannot see error messages. It's also useful to add debugging lines, like echo "VARIABLE: $VARIABLE" to the script, they will help to see what probably goes wrong. Run: /usr/local/bin/BUPB_handler RECEIVED /var/spool/sms/incoming/GSM1.xxxxxx.
|
|
#3 Tue Jul 28, 2009 16:39, 186 months ago.
|
Member
Registered: Jul 2009
Location: Bandung, Indonesia
Topic owner
|
Thanks for your reply keke. I'll try it.
|
|
#4 Tue Jul 28, 2009 17:27, 186 months ago.
|
Member
Registered: Jul 2009
Location: Bandung, Indonesia
Topic owner
|
I put BUPB+handler in /usr/local/bin and chmod +x to it. But, why it show error message like this? What it's mean by /bin/sh^M ? Any suggestion? Help me please....
|
|
#5 Tue Jul 28, 2009 17:35, 186 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
It looks like your editor has saved the script file using CR characters. Use the editor which uses only LF for line termination.
You could also move to /bin/bash, in many cases it's more powerful. I have not checked if Fedora has it, but usually GNU/Linux has bash.
|
|
#6 Tue Jul 28, 2009 17:54, 186 months ago.
|
Member
Registered: Jul 2009
Location: Bandung, Indonesia
Topic owner
|
Ya, I'm use Kwrite before, and after that, I'm use vim and its show some character ^M there. After that, I run it again and still show the error message : ( Or vim also has saved the script file using CR characters?? Could you recommended me another editor which uses only LF for line termination? If yes, what's that? Help me please. Thanks. FYI : This is copy paste from my vim in terminal (konsole) : [root@astina-pura bin]#vim /usr/local/bin/BUPB_handler « Last edit by certain_death on Tue Jul 28, 2009 17:57, 186 months ago. »
|
|
#7 Tue Jul 28, 2009 18:11, 186 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Vim did show those characters but did not remove them.
You can use several methods to remove CR's, for example dos2unix command if it's available. If it's not, try: tr -d '\r' < original_file > cleaned_file
Then you can use vi, vim, joe, nano, any editor in the console, I think they will all work. Perhaps in Kwrite there is some setting for line ends, I cannot check this right now because any K* system is not up.
|
|
#8 Tue Jul 28, 2009 18:32, 186 months ago.
|
Member
Registered: Jul 2009
Location: Bandung, Indonesia
Topic owner
|
Hi keke, Thanks for your suggestion, it work I think it didn't show error again, isn't it? Oya, sorry, it must be console, not konsole. Forgive me. But, hey, why in /var/spool/sms/incoming I didn't see the message from sms that I send from my another phone? It work or not? This is some of log keke :
|
|
#9 Tue Jul 28, 2009 18:47, 186 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Ok, it didn't show error but you still used the original script? Or did you already fix it?
Your device uses ME memory for messages. In some cases, messages in this memory are indexed using different numbers than 1, 2 and so on. In the modem section of smsd.conf, insert the following line: check_memory_method = 3
Then restart the daemon. After this incoming messages should work.
|
|
#10 Tue Jul 28, 2009 18:47, 186 months ago.
|
Member
Registered: Jul 2009
Location: Bandung, Indonesia
Topic owner
|
I've try it again and found in /var/spool/sms/incoming my sms that contain : ref#jhon Seem that my modem received my sms and store it in that directory. But why my eventhandler didn't handling that using evenhandler script? The server must be send sms reply that said the format was wrong (reg, not ref). What's happen with this? Error in my evenhadler script (BUPB_handler) ? Or my phone (motorola) can receive my sms (and store it in /var/spool/sms/incoming) but can't auto reply as command as in evenhandler script? Need your help please.. Thanks.
|
|
#11 Tue Jul 28, 2009 19:08, 186 months ago.
|
Member
Registered: Jul 2009
Location: Bandung, Indonesia
Topic owner
|
As you suggest, I do that. But now, the problem is : I send sms from my phone to modem but my modem didn't store it to incoming folde (it only receive and show it in phone). I check the log and found like this : What it's mean by this? Quote 2009-07-29 02:03:39,3, C650: Modem did not accept the init string
What should I do now? FYI : I've fix my BUPB_handler and use it.
|
|
#12 Tue Jul 28, 2009 19:13, 186 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Your setup was working (at least for sending) but now it's broken... Why did you add the init string back, as far as I remember that issue was solved in the previous thread?? Remove it from the smsd.conf and try once again...
|
|
#13 Tue Jul 28, 2009 19:25, 186 months ago.
|
Member
Registered: Jul 2009
Location: Bandung, Indonesia
Topic owner
|
Ups...sorry for my fool OK, its run because of your suggestion Here the log : But, still, my modem didn't send me the sms report that tell me my mistake (I type ref, not reg, so that, as evenhandle command, modem must send me sms report about that error format)
|
|
#14 Tue Jul 28, 2009 19:58, 186 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
This message is a sent message, not received. Probably your device cannot be used for successful communication, be aware to moving to some real modem...
Your phone stores sent messages to the same memory where incoming messages are read. In any case, if you want to use this device as a modem, you should not use it as a phone anymore.
Have you checked the message file /var/spool/sms/incoming/C650.5knf03, what is in there?
For the future support, please update your global part of smsd.conf with the following line: store_received_pdu = 3
It is important to see what is there actually happening. In some cases, like right now, it is useful to see the message file content. If there is a PDU included, it's even better for resolving issues.
Your script was ill-formed, but I do not know why Fedora did not give any error messages. I do not have Fedora installed and will not install it at least very soon. Do you have a ssh connection open to your server, probably I could connect to it tomorrow?
|
|
#15 Fri Jul 31, 2009 16:24, 186 months ago.
|
Member
Registered: Jul 2009
Location: Bandung, Indonesia
Topic owner
|
Hai keke, Soryy for the late. I've headache for 2 days because of this >_< I've check file in /var/spool/sms/incoming/C650.5knf03 Here is C650.5knf03 using vim
|
|
#16 Fri Jul 31, 2009 16:34, 186 months ago.
|
Member
Registered: Jul 2009
Location: Bandung, Indonesia
Topic owner
|
Now using your suggestion store_received_pdu = 3, my mode (Motorola C650) success receive sms from my phone (Nokia N81) and store sms in incoming directory. here is : and this is in the file (using vim) Btw, I'm use my PC as server and it run in localhost (using IP private, not IP public), so that I think you can't remote it there using SSH. But I'm open SSH service. « Last edit by certain_death on Fri Jul 31, 2009 16:35, 186 months ago. »
|
|
#17 Fri Jul 31, 2009 16:41, 186 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Okay, it was a sent message but now it's removed from the phone. There was no error while removing it, your log just did not show the result. As you do not have those problematic messages anymore, you can continue messaging normally. But do not use this phone manually to send messages (using it's own keyboard) and do not store sent messages into it as they will cause troubles. Or just ignore those messages with notifications about incorrect PDU.
|
|
#18 Fri Jul 31, 2009 16:46, 186 months ago.
|
Member
Registered: Jul 2009
Location: Bandung, Indonesia
Topic owner
|
Until now, my modem (C650) still can't send my Nokia the sms reply according to evenhandler script I think my device (C650) is not so good as modem in this case. keke wrote This message is a sent message, not received. Probably your device cannot be used for successful communication, be aware to moving to some real modem...
I thinks this is true. So, what your suggestion for this?What device that best for your suggestion (but I hope it so cheap ) Or any solution for my Motorola C650? Thanks for your help.
|
|
#19 Fri Jul 31, 2009 16:52, 186 months ago.
|
Member
Registered: Jul 2009
Location: Bandung, Indonesia
Topic owner
|
keke wrote Okay, it was a sent message but now it's removed from the phone. There was no error while removing it, your log just did not show the result.
I've check the log and it's as you said. keke wrote As you do not have those problematic messages anymore, you can continue messaging normally. But do not use this phone manually to send messages (using it's own keyboard) and do not store sent messages into it as they will cause troubles. Or just ignore those messages with notifications about incorrect PDU.
excuse me, What "this phone" refer to? My Motorola 9as modem) or my Nokia? when send sms from PC (motorola C650 as modem) to receiver (my Nokia), I'm use my keyboard in Pc to type the message. keke wrote and do not store sent messages into it as they will cause troubles. Or just ignore those messages with notifications about incorrect PDU.
And what "it" refer to? I need your help. Thanks keke.
|
|
#20 Fri Jul 31, 2009 17:05, 186 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
certain_death wrote keke wrote As you do not have those problematic messages anymore, you can continue messaging normally. But do not use this phone manually to send messages (using it's own keyboard) and do not store sent messages into it as they will cause troubles. Or just ignore those messages with notifications about incorrect PDU.
excuse me, What "this phone" refer to? My Motorola 9as modem) or my Nokia? when send sms from PC (motorola C650 as modem) to receiver (my Nokia), I'm use my keyboard in Pc to type the message.
I meant a phone which is connected to the server and which is used (as a modem) by smsd. That's your Motorola. If you use it directly, with it's own keyboard, without connection to PC, like phones are usually used to write SMS, you may get more stored sent messages into it's memory, and then you have more headache... Currently you do not have problems with Motorola, your script just does not work... If you create an account for me and tell the IP and get ssh up, I may try to help you with scripting on Fedora. Use e-mail to send those details, not this board. Hidden private text.
|
|
#21 Fri Jul 31, 2009 17:11, 186 months ago.
|
Member
Registered: Jul 2009
Location: Bandung, Indonesia
Topic owner
|
OK
Thanks for your help keke.
Check your e-mail asap. Thanks.
|
|
#22 Sat Aug 15, 2009 19:43, 185 months ago.
|
Member
Registered: Jul 2009
Location: Bandung, Indonesia
Topic owner
|
Hi Keke, Now my eventhandler (BUPB_handler) can generate ID for me (client), send me SMS confirmation if my format is wrong, and store ID+name+telnumber to database (if format valid). Here is the code : Now I'm want to add some script in BUPB_handler so that it can : 1. Check sms from client with format KRM#ID#nama If format is wrong, then server will send client sms "Your format is wrong. Type KRM#ID#name" If format is valid, but ID and or name wrong, then server will send sms to client "your ID and or name not correct. try again" If both of them (format+ID+name) valid, server will send client a sms "Thanks." Hint : ID = ID that generated by server in registration phase. Name = name client, registered by client. Both of them (ID and name) checked on database. 2. Check sms from client with format GET#ID#nama (same like no 1) if format is wrong, then server will send client sms "Your format is wrong. Type GET#ID#name" If format is valid, but ID and or name wrong, then server will send sms to client "your ID and or name not correct. try again" If both of them (format+ID+name) valid, server will send client a sms "Thanks." Hint : ID = ID that generated by server in registration phase. Name = name client, registered by client. Both of them (ID and name) checked on database. But, until now, why it still error? Could you help me plz? Thanks.
|
|
#23 Sun Aug 16, 2009 11:07, 185 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
certain_death wrote But, until now, why it still error?
What is the error message?
|
|
#24 Thu Sep 03, 2009 19:01, 185 months ago.
|
Member
Registered: Jul 2009
Location: Bandung, Indonesia
Topic owner
|
Hi keke, I'm sorry for very late reply. I can solve that problem using any trick. In this case I use 3 eventhandlers (BUPB_REG_handler, BUPB_GET_handler, and BUPB_KRM_handler) and run each of them. Example, for registration phase, I'm run the BUPB_REG_handler and comment or deactive (#) KRM and GET in /etc/smsd.conf Here my code : BUPB_GET_handler BUPB_REG_handler BUPB_KRM_handler *all of that code using some Indonesian language in its. Now my problem is : How to store incoming sms in my database using eventhandler? In this case I use my database (BUPBDB), table cltsms, and I want sms stored in that DB. Could you help me about the eventhandler (shell) script? Plz.. Regard Thanks.
|
|
#25 Thu Sep 03, 2009 19:07, 185 months ago.
|
Member
Registered: Jul 2009
Location: Bandung, Indonesia
Topic owner
|
I mean, In default, all sms will insert into inbox of my HP (as modem) and store in incoming directory (/var/spool/sms/incoming). I want that all of them (sms) will be store from incoming to field "file" of cltsms table in BUPBDB db. Help me the code in shell script as eventhandler pleae. Or any example for this case? Please show me that. Thanks. Edited (add) : Here the structure of cltsms table : CREATE TABLE `cltsms` ( `ID` varchar(50) NOT NULL, `notel` varchar(50) NOT NULL, `nama` varchar(100) NOT NULL, `file` varchar(160) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; « Last edit by certain_death on Thu Sep 03, 2009 19:11, 185 months ago. »
|
This topic is locked
Page: 1 2 Next
Time in this board is UTC.
|
|
|
|
|
|
|