pull/586/merge
Matthias Van Woensel 2018-05-17 14:45:12 +00:00 committed by GitHub
commit c468890774
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 227 additions and 8 deletions

View File

@ -11,7 +11,10 @@
"symfony/http-foundation": "~3.4",
"php-pushover/php-pushover": "dev-master",
"paragonie/random_compat": "^2.0",
"twig/twig": "~2.0"
"twig/twig": "~2.0",
"plivo/plivo-php": "^4.0",
"callr/sdk-php": "^0.10"
},
"autoload": {
"files": [

View File

@ -61,6 +61,8 @@ The following SMS gateways are currently available:
* FreeMobile (FR) - <https://mobile.free.fr/>
* Twilio - <https://twilio.com>
* CM Telecom - <https://www.cm.com/>
* Plivo - <https://plivo.com>
* Callr - <https://callr.com>
Please note: for these gateways you will need an account with sufficient credits.

View File

@ -578,6 +578,12 @@ function psm_build_sms() {
case 'twilio':
$sms = new \psm\Txtmsg\Twilio();
break;
case 'plivo':
$sms = new \psm\Txtmsg\Plivo();
break;
case 'callr':
$sms = new \psm\Txtmsg\Callr();
break;
}
// copy login information from the config file

View File

@ -216,6 +216,9 @@ $sm_lang = array(
'sms_gateway_smsglobal' => 'SMSGlobal',
'sms_gateway_octopush' => 'Octopush',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_username' => 'Потребител',
'sms_gateway_password' => 'Парола',
'sms_from' => 'Номер на изпращача',

View File

@ -231,6 +231,9 @@ $sm_lang = array(
'sms_gateway_freemobilesms' => 'FreeMobileSMS',
'sms_gateway_clicksend' => 'ClickSend',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_username' => 'Uživatelské jméno brány',
'sms_gateway_password' => 'Heslo brány',
'sms_from' => 'Telefonní číslo odesilatele',

View File

@ -213,6 +213,9 @@ $sm_lang = array(
'sms_gateway_octopush' => 'Octopush',
'sms_gateway_smsit' => 'Smsit',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_username' => 'Gateway brugernavn/apikey',
'sms_gateway_password' => 'Gateway adgangskode',
'sms_from' => 'Afsenderens navn.',

View File

@ -217,6 +217,9 @@ $sm_lang = array(
'sms_gateway_smsit' => 'Smsit',
'sms_gateway_freevoipdeal' => 'FreeVoipDeal',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_username' => 'Gateway Benutzername',
'sms_gateway_password' => 'Gateway Passwort',
'sms_from' => 'SMS-Sendernummer',

View File

@ -254,6 +254,8 @@ $sm_lang = array(
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_smsgw' => 'SMSgw',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_username' => 'Gateway username',
'sms_gateway_password' => 'Gateway password',
'sms_from' => 'Sender\'s phone number',

View File

@ -220,6 +220,9 @@ $sm_lang = array(
'sms_gateway_username' => 'Usuario',
'sms_gateway_password' => 'Contraseña',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_username' => 'Gateway username',
'sms_gateway_password' => 'Gateway password',
'sms_from' => 'Número origen del SMS',

View File

@ -201,6 +201,10 @@ $sm_lang = array(
'sms_gateway_smsglobal' => 'SMSGlobal',
'sms_gateway_smsit' => 'Smsit',
'sms_gateway_freevoipdeal' => 'FreeVoipDeal',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_username' => 'Värava kasutajanimi',
'sms_gateway_password' => 'Värava parool',
'sms_from' => 'Saatja telefoni number',

View File

@ -201,6 +201,10 @@ $sm_lang = array(
'sms_gateway_smsglobal' => 'SMSGlobal',
'sms_gateway_smsit' => 'Smsit',
'sms_gateway_freevoipdeal' => 'FreeVoipDeal',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_username' => 'نام کاربری Gateway',
'sms_gateway_password' => 'کلمه عبور Gateway',
'sms_from' => 'شماره تلفن ارسال کننده',

View File

@ -201,6 +201,10 @@ $sm_lang = array(
'sms_gateway_smsglobal' => 'SMSGlobal',
'sms_gateway_smsit' => 'Smsit',
'sms_gateway_freevoipdeal' => 'FreeVoipDeal',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_username' => 'Palvelun käyttäjänimi',
'sms_gateway_password' => 'Palvelun salasana',
'sms_from' => 'Lähettäjän puhelinnumero',

View File

@ -217,6 +217,9 @@ $sm_lang = array(
'sms_gateway_smsit' => 'Smsit',
'sms_gateway_freevoipdeal' => 'FreeVoipDeal',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_freemobilesms' => 'FreeMobileSMS',
'sms_gateway_username' => 'Nom utilisateur de la passerelle',
'sms_gateway_password' => 'Mot de passe de la passerelle',

View File

@ -216,6 +216,9 @@ $sm_lang = array(
'sms_gateway_smsit' => 'Smsit',
'sms_gateway_freevoipdeal' => 'FreeVoipDeal',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_username' => 'Nome Utente Gateway',
'sms_gateway_password' => 'Password Gateway',
'sms_from' => 'Numero di telefono del mittente',

View File

@ -222,6 +222,9 @@ $sm_lang = array(
'sms_gateway_freemobilesms' => 'FreeMobileSMS',
'sms_gateway_clicksend' => 'ClickSend',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_smsgw' => 'SMSgw',
'sms_gateway_username' => 'ゲートウェイのユーザー名',
'sms_gateway_password' => 'ゲートウェイのパスワード',

View File

@ -212,7 +212,10 @@ $sm_lang = array(
'sms_gateway_clickatell' => 'Clickatell',
'sms_gateway_smsit' => 'Smsit',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_textmarketer' => 'Textmarketer',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_textmarketer' => 'Textmarketer',
'sms_gateway_smsglobal' => 'SMSGlobal',
'sms_gateway_freevoipdeal' => 'FreeVoipDeal',
'sms_gateway_octopush' => 'Octopush',

View File

@ -216,6 +216,9 @@ $sm_lang = array(
'sms_gateway_smsit' => 'Smsit',
'sms_gateway_freevoipdeal' => 'FreeVoipDeal',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_username' => 'Gateway gebruikersnaam',
'sms_gateway_password' => 'Gateway wachtwoord',
'sms_from' => 'Telefoonnummer afzender',

View File

@ -216,6 +216,9 @@ $sm_lang = array(
'sms_gateway_smsit' => 'Smsit',
'sms_gateway_freevoipdeal' => 'FreeVoipDeal',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_username' => 'Login do bramki',
'sms_gateway_password' => 'Hasło do bramki',
'sms_from' => 'Numer nadawcy',

View File

@ -219,9 +219,12 @@ $sm_lang = array(
'sms_gateway_password' => 'Senha do Gateway',
'sms_from' => 'Número de telefone de envio',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_username' => 'Usuário do Gateway',
'sms_gateway_password' => 'Senha do Gateway',
'sms_from' => 'Número de telefone de envio',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_username' => 'Usuário do Gateway',
'sms_gateway_password' => 'Senha do Gateway',
'sms_from' => 'Número de telefone de envio',
'pushover_status' => 'Habilitar envio de mensagens Pushover',
'pushover_description' => 'Pushover é um serviço de notificações em tempo real. Veja <a href="https://pushover.net/">o website</a> para mais informações.',
'pushover_clone_app' => 'Clique aqui para criar sua app Pushover',

View File

@ -216,6 +216,9 @@ $sm_lang = array(
'sms_gateway_smsit' => 'Smsit',
'sms_gateway_freevoipdeal' => 'FreeVoipDeal',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_username' => 'Пользователь',
'sms_gateway_password' => 'Пароль',
'sms_from' => 'Номер отправителя',

View File

@ -217,6 +217,9 @@ $sm_lang = array(
'sms_gateway_freemobilesms' => 'FreeMobileSMS',
'sms_gateway_clicksend' => 'ClickSend',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_username' => 'Užívateľské meno brány',
'sms_gateway_password' => 'Heslo brány',
'sms_from' => 'Telefónne číslo odosielateľa',

View File

@ -197,7 +197,11 @@ $sm_lang = array(
'sms_gateway_clickatell' => 'Clickatell',
'sms_gateway_textmarketer' => 'Textmarketer',
'sms_gateway_smsglobal' => 'SMSGlobal',
'sms_gateway_smsit' => 'Smsit',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_smsit' => 'Smsit',
'sms_gateway_username' => 'Uporabniško ime SMS prehoda',
'sms_gateway_password' => 'Geslo SMS prehoda',
'sms_from' => 'Telefonska številka pošiljatelja',

View File

@ -210,11 +210,14 @@ $sm_lang = array(
'sms_gateway_spryng' => 'Spryng',
'sms_gateway_inetworx' => 'Inetworx',
'sms_gateway_clickatell' => 'Clickatell',
'sms_gateway_textmarketer' => 'Textmarketer',
'sms_gateway_textmarketer' => 'Textmarketer',
'sms_gateway_smsglobal' => 'SMSGlobal',
'sms_gateway_smsit' => 'Smsit',
'sms_gateway_freevoipdeal' => 'FreeVoipDeal',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_username' => 'Gateway användarnamn',
'sms_gateway_password' => 'Gateway lösenord',
'sms_from' => 'Avsändarens telefonnummer',

View File

@ -215,7 +215,10 @@ $sm_lang = array(
'sms_gateway_octopush' => 'Octopush',
'sms_gateway_smsit' => 'Smsit',
'sms_gateway_freevoipdeal' => 'FreeVoipDeal',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_username' => 'Servis kullanıcı adı',
'sms_gateway_password' => 'Servis şifresi',
'sms_from' => 'Gönderen numarası',

View File

@ -198,6 +198,10 @@ $sm_lang = array(
'sms_gateway_textmarketer' => 'Textmarketer',
'sms_gateway_smsglobal' => 'SMSGlobal',
'sms_gateway_smsit' => 'Smsit',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_username' => 'Gateway username',
'sms_gateway_password' => 'Gateway password',
'sms_from' => 'Số điện thoại của người gửi',

View File

@ -232,6 +232,9 @@ $sm_lang = array(
'sms_gateway_smsit' => 'Smsit',
'sms_gateway_freevoipdeal' => 'FreeVoipDeal',
'sms_gateway_nexmo' => 'Nexmo',
'sms_gateway_twilio' => 'Twilio',
'sms_gateway_callr' => 'Callr',
'sms_gateway_plivo' => 'Plivo',
'sms_gateway_username' => 'SMS网关用户名',
'sms_gateway_password' => 'SMS网关密码',
'sms_from' => '发信人电话号',

View File

@ -378,6 +378,8 @@ class ConfigController extends AbstractController {
'label_sms_gateway_freemobilesms' => psm_get_lang('config', 'sms_gateway_freemobilesms'),
'label_sms_gateway_clicksend' => psm_get_lang('config', 'sms_gateway_clicksend'),
'label_sms_gateway_twilio' => psm_get_lang('config', 'sms_gateway_twilio'),
'label_sms_gateway_plivo' => psm_get_lang('config', 'sms_gateway_plivo'),
'label_sms_gateway_callr' => psm_get_lang('config', 'sms_gateway_callr'),
'label_sms_gateway_username' => psm_get_lang('config', 'sms_gateway_username'),
'label_sms_gateway_password' => psm_get_lang('config', 'sms_gateway_password'),
'label_sms_from' => psm_get_lang('config', 'sms_from'),

68
src/psm/Txtmsg/Callr.php Normal file
View File

@ -0,0 +1,68 @@
<?php
/**
* PHP Server Monitor
* Monitor your servers and websites.
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PHP Server Monitor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>.
*
* @package phpservermon
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
**/
namespace psm\Txtmsg;
class Callr extends Core {
// =========================================================================
// [ Fields ]
// =========================================================================
public $gateway = 1;
public $resultcode = null;
public $resultmessage = null;
public $success = false;
public $successcount = 0;
// =========================================================================
// [ Methods ]
// =========================================================================
public function setGateway($gateway) {
$this->gateway = $gateway;
}
public function sendSMS($message) {
//api stuff here
$api = new \CALLR\API\Client;
$api->setAuth(new CALLR\API\Authentication\LoginPasswordAuth($this->username, $this->password));
$options = new stdClass;
$options->force_encoding = 'GSM';
$options->nature = 'ALERTING';
$options->flash_message = false;//set to true if you don't want the SMS to be stored on the phone
try {
foreach($this->recipients as $recipient) {
$api->call('sms.send', [$this->originator, $recipient, $message, $options]);
}
return 1;
} catch(Exception $e){
if($e->getCode() == 22){
return "Exception: Authentication failure\r\n";
} else {
return $e->getMessage();
}
}
}
}

63
src/psm/Txtmsg/Plivo.php Normal file
View File

@ -0,0 +1,63 @@
<?php
/**
* PHP Server Monitor
* Monitor your servers and websites.
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PHP Server Monitor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>.
*
* @package phpservermon
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
**/
namespace psm\Txtmsg;
class Plivo extends Core {
// =========================================================================
// [ Fields ]
// =========================================================================
public $gateway = 1;
public $resultcode = null;
public $resultmessage = null;
public $success = false;
public $successcount = 0;
// =========================================================================
// [ Methods ]
// =========================================================================
public function setGateway($gateway) {
$this->gateway = $gateway;
}
public function sendSMS($message) {
$authId = $this->username;
$authToken = $this->password;
$client = new \Plivo\RestClient($authId, $authToken);
/* @var $message_created \Plivo\Resources\Message\MessageCreateResponse */
$message_created = $client->messages->create(
$this->originator,
$this->recipients,
$message
);
if($message_created && count($message_created->getMessageUuid()) ) {
return 1;
} else {
return $message_created->getMessage();
}
}
}

View File

@ -203,6 +203,8 @@
<option value="smsgw" {{ sms_selected_smsgw|raw }}>{{ label_sms_gateway_smsgw }}</option>
<option value="nexmo" {{ sms_selected_nexmo|raw }}>{{ label_sms_gateway_nexmo }}</option>
<option value="twilio" {{ sms_selected_twilio|raw }}>{{ label_sms_gateway_twilio }}</option>
<option value="plivo" {{ sms_selected_plivo|raw }}>{{ label_sms_gateway_plivo }}</option>
<option value="callr" {{ sms_selected_callr|raw }}>{{ label_sms_gateway_callr }}</option>
</select>
</div>
</div>