Creating a script for sending SMS

Can’t tell where is the issue regarding removing SMS, try to upgrade ROS to 7.14, there is some fix in 7.14 regarding SMS removal:

*) modem - fixed SMS removal (introduced in v7.13);

here is script that retries removing SMS in recursion until no error with max retry count 10, controlled by maxRetry variable:

:local removeAllSMS do={
  :do {
    /tool/sms/inbox/remove [find]
  } on-error={
    :if ($retryCnt < $maxRetry) do={
      $removeAllSMS removeAllSMS=$removeAllSMS retryCnt=($retryCnt + 1) maxRetry=$maxRetry
    }
  }
}

:global sendingSMS
:if (!$sendingSMS && [/tool sms inbox find where message ~"1237"]) do={
  :set sendingSMS true
  :do {
    /tool/sms/send Vivacom-LTE phone-number="1237" status-report-request=no message=traffic
  } on-error={
    :set sendingSMS false
    :local errMsg "Send SMS for Traffic reset failed"
    :log error $errMsg
    :error $errMsg
  }
  :log info "Send SMS for Traffic reset"
  $removeAllSMS removeAllSMS=$removeAllSMS retryCnt=1 maxRetry=10
  :set sendingSMS false
}