yep, you're right.

new file attached.
without blank comments, and text cleaned.

Vincent.

Alexander Malysh a écrit :
Hi Vincent,

some comments:
+ error(0, "AT2[%s]: [%d/%ld] Initialization of device failed.", octstr_get_cstr(privdata->name),
+                     error_count, privdata->max_error_count);

this is not very informative for kannel user. Please write out something like Init failed errors X from max errors X.

please kill comments like this:
+      /*
+       */

please fix indentation, we use 4 spaces...

Thanks,
Alex


Am 17.06.2009 um 12:56 schrieb Vincent CHAVANIS:


From an old thread (http://www.mail-archive.com/[email protected]/msg07693.html)
Alex moved the at2_error_string into smsc_at.c

2004-09-18 Alexander Malysh <amalysh at kannel.org>
   * gw/smsc/smsc_at.c: added new function 'at2_error_string' and teached
     smsc_at to use it.

But some error codes are missing.
1472:2009-06-16 16:00:59.0442 [2255] [8] ERROR: AT2[WAVECOM]: Generic error: +CME ERROR: 515 2710:2009-06-16 23:35:40.0142 [2255] [8] ERROR: AT2[WAVECOM]: CMS ERROR: +CMS ERROR: 513 2711:2009-06-16 23:35:40.0142 [2255] [8] ERROR: AT2[WAVECOM]: CMS ERROR: Error number unknown. Ask google and add it. (513)

Each code is more or less detailled on comments
I think this should be left as it as there are no documentation on it.

This patch also prints the counter before the reset-string.

Vincent.

--- /gateway-cvs/gw/smsc/smsc_at.c      2009-04-15 14:02:48.000000000 +0200
+++ /gateway/gw/smsc/smsc_at.c  2009-06-17 13:21:13.000000000 +0200
@@ -1329,7 +1329,8 @@
         }
 
         if (at2_init_device(privdata) != 0) {
-            error(0, "AT2[%s]: Initialization of device failed.", 
octstr_get_cstr(privdata->name));
+            error(0, "AT2[%s]: Initialization of device failed. Attempt #%d on 
%ld max.", octstr_get_cstr(privdata->name),
+                     error_count, privdata->max_error_count);
             at2_close_device(privdata);
             error_count++;
             reconnecting = 1;
@@ -2895,47 +2896,226 @@
 static const char *at2_error_string(int code)
 {
     switch (code) {
+    case 0:
+      /*
+       * Default the code to 0 then when you extract the value from the
+       * modem response message and no code is found, 0 will result.
+       */
+      return "Modem returned ERROR but no error code - possibly unsupported or 
invalid command?";
+    case 1: 
+      /* 
+       * This cause indicates that the destination requested by the Mobile 
+       * Station cannot be reached because, although the number is in a 
+       * valid format, it is not currently assigned (allocated).
+       */
+      return "Unassigned (unallocated) number";
+    case 3: 
+      /* 
+       * This can be a lot of things, depending upon the command, but in 
general
+       * it relates to trying to do a command when no connection exists.
+       */
+      return "Operation not allowed at this time (connection may be required)";
+    case 4: 
+      /* 
+       * This can be a lot of things, depending upon the command, but in 
general
+       * it relates to invaid parameters being passed.
+       */
+      return "Operation / Parameter(s) not supported";
     case 8:
+      /*
+       * This cause indicates that the MS has tried to send a mobile 
originating
+       * short message when the MS's network operator or service provider has
+       * forbidden such transactions.
+       */
         return "Operator determined barring";
     case 10:
-        return "Call barred";
+      /*
+       * This cause indicates that the outgoing call barred service applies to
+       * the short message service for the called destination.
+       */
+      return "Call barred or SIM not inserted or Card inserted is not a SIM";
+    case 11:
+      return "SIM PIN required";
+    case 12:
+      return "SIM PUK required";
+    case 13:
+      return "SIM failure";
+    case 16:
+      return "Incorrect password";
+    case 17:
+      /*
+       * This cause is sent to the MS if the MSC cannot service an MS generated
+       * request because of PLMN failures, e.g. problems in MAP.
+       */
+      return "Network failure";
+    case 18:
+      return "SIM PUK2 required";
+    case 20:
+      return "Memory full";
     case 21:
+      /*
+       * This cause indicates that the equipment sending this cause does not 
+       * wish to accept this short message, although it could have accepted 
+       * the short message since the equipment sending this cause is neither 
+       * busy nor incompatible.
+       */
         return "Short message transfer rejected";
+    case 22:
+      /*
+       * This cause is sent if the service request cannot be actioned because 
+       * of congestion (e.g. no channel, facility busy/congested etc.). Or 
+       * this cause indicates that the mobile station cannot store the 
+       * incoming short message due to lack of storage capacity.
+       */
+      return "Congestion or Memory capacity exceeded";
+    case 24:
+      return "Text string too long"; /* +CPBW, +CPIN, +CPIN2, +CLCK, +CPWD */
+    case 26:
+      return "Dial string too long"; /* +CPBW, ATD, +CCFC */
     case 27:
+      /*
+       * This cause indicates that the destination indicated by the Mobile 
+       * Station cannot be reached because the interface to the destination 
+       * is not functioning correctly. The term "not functioning correctly" 
+       * indicates that a signalling message was unable to be delivered to 
+       * the remote user; e.g., a physical layer or data link layer failure 
+       * at the remote user, user equipment off-line, etc.
+       * Also means "Invalid characters in dial string" for +CPBW.
+       */
         return "Destination out of service";
     case 28:
+      /*
+       * This cause indicates that the subscriber is not registered in the 
PLMN 
+       * (i.e. IMSI not known).
+       */
         return "Unidentified subscriber";
     case 29:
+      /*
+       * This cause indicates that the facility requested by the Mobile 
Station 
+       * is not supported by the PLMN.
+       */
         return "Facility rejected";
     case 30:
-        return "Unknown subscriber";
+      /*
+       * This cause indicates that the subscriber is not registered in the HLR 
+       * (i.e. IMSI or directory number is not allocated to a subscriber).
+       * Also means "No network service" for +VTS, +COPS=?, +CLCK, +CCFC, 
+CCWA, +CUSD
+       */
+      return "Unknown subscriber or No network service";
+    case 32:
+      return "Network not allowed - emergency calls only"; /* +COPS */
     case 38:
+      /*
+       * This cause indicates that the network is not functioning correctly 
and 
+       * that the condition is likely to last a relatively long period of 
time; 
+       * e.g., immediately reattempting the short message transfer is not 
+       * likely to be successful.
+       */
         return "Network out of order";
+    case 40:
+      return "Network personal PIN required (Network lock)";
     case 41:
+      /*
+       * This cause indicates that the network is not functioning correctly 
and 
+       * that the condition is not likely to last a long period of time; e.g., 
+       * the Mobile Station may wish to try another short message transfer 
+       * attempt almost immediately.
+       */
         return "Temporary failure";
     case 42:
+      /*
+       * This cause indicates that the short message service cannot be 
serviced 
+       * because of high traffic.
+       */
         return "Congestion";
     case 47:
+      /*
+       * This cause is used to report a resource unavailable event only when 
no 
+       * other cause applies.
+       */
         return "Resources unavailable, unspecified";
     case 50:
+      /*
+       * This cause indicates that the requested short message service could 
not
+       * be provided by the network because the user has not completed the 
+       * necessary administrative arrangements with its supporting networks.
+       */
         return "Requested facility not subscribed";
     case 69:
+      /*
+       * This cause indicates that the network is unable to provide the 
+       * requested short message service.
+       */
         return "Requested facility not implemented";
     case 81:
+      /*
+       * This cause indicates that the equipment sending this cause has 
received
+       * a message with a short message reference which is not currently in 
use 
+       * on the MS-network interface.
+       */
         return "Invalid short message transfer reference value";
     case 95:
+      /*
+       * This cause is used to report an invalid message event only when no 
+       * other cause in the invalid message class applies.
+       */
         return "Invalid message, unspecified";
     case 96:
+      /*
+       * This cause indicates that the equipment sending this cause has 
received
+       * a message where a mandatory information element is missing and/or has 
+       * a content error (the two cases are indistinguishable).
+       */
         return "Invalid mandatory information";
     case 97:
+      /*
+       * This cause indicates that the equipment sending this cause has 
received
+       * a message with a message type it does not recognize either because 
this
+       * is a message not defined or defined but not implemented by the 
+       * equipment sending this cause.
+       */
         return "Message type non-existent or not implemented";
     case 98:
+      /*
+       * This cause indicates that the equipment sending this cause has 
received
+       * a message such that the procedures do not indicate that this is a 
+       * permissible message to receive while in the short message transfer 
+       * state.
+       */
         return "Message not compatible with short message protocol state";
     case 99:
+      /*
+       * This cause indicates that the equipment sending this cause has 
received
+       * a message which includes information elements not recognized because 
+       * the information element identifier is not defined or it is defined 
+       * but not implemented by the equipment sending the cause. However, the 
+       * information element is not required to be present in the message in 
+       * order for the equipment sending the cause to process the message.
+       */
         return "Information element non-existent or not implemented";
+    case 103:
+      return "Illegal MS (#3)"; /* +CGATT */
+    case 106:
+      return "Illegal ME (#6)"; /* +CGATT */
+    case 107:
+      return "GPRS services not allowed (#7)"; /* +CGATT */
     case 111:
-        return "Protocol error, unspecified";
+      /*
+       * This cause is used to report a protocol error event only when no 
other 
+       * cause applies.
+       * Also means "PLMN not allowed (#11)" for +CGATT
+       */
+      return "Protocol error, unspecified or PLMN not allowed (#11)";
+    case 112:
+      return "Location area not allowed (#12)"; /* +CGATT */
+    case 113:
+      return "Roaming not allowed in this area (#13)"; /* +CGATT */
     case 127:
+      /*
+       * This cause indicates that there has been interworking with a network 
+       * which does not provide causes for actions it takes; thus, the precise 
+       * cause for a message which is being send cannot be ascertained.
+       */
         return "Interworking, unspecified";
     case 128:
         return "Telematic interworking not supported";
@@ -2943,18 +3123,30 @@
         return "Short message Type 0 not supported";
     case 130:
         return "Cannot replace short message";
+    case 132:
+      return "Service option not supported (#32)"; /* +CGACT +CGDATA ATD*99 */
+    case 133:
+      return "Requested service option not subscribed (#33)"; /* +CGACT 
+CGDATA ATD*99 */
+    case 134:
+      return "Service option temporarily out of order (#34)"; /* +CGACT 
+CGDATA ATD*99 */
     case 143:
         return "Unspecified TP-PID error";
     case 144:
-        return "Data coding scheme (alphabet not supported";
+      return "Data coding scheme (alphabet) not supported";
     case 145:
         return "Message class not supported";
+    case 148:
+      return "Unspecified GPRS error";
+    case 149:
+      return "PDP authentication failure"; /* +CGACT +CGDATA ATD*99 */
+    case 150:
+      return "Invalid mobile class";
     case 159:
         return "Unspecified TP-DCS error";
     case 160:
         return "Command cannot be actioned";
     case 161:
-        return "Command unsupported";
+      return "Unsupported command";
     case 175:
         return "Unspecified TP-Command error";
     case 176:
@@ -2976,13 +3168,13 @@
     case 199:
         return "TP-VP not supported";
     case 208:
-        return "D0 SIM SMS storage full";
+      return "DO SIM SMS storage full";
     case 209:
         return "No SMS storage capability in SIM";
     case 210:
         return "Error in MS";
     case 211:
-        return "D0 SIM SMS storage full";
+      return "SIM Memory Capacity Exceeded";
     case 212:
         return "SIM Application Toolkit Busy";
     case 213:
@@ -3036,7 +3228,77 @@
     case 500:
         return "Unknown error. -> maybe Sim storage is full? I'll have a look 
at it.";
     case 512:
-        return "User abort";
+      /*
+       * Resulting from +CMGS, +CMSS
+       */
+      return "User abort or MM establishment failure (SMS)";
+    case 513:
+      /*
+       * Resulting from +CMGS, +CMSS
+       */
+      return "Lower layer falure (SMS)";
+    case 514:
+      /*
+       * Resulting from +CMGS, +CMSS
+       */
+      return "CP error (SMS)";
+    case 515:
+      return "Please wait, service not available, init or command in progress";
+    case 517:
+      /*
+       * Resulting from +STGI
+       */
+      return "SIM ToolKit facility not supported";
+    case 518:
+      /*
+       * Resulting from +STGI
+       */
+      return "SIM ToolKit indication not received";
+    case 519:
+      /*
+       * Resulting from +ECHO, +VIP
+       */
+      return "Reset the product to activate or change a new echo cancellation 
algorithm";
+    case 520:
+      /*
+       * Resulting from +COPS=?
+       */
+      return "Automatic abort about get plmn list for an incoming call";
+    case 526:
+      /*
+       * Resulting from +CLCK
+       */
+      return "PIN deactivation forbidden with this SIM card";
+    case 527:
+      /*
+       * Resulting from +COPS
+       */
+      return "Please wait, RR or MM is busy. Retry your selection later";
+    case 528:
+      /*
+       * Resulting from +COPS
+       */
+      return "Location update failure. Emergency calls only";
+    case 529:
+      /*
+       * Resulting from +COPS
+       */
+      return "PLMN selection failure. Emergency calls only";
+    case 531:
+      /*
+       * Resulting from +CMGS, +CMSS
+       */
+      return "SMS not sent: the <da> is not in FDN phonebook, and FDN lock is 
enabled";
+    case 532:
+      /*
+       * Resulting from +WOPEN
+       */
+      return "The embedded application is activated so the objects flash are 
not erased.";
+    case 533:
+      /*
+       * Resulting from +ATD*99,+GACT,+CGDATA
+       */
+      return "Missing or unknown APN";
     default:
         return "Error number unknown. Ask google and add it.";
     }

Reply via email to