An _**intercom**_ is the device installed near the front door to protect residents from strangers. People outside can call people inside the building, and the latter decide to open the door or not. Each intercom provides its own API. Now we work only with intercoms manufactured by Beward. Makaw is responsible for direct communication with the intercom. > You can access the intercom logs with `http:///log0.asp` #### Docs **Request the parameters:**  `/cgi-bin/intercom_cgi?action=get` ```text HandsetUpLevel=%d\n DoorOpenLevel=%d\n CMSOffset=%d\n DoorOpenTime=%d\n CallTimeout=%d\n TalkTimeout=%d\n ConciergeApartment=%d\n AlertNoUSBDisk={on|off}\n CmdTimeout=%d\n SamplingTime=%d\n VoltageDelta=%d\n DoorOpenMode={on|off}\n DoorCode=%d\n DoorCodeActive={on|off}\n AutoCollectKeys={on|off}\n ``` **Kind of relay commutation:** ```text RelayType=1 - NC , RelayType=0 - NO ; DoorOpenSipFail={on|off}\n Keep the doors open while the sip server is unavailable ``` **Set parameters:**  `/cgi-bin/intercom_cgi?action=set¶m1=value1¶m2=value2...` **Line Level Query:**  `/cgi-bin/intercom_cgi?action=linelevel&Apartment=100` > Apartment - an apartment number **Request for receiving apartment parameters:** `/cgi-bin/apartment_cgi?action=get&Number=100` ```text Number=%d\n DoorCode=%d\n DoorCodeActive={on|off}\n - The door opening code is active RegCode=%d\n - RFID Registration Code RegCodeActive={on|off}\n RFID registration code is active BlockCMS={on|off}\n Block call on the CMS PhonesActive={on|off}\n Calling numbers are active Phone1=%s\n Number to call number №1 Phone2=%s\n Number to call number №2 Phone3=%s\n Number to call number №3 Phone4=%s\n Number to call number №4 Phone5=%s\n Number to call number №5 ``` **Request for setting apartment parameters:**  `/cgi-bin/apartment_cgi?action=set¶m1=value1¶m2=value2...` **Request for door opening code regeneration:**  `/cgi-bin/apartment_cgi?action=set&DoorCode=generate` **RFID Registration Code Regeneration Request:**  `/cgi-bin/apartment_cgi?action=set&RegCode=generate` **Request cleaning apartments:**  `/cgi-bin/apartment_cgi?action=clear&FirstNumber=100[&LastNumber=100]` > FirstNumber - the number of the first apartment for cleaning LastNumber - the last apartment number for cleaning, you can not specify if one apartment is being cleaned. **Request for receiving a list of RFID keys:**  `/cgi-bin/rfid_cgi?action=list[&IndexFrom=0][&IndexTo=100][&Apartment=100]` > IndexFrom - the initial key index IndexTo - final key index Apartment - get a list of keys for a specific apartment **Request to add RFID key:**  `/cgi-bin/rfid_cgi?action=add&Key=412FFFEBA2F3[&Index=2][&Apartment=99]` > Key - RFID key Index - key index Apartment - apartment number **RFID key removal request:**  `/cgi-bin/rfid_cgi?action=delete&Key=412FFFEBA2F3[&Index=2][&Apartment=99]` > Key - delete RFID key Index - delete key by index Apartment - remove all keys for apartment number **Request binding / decoupling RFID key to the apartment:**  `/cgi-bin/rfid_cgi?action=update&Key=412FFFEBA2F3[&Apartment=122]` > if you do not set Apartment, then unlinked **Open the main door:**  `/cgi-bin/intercom_cgi?action=maindoor` **Open an additional door:**  `/cgi-bin/intercom_cgi?action=altdoor` **Request getting display parameters:**  `/cgi-bin/display_cgi?action=getTickerEnable={on|off}\n On/off running line` ```text TickerText=%s\n Ticker Text TickerTimeout=%d\n Ticker timeout LineEnable1={on|off}\n LineText1=%s\n LineEnable2={on|off}\n LineText2=%s\n LineEnable3={on|off}\n LineText3=%s\n LineEnable4={on|off}\n LineText4=%s\n LineEnable5={on|off}\n LineText5=%s\n LinesTimeout=%d\n Timeout for changing lines ``` **Request to set display parameters:**  `/cgi-bin/display_cgi?action=set¶m1=value1¶m2=value2...` **Request getting the settings of the RFID key scanning mode:**  `/cgi-bin/rfid_cgi?action=get` ```text RegCode=%d\n Code to run the scan mode of RFID keys RegCodeActive={on|off}\n On/Off code to run the scan mode of RFID keys RegKeyValue=%012llX\n RFID key to start the scan mode of RFID keys RegModeActive={on|off}\n Is the RFID key scanning mode active now ``` **Request to change the settings for scanning RFID keys:**  `/cgi-bin/rfid_cgi?action=set¶m1=value1¶m2=value2...` **To run the mode:**  `/cgi-bin/rfid_cgi?action=set&RegModeActive=on` **To stop the mode:**  `/cgi-bin/rfid_cgi?action=set&RegModeActive=off` **Request code regeneration to run the scan mode of RFID keys:**  `/cgi-bin/rfid_cgi?action=set&RegCode=generate` **Request getting alarm parameters:**  `/cgi-bin/intercom_alarm_cgi?action=get` ```text MDoorMaxTime=%d\n Time of long opening of the main door MDoorLongOpenCallActive={on|off}\n On/off alarm of long opening of the main door MDoorLongOpenCallNumber=%s\n Number to call for a long opening of the main door MDoorBreakInCallActive={on|off}\n On/off alarm hacking the main doorMDoorBreakInCallNumber=%s\n Number to call for breaking the main door ADoorMaxTime=%d\n Long opening time for an additional door ADoorLongOpenCallActive={on|off}\n On/off alarm for long opening additional door ADoorLongOpenCallNumber=%s\n Number to call for a long opening additional door ADoorBreakInCallActive={on|off}\n On/off alarm break-in additional door ADoorBreakInCallNumber=%s\n Number for calling an additional door to break SOSCallActive=%s\n On / off call by pressing the SOS button SOSCallNumber=%s\n Number to call by pressing the SOS button IntercomBreakInEmailActive={on|off}\n On / off send e-mail when the doorphone is hacked ``` **Request setting alarm parameters:**  `/cgi-bin/intercom_alarm_cgi?action=set¶m1=value1¶m2=value2...` **Request getting device name:**  `/cgi-bin/systeminfo_cgi?action=get` ```text HostName=%s\n ``` **Request setting the door opening code:**  `/cgi-bin/apartment_cgi?action=set&DoorCode=000000204A16` **RFID registration code setting request:**  `/cgi-bin/apartment_cgi?action=set&RegCode=000000204A16` **Request setting code to run the scan mode RFID keys:**  `/cgi-bin/rfid_cgi?action=set&RegCode=000000204A16` **Request for forced saving of settings:**  `/cgi-bin/config_cgi?action=forcesave` **Request to display a list of apartments:**  `/cgi-bin/apartment_cgi?action=list[&FirstNumber=1][&LastNumber=9999]` > FirstNumber - the number of the first apartment, you can not specify LastNumber - the number of the last apartment, you can not specify **Request getting HTTPS settings:**  `/cgi-bin/https_cgi?action=get` ```text Type={0-2}\n 0 - only HTTP, 1 - only HTTPS, 2 - both types Certificate={0-1}\n 0 - no certificate, 1 - there is a certificate Request=%d\n 0 - no certificate request, 1 - there is a certificate request ``` **Request HTTPS settings:**  `/cgi-bin/https_cgi?action=set&Type={0-2}` **Request to get the contents of the HTTPS certificate request:**  `/cgi-bin/https_cgi?action=printreq` **Request to get HTTPS certificate content:**  `/cgi-bin/https_cgi?action=printcert` **HTTPS certificate request creation request:**  `/cgi-bin/https_cgi?action=createreq&Country=RU&State=Krasnoyarsk&Locality=Krasnoyarsk&Organization=Beward&Unit=RnD&CommonName=DKS15121&KeyLength=512` **Request to create a self-signed HTTPS certificate:**  `/cgi-bin/https_cgi?action=createcert&Country=RU&State=Krasnoyarsk&Locality=Krasnoyarsk&Organization=Beward&Unit=RnD&CommonName=DKS15121&Days=365` **Request to delete an HTTPS certificate request:**  `/cgi-bin/https_cgi?action=deletereq` **Request to delete an HTTPS self-signed certificate:**  `/cgi-bin/https_cgi?action=deletecert` > HTTPS certificate setting request: POST /cgi-bin/https\_cgi?action=install&filename=cert.pem **Request getting syslog settings:**  `/cgi-bin/rsyslog_cgi?action=get` ```text Enable={on|off}\n Protocol={tcp|udp}\n ServerAddress=%s\n ServerPort=%d\n LogLevel={0-7}\n ``` **Request setting syslog settings:**  `/cgi-bin/rsyslog_cgi?action=set&Param1=Value1&...` **Request getting NTP settings:**  `/cgi-bin/ntp_cgi?action=get` ```text Enable={on|off}\n ServerAddress=%s\n ServerPort=%d\n Timezone={0-34}\n ``` **Request setting NTP parameters:**  `/cgi-bin/ntp_cgi?action=set&Param1=Value1&...` **Request for getting the status of limit switches:**  `/cgi-bin/intercom_cgi?action=status` ```text MainDoorButtonPressed={on|off}\n Status of the main door button AltDoorButtonPressed={on|off}\n Alternative Door Button StatusMainDoorOpened={on|off}\n The status of the main door switch AltDoorOpened={on|off}\n Status of additional door switch IntercomBreakIn={on|off}\n The status of the end switch of the intercom ``` **Request serial number:**  `/cgi-bin/systeminfo_cgi?action=get` ```text DeviceID=%u\n ``` **Request for obtaining the MC firmware version:**  `/cgi-bin/intercom_cgi?action=fwversion` ```text FWVersion=%s\n ``` **Request for SIP Registration Status:**  `/cgi-bin/sip_cgi?action=regstatus` ```text AccountReg1={0|1}\n AccountReg2={0|1}\n ``` **Request to reset the settings while maintaining the network and apartment settings:**  `/cgi-bin/factorydefault_cgi` **Request a full reset:**  `/cgi-bin/hardfactorydefault_cgi` **Request getting gate settings:**  `/cgi-bin/gate_cgi?action=get` ```text Enable={on|off}\n This intercom is installed on the gate MainDoor={on|off}\n Open the main door AltDoor={on|off}\n Open additional door PowerRely={on|off}\n Run off the power relay output EntranceCount=%d\n Number of entrances Address%d=%s\n Doorphone Address BegNumber%d=%d\n Apartment no. From EndNumber%d=%d\n Apartment no. To Mode = {0 | 1} \ n Gate mode: 0 - mode 1, 1 - mode 2; Prefix%d=%04d\n Home Prefix ``` **Request setting gate settings:**  `/cgi-bin/gate_cgi?action=set&Param1=Value1&...` **Request to get a list of configuration files on a USB drive:**  `/cgi-bin/config_cgi?action=list` ```text 20180306_083144\n 20180306_083145\n ``` **Request to delete configuration files on a USB drive:**  `/cgi-bin/config_cgi?action=remove&name=20180306_083144` **Request to download configuration files on a USB drive:**  `/cgi-bin/config_cgi?action=download&name=20180306_083144` **Request getting user settings:**  `/cgi-bin/pwdgrp_cgi?action=get` ```text username:password:level:blockdoors\n admin::1:0\n user1::2:1\n user2::2:0\n ``` **Request setting user preferences:**  `/cgi-bin/pwdgrp_cgi?action=update&username=user1&blockdoors={0|1}`  `/cgi-bin/systeminfo_cgi?action=get`  uptime work and other system parameters  **Comment Edit** **Request for obtaining compliance of the apartment:**  `/cgi-bin/intercomdu_cgi?action=get&Index=0&Dozens=0&Units=0` **Answer:** ```text %d\r\n Apartment Number ``` **Request for setting of apartment matching:**  `/cgi-bin/intercomdu_cgi?action=set&Index=0&Dozens=0&Units=0&Apartment=20` **Request for obtaining a list of matching apartments:**  `/cgi-bin/intercomdu_cgi?action=list&Index=-1` **Answer:** ```text %d %d %d %d %d %d %d %d %d %d\r\n %d %d %d %d %d %d %d %d %d %d\r\n %d %d %d %d %d %d %d %d %d %d\r\n %d %d %d %d %d %d %d %d %d %d\r\n %d %d %d %d %d %d %d %d %d %d\r\n %d %d %d %d %d %d %d %d %d %d\r\n%d %d %d %d %d %d %d %d %d %d\r\n %d %d %d %d %d %d %d %d %d %d\r\n %d %d %d %d %d %d %d %d %d %d\r\n %d %d %d %d %d %d %d %d %d %d\r\n \r\n %d %d %d %d %d %d %d %d %d %d\r\n ... ``` **Request for setting of apartment preset matching:**  `/cgi-bin/intercomdu_cgi?action=fill&Type=0&FirstApartment=1` > Type - preset type: 0 - Visit, Digital, Eltis; 1 - Metacom 80 100 160 220; 2 - Metacom 25. **Request export of the apartment matching table:**  `/cgi-bin/intercomdu_cgi?action=export` **Request for importing apartment matching tables:**  `/cgi-bin/intercomdu_cgi?action=import` **1) Configuration update via TFTP server:**  `/cgi-bin/config_cgi?action=restore&filename=20180825_062523.bck&server=192.168.0.55&port=69`  The file can be either an extension of bak and bck **2) Audio tube CMS settings and microphone / intercom speaker:**  Getting parameters:  `/cgi-bin/audio_cgi?action=get` ```text MicSensitivity=8 SpeakerVolume=8 KmnMicSensitivity=8 KmnSpeakerVolume=8 ``` interval \[1 - 16\] **Setting parameters:**  `/cgi-bin/audio_cgi?action=set&MicSensitivity=15` **Download DSP Parameters File:**  Speaker / Microphone POST  `/cgi-bin/audio_cgi?action=dsp1CMS` tube POST  `/cgi-bin/audio_cgi?action=dsp2` **File name**  filename=\*.bin **Model change:**  `/cgi-bin/config_cgi?action=lens&Type=Dome`  `/cgi-bin/config_cgi?action=lens&Type=Pinhole`  where: > Dome - dome camera (DKS15120, DKS15122), Pinhole - pinhole camera with a false lens. (DKS15100, DKS15102) `/cgi-bin/textoverlay_cgi?action=get`  **Parameter** > DateFormat=\[0-2\] Corresponds to order in the web 0 - yyyy-mm-dd 1 - mm-dd-yyyy 2 - dd-mm-yyyy Example:  [`http://192.168.0.144/cgi-bin/textoverlay_cgi?action=set&DateFormat=2`](http://192.168.0.144/cgi-bin/textoverlay_cgi?action=set&DateFormat=2) **Changed CGI request pwdgrp\_cgi:**  action=get returns data in the form of "name: access rights separated by comma", example: `user1:1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1` **Change Request:**  `action=update&username=user1&capabilities=1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1` **Alert for add. reader (if enabled, the intercom responds to the key with the add. reader as well as from its internal)**  `/cgi-bin/intercom_cgi?action=get` ```text ExtReaderNotify={on|off}\n ``` **Request for filling apartments:**  `/cgi-bin/apartment_cgi?action=fill&FirstNumber=100[&LastNumber=100]` > FirstNumber - the number of the first apartment to fill LastNum