[Serusers] SMS gateway using a mobile phone

Bogdan-Andrei IANCU iancu at fokus.fraunhofer.de
Tue Apr 1 18:30:18 CEST 2003


Hi Kenny,

First, I want to say that our SMS module is base on the same library as 
Stefan Frings's "SMS Server Tools", so , if you succeeded it in sending 
a SMS with this tool, you can do it also with the SMS GW.
The log you sent actually says the SMS GW is trying (using AT+CREG 
command) to find out if the modem is registered on the GSM network (if 
you have signal on your phone). But, if your phone doesn't support 
AT+CREG command (as you said), the GW will remain blocked there until it 
will figure out the modem status regarding registration on the network. 
You said you were able to use the "SMS Server Tools" which actually does 
to same - first checks if the modem is registered on GSM network. My 
opinion is you specified to "putsms" the '-m' parameter (the PDU mod) to 
"DIGICOM" - this is the only way haw to skip the registration check. 
Please tell me if I right or not. If yes, you can find a similar setting 
for the SMS GW - in "modem" section switch the 'm' param from '"new" to 
"digicom".

Now, regarding the SMS center number. I guess you are right. I will turn 
this parameter to "optional" - to be more flexible- and I will move it 
from "network" section to the "modem" one. As soon as I will finish the 
changing, I will let you know.

Yes, indeed, there is no support for 57600 baud rate - I will added asap.


In order to be able to help you more, if it's possible, please send me 
exactly the parameters you used with "putsms" (from "SMS Server Tools").

Best regards,
Bogdan

LeeCC, Kenny wrote:

>Hi,
>
>Am trying to get SER to send SMS messages out via my SER server serial/comm port connected to a Motorola Timeport P7382 mobile phone but am having trouble because of SER "sms.so" module keep trying to register the SMS center number; syslog snippet. 
>
><snip>
>Apr  1 18:32:28 gits /usr/sbin/ser[18276]: INFO:initmodem: Checking if Modem is registered to the network
>Apr  1 18:32:30 gits /usr/sbin/ser[18266]: NOTICE:initmodem: Waiting 2 sec. before retrying
><snip>
>
>The mobile phone already register to the SMS center number thus re-registering is not required. "sms.so" module doesn't seems to pick up the message that the mobile phone have already registered to the SMS center number and I have to amend and recompile "libsms_modem.c" because the mobile phone do not recognise AT+CREG command but AT+CSCA command.
>
>To test whether the mobile phone is able to send SMS messages out via the serial/comm port, I used Stefan Frings "SMS Server Tools" by commenting the config file from registering the SMS center number and it managed to send out sms messages. However on SER "sms.so" modules, I have no idea how to stop it from registering the SMS center number. From the "../sms/README" file, it did mention that "c=SMS_center" is mandatory. That looks like not registering to the SMS center is a no-no. :-( Other than changing some words here and there of the source code via gut feel, I don't have any experience in C thus am yelping for help here.
>
>Btw, the modem baud rate on "sms.c" only supports up to 38400 and that won't work with my mobile phone, thus have to add a line for 57600 baud rate. Maybe is already added in the latest CVS. Am using the stable version source. Below is my "ser.cfg".
>
>Thanks & rgds,
>kenny.leecc
>-------------------------------------------
>
>#
># $Id: ser.cfg,v 1.12 2002/10/21 02:40:06 jiri Exp $
>#
># simple quick-start config script
>#
>
># ----------- global configuration parameters ------------------------
>
>debug=9          # debug level (cmd line: -dddddddddd)
>fork=yes
>log_stderror=no # (cmd line: -E)
>check_via=no    # (cmd. line: -v)
>dns=no           # (cmd. line: -r)
>rev_dns=no      # (cmd. line: -R)
>port=5060
>children=4
>fifo="/tmp/ser_fifo"
>
># ------------------ module loading ----------------------------------
>
># Uncomment this if you want to use SQL database
>loadmodule "//usr/lib/ser/modules/mysql.so"
>
>loadmodule "//usr/lib/ser/modules/sl.so"
>loadmodule "//usr/lib/ser/modules/tm.so"
>loadmodule "//usr/lib/ser/modules/rr.so"
>loadmodule "//usr/lib/ser/modules/maxfwd.so"
>loadmodule "//usr/lib/ser/modules/sms.so"
>loadmodule "//usr/lib/ser/modules/im.so"
>loadmodule "//usr/lib/ser/modules/textops.so"
>loadmodule "//usr/lib/ser/modules/usrloc.so"
>loadmodule "//usr/lib/ser/modules/registrar.so"
>loadmodule "//usr/lib/ser/modules/pike.so"
>
># Uncomment this if you want digest authentication
># mysql.so must be loaded !
>loadmodule "//usr/lib/ser/modules/auth.so"
>
># ----------------- setting module-specific parameters ---------------
>
># -- usrloc params --
>
>#modparam("usrloc", "db_mode",   0)
>
># Uncomment this if you want to use SQL database
># for persistent storage and comment the previous line
>modparam("usrloc", "db_mode", 2)
>
># -- auth params --
># Uncomment if you are using auth module
>#
>modparam("auth", "secret", "alsdkhglaksdhfkloiwr")
>modparam("auth", "calculate_ha1", yes)
>#
># If you set "calculate_ha1" parameter to yes (which true in this config),
># uncomment also the following parameter)
>#
>modparam("auth", "password_column", "password")
>
># -- SMS params --
>modparam("sms","modems","Motorola [d=/dev/ttyS0;b=57600;m=new;l=20;r=2]")
>modparam("sms","networks","Maxis[c=60120000015;m=10]")
>modparam("sms","links","Motorola [Maxis]")
>modparam("sms","domain","gits.msasip.net")
>modparam("sms","max_sms_parts",3)
>modparam("sms","use_contact",1)
>
># -- tm params --
>modparam("tm", "fr_timer", 10 )
>modparam("tm", "fr_inv_timer", 10 )
>modparam("tm", "wt_timer", 10 )
>
># -- pike params --
># no more than minimum 5 or maximum 5*3 msg per 10 secs - only for sms
>modparam("pike","sampling_time_unit",60)
>modparam("pike","reqs_density_per_unit",5)
>modparam("pike","removel_latency",30)
>
># -------------------------  request routing logic -------------------
>
># main routing logic
>
>alias="my.domain"
>
>route{
>
>        # initial sanity checks -- messages with
>        # max_forwars==0, or excessively long requests
>        # filter too old messages
>        if (!mf_process_maxfwd_header("10")) {
>                log("LOG: Too many hops\n");
>                sl_send_reply("483","Too Many Hops");
>                break;
>        };
>
>        # messages too large are denied
>        if (len_gt( max_len )) {
>                sl_send_reply("513", "Message too big");
>                break;
>        };
>
>        # accept only req coming from my.domain
>        if (!src_ip==192.168.1.1 |
>        !( uri=~"my.domain" | uri=~"192\.168\.1\.0" ))
>        {
>                sl_send_reply("403","Forbidden");
>                log("SER:Forbidden request: wrong src_ip or req_uri\n");
>                break;
>        };
>
>        # we are not interested in non-MESSAGE requests
>        if (!method=="MESSAGE")
>        {
>                sl_send_reply("501","Not Implemented");
>                break;
>        };
>
>        # error occured ...
>        if (! t_newtran())
>        {
>                sl_reply_error();
>                break;
>        };
>
>        ### ------ SMS GATEWAY --------
>        # let's block ips that send a lot of request!!
>        if (!pike_check_req() )
>        {
>                break;
>        };
>        # SMS expects only the numbers as follows +<int> <area> <nr>
>        #if (!(uri=~"sip:+[^0][0-9]{3}"))
>        if (!(uri=="sip:0121234567"))
>        {
>                log("SER: invalid number format!!\n");
>                if (!t_reply("502","Bad gateway - invalid number"))
>                {
>                        # if replying failed, retry statelessly
>                        sl_reply_error();
>                };
>                break;
>        };
>        if (sms_send_msg_to_net("Maxis"))
>        {
>                # for sending replies, we won't use the statefull
>                # function because it is not able to add the Contact
>                # header (in fact to add any rpl_lump :-( )
>                # things went well, send ok upstream
>                if (!t_reply("202", "yes sir, SMS sent over"))
>                {
>                        # if replying failed, retry statelessly
>                        sl_reply_error();
>                };
>        } else {
>                if (!t_reply("502", "Bad gateway - SMS error"))
>                {
>                        # if replying failed, retry statelessly
>                        sl_reply_error();
>                };
>                break;
>        };
>
>        # Do strict routing if pre-loaded route headers present
>        rewriteFromRoute();
>
>        # forward or handoff to PSTN
>        if (uri=~"^sip:9[0-9]*@192.168.1.66") {
>               strip(1);
>               log("Forwarding to PSTN\n");
>               rewritehostport("192.168.1.50:5060");
>        };
>
>        lookup("aliases");
>        # if the request is for other domain use UsrLoc
>        # (in case, it does not work, use the following command
>        # with proper names and addresses in it)
>        if (uri==myself) {
>
>                if (method=="REGISTER") {
>
># Uncomment this if you want to use digest authentication
>                        if (!www_authorize("my.domain", "subscriber")) {
>                                www_challenge("my.domain", "0");
>                                break;
>                        };
>
>
>                        save("location");
>                        break;
>                };
>
>                # native SIP destinations are handled using our USRLOC DB
>                if (!lookup("location")) {
>                        sl_send_reply("404", "Not Found");
>                        break;
>                };
>        };
>
>        # forward to current uri now
>        if (!t_relay()) {
>                sl_reply_error();
>        };
>
>}
>_______________________________________________
>Serusers mailing list
>serusers at lists.iptel.org
>http://lists.iptel.org/mailman/listinfo/serusers
>
>  
>





More information about the sr-users mailing list