[how] Script sending an AT command to a GSM modem

How can I send an AT command to a GSM modem using a script (and a serial terminal)?

Use can use /interface/ppp-out/at-chat input=ATI for a serial-based or modem may appear as /interface/lte, and that too has the /interface/lte/at-chat input=ATI.

The /system/serial-terminal is only for interactive use, no scripting.

Do I need to configure the PPP interface in any special way for chat-at to work? It doesn’t work for me with default settings
chat-at.png

USB modem typically have several ports, /port/print will show how many.

And on the /interface/ppp-client interface, it’s the info-channel= that’s used for AT commands. So it using the 2nd port (zero index), you might try making info-channel=0 or info-channel=2…

Also may want to disable/uncheck dial-on-demand while testing this too.

It works! Thanks!