# Hikvision Device Registration Process Based on the ISUP SDK documentation, here's how Hikvision devices should register with your server: ## Registration Flow Overview According to the documentation, the device registration follows this sequence: 1. **Device connects** to your ISUP server (TCP port 7660) 2. **Device sends REGISTER_REQ** (0x01) with device information 3. **Server responds** with REGISTER_RSP (0x81) - success/failure 4. **Authentication phase** (if required): - Device sends AUTH_REQ (0x03) with credentials - Server responds with AUTH_RSP (0x83) 5. **Session key exchange** (for ISUP 5.0): - Device sends SESSIONKEY_REQ (0x04) - Server responds with SESSIONKEY_RSP (0x84) 6. **Heartbeat maintenance**: - Device sends periodic HEARTBEAT_REQ (0x02) - Server responds with HEARTBEAT_RSP (0x82) ## Device Configuration Requirements ### On the Hikvision Device: 1. **Enable ISUP Protocol**: - Go to Configuration → Network → Advanced Settings → Platform - Select "ISUP" from platform access mode - Check "Enable" 2. **Set ISUP Version**: - Choose "5.0" for ISUP 5.0 protocol - This requires setting an ISUP key (8-32 characters) 3. **Configure Server Settings**: - **Server IP**: Your server's IP address - **Port**: 7660 (your ISUP server port) - **Device ID**: Unique identifier for the device - **ISUP Key**: Authentication key (for ISUP 5.0) ### Example Device Settings: ``` ISUP Version: 5.0 Server IP: your-server-ip Port: 7660 Device ID: 255 ISUP Key: hikvision123 ``` ## Registration Message Format ### REGISTER_REQ (0x01) Structure: ``` ISUP Header (20 bytes): - Version: 0x50 (ISUP 5.0) - Message Type: 0x01 (REGISTER_REQ) - Sequence: 2 bytes - Device ID Length: 1 byte - Device ID: 32 bytes (padded) - Data Length: 2 bytes - Reserved: 2 bytes Registration Data: - Serial Number - Device Type - Firmware Version - MAC Address - Capabilities - Other device-specific information ``` ## Troubleshooting Connection Issues ### 1. Check Network Connectivity ```bash # Test if device can reach your server ping your-server-ip # Test if port is accessible telnet your-server-ip 7660 ``` ### 2. Verify Server Configuration - Ensure ISUP server is running on port 7660 - Check firewall settings - Verify server logs for connection attempts ### 3. Device Configuration Checklist - [ ] ISUP protocol enabled - [ ] Correct server IP and port - [ ] Valid device ID set - [ ] ISUP key configured (for v5.0) - [ ] Network connectivity working ### 4. Common Issues **Device not connecting:** - Check network connectivity - Verify server IP/port settings - Ensure ISUP is enabled on device **Connection established but no registration:** - Check ISUP version compatibility - Verify device ID format - Check authentication credentials **Registration fails:** - Verify device is in authorized devices list - Check ISUP key matches - Review server logs for error details ## Debug Information Your enhanced server now logs: 1. **Connection Attempts**: All TCP connections to port 7660 2. **Registration Attempts**: Device registration requests with details 3. **Raw ISUP Messages**: All protocol messages with hex data Access the debug information at: `http://your-server/debug` ## Expected Device Behavior When properly configured, a Hikvision device should: 1. **Establish TCP connection** to your server 2. **Send registration request** within seconds of connection 3. **Maintain heartbeat** every 30-60 seconds 4. **Send events** (access control, alarms) as they occur 5. **Respond to commands** sent from server ## Next Steps 1. **Configure your device** with the correct ISUP settings 2. **Monitor the Debug tab** to see if connection attempts are being made 3. **Check registration attempts** to see if device is sending proper data 4. **Review raw messages** to understand what the device is actually sending If you see connection attempts but no registration, the device may be: - Using a different ISUP version - Sending malformed registration data - Using different authentication method The debug logging will help identify exactly what's happening!