add: parameter config support alarm forward config

This commit is contained in:
2024-09-06 10:49:22 +08:00
parent 86ae0779ef
commit 388729bf09
13 changed files with 497 additions and 77 deletions

View File

@@ -99,22 +99,23 @@ func AlarmForwardBySMS(alarmData *Alarm) (string, error) {
func AlarmForwardBySMPP(alarmData *Alarm) (string, error) {
log.Info("AlarmForwardBySMPP processing... ")
toUsers, err := dborm.XormGetAlarmForward("SMS")
if err != nil {
log.Error("Failed to XormGetAlarmForward:", err)
return "", err
} else if toUsers == nil {
err := errors.New("not found forward phone number")
log.Error(err)
return "", err
}
userList := strings.Join(*toUsers, ",")
// toUsers, err := dborm.XormGetAlarmForward("SMS")
// if err != nil {
// log.Error("Failed to XormGetAlarmForward:", err)
// return "", err
// } else if toUsers == nil {
// err := errors.New("not found forward phone number")
// log.Error(err)
// return "", err
// }
// userList := strings.Join(*toUsers, ",")
userList := config.GetYamlConfig().Alarm.SMSCForward.MobileList
auth := gosmpp.Auth{
SMSC: config.GetYamlConfig().Alarm.SMSC.Addr,
SystemID: config.GetYamlConfig().Alarm.SMSC.SystemID,
Password: config.GetYamlConfig().Alarm.SMSC.Password,
SystemType: config.GetYamlConfig().Alarm.SMSC.SystemType,
SMSC: config.GetYamlConfig().Alarm.SMSCForward.SMSCAddr,
SystemID: config.GetYamlConfig().Alarm.SMSCForward.SystemID,
Password: config.GetYamlConfig().Alarm.SMSCForward.Password,
SystemType: config.GetYamlConfig().Alarm.SMSCForward.SystemType,
}
// conn, err := gosmpp.NonTLSDialer(auth.SMSC)