Subscribe to News

AT Commands ( Messaging )

Author : Jbuenol

From TechnologicalWiki

Jump to: navigation, search
  • AT+CSCA : Service Center Address . This command is uded to indicate which service center the messagemust be sent to. It's necessary initialize this parameter at the modem. If it is not initialized an error will be generated.
   AT+CSCA=<number>
           <number> Phone number which belongs to the message center choosen.
   e.g. AT+CSCA="0696741234"

Obtaining a response like this :

   OK
  • AT+CSMS : Service Message Service Address . This command is uded to indicate which service center the messagemust be sent to. It's necessary initialize this parameter at the modem. If it is not initialized an error will be generated.
    e.g. AT+CSCA="0696741234"

Obtaining a response like this :

   OK
  • AT+CMGL : Read message list from device.
    AT+CMGL=<stat>
            <stat> Type of messages to catch.
    <stat> = "REC UNREAD" : received and unread messages.
           = "REC READ" : received and read messages
           = "STO UNSENT" : stored and unsent messages
           = "STO SENT" : stored and sent messages


Obtaining a response like this :

   +CMGL: 2,"REC READ","0146290800",
   <CR><LF>
   hello!!!!
   OK
  • AT+CMGF : Preferred message format.
    AT+CMGF=<format>
            <format> Type of format of the messages.
    <format> = 0 PDU format.
             = 1 Text format.

There are two ways of sending and receiving SMS messages: by text mode and by PDU (protocol description unit) mode. The text mode (unavailable on some phones) is just an encoding of the bit stream represented by the PDU mode.

Obtaining a response like this :

  OK
  • AT+CPGR : Allows to read stored messages.
    AT+CPGR = <index>
              <index> Index of the entry in the box.


    e.g. AT+CMGR=1

Obtaining a response like this :

  +CMGR="REC UNREAD","0146290800","98/10/01, 18:22:11+00",<CR><LF>
  This is the body of the selected message !!!
  OK
  • AT+CPGW : Allows to write a message in memory.

2 ways :

    - text format : AT+CPGW = <orig/dest>[ <type orig/dest> [ <stat> ]]<CR>
                    Text of the Message<ctrl-Z>
    <orig/dest>      = Originating or Destination Address Value in string format.
    <type orig/dest> = Type of Originating / Destination Address.
    <stat>           = (View +CMGL command)
    - PDU  format : AT+CPGW = <length>[ <stat> ]<CR>text codified (PDU)<ctrl-Z>
    <length>         = Length of the actual data unit in octects.


    e.g.
         - AT+CMGW="+85291234567",145,"STO UNSENT"<CR>
           This is an example for illustrating the syntax
           of the +CMGW AT command in SMS text mode.
           <Ctrl+z>
         - AT+CMGW=42<CR>07915892000000F001000B915892214365F7000021493A2
                   83D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72E
                   <Ctrl+z>

Obtaining a response like this :

  +CMGW=<index> ... where index is the position where the message has been stored.
  OK
  • AT+CNMI : Configure modem to advise when a message arrives.


    AT+CNMI = [<mode>[,<mt>[,<bm>[,<ds>[,<bfr>]]]]]
               <mode> = 0 buffer in TA;
                      = 1 discard indication and reject new SMs when TE-TA link is reserved.
                        otherwise forward directly.
                      = 2 buffer new Sms when TE-TA link is reserved and flush them to
                        TE after reservation.
                        otherwise forward directly to the TE.
                      = 3 forward directly to TE.
                <mt>  = 0 no SMS-DELIVER are routed to TE.
                      = 1 +CMTI: <mem>,<index> routed to TE.
                      = 2 for all SMS_DELIVERs except class 2: +CMT: .... routed to TE.
                          class 2 is indicated as in <mt>=1.
                      = 3 Class 3: as in <mt>=2.
                        other classes: As in <mt>=1.
                <bm>  = same as <mt>, but for CBMs.
                <ds>  = 0 No SMS-STATUS-REPORT are routed to TE.
                      = 1 SMS-STATUS-REPORTs are routed to TE, using +CDS: ...
                <bfr> = 0 TA buffer is flushed to TE (if <mode>=1..3).
                      = 1 TA buffer is cleared (if <mode>=1..3).
    e.g.
         - AT+CNMI=2,1,0,0,0
         - AT+CNMI=2,2,0,0,0

Obtaining a response like one of these respectively:

  +CMTI: "SM",1   ... where 1 represents the position of the new message.
  +CMT: "123456","98/10/01,12:30:00+00",129,4,32,240,"15379",129,5<CR><LF>
  Text of the message

[edit] References

How To manage your cell phone using AT Commands

Main Collaborators