Hello, guys!
I have a problem with my script. Can you help me to find mistake? I try to deploy a hotspot with sms-authorization on my RB951Ui-2HnD (RouterOS 6.41.3).
I can receive SMS and i can send SMS. I have chosen this script for generation and sending a passwords in SMS:
:local smsSecret "Internet"
:foreach i in=[/tool sms inbox find] do={
:local smsMessage [/tool sms inbox get $i message];
if ($smsMessage = $smsSecret) do={
#Password generation
:local time [/system clock get time]
:local hour [:pick $time 0 2]
:local min [:pick $time 3 5]
:local sec [:pick $time 6 8]
:local pass [($hour * $min * $sec)]
:if ($pass = 0) do={ :set pass 6524 }
#End password generation
:local smsPhone [/tool sms inbox get $i phone];
:if ([:len $smsPhone]>11) do={
:local login [:pick $smsPhone 1 12]
/tool user-manager user add customer=admin disabled=no username=$login password=$pass shared-users=1 phone=$smsPhone
/tool user-manager user create-and-activate-profile "$login" customer=admin profile=Default
/tool sms inbox remove $i
:local smsAnswer [("Login: ".$login."\nPassword: " . $pass)]
/tool sms send usb1 $smsPhone message=$smsAnswer
}
}
}
Logically, then user sends SMS-secret(Internet) to router he should receive sms with password, but it doesn't work. I added this script on sheduler, it runs
every minute, but user doesn't receive sms.
Thanks!