Cannot send a SMS with gammu (error 500, message reference=-1)

marxin picture marxin · May 11, 2016 · Viewed 7k times · Source

I've been playing with gammu and Huawei USB modem:

lsusb | grep Huawei

Bus 001 Device 006: ID 12d1:1001 Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA Modem

The modem is capable of receiving SMS, but sending does not work.

Problematic command

gammu sendsms TEXT 728123456 -text "text"
If you want break, press Ctrl+C...
Sending SMS 1/1....waiting for network answer..error 500, message reference=-1
Unknown error.

gammu monitor

According to monitor, signal and other info about network, etc. are fine.

SIM phonebook        :  12 used, 238 free
Dialled numbers      :   0 used,  10 free
Received numbers     :   0 used,  10 free
Missed numbers       :   0 used,  10 free
Own numbers          :   0 used,   4 free
Phone phonebook      :   0 used, 100 free
Battery level        : 100 percent
Charge state         : powered from battery
Signal strength      : -73 dBm
Network level        : 60 percent
SIM SMS status       : 3 used, 0 unread, 10 locations
Phone SMS status     : 0 used, 0 unread, 255 locations
Network state        : home network
Network              : 230 02 (O2, Czech Republic), LAC 1, CID 
Name in phone        : "EUROTEL - CZ"
Packet network state : home network
Packet network       : 230 02 (O2, Czech Republic), LAC , CID 
Name in phone        : "EUROTEL - CZ"
GPRS                 : attached

SIM phonebook        :  12 used, 238 free
Dialled numbers      :   0 used,  10 free
Received numbers     :   0 used,  10 free
Missed numbers       :   0 used,  10 free
Own numbers          :   0 used,   4 free
Phone phonebook      :   0 used, 100 free
Battery level        : 100 percent
Charge state         : powered from battery
Signal strength      : -73 dBm
Network level        : 60 percent
SIM SMS status       : 3 used, 0 unread, 10 locations
Phone SMS status     : 0 used, 0 unread, 255 locations
Network state        : home network
Network              : 230 02 (O2, Czech Republic), LAC 1, CID 
Name in phone        : "EUROTEL - CZ"
Packet network state : home network
Packet network       : 230 02 (O2, Czech Republic), LAC , CID 
Name in phone        : "EUROTEL - CZ"
GPRS                 : attached

Following output is provided by gammu log file with textall Logformat.

gammu log

[Gammu            - 1.37.0]
[Connection       - "at"]
[Connection index - 0]
[Model type       - ""]
[Device           - "/dev/ttyUSB0"]
[Running on       - Linux, kernel 4.5.2-1-default (#1 SMP PREEMPT Thu Apr 21 09:07:52 UTC 2016 (0454a6e))]
Serial device: DTR is up, RTS is up, CAR is down, CTS is up
Setting speed to 115200
[Module           - "auto"]
Escaping SMS mode
SENDING frame type 0x00/length 0x02/2
1B |0D                                                          ..              
Sending simple AT command to wake up some devices
SENDING frame type 0x00/length 0x03/3
41A|54T|0D                                                      AT.             
1 "AT"
2 "OK"
Checking line: OK
AT reply state: 1
RECEIVED frame type 0x00/length 0x09/9
41A|54T|0D |0D |0A |4FO|4BK|0D |0A                              AT...OK..       
Enabling echo
SENDING frame type 0x00/length 0x05/5
41A|54T|45E|311|0D                                              ATE1.           
1 "ATE1"
2 "OK"
Checking line: OK
AT reply state: 1
RECEIVED frame type 0x00/length 0x0B/11
41A|54T|45E|311|0D |0D |0A |4FO|4BK|0D |0A                      ATE1...OK..     
Trying Motorola mode switch
SENDING frame type 0x00/length 0x0A/10
41A|54T|2B+|4DM|4FO|44D|45E|3D=|322|0D                          AT+MODE=2.      
1 "AT+MODE=2"
2 "ERROR"
Checking line: ERROR
AT reply state: 3
RECEIVED frame type 0x00/length 0x13/19
41A|54T|2B+|4DM|4FO|44D|45E|3D=|322|0D |0D |0A |45E|52R|52R|4FO AT+MODE=2...ERRO
52R|0D |0A                                                      R..             
Seems not to be supported
Enabling CME errors
SENDING frame type 0x00/length 0x0A/10
41A|54T|2B+|43C|4DM|45E|45E|3D=|311|0D                          AT+CMEE=1.      
1 "AT+CMEE=1"
2 "OK"
Checking line: OK
AT reply state: 1
RECEIVED frame type 0x00/length 0x10/16
41A|54T|2B+|43C|4DM|45E|45E|3D=|311|0D |0D |0A |4FO|4BK|0D |0A  AT+CMEE=1...OK..
SENDING frame type 0x00/length 0x09/9
41A|54T|2B+|43C|53S|43C|53S|3F?|0D                              AT+CSCS?.       
1 "AT+CSCS?"
2 "+CSCS: "UCS2""
3 "OK"
Checking line: OK
AT reply state: 1
RECEIVED frame type 0x00/length 0x20/32
41A|54T|2B+|43C|53S|43C|53S|3F?|0D |0D |0A |2B+|43C|53S|43C|53S AT+CSCS?...+CSCS
3A:|20 |22"|55U|43C|53S|322|22"|0D |0A |0D |0A |4FO|4BK|0D |0A  : "UCS2"....OK..
SENDING frame type 0x00/length 0x0A/10
41A|54T|2B+|43C|53S|43C|53S|3D=|3F?|0D                          AT+CSCS=?.      
1 "AT+CSCS=?"
2 "+CSCS: ("IRA","GSM","UCS2")"
3 "OK"
Checking line: OK
AT reply state: 1
RECEIVED frame type 0x00/length 0x2F/47
41A|54T|2B+|43C|53S|43C|53S|3D=|3F?|0D |0D |0A |2B+|43C|53S|43C AT+CSCS=?...+CSC
53S|3A:|20 |28(|22"|49I|52R|41A|22"|2C,|22"|47G|53S|4DM|22"|2C, S: ("IRA","GSM",
22"|55U|43C|53S|322|22"|29)|0D |0A |0D |0A |4FO|4BK|0D |0A      "UCS2")....OK.. 
Chosen GSM as normal charset
Chosen UCS2 as unicode charset
SENDING frame type 0x00/length 0x0E/14
41A|54T|2B+|43C|53S|43C|53S|3D=|22"|47G|53S|4DM|22"|0D          AT+CSCS="GSM".  
1 "AT+CSCS="GSM""
2 "OK"
Checking line: OK
AT reply state: 1
RECEIVED frame type 0x00/length 0x14/20
41A|54T|2B+|43C|53S|43C|53S|3D=|22"|47G|53S|4DM|22"|0D |0D |0A  AT+CSCS="GSM"...
4FO|4BK|0D |0A                                                  OK..            
SENDING frame type 0x00/length 0x09/9
41A|54T|2B+|43C|53S|43C|53S|3F?|0D                              AT+CSCS?.       
1 "AT+CSCS?"
2 "+CSCS: "GSM""
3 "OK"
Checking line: OK
AT reply state: 1
RECEIVED frame type 0x00/length 0x1F/31
41A|54T|2B+|43C|53S|43C|53S|3F?|0D |0D |0A |2B+|43C|53S|43C|53S AT+CSCS?...+CSCS
3A:|20 |22"|47G|53S|4DM|22"|0D |0A |0D |0A |4FO|4BK|0D |0A      : "GSM"....OK.. 
Getting model
SENDING frame type 0x00/length 0x08/8
41A|54T|2B+|43C|47G|4DM|4DM|0D                                  AT+CGMM.        
1 "AT+CGMM"
2 "E1750"
3 "OK"
Checking line: OK
AT reply state: 1
RECEIVED frame type 0x00/length 0x17/23
41A|54T|2B+|43C|47G|4DM|4DM|0D |0D |0A |45E|311|377|355|300|0D  AT+CGMM...E1750.
0A |0D |0A |4FO|4BK|0D |0A                                      ...OK..         
[Model name: `E1750']
[Model data: `E1750']
[Model data: `E1750']
[Connected model  - "E1750"]
SENDING frame type 0x00/length 0x08/8
41A|54T|2B+|43C|47G|4DM|49I|0D                                  AT+CGMI.        
1 "AT+CGMI"
2 "QUALCOMM INCORPORATED"
3 "OK"
Checking line: OK
AT reply state: 1
RECEIVED frame type 0x00/length 0x27/39
41A|54T|2B+|43C|47G|4DM|49I|0D |0D |0A |51Q|55U|41A|4CL|43C|4FO AT+CGMI...QUALCO
4DM|4DM|20 |49I|4EN|43C|4FO|52R|50P|4FO|52R|41A|54T|45E|44D|0D  MM INCORPORATED.
0A |0D |0A |4FO|4BK|0D |0A                                      ...OK..         
Manufacturer info received
[Manufacturer: Qualcomm]
Checking for OBEX support
SENDING frame type 0x00/length 0x0B/11
41A|54T|2B+|43C|50P|52R|4FO|54T|3D=|3F?|0D                      AT+CPROT=?.     
1 "AT+CPROT=?"
2 "ERROR"
Checking line: ERROR
AT reply state: 3
RECEIVED frame type 0x00/length 0x14/20
41A|54T|2B+|43C|50P|52R|4FO|54T|3D=|3F?|0D |0D |0A |45E|52R|52R AT+CPROT=?...ERR
4FO|52R|0D |0A                                                  OR..            
Checking for SYNCML/OBEX support
SENDING frame type 0x00/length 0x0C/12
41A|54T|2B+|53S|59Y|4EN|43C|4DM|4CL|3D=|3F?|0D                  AT+SYNCML=?.    
1 "AT+SYNCML=?"
2 "ERROR"
Checking line: ERROR
AT reply state: 3
RECEIVED frame type 0x00/length 0x15/21
41A|54T|2B+|53S|59Y|4EN|43C|4DM|4CL|3D=|3F?|0D |0D |0A |45E|52R AT+SYNCML=?...ER
52R|4FO|52R|0D |0A                                              ROR..           
SENDING frame type 0x00/length 0x0D/13
41A|54T|24$|54T|53S|53S|50P|43C|53S|57W|3D=|3F?|0D              AT$TSSPCSW=?.   
1 "AT$TSSPCSW=?"
2 "ERROR"
Checking line: ERROR
AT reply state: 3
RECEIVED frame type 0x00/length 0x16/22
41A|54T|24$|54T|53S|53S|50P|43C|53S|57W|3D=|3F?|0D |0D |0A |45E AT$TSSPCSW=?...E
52R|52R|4FO|52R|0D |0A                                          RROR..          
[Module           - "A2D|iPAQ|at|M20|S25|MC35|TC35|C35i|S65|S300|5110|5130|5190|5210|6110|6130|6150|6190|6210|6250|6310|6310i|6510|7110|8210|8250|8290|8310|8390|8850|8855|8890|8910|9110|9210"]
Escaping SMS mode
SENDING frame type 0x00/length 0x02/2
1B |0D                                                          ..              
Sending simple AT command to wake up some devices
SENDING frame type 0x00/length 0x03/3
41A|54T|0D                                                      AT.             
1 "AT"
2 "OK"
Checking line: OK
AT reply state: 1
RECEIVED frame type 0x00/length 0x09/9
41A|54T|0D |0D |0A |4FO|4BK|0D |0A                              AT...OK..       
Enabling echo
SENDING frame type 0x00/length 0x05/5
41A|54T|45E|311|0D                                              ATE1.           
1 "ATE1"
2 "OK"
Checking line: OK
AT reply state: 1
RECEIVED frame type 0x00/length 0x0B/11
41A|54T|45E|311|0D |0D |0A |4FO|4BK|0D |0A                      ATE1...OK..     
Trying Motorola mode switch
SENDING frame type 0x00/length 0x0A/10
41A|54T|2B+|4DM|4FO|44D|45E|3D=|322|0D                          AT+MODE=2.      
1 "AT+MODE=2"
2 "ERROR"
Checking line: ERROR
AT reply state: 3
RECEIVED frame type 0x00/length 0x13/19
41A|54T|2B+|4DM|4FO|44D|45E|3D=|322|0D |0D |0A |45E|52R|52R|4FO AT+MODE=2...ERRO
52R|0D |0A                                                      R..             
Seems not to be supported
Enabling CME errors
SENDING frame type 0x00/length 0x0A/10
41A|54T|2B+|43C|4DM|45E|45E|3D=|311|0D                          AT+CMEE=1.      
1 "AT+CMEE=1"
2 "OK"
Checking line: OK
AT reply state: 1
RECEIVED frame type 0x00/length 0x10/16
41A|54T|2B+|43C|4DM|45E|45E|3D=|311|0D |0D |0A |4FO|4BK|0D |0A  AT+CMEE=1...OK..
SENDING frame type 0x00/length 0x09/9
41A|54T|2B+|43C|53S|43C|53S|3F?|0D                              AT+CSCS?.       
1 "AT+CSCS?"
2 "+CSCS: "GSM""
3 "OK"
Checking line: OK
AT reply state: 1
RECEIVED frame type 0x00/length 0x1F/31
41A|54T|2B+|43C|53S|43C|53S|3F?|0D |0D |0A |2B+|43C|53S|43C|53S AT+CSCS?...+CSCS
3A:|20 |22"|47G|53S|4DM|22"|0D |0A |0D |0A |4FO|4BK|0D |0A      : "GSM"....OK.. 
SENDING frame type 0x00/length 0x0A/10
41A|54T|2B+|43C|53S|43C|53S|3D=|3F?|0D                          AT+CSCS=?.      
1 "AT+CSCS=?"
2 "+CSCS: ("IRA","GSM","UCS2")"
3 "OK"
Checking line: OK
AT reply state: 1
RECEIVED frame type 0x00/length 0x2F/47
41A|54T|2B+|43C|53S|43C|53S|3D=|3F?|0D |0D |0A |2B+|43C|53S|43C AT+CSCS=?...+CSC
53S|3A:|20 |28(|22"|49I|52R|41A|22"|2C,|22"|47G|53S|4DM|22"|2C, S: ("IRA","GSM",
22"|55U|43C|53S|322|22"|29)|0D |0A |0D |0A |4FO|4BK|0D |0A      "UCS2")....OK.. 
Chosen GSM as normal charset
Chosen UCS2 as unicode charset
SENDING frame type 0x00/length 0x08/8
41A|54T|2B+|43C|47G|4DM|49I|0D                                  AT+CGMI.        
1 "AT+CGMI"
2 "QUALCOMM INCORPORATED"
3 "OK"
Checking line: OK
AT reply state: 1
RECEIVED frame type 0x00/length 0x27/39
41A|54T|2B+|43C|47G|4DM|49I|0D |0D |0A |51Q|55U|41A|4CL|43C|4FO AT+CGMI...QUALCO
4DM|4DM|20 |49I|4EN|43C|4FO|52R|50P|4FO|52R|41A|54T|45E|44D|0D  MM INCORPORATED.
0A |0D |0A |4FO|4BK|0D |0A                                      ...OK..         
Manufacturer info received
[Manufacturer: Qualcomm]
Checking for OBEX support
SENDING frame type 0x00/length 0x0B/11
41A|54T|2B+|43C|50P|52R|4FO|54T|3D=|3F?|0D                      AT+CPROT=?.     
1 "AT+CPROT=?"
2 "ERROR"
Checking line: ERROR
AT reply state: 3
RECEIVED frame type 0x00/length 0x14/20
41A|54T|2B+|43C|50P|52R|4FO|54T|3D=|3F?|0D |0D |0A |45E|52R|52R AT+CPROT=?...ERR
4FO|52R|0D |0A                                                  OR..            
Checking for SYNCML/OBEX support
SENDING frame type 0x00/length 0x0C/12
41A|54T|2B+|53S|59Y|4EN|43C|4DM|4CL|3D=|3F?|0D                  AT+SYNCML=?.    
1 "AT+SYNCML=?"
2 "ERROR"
Checking line: ERROR
AT reply state: 3
RECEIVED frame type 0x00/length 0x15/21
41A|54T|2B+|53S|59Y|4EN|43C|4DM|4CL|3D=|3F?|0D |0D |0A |45E|52R AT+SYNCML=?...ER
52R|4FO|52R|0D |0A                                              ROR..           
SENDING frame type 0x00/length 0x0D/13
41A|54T|24$|54T|53S|53S|50P|43C|53S|57W|3D=|3F?|0D              AT$TSSPCSW=?.   
1 "AT$TSSPCSW=?"
2 "ERROR"
Checking line: ERROR
AT reply state: 3
RECEIVED frame type 0x00/length 0x16/22
41A|54T|24$|54T|53S|53S|50P|43C|53S|57W|3D=|3F?|0D |0D |0A |45E AT$TSSPCSW=?...E
52R|52R|4FO|52R|0D |0A                                          RROR..          
Setting date & time
SENDING frame type 0x00/length 0x21/33
41A|54T|2B+|43C|43C|4CL|4BK|3D=|22"|322|300|311|366|2F/|300|355 AT+CCLK="2016/05
2F/|311|311|2C,|311|311|3A:|322|355|3A:|322|333|2B+|300|311|22" /11,11:25:23+01"
0D                                                              .               
1 "AT+CCLK="2016/05/11,11:25:23+01""
2 "ERROR"
Checking line: ERROR
AT reply state: 3
RECEIVED frame type 0x00/length 0x2A/42
41A|54T|2B+|43C|43C|4CL|4BK|3D=|22"|322|300|311|366|2F/|300|355 AT+CCLK="2016/05
2F/|311|311|2C,|311|311|3A:|322|355|3A:|322|333|2B+|300|311|22" /11,11:25:23+01"
0D |0D |0A |45E|52R|52R|4FO|52R|0D |0A                          ...ERROR..      
Getting firmware versions
SENDING frame type 0x00/length 0x08/8
41A|54T|2B+|43C|47G|4DM|52R|0D                                  AT+CGMR.        
1 "AT+CGMR"
2 "SSD_M6281A-0.0.1   1  [Oct 02 2008 07:00:00]"
3 "OK"
Checking line: OK
AT reply state: 1
RECEIVED frame type 0x00/length 0x3E/62
41A|54T|2B+|43C|47G|4DM|52R|0D |0D |0A |53S|53S|44D|5F_|4DM|366 AT+CGMR...SSD_M6
322|388|311|41A|2D-|300|2E.|300|2E.|311|20 |20 |20 |311|20 |20  281A-0.0.1   1  
5B[|4FO|63c|74t|20 |300|322|20 |322|300|300|388|20 |300|377|3A: [Oct 02 2008 07:
300|300|3A:|300|300|5D]|0D |0A |0D |0A |4FO|4BK|0D |0A          00:00]....OK..  
Received firmware version: "SSD_M6281A-0.0.1   1  [Oct 02 2008 07:00:00]"
Number version is "62810.011022"
[Firmware version - "SSD_M6281A-0.0.1   1  [Oct 02 2008 07:00:00]"]
[Connected]
Checking used: UDH len 0, UsedBytes 0, FreeText 160, UsedText 0, FreeBytes 140
Adding text
Copy 160 (max 4)
Defalt text, length 4 4
Text added
Checking at the end: UDH len 0, UsedBytes 4, FreeText 156, UsedText 4, FreeBytes 136
4 4
Entering GSM_GetSMSC
Getting SMSC
SENDING frame type 0x00/length 0x09/9
41A|54T|2B+|43C|53S|43C|41A|3F?|0D                              AT+CSCA?.       
1 "AT+CSCA?"
2 "+CSCA: "+85290000000",145"
3 "OK"
Checking line: OK
AT reply state: 1
RECEIVED frame type 0x00/length 0x2C/44
41A|54T|2B+|43C|53S|43C|41A|3F?|0D |0D |0A |2B+|43C|53S|43C|41A AT+CSCA?...+CSCA
3A:|20 |22"|2B+|388|355|322|399|300|300|300|300|300|300|300|22" : "+85290000000"
2C,|311|344|355|0D |0A |0D |0A |4FO|4BK|0D |0A                  ,145....OK..    
SMSC info received
Parsing +CSCA: "+85290000000",145 with +CSCA: @p, @i
Grabbed string from reply: "+85290000000" (parsed 14 bytes)
Parsed phone string "+85290000000"
Phone string decoded as "+85290000000"
Parsed int 145
Leaving GSM_GetSMSC
Entering GSM_SendSMS
Trying SMS PDU mode
SENDING frame type 0x00/length 0x0A/10
41A|54T|2B+|43C|4DM|47G|46F|3D=|300|0D                          AT+CMGF=0.      
1 "AT+CMGF=0"
2 "OK"
Checking line: OK
AT reply state: 1
RECEIVED frame type 0x00/length 0x10/16
41A|54T|2B+|43C|4DM|47G|46F|3D=|300|0D |0D |0A |4FO|4BK|0D |0A  AT+CMGF=0...OK..
SMS Submit
Recipient number "728119904"
SMSC number "+85290000000"
SMS class -1
SMS validity ff
TPMR: 00 0
7 bit SMS, length 4, 4
text
Waiting for modem prompt
SENDING frame type 0x00/length 0x0B/11
41A|54T|2B+|43C|4DM|47G|53S|3D=|311|377|0D                      AT+CMGS=17.     
1 "AT+CMGS=17"
2 "> "
Checking line: > 
AT reply state: 7
RECEIVED frame type 0x00/length 0x0F/15
41A|54T|2B+|43C|4DM|47G|53S|3D=|311|377|0D |0D |0A |3E>|20      AT+CMGS=17...>  
Sending SMS
SENDING frame type 0x00/length 0x32/50
300|377|399|311|355|388|399|322|300|300|300|300|300|300|46F|300 07915892000000F0
311|311|300|300|300|399|388|311|322|377|311|388|399|311|300|399 1100098127189109
46F|344|300|300|300|300|46F|46F|300|344|46F|344|333|322|399|45E F40000FF04F4329E
300|45E                                                         0E              
SENDING frame type 0x00/length 0x01/1
1A                                                              .               
Leaving GSM_SendSMS
1 "AT+CMGS=17"
2 "> 07915892000000F01100098127189109F40000FF04F4329E0E"
3 "+CMS ERROR: 500"
Checking line: +CMS ERROR: 500
AT reply state: 5
RECEIVED frame type 0x00/length 0x56/86
41A|54T|2B+|43C|4DM|47G|53S|3D=|311|377|0D |0D |0A |3E>|20 |300 AT+CMGS=17...> 0
377|399|311|355|388|399|322|300|300|300|300|300|300|46F|300|311 7915892000000F01
311|300|300|300|399|388|311|322|377|311|388|399|311|300|399|46F 100098127189109F
344|300|300|300|300|46F|46F|300|344|46F|344|333|322|399|45E|300 40000FF04F4329E0
45E|0D |0A |0D |0A |2B+|43C|4DM|53S|20 |45E|52R|52R|4FO|52R|3A: E....+CMS ERROR:
20 |355|300|300|0D |0A                                           500..          
Error 500
Sent SMS on device: "/dev/ttyUSB0"
CMS Error 500: "unknown error"
[Terminating]
[Closing]

Thanks, Martin

Answer

marxin picture marxin · May 12, 2016

So the problem was caused by wrong phone number of my operator's SMS center.

After that, gammu works fine:

If you want break, press Ctrl+C...
Sending SMS 1/1....waiting for network answer..OK, message reference=207