> For the complete documentation index, see [llms.txt](https://help.boomerang3.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.boomerang3.com/b3-sms-device-installation-manual/installation-procedures/rut955-router-setup/script-preparation.md).

# Script preparation

The RUT955 script that requests update from the B3 SMS server and sends SMS can be downloaded from <https://icuscandinavia060.sharepoint.com/:u:/s/Technicalfile/IQDUOlUNwfwTQYfrEquxlFr9AT-VyQptZ8KjQhU7fPJXYVg?e=aGrkD0>

The default RUT955 script is shown below. It must be modified before it is installed on the router.

{% code overflow="wrap" lineNumbers="true" %}

```sh
#!/bin/sh
APIUniqueID="Customer1b3"
#If you are using Telia SIM with ICU APN you must use IP adress - in other cases you need to use top domain.
API_URL="http://rqs.se/api/data/json.asp?id=$APIUniqueID"
#API_URL="http://10.50.33.14/api/data/json.asp?id=$APIUniqueID"
API_KEY="dZucDUygTFJvgCs7QRDx"
#SMS_GATEWAY="http://172.16.0.32/cgi-bin/sms_send"
SMS_GATEWAY="http://127.0.0.1/cgi-bin/sms_send"
USERNAME="smsuser"
PASSWORD="n2femPSx83PTVhkX"
INTERVAL=60

urlencode() {
  local s="$1"
  local out=""
  local i=1
  local c

  while [ $i -le ${#s} ]; do
    c=$(echo "$s" | cut -c $i)
    case "$c" in
      [a-zA-Z0-9.~_-]) out="$out$c" ;;
      *) out="$out$(printf '%%%02X' "'$c")" ;;
    esac
    i=$((i + 1))
  done

  echo "$out"
}

# Get SIM/modem status using gsmctl
OPERATOR=$(gsmctl --operator)
RSSI=$(gsmctl -q | grep -o '[0-9\-]*')
ICCID=$(gsmctl --iccid)
IMEI=$(gsmctl --imei)

# gsmctl may not provide RSRP/RSRQ; omit if unsupported
RSRP=""
RSRQ=""
SIM_STATE=""  # Not available in gsmctl
SIM_ACTIVE=""

POST_PAYLOAD=$(cat <<EOF
{
  "custId": "$APIUniqueID",
  "signal_rssi": "$RSSI",
  "operator": "$OPERATOR",
  "iccid": "$ICCID",
  "imei": "$IMEI"
}
EOF
)

while true; do

  RESPONSE=$(curl -s -H "x-api-key: $API_KEY" "$API_URL")

  CODE=$(echo "$RESPONSE" | awk -F'"code"[[:space:]]*:[[:space:]]*"' '{print $2}' | awk -F'"' '{print $1}')

  if [ "$CODE" = "99" ]; then
    logger -t poll_api "Received code 99 - no SMS to send"
    SMSNR=""
    TEXT=""
  else
    SMSNR=$(echo "$RESPONSE" | awk -F'"smsnr"[[:space:]]*:[[:space:]]*"' '{print $2}' | awk -F'"' '{print $1}')
    TEXT=$(echo "$RESPONSE" | awk -F'"text"[[:space:]]*:[[:space:]]*"' '{print $2}' | awk -F'"' '{print $1}')

    if [ -n "$SMSNR" ]; then
      ENCODED_TEXT=$(urlencode "$TEXT")
      FULL_URL="${SMS_GATEWAY}?username=${USERNAME}&password=${PASSWORD}&number=${SMSNR}&text=${ENCODED_TEXT}"

      logger -t poll_api "Sending SMS to $SMSNR: $TEXT"
      curl -s "$FULL_URL"
    else
      logger -t poll_api "No SMS number found in response"
    fi
  fi

  curl -s -X POST "$API_URL" -H "x-api-key: $API_KEY" -H "Content-Type: application/json" -d "$POST_PAYLOAD"

  sleep $INTERVAL
done
```

{% endcode %}

There are two places were the script shall be modified:

1. [APIUniqueID](https://help.boomerang3.com/b3-sms-device-installation-manual/installation-procedures/rut955-router-setup/script-preparation/apiuniqueid.md).
2. [SMS server URL](https://help.boomerang3.com/b3-sms-device-installation-manual/installation-procedures/rut955-router-setup/script-preparation/sms-server-url.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.boomerang3.com/b3-sms-device-installation-manual/installation-procedures/rut955-router-setup/script-preparation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
