Index: includes/definitions/transports.inc.php =================================================================== --- includes/definitions/transports.inc.php (revision 7099) +++ includes/definitions/transports.inc.php (working copy) @@ -61,4 +61,11 @@ ) ); +$config['alerts']['transports']['smsbox'] = array( + 'name' => 'Kannel SMSBox', + 'parameters' => array( + 'phone' => "Recipient's phone number", + ) +); + // EOF Index: includes/defaults.inc.php =================================================================== --- includes/defaults.inc.php (revision 7099) +++ includes/defaults.inc.php (working copy) @@ -193,6 +193,15 @@ $config['email']['smtp_username'] = NULL; // SMTP username. $config['email']['smtp_password'] = NULL; // Password for SMTP authentication. +// Kannel SMSBox settings + +$config['smsbox']['scheme'] = 'http'; // URL scheme, http or https. +$config['smsbox']['host'] = 'localhost'; // Name of host on which SMSBox is running. +$config['smsbox']['port'] = '13013'; // Port number on which SMSBox host receives requests. +$config['smsbox']['user'] = 'kannel'; // SMSBox username. +$config['smsbox']['password'] = ''; // SMSBox password. +$config['smsbox']['from'] = ''; // Phone number of sender, usually overridden by SMSC. + // Alerting Settings $config['alerts']['bgp']['whitelist'] = NULL; // Populate as an array() with ASNs to alert on. Index: includes/alerting/smsbox.inc.php =================================================================== --- includes/alerting/smsbox.inc.php (revision 0) +++ includes/alerting/smsbox.inc.php (working copy) @@ -0,0 +1,31 @@ +<?php + +/* + * Kannel SMSBox documentation: http://kannel.org/download/1.5.0/userguide-1.5.0/userguide.html#AEN4623 + */ + +$message = $message_tags['ALERT_STATE'] . " " . $message_tags['DEVICE_HOSTNAME'] .": " . $message_tags['ENTITY_NAME'] . "\n" . $message_tags['ALERT_MESSAGE']; + +$context_data = array ( + 'method' => 'GET', + 'header' => "Connection: close\r\n" + ); + +$url = sprintf('%s://%s:%d/cgi-bin/sendsms?user=%s&password=%s&text=%s&from=%s&to=%s', + $config['smsbox']['scheme'], $config['smsbox']['host'], $config['smsbox']['port'], + $config['smsbox']['user'], $config['smsbox']['password'], + urlencode($message), + urlencode($config['smsbox']['from']), urlencode($endpoint['phone'])); + +$response = get_http_request($url, $context_data); + +if (strpos($response, "Accepted") || strpos($response, "Queued")) +{ + $notify_status['success'] = TRUE; +} else { + $notify_status['success'] = FALSE; +} + +unset($message); + +// EOF