You can directly access any serial device connected to your Mikrotik, including USB GSM modems.
There’s a few options how to access the serial port remotely.
- manually with winbox
winbox –> terminal –>/system serial-terminal port=usb1
- directly via telnet and ssh
add a new user gsm and create a special-login (system->Special login, user gsm, port usb1)
you can then calltelnet gsm@<IP>
ssh gsm@<IP>
make sure you have telnet/ssh enabled - create a virtual serial device which will mimic standard locally connected serial device
you can then connect you app to it without the need of any modifications to the program.
see below
Let’s get a virtual serial port to work!
- connect your 3G USB modem to Mikrotik USB port
it appears in/port print detail
check your baud rate, data-bits, parity, stop-bits and flow-control settings, defaults are 9600, 8, none, 1, none /port remote-access add port=usb1 protocol=raw tcp-port=10000 channel=3
Pro tip: take care of choosing the right protocol! You can try both of them. Default protocol is rfc2217, which is telnet with port setting synchronization (baud rate, parity, stop bit etc.).
Pro tip: My Huawei modem reports 5 channels. You can use channel 0, but there are no modem notification on this channel. For sms notifications, signal strange notifications and call notifications use different channel. I had to use channel 3 with my Huawei E173/E367.- run
socat pty,link=/dev/vmodem0,raw tcp:<IP>:10000&
- virtual serial port
/dev/vmodem0
should be created and you can now connect to it
screen /dev/vmodem0 9600
- hurray! You can test some commands, then exit with Ctrl+A D
AT
> OK
ATZ
> OK
Tested on Debian. This should work on OS X too, but socat command must be a bit different (update coming later).