在旅途中拿電腦開Winbox,來要改雙卡單待的 SIM比較難。所有改wiki mikrotik "dual sim Script". SIM up(hk) 是香港, SIM down(CN)是中國, 要是沒有連網, SIM UP and SIM down (互換)。
{
# Setup and read current values, switch between "up" SIM slot, and "down" if not connected.
:global simSlot [/system routerboard sim get sim-slot]
:global timeoutLTE 60
:global timeoutConnect 60
:log info message="Enter RoamingScript"
# Wait for LTE to initialize for maximum "timeoutLTE" seconds
:local i 0
:local isLTEinit false
:while ($i<$timeoutLTE) do={
:foreach n in=[/interface lte find] do={:set $isLTEinit true}
:if ($isLTEinit=true) do={
:set $i $timeoutLTE
}
:set $i ($i+1)
:delay 1s
}
# Check if LTE is initialized, or try power-reset the modem
:if ($isLTEinit=true) do={
# Wait for LTE interface to connect to mobile network for maximum "timeoutConnet" seconds
:local isConnected false
:set $i 0
:while ($i<$timeoutConnect) do={
:if ([/interface lte get [find name="lte-1"] running]=true) do={
:set $isConnected true
:set $i $timeoutConnect
}
:set $i ($i+1)
:delay 1s
}
# Check if LTE is connected
if ($isConnected=true) do={
:log info message="Connected, do nothing"
} else={
:log info message="LTE interface did not connect to network, switch Dual SIM"
:if ($simSlot="down") do={
# If "down" (home) slot, check roaming status
:log info message="SIM existed but not running, switching to SIM UP (HK) APN-HK"
/system routerboard sim set sim-slot=up
/interface lte set [find] apn-profiles="APN-HK"
} else={
# Else "up" (roaming) slot, check roaming status
:log info message="SIM existed but not running, switching to SIM DOWN (CN) APN-CMCC"
/system routerboard sim set sim-slot=down
/interface lte set [find] apn-profiles="APN-CMCC"
}
}
} else={
:log info message="LTE modem did not appear, trying power-reset"
/system routerboard usb power-reset duration=5s
}
}作者: yiucsw 時間: 2018-8-27 01:13
LTAP 是常开Roaming, 過關要VOWIFI不是很方便,所有改了用mode-button, 按一下改那個SIM 連上網,WIFI網路不會斷太久。
開Mode-button:
/system routerboard mode-button set on-event=switchsim
/system routerboard mode-button set enabled=yes
system script switchsim
{
:local simSlot [/system routerboard sim get sim-slot]
:log info "Mode Button press, switch sim-slot current $simSlot"
:if ($simSlot="down") do={
/system routerboard sim set sim-slot=up
:log info "swtich sim position by mode to up"
} else {
/system routerboard sim set sim-slot=down
:log info "swtich sim position by mode to down"
}