testing chat - PPP

This is a discussion on testing chat - PPP ; Hello! First of all, thanks for your time and sorry for my poor english: I am trying to test chat scripts directly through the chat program, without using pppd. So I have used a simple chat script: ABORT BUSY ABORT ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: testing chat

  1. testing chat

    Hello!

    First of all, thanks for your time and sorry for my poor english:

    I am trying to test chat scripts directly through the chat program,
    without using pppd. So I have used a simple chat script:

    ABORT BUSY ABORT 'NO CARRIER' ABORT ERROR\
    TIMEOUT 30 \
    AT OK \
    "ATD620524004" CONNECT

    I know the gprs modem works well because I have talken with it with
    minicom

    But when I call to chat :

    [root@localhost ppp]# chat -vs -f chatscript
    abort on (BUSY)
    abort on (NO CARRIER)
    abort on (ERROR\)
    timeout set to 30
    seconds

    expect ()

    got it

    send (AT^M)
    expect (OK)
    alarm
    Failed

    The modem doesnt seems to reply anything.

    Any suggestion of what I am not doing well??

    Is this the right method of testing the chatscripts (I need to test it
    separately of pppd)

    I dont know how to tell chat that the modem is in ttyS0 9600, how
    could I specify this?

    Lot of thanks

    Jorge

  2. Re: testing chat

    Jorge Naxus wrote:

    > I am trying to test chat scripts directly through the chat program,
    > without using pppd. So I have used a simple chat script:


    > ABORT BUSY ABORT 'NO CARRIER' ABORT ERROR\
    > TIMEOUT 30 \
    > AT OK \
    > "ATD620524004" CONNECT


    > I know the gprs modem works well because I have talken with it with
    > minicom


    > But when I call to chat :


    > [root@localhost ppp]# chat -vs -f chatscript
    > abort on (BUSY)
    > abort on (NO CARRIER)
    > abort on (ERROR\)
    > timeout set to 30
    > seconds
    >
    > expect ()
    >
    > got it
    >
    > send (AT^M)
    > expect (OK)
    > alarm
    > Failed


    > The modem doesnt seems to reply anything.


    No, you haven't told chat how to talk to the modem. You have to use
    standard output and standard input to do that when using chat as a
    stand-alone program.

    > Any suggestion of what I am not doing well??


    One minor thing is that if you escape the new-line then you have
    a space between the text at the end of the line and the beginning
    of the text on the next line. This showed up in the "abort on (ERROR\)"
    message, which means that chat won't abort on "ERROR".

    It would be better not to escape the new-line when it isn't between
    expect and send strings, or within quotes such as the "NO CARRIER,"
    something permitted in a chat script specified with -f. It would
    likely help improve the appearance of the output too.

    > Is this the right method of testing the chatscripts (I need to test it
    > separately of pppd)


    > I dont know how to tell chat that the modem is in ttyS0 9600, how
    > could I specify this?


    Through standard input and standard output, e.g., (with the chat script
    on the chat command line)

    chat -vs ABORT BUSY ABORT "NO CARRIER" ABORT ERROR TIMEOUT 45 AT OK \
    "ATD620524004" CONNECT \\c

    See man chat for what \c means. A TIMEOUT of 45 seconds or more may be
    necessary to allow time for the connection to complete. The default speed
    for a ttySx is 9600, if I remember correctly. It can be changed with

    stty -F /dev/ttyS0

    (see man stty), but there's no way for chat to set the baud rate.
    Pppd sets the baud rate and passes it to chat when they are used
    together.

    --
    Clifford Kite Email: "echo xvgr_yvahk-ccc@ri1.arg|rot13"
    PPP-Q&A links, downloads: http://ckite.no-ip.net/
    /* In my book, the first poster to resort to personal abuse in a Usenet
    debate loses by default. - Rod Smith */


  3. Re: testing chat

    Clifford Kite wrote:

    > chat -vs ABORT BUSY ABORT "NO CARRIER" ABORT ERROR TIMEOUT 45 AT OK \
    > "ATD620524004" CONNECT \\c


    Oops, the most important elements were omitted. It should read

    chat -vs ABORT BUSY ABORT "NO CARRIER" ABORT ERROR TIMEOUT 45 AT OK \
    "ATD620524004" CONNECT \\c > /dev/ttyS0 < /dev/ttyS0

    --
    Clifford Kite Email: "echo xvgr_yvahk-ccc@ri1.arg|rot13"
    PPP-Q&A links, downloads: http://ckite.no-ip.net/
    /* Emacs vs vi:
    Sort of like a Swiss Army knife versus a rapier. */

  4. Re: testing chat

    On Wed, 31 Dec 2003 10:06:23 -0600, Clifford Kite
    wrote:

    >Clifford Kite wrote:
    >
    >> chat -vs ABORT BUSY ABORT "NO CARRIER" ABORT ERROR TIMEOUT 45 AT OK \
    >> "ATD620524004" CONNECT \\c

    >
    >Oops, the most important elements were omitted. It should read


    Lot of thanks!
    I will test it right now


    Happy new year

    Jorge

  5. Re: testing chat

    Clifford Kite writes:

    ]Jorge Naxus wrote:

    ]> I am trying to test chat scripts directly through the chat program,
    ]> without using pppd. So I have used a simple chat script:

    ]> ABORT BUSY ABORT 'NO CARRIER' ABORT ERROR\
    ]> TIMEOUT 30 \
    ]> AT OK \
    ]> "ATD620524004" CONNECT

    ]> I know the gprs modem works well because I have talken with it with
    ]> minicom

    ]> But when I call to chat :

    ]> [root@localhost ppp]# chat -vs -f chatscript

    chat connects to stdin and stdout. That is all.
    To make it work stdin and stdout must be connected to the device you
    want to test
    chat -vs -f chatscript <>/dev/ttyS0
    for example.


  6. Re: testing chat

    Bill Unruh wrote:

    > chat connects to stdin and stdout. That is all.
    > To make it work stdin and stdout must be connected to the device you
    > want to test
    > chat -vs -f chatscript <>/dev/ttyS0
    > for example.


    I suppose it could work with a -f chat script (haven't tried it), but
    "<>/dev/ttyS0" didn't work here with the chat command line script in my
    most recent reply to the OP when that script was modified to use it.

    --
    Clifford Kite Email: "echo xvgr_yvahk-ccc@ri1.arg|rot13"
    PPP-Q&A links, downloads: http://ckite.no-ip.net/
    /* For every credibility gap, there is a gullibility fill.
    -- R. Clopton */

  7. Re: testing chat

    Clifford Kite wrote:
    > Clifford Kite wrote:


    >> chat -vs ABORT BUSY ABORT "NO CARRIER" ABORT ERROR TIMEOUT 45 AT OK \
    >> "ATD620524004" CONNECT \\c


    > Oops, the most important elements were omitted. It should read


    > chat -vs ABORT BUSY ABORT "NO CARRIER" ABORT ERROR TIMEOUT 45 AT OK \
    > "ATD620524004" CONNECT \\c > /dev/ttyS0 < /dev/ttyS0


    Here is yet another correction. :/

    chat -vs ABORT BUSY ABORT "NO CARRIER" ABORT ERROR TIMEOUT 45 "" AT OK \
    "ATD620524004" CONNECT \\c > /dev/ttyS0 < /dev/ttyS0

    This time I tested it before posting.

    --
    Clifford Kite Email: "echo xvgr_yvahk-ccc@ri1.arg|rot13"
    PPP-Q&A links, downloads: http://ckite.no-ip.net/
    /* They that can give up essential liberty to obtain a little temporary
    safety deserve neither liberty nor safety." Benjamin Franklin */


  8. Re: testing chat

    Clifford Kite writes:

    ]Bill Unruh wrote:

    ]> chat connects to stdin and stdout. That is all.
    ]> To make it work stdin and stdout must be connected to the device you
    ]> want to test
    ]> chat -vs -f chatscript <>/dev/ttyS0
    ]> for example.

    ]I suppose it could work with a -f chat script (haven't tried it), but
    ]"<>/dev/ttyS0" didn't work here with the chat command line script in my
    ]most recent reply to the OP when that script was modified to use it.

    Hmm I guess you are right. This opens file descriptor 0 ( stdin) for
    both reading and writing. But of course chat writes to file descriptor
    1.

    So the right thing is
    chat -vs -f chatscript <>/dev/ttyS0 >&0
    This seems to work.



+ Reply to Thread