Skip to content

flamebmf/hilink-sms-api

Repository files navigation

hilink-sms-api

Perl CGI SMS gateway for Brovi/Huawei HiLink LTE modems (E3372-325). Provides a web dashboard and Zabbix webhook integration for alert notifications.

Copyright (c) 2026 PlurumTech.com. See LICENSE for terms.

Features

  • Send SMS via modem HTTP API
  • Async SMS sending with job queue
  • Web dashboard: device status, signal info, network, SMS inbox/outbox
  • Zabbix 6+ GET-based webhook alert integration
  • Apache Basic Auth protection
  • Phone number normalization (8...+7...)

Requirements

  • Apache httpd with mod_cgi
  • Perl 5 with CGI, IO::Socket::INET, JSON modules
  • HiLink modem (E3372-325 or similar) at 192.168.8.1

Files

File Purpose
HilinkSMS.pm Core Perl module — all modem logic
sms-gw.pl CGI + CLI dual-mode (detects automatically)
hilink-sms-cli.pl CLI-only tool (lightweight alternative)
hilink-smsd.pl Standalone HTTP daemon (no Apache)
hilink-dash.html Web dashboard UI
hilink-auth.conf Apache Basic Auth config
zabbix_hilink_sms_webhook.yaml Zabbix media type import

Install

  1. Copy files to server:
scp HilinkSMS.pm sms-gw.pl user@server:/var/www/cgi-bin/
scp hilink-dash.html user@server:/var/www/html/
scp hilink-auth.conf user@server:/etc/httpd/conf.d/
  1. Set permissions:
chmod 755 /var/www/cgi-bin/sms-gw.pl /var/www/cgi-bin/HilinkSMS.pm
chgrp apache /var/www/cgi-bin/sms-gw.pl /var/www/cgi-bin/HilinkSMS.pm
  1. Create log directory:
mkdir -p /var/www/cgi-bin/log
chown apache:apache /var/www/cgi-bin/log
  1. Create htpasswd file:
htpasswd -c /var/www/cgi-bin/.htpasswd admin
chgrp apache /var/www/cgi-bin/.htpasswd
chmod 660 /var/www/cgi-bin/.htpasswd
  1. Restart Apache:
systemctl restart httpd

Zabbix IP Exception

By default, Basic Auth protects both the dashboard and CGI. To allow Zabbix server to send SMS without authentication, add your Zabbix server IP to hilink-auth.conf:

<RequireAny>
  Require valid-user
  Require ip <ZABBIX_SERVER_IP>   # <-- replace with your Zabbix server IP
</RequireAny>

Then reload Apache:

systemctl reload httpd

Usage

  • Dashboard: http://server/hilink-dash.html
  • API (CGI): http://server/cgi-bin/sms-gw.pl?action=send&phone=+71234567890&msg=Hello
  • API (CLI): perl sms-gw.pl phone=+7XXXXXXXXXX text="Alert"
  • Default credentials: admin / hilink2026

Zabbix Integration

Import zabbix_hilink_sms_webhook.yaml as a media type in Zabbix 6+. Configure user media with URL: http://server/cgi-bin/sms-gw.pl Parameters: phone, msg — script sends GET with action=send.

Zabbix requests from the whitelisted IP bypass Basic Auth.

CLI Usage (No Apache, No HTTP)

Send SMS directly from command line — for cron, scripts, monitoring:

perl sms-gw.pl phone=+7XXXXXXXXXX text="Alert: server down"
# or
perl hilink-sms-cli.pl phone=+7XXXXXXXXXX msg="Hello world"

Both scripts talk directly to the modem at 192.168.8.1 with zero setup.

Standalone Daemon (No Apache)

Run without Apache:

perl hilink-smsd.pl --daemon --port 8080

Access API at http://localhost:8080/cgi-bin/sms-gw.pl?action=signal

No authentication, no Apache — works as a local API proxy on any machine with modem access.

About

Perl CGI SMS gateway for Brovi/Huawei HiLink LTE modems (E3372-325). Web dashboard + Zabbix webhook integration.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors