Search code examples
raspberry-pismsdongleraspberry-pi4

Failed to send sms through wvdial (No Carrier! Trying again)


Problem


    pi@raspberrypi:/~ $ sudo wvdial

    --> WvDial: Internet dialer version 1.61
    --> Initializing modem.
    --> Sending: ATZ
    ATZ
    OK
    --> Sending: ATQ0 V1 E1 S0=0 &C1 &D2
    ATQ0 V1 E1 S0=0 &C1 &D2
    OK
    --> Modem initialized.
    --> Sending: ATDT07********
    --> Waiting for carrier.
    ATDT07********
    NO CARRIER
    --> No Carrier!  Trying again.
    --> Sending: ATDT07********
    --> Waiting for carrier.
    ATDT07********
    NO CARRIER
    --> No Carrier!  Trying again.
    --> Sending: ATDT07********
    --> Waiting for carrier.
    ATDT07********
    NO CARRIER
    --> No Carrier!  Trying again.

sudo wvdialconf


    pi@raspberrypi:/~ $ sudo wvdialconf
    Editing `/etc/wvdial.conf'.

    Scanning your serial ports for a modem.

    ttyUSB0: ATQ0 V1 E1 -- OK
    ttyUSB0: ATQ0 V1 E1 Z -- OK
    ttyUSB0: ATQ0 V1 E1 S0=0 -- OK
    ttyUSB0: ATQ0 V1 E1 S0=0 &C1 -- OK
    ttyUSB0: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
    ttyUSB0: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- ERROR
    ttyUSB0: Modem Identifier: ATI -- Manufacturer: huawei
    ttyUSB0: Speed 9600: AT -- OK
    ttyUSB0: Max speed is 9600; that should be safe.
    ttyUSB0: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
    ttyUSB1: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
    ttyUSB1: ATQ0 V1 E1 -- failed with 9600 baud, next try: 9600 baud
    ttyUSB1: ATQ0 V1 E1 -- and failed too at 115200, giving up.
    ttyUSB2: ATQ0 V1 E1 -- OK
    ttyUSB2: ATQ0 V1 E1 Z -- OK
    ttyUSB2: ATQ0 V1 E1 S0=0 -- OK
    ttyUSB2: ATQ0 V1 E1 S0=0 &C1 -- OK
    ttyUSB2: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
    ttyUSB2: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- ERROR
    ttyUSB2: Modem Identifier: ATI -- Manufacturer: huawei
    ttyUSB2: Speed 9600: AT -- OK
    ttyUSB2: Max speed is 9600; that should be safe.
    ttyUSB2: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK

    Found a modem on /dev/ttyUSB0.
    Modem configuration written to /etc/wvdial.conf.
    ttyUSB0: Speed 9600; init "ATQ0 V1 E1 S0=0 &C1 &D2"
    ttyUSB2: Speed 9600; init "ATQ0 V1 E1 S0=0 &C1 &D2"

Above details says that i can use ttyUSB0 or ttyUSB2 to send sms

lsusb Here the dongle is detected as modem


    pi@raspberrypi:/~ $ lsusb
    Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 009: ID 12d1:1001 Huawei Technologies Co., Ltd. E161/E169/E620/E800 HSDPA Modem
    Bus 001 Device 003: ID 09da:054f A4Tech Co., Ltd. 
    Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

/etc/wvdial.conf


    [Dialer Defaults]
    Init1 = ATZ
    Init2 = ATQ0 V1 E1 S0=0 &C1 &D2
    Modem Type = Analog Modem
    ISDN = 0
    New PPPD = yes
    Phone = 07********
    Modem = /dev/ttyUSB0
    Username = etisalat
    Password = etisalat
    Baud = 9600


Solution

  • To send sms through modem, it is required to switch to gsm text mode. wvdial.conf properties have to updated like following:

    
        [Dialer Defaults]
        Init1 = AT
        #
        Init2 = AT+CSCS="GSM"
        # Set the GSM modem in SMS Text Mode
        Init3 = AT+CMGF=1
        # Get info about the current operator.
        Init4 = AT+COPS?
        # To check whether the GSM/GPRS modem or mobile phone supports SMS text mode, 
        Init5 = AT+CMGF=?
        # Display the currently active modem mode.
        Init6 = AT^GETPORTMODE
        # : 1,1,1  : SMS text mode send, receive, boradcast supported
        Init7 = AT+CSMS=1
        # Device model Number
        Init8 = AT+GMM
        # 31, 3207880  : First number is signal strength, 0...31 where 31 is maximum possible. 2nd number  = ?
        Init9 = AT+CSQ
        # 0,0  : means the modem i snot connected to the network
        Init10 = AT+CREG?
        # 1 : means CDMA digital service available(0=no service, 2=TDMA, 3=analog)
        Init11 = AT+CAD?
        # should have said what storage memory is available for SMS
        Init12 = AT+CPMS=?
    
        # Type of the modem.
        Modem Type = Analog Modem
        # The location of the device that wvdial should use as your modem.
        Modem = /dev/ttyUSB0
        ISDN = 0
        Baud = 9600
        Dial Attempts = 3
    
    

    when you save above properties, then wvdial will work fine...

    In following file you will see the detailed explanation of all properties https://github.com/morfikov/files/blob/master/configs/etc/wvdial.conf

    https://www.developershome.com/sms/cmgsCommand3.asp