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. My application run well in my Nokia N81 8GB when I test it.
In server side, case of this topic, 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 question 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. I'll explain each phase below :
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 that contain message "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" ), in attachmnt.
I've try it at SMS Server Tools (as shell script in eventhandler /etc/smsd.conf), but it only run well when I'm send a sms that contain wrong format (ex : ref#jhon) and server will send me a sms that contain message "your format is worng. Type : reg#name".
But if my format valid, it can't generate ID for client (in this case is sender, myself), store data (name, ID, telp number) in database, and also can't send client sms that contain format "$nama, your registration is complete. your Id is xxx".
help me to solve my problem and complete my script. Thanks,