API for SimRoulette aggregators with SMART firmware

For aggregators with installed software versions

  • SR-Nano — version 7 or higher
  • SR-Train — version 5 or higher
  • SR-Box — version 4 or higher
  • SR-Board — version 2 or higher
  • SR-Organizer — version 4 or higher

Secure connection (HTTPS/TLS)

Starting from firmware version 9, SimRoulette supports secure connections:

  1. HTTPS for HTTP requests to the server
  2. TLS for socket connections.

For backward compatibility, legacy connections continue to work (see HTTP/HTTPS and TCP/TLS sockets below).

We recommend enabling secure mode. Responsibility for integration security when using unencrypted protocols lies with the user and/or their infrastructure.


Managing SimRoulette

Ways to interact with SimRoulette

  1. Enter a command directly via the WEB interface terminal of the aggregator.
  2. Create command lists (Macros) via the aggregator’s WEB interface and then have the device execute them.
  3. Send a GET or POST request to the aggregator: http://XXX.XXX.XXX.XXX/port?token=$token&command=$command
  4. Exchange data via the aggregator’s periodic GET requests to the URL of your server (website). For example, http://site.ru/sr/io.php
  5. Connect the aggregator to your server via a TCP socket using the IP/domain and port specified in the web interface. For example, site.ru:1234

GET or POST request to the aggregator

The aggregator accepts HTTP requests in the following form:

http://XXX.XXX.XXX.XXX/port?token=$token&command=$command

Where:

  • XXX.XXX.XXX.XXX — the aggregator’s IP address
  • $token — the secret key set in the aggregator’s web interface
  • $command — the command to execute

If no command is required (e.g., you only need to fetch data from the device), use the special value request as the command.

Important: special characters before the command change the aggregator’s behavior:

  • . (dot) — the controller expects a reply to the command. Without the dot, the command will be executed but no response will be returned.
  • @ — suppresses a verbose reply. Use when only the execution result is needed.


Data exchange via periodic GET requests

The aggregator periodically calls the specified URL on your server, for example: http://site.ru/sr/io.php
With each request, the aggregator passes a GET parameter:

  • data — contains the result of the previous command.

In response, the server must return a new command as plain text with a mandatory prefix:

{data}command

Important: the {data} prefix is required so the aggregator recognizes the response as valid. A response without it will be ignored.

Important: special characters before the command change the aggregator’s behavior:

  • . (dot) — the controller expects a reply to the command. Without the dot, the command will be executed but no response will be returned.
  • @ — suppresses a verbose reply. Use when only the execution result is needed.

HTTPS is supported. We recommend specifying your handler URL as https://…
Setup: the server address and polling frequency are set in the web interface or via the server command.

Connecting the SimRoulette aggregator to your server via TCP socket

When a connection is established, the aggregator sends identification and service data to your server in the following format:

  • TK:[key] — the authorization key, where key is MD5(token + salt).
  • The value of token is set in the interface.
  • The value of salt is available only to registered users in the personal account or via technical support.
  • All data from the aggregator is wrapped in blocks: [SRBEGIN]...[SREND]
  • File contents (e.g., audio) are wrapped as: [FILEBEGIN]...[FILEEND]
  • Every 10 seconds the aggregator sends a service signal [HEARTBEAT] to confirm the connection is active.
  • Response data from the server is sent back to the aggregator without any wrapping — as is.

Important: special characters before the command change the aggregator’s behavior:

  • . (dot) — the controller expects a reply to the command. Without the dot, the command will be executed but no response will be returned.
  • @ — suppresses a verbose reply. Use when only the execution result is needed.


TCP/TLS profiles and ports

The following port scheme applies:
Any even ports — plain TCP, odd ports — TLS.
Example: you can use port 8000 for a TCP connection or 8001 for a secure (TLS) connection.

Setup: the domain, port, and token for the TCP connection are configured via the web interface or with the socket command.

Server certificate requirements

The aggregator validates the certificate via the trust chain. If necessary, the chain may be placed on your domain under /.well-known/ for automatic retrieval. Domain/port/token parameters are set as before, via the socket command or the web interface.


Aggregator operating modes

The SimRoulette aggregator supports two operating modes:

  1. Automatic mode (recommended)
    In this mode, the aggregator independently manages SIM cards and modems:
    • monitors SIM card statuses
    • reads/sends SMS
    • processes USSD requests
    Recommended for most tasks — stable, fast, and reliable.
  2. Manual mode
    Modems are controlled directly via AT commands. Suitable for debugging, tests, or non-standard tasks.
Setup: select the mode with the set.dev.mode command.

Aggregator response

The aggregator returns data in JSON format. Example:

{"result":"[RESULT]"}

Where [RESULT] is the command execution result. The value can be:

  • 1 — the command was executed successfully
  • NULL — an error or no result
  • Number, text, array — if the command returns another data type

Important: the value 0 is always encoded as NULL.

Responses are asynchronous. In addition to direct replies to commands with the . prefix, the aggregator can also send messages about:

  • Changes in modem status
  • Events from system devices (e.g., modems, buttons, etc.)

These data are sent to the output stream as they occur.

Example:
request: http://192.168.1.2/port?token=12345&command=.version
Important! For a GET request, the command parameter in the URL must be URL-encoded on the client side using urlencode.
response: {"result":"1.69"}command_execution_result


Multiple commands can be chained with &&. In this case they will be executed sequentially.

Example:
request: http://192.168.1.2/port?token=12345&command=.version%26%26.set.dev.ip
Note! Since the command parameter is urlencoded, && becomes %26%26.
responses:
{"result":"1.69"}result_of_1st_command
{"result":"192.168.1.2"}result_of_2nd_command

Command signature (optional)

For easier navigation of asynchronous responses, any command you send can additionally be signed by adding a parameter:

"sign":"[SIGNATURE]"

In this case the aggregator will add the corresponding field in its response. This is especially helpful when several commands are sent at once and you need to match responses to original requests.

Example:
request: http://192.168.1.2/port?token=12345&command=.version:{"sign":"test"}
response: {"result":"1.69","sign":"test"}command_execution_result

Forming a custom result in the response

The aggregator allows you to control the value of the "result" field in the response. To do this, add the parameter to the outgoing command:

"result":"[KEY]"

In this case, the aggregator will return the value of the parameter from [KEY] in the "result" field.

Example:
request: http://192.168.1.2/port?token=12345&command=.version:{"sign":"test","result":"sign"}
response: {"result":"test"}command_execution_result

Terms and definitions


Command parameters can be passed sequentially, separated by commas, or in JSON format.
Example:

sms.send:number(1),sms(2)[,modem=1(3)]

Passing parameters sequentially, separated by commas (1, 2, 3), with the parameter in [square brackets] optional: sms.send:+79001234567,SMS text
Passing parameters in JSON (number, sms, modem), with the parameter in [square brackets] optional: sms.send:{"number":"+79001234567","sms":"SMS text","modem":"1"}

SimRoulette responses

  • Responses are asynchronous — not immediately after sending a command
  • Answer buffer — dynamic; can store dozens of results
  • 0 is always interpreted as NULL
  • Most commands return in the result field:
    • 1 — success
    • NULL — error or failure

Further notation in the text:

D — number, example: 33
W — word, character data, example: Text
X — numeric or character data
(D) — parameter ordinal number, example: fs.rename:source(1),target(2)

Thus, the command fs.rename:/terminal.dat,/test/terminal.dat is equivalent to fs.rename:{"source":"/terminal.dat","target":"/test/terminal.dat"}

[W] — optional parameter, example: sms.send:number(1),sms(2)[,modem(3)]
=X — default value for an optional parameter, example: ussd:number(1)[,modem(2)=1]
{D...D} — allowed range of values, example: {-23...23}


Aggregator control commands


echo:W — outputs the entered string to the output stream
example: @echo:Text response: Text



MODEMS


modem.on — turn modem(s) on
example: modem.on response: 1always


modem.off — turn modem(s) off
example: modem.off response: 1always


modem.map — get bank map (SR-Box only)
example: modem.map response: 10001000Banks 1 and 5 are connected


modem.select:data(1) — select the active modem for subsequent sending via modem.send (for aggregators with 8+ modems)
examples:
modem.select:? response: 1;2current active modems
modem.select:1 response: 1;2selected active modems
Note: The aggregator can receive responses from the 2 most recently selected modems simultaneously (does not apply to batch processing via modem.pack)


modem.card:data(1) — select card(s)
A2 — select a single card
A1+C8+D4 — select multiple cards (except models with 1 modem)
examples:
modem.card:A1 response: 1done 0error
modem.card:A2+B3+C4+D5+E6+G7+H8 response: 1done 0error


modem.set.request[:data(1)] — configure auto-requests (performed by the aggregator in the background and emitted to the output stream as events)
P — phone number stored on the SIM card
I — ICCID
C — IMSI
O — Operator name
N — Cellular network name
S — Signal level
examples:
modem.set.request response: PIOcurrent settings NONEempty
modem.set.request:PIONS response: PIONScurrent settings
Note: See also modem.set.timer.opt


modem.set.timer.reg[:data(1)] — set timeout (5–60 seconds) for the first post-activation request of the card’s registration status (status is emitted to the output stream as an event)
examples:
modem.set.timer.reg response: 15current value
modem.set.timer.reg:20 response: 20new value


modem.set.timer.check[:rescan(1),test(2)] — set timeouts (5–3600 seconds) between registration checks (rescan when all cards are registered, test when there are unregistered cards)
examples:
modem.set.timer.check response: 180;40current value
modem.set.timer.check:180,40 response: 180;40new value


modem.set.timer.opt[:data(1)] — set timeout (0–300 seconds) between auto-requests (see modem.set.request)
examples:
modem.set.timer.opt response: 15current value
modem.set.timer.opt:5 response: 5new value


modem.set.timer.sms[:data(1)] — set timeout (0–3600 seconds) between SMS arrival checks (on receipt, the SMS is output in PDU format)
examples:
modem.set.timer.sms response: 15current value
modem.set.timer.sms:20 response: 20new value


modem.set.clear.sms:data(1) — enable/disable clearing the modem’s SMS storage when switching SIM cards
examples:
modem.set.clear.sms:? response: 1current value
modem.set.clear.sms:0 response: 0new value


modem.send[1,2,3]:W — send a command directly to the selected (modem.select) modem
On devices with 8 modems, select the modem first via modem.select
Note! This sends standard AT commands to the modem
example: modem.send:ATD+79001234567; response: 1always


modem.pack:command(1),modem(2)[,answer(3)] — batch send commands (only for aggregators with 8+ modems) to selected (15678) or all (all) modems (answer=0 don’t wait for response / answer=1 extract only significant data / answer=2 return the full response)
examples:

modem.pack:AT+CREG?,12345,2
response:

{"type":"alert","dev":{"modem1":{"data":"AT+CREG?⏎⏎+CREG: 0,1⏎⏎OK"},"modem2":{"data":"AT+CREG?⏎⏎+CREG: 0,1⏎⏎OK"},"modem3":{"data":"AT+CREG?⏎⏎+CREG: 0,1⏎⏎OK"},"modem4":{"data":"AT+CREG?⏎⏎+CREG: 0,1⏎⏎OK"},"modem5":{"data":"AT+CREG?⏎⏎+CREG: 0,1⏎⏎OK"}}}

modem.pack:AT+CREG?,all,1
response:

{"type":"alert","dev":{"modem1":{"data":"0,1"},"modem2":{"data":"0,1"},"modem3":{"data":"0,1"},"modem4":{"data":"0,1"},"modem5":{"data":"0,1"},"modem6":{"data":"0,1"},"modem7":{"data":"0,1"},"modem8":{"data":"0,1"}}}


modem.download:modem(1),url(2),file(3)[,size(4)=10240] — download a file from a website and upload it to the specified modem’s memory
example: modem>download:simroulette.com/download/voice.amr;C:\User\voice.amr; response: 1done 0error


call:number(1)[,modem(2)=1] — Outgoing call from the current SIM card of the specified modem
examples:
call:+79001234567 response:1done 0error
call:{"number":"*102#","modem":"2"} response:1done 0error


ussd:number(1)[,modem(2)=1] — USSD request from the current SIM card of the specified modem
examples:
ussd:*102# response:1done 0error
ussd:{"number":"*102#","modem":"2"} response:1done 0error


command:action(1)[,modem(2)=1] — predefined action (answer, hangup)
examples:
command:answer,3 — answer an incoming call on modem 3, response:1done 0error
command:{"answer":"hangup","modem":"2"} — hang up on modem 2, response: 1done 0error



SMS


All SMS arriving at the aggregator are read by the device from the modems and sent to the controlling side in JSON in one of the following variants:

PDU
Example:

{"type":"alert","event":"sms","dev":{"modem1":{"sms":"1,0,55 07919762020041F7040B919710325476F80008520120022141212404220435043A0441044200200442043504410442043E0432043E043900200053004D0053"}}}

Text
Example:

{"type":"alert","event":"sms","dev":{"modem1":{"sms":"02.10.25 20:10:21;+79012345678;;Test SMS text"}}}

The variant is selected by the set.sms_parsing parameter


set.sms_parsing[:data(1)] — enable/disable SMS parsing on the aggregator side
examples:
set.sms_parsing response:0current value
set.sms_parsing:1 response:1new value


sms.send:number(1),sms(2),modem(3)[,delivery(4)][number2(5),sms2(6),modem2(7)] — send SMS (can be done simultaneously from 2 selected modems (for 8-modem models) or from all (for other models); delivery=1 — wait for delivery report)
examples:
sms.send:+79001234567,SMS text,3,0,+79001234568,SMS text 2,4 status in response:OKsent ERRORerror
sms.send:{"number":"+79001234567","sms":"SMS text","delivery":"1"} status in response:OKsent DELIVEREDdelivered ERRORerror


set.sms.delivery[:data(1)] — set the waiting time (seconds) for the SMS delivery report
examples:
set.sms.delivery response:10current value
set.sms.delivery:15 response:15new value



DISPLAY

Only for models with a screen

display.clear — clear the display
example: display.clear response: 1always


display:W — output text and special symbols to the display
W — parameters separated by "::":

1 — font size 10, 16, or 24
2 — alignment: left (L), center (C), right (R)
3 — X position (0 — 127)
4 — Y position (0 — 63)
5 — text (depending on the selected UI language you can show the user {English~Russian} version)
(6) — optional — a "|" delimiter after which you can append the second, third, etc. lines

examples:
display:10::C::64::30::Text|16::C::64::45::More text
display:10::C::64::35::{English text~Русский текст}! — depending on the selected language, the corresponding variant will be used
response: 1always


display.com:W — enable/disable display inversion
W — parameter:

i — enable inversion / n — disable inversion, example: display.com:i response: 1always


SOUND

Only for models with a beeper

sound:beep — short beep
example: sound:beep response: 1always


sound:error — long tone
example: sound:error response: 1always



BUFFER


The device’s text buffer is a powerful tool for parsing inputs and forming outputs and commands.
Useful when using macros.


buffer.clear — clear the buffer
example: buffer.clear response: 1always


buffer.view — output buffer contents to the output stream; to build tables you can use bbcode: [table][tr][th][thc[thr][td][tdc][tdr]
example: buffer.view response: ...buffer content 0buffer empty


buffer.raw — output buffer contents to the output stream without bbcode processing
example: buffer.raw response: ...buffer content 0buffer empty


buffer.display — display the buffer contents on the device screen (depending on volume, the device will set font size and, if needed, paginated output)
example: buffer.display response: 1always


buffer.write:W — write new data into the buffer
example: buffer.write:Value A: (a) response: 1always
Important! To substitute a variable value use (a), (Z), etc.; to substitute a character use (32), (147), etc.


buffer.prefix:W — prepend data to the current text
example: buffer.prefix:Line start(32) response: 1always
Important! To substitute a variable value use (a), (Z), etc.; to substitute a character use (32), (147), etc.


buffer.postfix:W — append data to the current text
example: buffer.postfix: line end response: 1always
Important! To substitute a variable value use (a), (Z), etc.; to substitute a character use (32), (147), etc.


buffer.push — save the buffer contents to the stack (device memory)
example: buffer.push response: 1buffer has data 0buffer empty


buffer.pop — restore buffer contents from the stack
example: buffer.pop response: 1buffer has data 0buffer empty


buffer.swap — swap the buffer contents with the saved copy on the stack
example: buffer.swap response: 1buffer has data 0buffer empty


buffer.merge[=W] — merge the buffer with its saved copy from the stack (result stays in the buffer)
W — optional text to insert between the merged parts
example: buffer.merge(13)(10) response: 1always
Important! To substitute a variable value use (a), (Z), etc.; to substitute a character use (32), (147), etc.


buffer.time — append the current time (HH:MM) to the buffer
example: buffer.time response: 1always


buffer.date — append the current date (DD.MM.YYYY) to the buffer
example: buffer.date response: 1always


buffer.timestamp — copy the internal timestamp to the buffer (seconds since 01.01.2000)
example: buffer.timestamp response: 1always


buffer.event.dev — copy to the buffer the device that initiated the event which triggered the macro
example: buffer.event.dev response: 1device


buffer.event.result — copy to the buffer the result of the event which triggered the macro
example: buffer.event.result response: 1result


buffer.file.save:file(1) — save the buffer contents to a file
file(1) — path and filename to save the buffer contents
example: buffer.file.save:/buffer.txt response: 1done 0error


buffer.file.append:file(1) — append the buffer contents to a file
file(1) — path and filename to append the buffer contents
example: buffer.file.append:/buffer.txt response: 1done 0error


buffer.file.load:file(1)[,line(2){-1...1000000}] — load file contents into the buffer; if a line number other than -1 is specified, only that line is placed into the buffer
examples:
buffer.file.load:/buffer.txt response: 1buffer has data 0buffer empty
buffer.file.load:/buffer.txt,3 response: 1buffer has data 0buffer empty
buffer.file.load:{"file":"/buffer.txt","line":"10"}


buffer.find:W — search the buffer for a sequence and replace the buffer with the found fragment
W — search string:
* — matches any number of arbitrary characters, example: buffer.find:balance* — if the buffer line contains the word “balance”, the buffer will keep text from “balance” to the end of the line, response: 1match found 0no match
[dD] — search for a number with the specified (D) number of digits, example: buffer.find:[d10] response: 110-digit number found 0not found — if found, only it remains in the buffer
[sD] — select the specified (D) number of characters from the start, or (-D) from the end (Russian characters take 2 bytes), example: buffer.find:[s10] — only the first 10 characters remain in the buffer, response: 1done 0not done


buffer.test:W — test whether the buffer contains a sequence
W — search string:
* — matches any number of arbitrary characters, example: buffer.test:balance* response: 1match found 0no match
[dD] — check for a number with the specified (D) digits, example: buffer.test:[d10] response: 110-digit number found 0not found
[sD] — select the specified (D) number of characters from the start, or (-D) from the end (Russian characters take 2 bytes), example: buffer.cut:[s10] — only the first 10 characters remain in the buffer, response: 1required number of characters present 0required number not found


buffer.cut:W — search the buffer for a sequence and remove the found fragment from the buffer
W — search string:
* — matches any number of arbitrary characters, example: buffer.cut:rub.* — if a line contains “rub.” it and everything after it will be removed, response: 1target string found and cut 0no match
[dD] — search for a number with (D) digits, example: buffer.cut:[d10] response: 110-digit number found and cut 0not found — if found, it is removed
[sD] — remove (D) characters from the start, or (-D) from the end (Russian characters take 2 bytes), example: buffer.cut:[s10] — the first 10 characters will be cut from the buffer, response: 1removed required number 0required number not found



VARIABLES


var:W[=D|+D|-D|*D|\D|==D|<D|>D] — work with a variable
W — the name of a numeric variable (26 variables available: a to z)

D — print the variable value
examples: var:a response: 123value of variable a

=D — assign a value to the variable
examples: var:a=123 response: 123assigned value of a, var:a=b response: assigned value of a

+D — addition
examples: var:a+1 response: new value of a, var:a+b response: new value of a

-D — subtraction
examples: var:a-2 response: new value of a, var:a-b response: new value of a

*D — multiplication
examples: var:a*3 response: new value of a, var:a*b response: new value of a

/D — division
examples: var:a/4 response: new value of a, var:a/b response: new value of a

==D — identity check
example: var:a==33 response: 1true 0false, var:a==b response: 1true 0false

<D — less-than check
examples: var:a<33 response: 1true 0false, var:a<b response: 1true 0false

>D — greater-than check
examples: var:a>33 response: 1true 0false, var:a>b response: 1true 0false

W — name of a text variable (3 variables available: str1, str2, str3)

var>str1 — print the contents of str1
example: var:buffer=str1 response: ...variable contents 0variable empty

var:str2=buffer — copy buffer contents into str2
example: var:str2=buffer response: 1always

var:buffer=str3 — copy str3 into the buffer
example: var:buffer=str3 response: 1always

Important! To insert a variable value into the buffer use (a), (b) ... (z).



FILES


The file system of all SimRoulette aggregators uses the controller’s internal FLASH memory. Available space varies by model, from 1.5 to 2.5 megabytes.
In some SR Nano configurations an external microSD card may additionally be used.


fs.space:[data(1)] — view memory status (free/used/total)

examples:
fs.space:free or fs.space response: 1000000free bytes
fs.space:used response: 2000000used bytes
fs.space:total response: 3000000total bytes


fs.list:W — list folder contents
W — folder name
example: fs.list:/ response: ❰ FILE LIST ❱ 0error


fs.view:W — view a file
W — filename
example: fs.view:/terminal.dat response: ❱❱ ENTERING VIEW MODE 0error


fs.edit:W — edit a file
W — filename
example: fs.edit:/terminal.dat response: ❱❱ ENTERING EDITOR 0error


fs.delete:W — delete a file
W — filename
example: fs.remove:/test/file.txt response: 1done 0error


fs.rename:source(1),target(2) — rename a file
source(1) — current path and filename
target(2) — new path and filename
examples: fs.rename:/terminal.dat,/test/terminal.dat
fs.rename:{"source":"/terminal.dat","target":"/test/terminal.dat"}
response: 1done 0error


fs.copy:source(1),target(2) — copy a file
source(1) — source filename
target(2) — destination filename
examples: fs.copy:/terminal.dat,/test/terminal.dat
fs.copy:{"source":"/terminal.dat","target":"/test/terminal.dat"}
response: 1done 0error


fs.download:url(1),file(2)[,size=30000] — download a file from a website (HTTP only)
url(1) — file URL
file(2) — path and filename to save
size(3) — maximum file size; large files may fail to save (optional)
examples:
fs.download:simroulette.com/download/test,/test/test response: 1done 0error
fs.download:{"url":"site.ru?get_request=123","file":"/test","size":"50000"} response: 1done 0error


fs.upload:url(1),file(2)[,newFileName(3)] — upload a file to a website (HTTP only)
url(1) — server URL to upload to
file(2) — path and filename to upload
newFileName(3) — filename to use on the server (optional)
examples:
fs.upload:simroulette.com/upload/test,/test/test response: 1done 0error
fs.upload:{"url":"site.ru?get_request=123","file":"/test","newFileName":"my_file"} response: 1done 0error
Important! The upload mechanism is implemented on our site, in your personal account. On your own server you can use the ready-made PHP script.


SR-Nano specific commands

TRACKS


SR-Nano-500 has 8 tracks, from 0 (A) to 7 (H). Cards are placed on the tracks. A — 100 cards, B — 90, C — 80, D — 68, E — 58, F — 46, G — 34, H — 24.

SR-Nano-1000 has 12 tracks, from 0 (A) to 11 (M). Cards are placed on the tracks. A — 140 cards, B — 130, C — 120, D — 110, E — 100, F — 90, G — 80, H — 68, I — 58, J — 46, K — 34, L — 24.


track:W — track
W — parameter:

0-7(11) — go to track (0 (A) to 7 (H) for SR-Nano-500, 0 (A) to 11 (M) for SR-Nano-1000), example: track:3 response: 1done 0error
? — current track number example: track:? response: 3current track number



SIM CARDS


card.discover — check if a SIM card is present in the current disk slot
example: card.discover response: 1card present 0no card


card.out:W — move the card (for manual extraction) to the arrow-marked position on the track (the screen shows the track letter and card number)
W — parameter:

A0-H23/M23 — card ordinal number (A0–A99,B0–B89,C0–C79,D0–D67,E0–E57,F0–F45,G0–G33,H0–H23 for SR-Nano-500; A0–A139,B0–B129,C0–C119,D0–D109,E0–E99,F0–F89,G0–G79,H0–H67,I0–I57,K0–K45,L0–L33,M0–M23 for SR-Nano-1000), example: card.out:A12 response: 1done 0error



MODEMS


modem.connect — connect contacts to the current SIM card
example: modem.connect response: 1done 0error
Note: does not work until a SIM card is selected. When connected, a corresponding icon is shown in the status line on the device screen and in the WEB interface.
Important! Always visually verify that the contacts are disconnected (raised) when changing the disk/carrier. To quickly raise the contacts, press the multifunction touch button.


modem.disconnect — disconnect contacts from the SIM card
example: modem.disconnect response: 1always
Note: happens automatically on any mechanical operation of the device


modem.outside — extend contacts without position check (service command)
example: modem.outside response: 1always
Important! use this command ONLY for maintenance of the aggregator!


modem.inside — retract contacts (service command)
example: modem.inside response: 1always


modem.activation[:bool] — connect to the SIM card and activate the modem with checking
example: modem.activation response: 1always



SETTINGS


version — get the aggregator firmware version
example:
version response:1.00aggregator version


set.dev.serial — get the aggregator’s serial number
example:
set.dev.serial response:DDDDDDDDDDDDDDDDDDaggregator serial number


set.dev.rev — get the aggregator revision (HARD version)
example:
set.dev.rev response:5aggregator revision


set.dev.ip — get the aggregator IP address
example:
set.dev.ip response:192.168.1.2aggregator IP


set.carrier_timer:[data(1){0...3600}] — idle timer (seconds) without external contacts (Server, Terminal); after the period the device reconnects to the network (0 — disabled)
examples:
set.carrier_time response:3600current value
set.carrier_time:60 response:60set timer


set.server:[url(1)][,frequency(2){1000...100000}] — get/set server connection parameters (URL and polling frequency)
examples:
set.server (you may specify http://… or https://…; HTTP is used by default) response:current parameters
set.server:simroulette.com/link/?token=DDDDDDDDDD,1000 response:parameters set


set.socket:[url:port@token] — get/set socket connection parameters
examples:
set.socket response:current parameters
set.socket:simroulette.com:1234@12345 response:parameters set
(use an even port for TCP, odd port for TLS).


set.dev.mode:[data(1)] — get/switch the aggregator mode (SMART — aggregator handles GSM-modem interaction; MANUAL — user polls modems for SMS, USSD, etc.)
examples:
set.dev.mode response:SMARTcurrent mode
set.dev.mode:MANUAL response:MANUALset mode


set.dev.alert:[data(1){0...1}] — get/set terminal notification output mode (the server will receive notifications regardless of this setting)
examples:
set.dev.alert response:1notifications enabled
set.dev.alert:0 response:0notifications disabled


set.ntp_server:[address(1)] — get/set NTP (Network Time Protocol) server address
examples:
set.ntp_server response:pool.ntp.org current address
set.ntp_server:pool.ntp.org response:pool.ntp.org set address
set.ntp_server:NONE — disable time sync response:1 NTP connection disabled


set.time.zone:[data(1){-23...23}] — get/set the current time zone of the aggregator
examples:
set.time.zone response:3current time zone UTC+03:00 Moscow
set.time.zone:5 response:5set time zone UTC+05:00 Yekaterinburg


set.time.daylightOffset:[data(1){-1...1}] — get/set daylight saving time offset
examples:
set.time.daylightOffset response:0current offset
set.time.zone:-1 response:-1offset set


set.dev.name:W — get/set the device name shown on the display
examples:
set.dev.name response:SR-Boardcurrent name
set.dev.name:Test response:Testnew name assigned


set.httpupdate:[data(1){0-10}] — how often the device checks SimRoulette server for updates (0 — disabled)
examples:
set.httpupdate response:1 current value
set.httpupdate:2 response:2 every second power-up


save — Save settings to the configuration file (without saving, settings persist only until the device is rebooted)
example: save response: 1 always



DATA PROTECTION

set.protection:[data(1){0-1}] — disable any commands to the modem(s); thus ICCID/IMSI, phone number, etc. cannot be obtained, but SMS and incoming call info will still be available
examples:
set.protection response:NULL current value
set.protection:1 response:1 value set
Important! The protection-enable command can be sent by any available means, but the protection-disable command can only be sent via the Terminal in the device’s local WEB interface!


Transport recommendations for external servers:

  • Use HTTPS for HTTP endpoints.
  • Use a TLS port for sockets.

For unencrypted connections, the infrastructure owner assumes the risk.


Storing certificate files for secure connections

To verify the server’s authenticity when establishing a TLS connection, the device uses local certificate files downloaded from your domain.


File format and location

Certificate files are hosted on your web server at:
http://<domain>/.well-known/ca.pem
where <domain> is the domain the device connects to (e.g., site.com).
The device automatically saves these files to its SPIFFS file system under /certs/ with the same base name:
/certs/site.com.pem
Thus, the filename always matches the domain name the certificate is issued for.

Contents of <domain>.pem
The file must contain the trust chain for your certificate, starting from the intermediate CA and ending with the root certificate.
You do not need to include the leaf domain certificate (e.g., site.com.pem from Let’s Encrypt). The device will obtain it during the connection.

Must include:
The intermediate certificate (e.g., Let’s Encrypt R13).
The root certificate (e.g., ISRG Root X1).
The file is a regular text PEM container and contains several blocks:

-----BEGIN CERTIFICATE-----
… intermediate certificate data …
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
… root certificate data …
-----END CERTIFICATE-----

Example
http://site.com/.well-known/ca.pem

-----BEGIN CERTIFICATE-----
MIIF… (Let’s Encrypt R13)
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIF… (ISRG Root X1)
-----END CERTIFICATE-----

Automatic updates
Whenever the Let’s Encrypt SSL certificate on the server is renewed, we recommend updating the corresponding ca.pem file.

Device behavior
On first connection, the device automatically downloads ca.pem and saves it to /certs/.
On subsequent connections, the local copy is used.
If the file is corrupted or missing, the device will attempt to download it again over HTTP.



CONTROL COMMANDS


answer.clear — clear the aggregator’s response queue
example: answer.clear response:1 always


command.clear — clear the command queue for the aggregator
example: command.clear response:1 always


i2c — list external devices connected via the i2c bus (for SR-Organizer)
example: i2с response:1 always


restart — soft reset of the aggregator
example: restart response: 1 ❱❱ DEVICE REBOOT


load_default_settings — reset settings to factory defaults
example: load_default_settings response:1 always


hard_reset — full device reset to a “new device” state
example: hard_reset response: 1 ❱❱ DEVICE REBOOT



MONITORING


request — command to receive a response (the result of previously executed commands) from the device (this command does not perform any action)


email.send:email(1);text(2) — send an email
examples: email:user@mail.ru,New information from SimRoulette
email:{"mail":"user@mail.ru","text":"New information from SimRoulette"}
response: 1email sent 0invalid settings



MACROS


Macros (or scripts) — a powerful internal automation mechanism of SimRoulette aggregators. With macros, absolutely any operating scenario can be implemented.

macro:W[,W2] | m:W[,W2] — run a macro with the given name (W) from the /m folder (variables can be used) with an optional input parameter (W2)
examples:
macro:filename response: ❱❱ EXECUTING MACRO 0error
m:filename response: ❱❱ EXECUTING MACRO 0error
macro:file_(a) response: ❱❱ EXECUTING MACRO 0error
macro:file,Text response: ❱❱ EXECUTING MACRO 0error
Note: macros can be edited and run in the Macros section of the SR-Nano WEB interface, where you can also track the execution progress of a running macro.


macro.stop | m.stop — stop execution of the current macro
example: m.stop response: 1 always


macro.event:event(1),macro(2),action(3) | m.event:event(1),macro(2),action(3) — add/remove a macro as an event listener

Note: when an event occurs, any running macro (if there was one) is stopped and all registered listener macros are executed sequentially; after completion, control is returned to the previously running macro. As an input parameter to the listener macro, the buffer receives the response from the device that triggered the event, for example: 1. Using the command buffer.event.dev, you can also get the device name into the buffer, e.g. modem1.

event(1) — event:

outCall — outgoing call started
inCall — incoming call received
noCarrier — attempt to establish connection failed
answer — answer to an incoming call, "handset picked up"
hangUp — call ended, "handset hung up"
ussd — response to a USSD request received
smsAlert — new SMS arrived at the modem
smsReceived — SMS copied into the aggregator file system
modemState — SIM card registration status changed
modemAnswer — response received from the modem
key — button pressed
portchangeState — port status changed (SR-Organizer)
portChangeUp — port status changed from low to high (SR-Organizer)
portChangeDown — port status changed from high to low (SR-Organizer)
i2cChangeState — I2C status changed (SR-Organizer)
timer1 — Timer 1 triggered
timer2 — Timer 2 triggered
dtmf — DTMF tone received
callBegin — conversation started (3G/4G modems)
callEnd — conversation ended
smsSent — SMS sent
smsNotSent — SMS not sent


macro(2) — macro:label to be executed when the event occurs
action(3) — action: add — add a listener, delete — remove a listener

examples:
m.event:event=modemState,macro=scanner:test,action=add response: 1done 0error
macros.event:event=key,macro=key,action=add response: 1done 0error


After the aggregator starts, the macro /m/autoexec is automatically executed, which contains conditions for handling certain events. More about macros can be found here.



SCHEDULER (CRON)


To perform tasks periodically at a specific time, the aggregator uses the classic CRON mechanism. Regular actions are described by instructions placed in the /crontab file.

Example file:

* * * * * macros:label

In this example, the macro /m/macros with the label label is set to run every minute.

Rules for forming macro execution times

MinuteHourDayMonthDay of week
* — every
X-Y — from minute X to minute Y
X,Y — minutes X and Y
*/X — every X minutes
* — every
X-Y — from hour X to hour Y
X,Y — hours X and Y
*/X — every X hours
* — every
X-Y — from day X to day Y
X,Y — days X and Y
*/X — every X days
* — every
X-Y — from month X to month Y
X,Y — months X and Y
*/X — every X months
* — every
X-Y — from day X to day Y
X,Y — days X and Y
@hourly — every hour
@daily, @midnight — every day
@weekly — once a week
@monthly — once a month
@yearly, @annually — once a year

Integrating SimRoulette into your project

We hope the information above will help you integrate SimRoulette into your project without any issues.
To simplify the task, we recommend using the WEB panel.
And of course, you can always use the services of our programmers.

Новости SIM Roulette

Анонсы новых девайсов и софта, информацию об акциях и скидках мы публикуем только в соцсетях: