[Request] automate devices (LTE Modem) via scriptable telnet

Hi all,

I have a LTE modem (LG FM300) and a RB751G. To get into the internet, one first has to login to the LTE modem via telnet (VLAN 99, port 10000) and enter two commands. (The first one provides the PIN of the LTE SIM card and the second one sets the APN of my ISP.) After that a router board DHCP client gets a public IP on VLAN 132. Interactively, this all works very well.

Unfortunately the second telnet command that sets the APN has to be repeated from time to time (like a keep-alive command), else the internet connection stops working (sometimes even before the DHCP lease time is up). If I then login via telnet, enter the command again, and trigger a DHCP rebind/refresh, everything works well again. I need a way to automate this keep-alive/DHCP-rebind via a script and without an additional 24/7 PC in the network.

Can u help?
Thanks.

Details:

[edit: shortened and streamlined the original post]

Is it maybe possible to write a small RouterOS plugin for this telnet command automation myself? Does a plugin API exist? Is some C sample code available that shows how to create a RouterOS package/plugin?
(I really need a solution that works autarkically without an additional 24/7-PC just for controlling the LTE modem with two simple telnet commands… However, I am open for suggestions; the easier the better.)