SMS Server Tools 3
This site is hosted by Kekekasvi.com
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. Please login or register. Tue Apr 16, 2024 16:25
SMSTools3 Community » Help and support Bottom

[solved] Can I skip AT+CMGF=0 commnad?

  This topic is locked

Page:  1

Author Post
Member
Registered:
Feb 2011
Location: China
Operating system name and version: Windows server 2003
Version of smsd: 3.1.14
Smsd installed from: sources
Name and model of a modem / phone: Flyfot GSM adapter
Interface: USB


I get a cheap GSM adapter , and it not support AT+CMGF command, because only support PDU mode. I use :
AT+CMGS=155
> input pdu date end with ctrl + Z

the message will be send successful.

so I need to know how can I skip AT+CMGF=0 command when using smstools3?

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Currently there is no configuration setting for skipping mode selection. You need to modify sources for it.

Here is the patch:

diff -Naur 3.1.14/src/modeminit.c smstools3/src/modeminit.c
--- 3.1.14/src/modeminit.c      2010-09-20 12:31:43.000000000 +0300
+++ smstools3/src/modeminit.c   2011-02-28 12:27:03.000000000 +0200
@@ -1506,26 +1506,29 @@
   }

   // -----------------------------------------------------------------------------------------------
-  writelogfile(LOG_INFO, 0, "Selecting PDU mode");
-  strcpy(command,"AT+CMGF=0\r");
-  retries=0;
-  do
+  if (DEVICE.select_pdu_mode) // 3.1.15.
   {
-    retries++;
-    put_command(command, answer, sizeof(answer), 1, EXPECT_OK_ERROR);
-    if (strstr(answer, "ERROR"))
-      if (retries < 2)
-        if (t_sleep(errorsleeptime))
-          return 7;
-  }
-  while (retries < 2 && !strstr(answer,"OK"));
-  if (strstr(answer,"ERROR"))
-  {
-    // 3.1: more detailed error message:
-    p = get_gsm_error(answer);
-    writelogfile0(LOG_ERR, 1, tb_sprintf("Error: Modem did not accept mode selection%s%s", (*p)? ", " : "", p));
-    alarm_handler0(LOG_ERR, tb);
-    return 5;
+    writelogfile(LOG_INFO, 0, "Selecting PDU mode");
+    strcpy(command,"AT+CMGF=0\r");
+    retries=0;
+    do
+    {
+      retries++;
+      put_command(command, answer, sizeof(answer), 1, EXPECT_OK_ERROR);
+      if (strstr(answer, "ERROR"))
+        if (retries < 2)
+          if (t_sleep(errorsleeptime))
+            return 7;
+    }
+    while (retries < 2 && !strstr(answer,"OK"));
+    if (strstr(answer,"ERROR"))
+    {
+      // 3.1: more detailed error message:
+      p = get_gsm_error(answer);
+      writelogfile0(LOG_ERR, 1, tb_sprintf("Error: Modem did not accept mode selection%s%s", (*p)? ", " : "", p));
+      alarm_handler0(LOG_ERR, tb);
+      return 5;
+    }
   }

   // -----------------------------------------------------------------------------------------------
diff -Naur 3.1.14/src/smsd_cfg.c smstools3/src/smsd_cfg.c
--- 3.1.14/src/smsd_cfg.c       2010-09-21 12:15:07.000000000 +0300
+++ smstools3/src/smsd_cfg.c    2011-02-28 12:26:19.000000000 +0200
@@ -344,6 +344,7 @@
     devices[i].verify_pdu = 0;
     devices[i].loglevel_lac_ci = 6;
     devices[i].log_not_registered_after = 0;
+    devices[i].select_pdu_mode = 1;
   }
   startup_err_str = NULL;
   startup_err_count = 0;
@@ -1680,6 +1681,12 @@
                 if (strcasecmp(name,"log_not_registered_after")==0)
                  NEWDEVICE.log_not_registered_after=atoi(ask_value(NEWDEVICE.name, name, value));
                 else
+                if (strcasecmp(name,"select_pdu_mode")==0)
+                {
+                 if ((NEWDEVICE.select_pdu_mode = yesno_check(ask_value(NEWDEVICE.name, name, value))) == -1)
+                    startuperror(yesno_error, name, value);
+                }
+                else
                  startuperror("Unknown setting for modem %s: %s\n", NEWDEVICE.name, name);
               }
            }
diff -Naur 3.1.14/src/smsd_cfg.h smstools3/src/smsd_cfg.h
--- 3.1.14/src/smsd_cfg.h       2010-09-20 14:11:26.000000000 +0300
+++ smstools3/src/smsd_cfg.h    2011-02-28 12:25:26.000000000 +0200
@@ -230,6 +230,7 @@
   int verify_pdu; // 3.1.14.
   int loglevel_lac_ci; // 3.1.14.
   int log_not_registered_after; // 3.1.14.
+  int select_pdu_mode; // 3.1.15.
 } _device;

 // NOTE for regular run intervals: effective value is at least delaytime.
 
 
'diff' Syntax Highlight powered by GeSHi


Save the patch as /tmp/patch. Then cd smstools3/src and run patch < /tmp/patch. Recompile with make, and replace executable: cp -p smsd.exe $(which smsd.exe). In /etc/smsd.conf, add a new setting for modem: select_pdu_mode = no, and restart smsd.

Member
Registered:
Feb 2011
Location: China
Topic owner
Hi keke
Thanks a lot , It works

  This topic is locked

Page:  1

SMSTools3 Community » Help and support Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.