## Has been tested and developed using: > ubuntu 16.04.6
> openssl: 1.0.2g
> node: 8.16.0 ## Requirements: ```sh curl -sL [https://deb.nodesource.com/setup_8.x](https://deb.nodesource.com/setup_8.x) | sudo -E bash - sudo apt-get install -y nodejs sudo apt-get install -y build-essential install python 2.7 rm package-lock.json && rm -rf node_modules && rm -rf ~/.node-gyp only **(if package-lock.json/node_modules or node was installed)** sudo apt-get install libasound2-dev sudo npm i -g node-gyp sudo npm install --unsafe-perm ``` ## How to guide how to configure units and the simulator
**1. Insert Groups**
Groups will be inserted using the following script directly on the database: ```sql set search_path to public; do $$ declare i INTEGER := 1; declare sipid integer; declare ressql varchar; declare acc_id integer = 1; declare number_of_groups INTEGER := 50; -- How many groups we create declare dispatcher_name varchar := 'Dispatcher Sergiu'; declare groups_name varchar := 'sergiu-sim-'; BEGIN -- Create groups WHILE i <= number_of_groups LOOP SELECT get_new_sipid(acc_id) INTO sipid; SELECT insert_update_groups(acc_id, Null, groups_name || i, '1', '1', '0', '0', '0', sipid, 0,'','') INTO ressql; i = i + 1; raise notice '%', sipid; -- raise notice '%', i; -- raise notice '%', ressql; -- end loop; -- Assign dispatcher on the groups insert into public.asset_group (asset_id, group_id) select (select id from public.asset where name = dispatcher_name), id from public."group" g where name like groups_name || '%'; end; $$; ```
**2. Insert units**
The units will be inserted from the provisioning(**Units -> Import from file**) and the **file_name.xlsx** file will have the following format: ![FILE.XLSX Format](./doc/units-xlsx.png)
**3. Simulator configuration:**
For the simulation to simulate **in a period**, we must put the **delay_between_clients setting in settings** (the value is in milliseconds).
Example in **config**:
```toml [mumble] port = '5668' host = '10.120.1.169' [hub] address = 'https://10.120.1.169/' [elogs] name = '169' [api] port = '' host = '10.120.1.169/api' use_secure = true accept_untrusted_certs = true [settings] max_fails = 20 send_voice = true send_gps = true gps_report_interval = 10000 # The interval in which the GPS is sent gps_lat_start_point = 46.217802 gps_lng_start_point = 24.776126 delay_between_clients = 1500 [assets] # linx-simulator-1 - linx-simulator-10 # ids = [15,16,17,18,19,20,21,22,23,24] # linx-simulator-1 - linx-simulator-25 # ids = [ # 15,16,17,18,19,20,21,22,23,24, # 25,26,27,28,29,30,31,32,33,34, # 35,36,37,38,39 # ] # linx-simulator-1 - linx-simulator-50 ids = [ 15,16,17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32,33,34, 35,36,37,38,39,40,41,42,43,44, 45,46,47,48,49,50,51,52,53,54, 55,56,57,58,59,60,61,62,63,64 ] [sounds] sound = 'sound.mp3' #sound = 'file_example_MP3_700KB.mp3' sounds_total_number = 1 ```
**4. To start the simulator**
To start the simulator we must specify which config file we want to use. ``` NODE_TLS_REJECT_UNAUTHORIZED='0' node ./index.js --path="./config/dev/" ``` ## Problems you may encounter
**1.** If you want to create groups, make sure you have enough free space on that account. If you do not have enough space you can use the following script (you must change the id to match your account) ```sql set search_path to public; DO $BODY$ BEGIN UPDATE license SET max_assets = 1000, max_dispatch = 1000, max_talk_groups = 1000 WHERE id = 1; UPDATE license SET crc = md5(coalesce(max_assets, 0)::text || coalesce(max_talk_groups, 0)::text || coalesce(max_dispatch, 0)::text || coalesce(to_char(expires_on at time zone 'utc','YYYY-MM-DD"T"HH24:MI:SS'), '1970-01-01T00:00:00')::text || coalesce(to_char(maintenance_end at time zone 'utc','YYYY-MM-DD"T"HH24:MI:SS') , '1970-01-01T00:00:00')::text )::varchar WHERE id = 1; END; $BODY$; ``` **2.** To start the server on a private system the setting is required: ```sh NODE_TLS_REJECT_UNAUTHORIZED='0' ``` otherwise you will receive the error: **Error: self signed certificate** ## Run with Vagrant Create the VM with vagrant up After you change anything vagrant destroy; vagrant up # or vagrant reload After installation, got to VirtualBox and add audio card to VM in Settings for VM. Do a `vagrant reload` afterwards. To see the ssh parameters for config use `vagrant ssh-config`. Vagrant will map the current directory to `/vagrant` by default. Steps to do in VM: vagrant ssh cd simulator sudo cp -R /vagrant/* . sudo chown -R vagrant:vagrant * sudo npm install --unsafe-perm ? (sudo?) npm install --unsafe-perm #run simulator NODE_TLS_REJECT_UNAUTHORIZED='0' node ./index.js --path="./config/dev/" ### Problems / to do It worked once but now it does not work, don't know why.